-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule Success/Failure Callback #16
Comments
@ehusaint That's not currently a feature - the event params are meant to store all information necessary for event handling, however we can certainly discuss making this possible. Can you elaborate a bit on why you're trying to access the rules object? I'd like to better understand the use case. |
I wanted to access the priority of the rule on successCallback but on successCallback, I only get back the event params and on failureCallback, I get back the complete rule params. On successCallback, I wanted to the know the priority of that rule. Is that possible? |
@ehusaint Currently, you could do a little pseudo hack during runtime to attach the rule priority to the event, something like: let rule = new Rule()
rule.setConditions({ /* ... */ })
rule.setPriority(10)
rule.setEvent({
type: 'message',
params: {
data: 'hello-world!',
rulePriority: rule.priority // store the rule priority on the event - `10`, in this example
}
}) I realize this isn't ideal, and I think I agree that the rule object should be more accessible. I'll tag this as a feature request, however I'm about to go on holiday so it'll be a few weeks before I can provide a more elegant solution that what's above. |
Got it. Yes, I can certainly use this as a workaround. But it would be certainly good to have that rule object more accessible as you mentioned. It would be great added feature. Thanks for a quick response. |
This feature is now available in 2.0.0-beta1. There is now a 3rd argument provided to both the success and failure events which contain a clone of the rule object. There's an example in pr #35 and some docs here and here This a beta because I'm going to let it stew for a week or so to provide the various stakeholders an opportunity to give feedback. Please let me know if you have any input. |
Closing - access to rule properties now provided by the success/failure callback |
Currently I'm getting the complete rule object back as part of rule failurecallback but for rule successCallback, I only get the event object. Is it possible to get the full rule object back as part of the successCallback.
The text was updated successfully, but these errors were encountered: