You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[rules] Add eventName property to event object (#465)
This exposes the simple class name of the event, e.g.
`ItemCommandEvent`, under the new `eventName` property of the event
object.
---------
Signed-off-by: Florian Hotze <dev@florianhotze.com>
Copy file name to clipboardExpand all lines: src/rules/rules.js
+12-4Lines changed: 12 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,8 @@
31
31
* @property {number} offset for {@link triggers.DateTimeTrigger}: offset in seconds added to the time of the DateTime Item
32
32
* @property {string} eventType for all triggers except {@link triggers.PWMTrigger}, {@link triggers.PIDTrigger}: Type of event that triggered event (change, command, time, triggered, update, time)
33
33
* @property {string} triggerType for all triggers except {@link triggers.PWMTrigger}, {@link triggers.PIDTrigger}: Type of trigger that triggered event
34
-
* @property {string} eventClass for all triggers: Java class name of the triggering event
34
+
* @property {string} eventName for all triggers: simple Java class name of the triggering event
35
+
* @property {string} eventClass for all triggers: full Java class name of the triggering event
35
36
* @property {string} module (user-defined or auto-generated) name of trigger
36
37
* @property {*} raw original contents of the event including data passed from a calling rule
37
38
* @property {*} payload if provided by event: payload of event in Java data types
@@ -355,13 +356,19 @@ function _addFromHashMap (hashMap, key, object) {
355
356
356
357
/**
357
358
* Get rule trigger data from raw Java input and generate JavaScript object.
359
+
* This method is not intended for direct use in user scripts, but used internally by JS Scripting.
358
360
*
359
361
* @private
360
-
* @param {*} input raw Java input from openHAB core
* and {@link https://github.com/openhab/openhab-core/blob/main/bundles/org.openhab.core.automation.module.script.rulesupport/src/main/java/org/openhab/core/automation/module/script/rulesupport/shared/simple/SimpleRuleActionHandler.java SimpleRuleActionHandler}
365
+
* @returns {EventObject}
362
366
*/
363
367
function_getTriggeredData(input){
364
368
constevent=input.get('event');
369
+
/**
370
+
* @type {EventObject}
371
+
*/
365
372
constdata={};
366
373
367
374
// Add input to data to passthrough any properties not captured below
@@ -386,7 +393,8 @@ function _getTriggeredData (input) {
0 commit comments