MCPcopy
hub / github.com/CacheControl/json-rules-engine / setEvent

Method setEvent

src/rule.js:94–106  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 4

constructorMethod · 0.95
index.test-d.tsFile · 0.80
rule.test.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected