@scion-scxml/core-base 1.0.25 → 1.0.26

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.
@@ -229,7 +229,7 @@ class BaseInterpreter extends EventEmitter {
229
229
  * @memberof BaseInterpreter.prototype
230
230
  */
231
231
  cancel(){
232
- setImmediate( () => delete this.opts.parentSession ) // run this asynchronously, as we still need a reference to the parent session to send the final <done> event
232
+ delete this.opts.parentSession;
233
233
  if(this._isInFinalState) return;
234
234
  this._isInFinalState = true;
235
235
  this._log(`session cancelled ${this.opts.invokeid}`);
@@ -466,7 +466,7 @@ class BaseInterpreter extends EventEmitter {
466
466
  }
467
467
 
468
468
  _finishBigStep(e, allStatesEntered, allStatesExited, cb){
469
- let statesToInvoke = Array.from(allStatesEntered).filter(s => s.invokes).sort(sortInEntryOrder);
469
+ let statesToInvoke = Array.from(new Set([...allStatesEntered].filter(s => s.invokes && !allStatesExited.has(s)))).sort(sortInEntryOrder);
470
470
 
471
471
  // Here we invoke whatever needs to be invoked. The implementation of 'invoke' is platform-specific
472
472
  statesToInvoke.forEach( s => {
@@ -1353,11 +1353,15 @@ class InterpreterScriptingContext{
1353
1353
  var timeoutHandle = setTimeout(function(){
1354
1354
  if (event.sendid) delete this._timeoutMap[event.sendid];
1355
1355
  this._timeouts.delete(timeoutOptions);
1356
+ const parentSessionOpts = this._interpreter.opts.parentSession && this._interpreter.opts.parentSession.opts;
1356
1357
  const _doSend = this._interpreter.opts.doSend || BaseInterpreter.doSend;
1358
+ const sendAsync = typeof this._interpreter.opts.sendAsync === 'boolean' ?
1359
+ this._interpreter.opts.sendAsync :
1360
+ !!(parentSessionOpts && parentSessionOpts.sendAsync);
1357
1361
  if(_doSend){
1358
1362
  _doSend(session, event);
1359
1363
  }else{
1360
- session[this._interpreter.opts.sendAsync ? 'genAsync' : 'gen'](event);
1364
+ session[sendAsync ? 'genAsync' : 'gen'](event);
1361
1365
  }
1362
1366
  }.bind(this), options.delay || 0);
1363
1367
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scion-scxml/core-base",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "Provide BaseInterpreter class and helper functions to modules that implement Statechart interface.",
5
5
  "main": "./lib/scion-core-base.js",
6
6
  "directories": {
@@ -39,5 +39,5 @@
39
39
  "babel-preset-es2015": "^6.9.0",
40
40
  "babelify": "^8.0.0"
41
41
  },
42
- "gitHead": "0838a38c74a63ce40c48168e03c4e783e37c1731"
42
+ "gitHead": "ce920c0df2cbf1e96b0ebafa658c1019c43f81d7"
43
43
  }