* Sets the event to emit when the conditions evaluate truthy * @param {object} event - event to emit * @param {string} event.type - event name to emit on * @param {string} event.params - parameters to emit as the argument of the event emission
(event)
| 92 | * @param {string} event.params - parameters to emit as the argument of the event emission |
| 93 | */ |
| 94 | setEvent (event) { |
| 95 | if (!event) throw new Error('Rule: setEvent() requires event object') |
| 96 | if (!Object.prototype.hasOwnProperty.call(event, 'type')) { |
| 97 | throw new Error( |
| 98 | 'Rule: setEvent() requires event object with "type" property' |
| 99 | ) |
| 100 | } |
| 101 | this.ruleEvent = { |
| 102 | type: event.type |
| 103 | } |
| 104 | if (event.params) this.ruleEvent.params = event.params |
| 105 | return this |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * returns the event object |
no outgoing calls
no test coverage detected