1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-28 22:23:17 +00:00

1. Updated promise to substitute promise, when then() returns a promise

2. Removed uncaught rejection, because it wasn't implemented correctly
This commit is contained in:
Bryan Roe
2020-05-29 02:28:34 -07:00
parent 9e6387599a
commit 5104dd40fe
2 changed files with 18 additions and 7 deletions

View File

@@ -92,8 +92,23 @@ function Promise(promiseFunc)
args.push(arguments[a]);
}
}
_resolver._self.emit.apply(_resolver._self, args);
_resolver._self.emit('settled');
if (args.length == 2 && args[1]._ObjectID == 'promise')
{
args[1].then(function ()
{
var parms = ['resolved'];
for(var ai in arguments)
{
parms.push(arguments[ai]);
}
this._XSLF.emit.apply(this._XSLF, parms);
}).parentPromise._XSLF = _resolver._self;
}
else
{
_resolver._self.emit.apply(_resolver._self, args);
_resolver._self.emit('settled');
}
};
this._internal.rejector = function _rejector()
{
@@ -126,10 +141,6 @@ function Promise(promiseFunc)
{
this._internal.once('rejected', event_switcher(this, rejected).func);
}
else
{
this._internal.once('rejected', function (e) { process.emit('uncaughtException', 'promise.unhandledRejection: ' + e); });
}
var retVal = new Promise(function (r, j) { });
this._internal.once('resolved', retVal._internal.resolver);