@5minds/node-red-contrib-processcube 1.1.4-feature-e7d879-m0jyro4t → 1.1.4-feature-bc1698-m0kn1ci4
Sign up to get free protection for your applications and to get access to all the features.
@@ -32,16 +32,26 @@ module.exports = function (RED) {
|
|
32
32
|
|
33
33
|
async function subscribe() {
|
34
34
|
const eventHandlers = {
|
35
|
-
created:
|
36
|
-
|
37
|
-
|
35
|
+
created: () =>
|
36
|
+
client.notification.onExternalTaskCreated(externalTaskCallback('created'), {
|
37
|
+
identity: currentIdentity,
|
38
|
+
}),
|
39
|
+
locked: () =>
|
40
|
+
client.notification.onExternalTaskLocked(externalTaskCallback('locked'), {
|
41
|
+
identity: currentIdentity,
|
42
|
+
}),
|
43
|
+
unlocked: () =>
|
44
|
+
client.notification.onExternalTaskUnlocked(externalTaskCallback('unlocked'), {
|
45
|
+
identity: currentIdentity,
|
46
|
+
}),
|
38
47
|
};
|
39
48
|
|
40
49
|
const handler = eventHandlers[config.eventtype];
|
50
|
+
|
41
51
|
if (handler) {
|
42
|
-
return await handler(
|
52
|
+
return await handler();
|
43
53
|
} else {
|
44
|
-
console.error('
|
54
|
+
console.error('No such event: ' + config.eventtype);
|
45
55
|
}
|
46
56
|
}
|
47
57
|
|
package/package.json
CHANGED
@@ -47,15 +47,20 @@ module.exports = function (RED) {
|
|
47
47
|
|
48
48
|
async function subscribe() {
|
49
49
|
const eventHandlers = {
|
50
|
-
new: client.userTasks.onUserTaskWaiting,
|
51
|
-
finished:
|
52
|
-
|
53
|
-
|
50
|
+
new: () => client.userTasks.onUserTaskWaiting(userTaskCallback(), { identity: currentIdentity }),
|
51
|
+
finished: () =>
|
52
|
+
client.userTasks.onUserTaskFinished(userTaskCallback(), { identity: currentIdentity }),
|
53
|
+
reserved: () =>
|
54
|
+
client.userTasks.onUserTaskReserved(userTaskCallback(), { identity: currentIdentity }),
|
55
|
+
'reservation-canceled': () =>
|
56
|
+
client.userTasks.onUserTaskReservationCanceled(userTaskCallback(), {
|
57
|
+
identity: currentIdentity,
|
58
|
+
}),
|
54
59
|
};
|
55
60
|
|
56
61
|
const handler = eventHandlers[config.eventtype];
|
57
62
|
if (handler) {
|
58
|
-
return await handler(
|
63
|
+
return await handler();
|
59
64
|
} else {
|
60
65
|
console.error('no such event: ' + config.eventtype);
|
61
66
|
}
|