@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: client.notification.onExternalTaskCreated,
36
- locked: client.notification.onExternalTaskLocked,
37
- unlocked: client.notification.onExternalTaskUnlocked,
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(externalTaskCallback(), { identity: currentIdentity });
52
+ return await handler();
43
53
  } else {
44
- console.error('no such event: ' + config.eventtype);
54
+ console.error('No such event: ' + config.eventtype);
45
55
  }
46
56
  }
47
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.1.4-feature-e7d879-m0jyro4t",
3
+ "version": "1.1.4-feature-bc1698-m0kn1ci4",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {
@@ -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: client.userTasks.onUserTaskFinished,
52
- reserved: client.userTasks.onUserTaskReserved,
53
- 'reservation-canceled': client.userTasks.onUserTaskReservationCanceled,
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(userTaskCallback(), { identity: currentIdentity });
63
+ return await handler();
59
64
  } else {
60
65
  console.error('no such event: ' + config.eventtype);
61
66
  }