@indra.ai/deva 1.1.101 → 1.1.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -15
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1058,7 +1058,7 @@ class Deva {
|
|
|
1058
1058
|
data.hash = this.hash(data);
|
|
1059
1059
|
this.action(data.value)
|
|
1060
1060
|
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
1061
|
-
return hasOnDone ? this.onDone(data) :
|
|
1061
|
+
return hasOnDone ? this.onDone(data) : this.finish(data);
|
|
1062
1062
|
}
|
|
1063
1063
|
|
|
1064
1064
|
/**************
|
|
@@ -1076,7 +1076,11 @@ class Deva {
|
|
|
1076
1076
|
if (!this._active) return Promise.resolve(this._messages.states.offline);
|
|
1077
1077
|
this.state('finish');
|
|
1078
1078
|
this.action('finish');
|
|
1079
|
-
|
|
1079
|
+
const hasOnFinish = this.onFinish && typeof this.onFinish === 'function' ? true : false;
|
|
1080
|
+
if (hasOnFinish) return this.onFinish(packet, resolve);
|
|
1081
|
+
else if (resolve) return resolve(packet);
|
|
1082
|
+
else return Promise.resolve(packet)
|
|
1083
|
+
return resolve ? resolve(packet) : Promise.resolve(packet);
|
|
1080
1084
|
}
|
|
1081
1085
|
|
|
1082
1086
|
/**************
|
|
@@ -1541,19 +1545,8 @@ class Deva {
|
|
|
1541
1545
|
This function will enable fast loading of Deva into a system.
|
|
1542
1546
|
***************/
|
|
1543
1547
|
load(key, client) {
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
this.devas[key].init(client).then(loaded => {
|
|
1547
|
-
this.talk(config.events.load, {
|
|
1548
|
-
id:this.uid(true),
|
|
1549
|
-
key,
|
|
1550
|
-
created: Date.now(),
|
|
1551
|
-
});
|
|
1552
|
-
return this.finish(this._messages.states.load, resolve);
|
|
1553
|
-
}).catch(err => {
|
|
1554
|
-
return this.error(err, deva, reject);
|
|
1555
|
-
})
|
|
1556
|
-
});
|
|
1548
|
+
this.state('load');
|
|
1549
|
+
return this.devas[key].init(client);
|
|
1557
1550
|
}
|
|
1558
1551
|
|
|
1559
1552
|
/**************
|