1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

1. Updated EncryptionStream.GenerateRandom to return a node JS buffer

2. Fixed bug in promise
This commit is contained in:
Bryan Roe
2020-08-05 21:14:44 -07:00
parent e081f711cf
commit 5f02915532
3 changed files with 27 additions and 2 deletions

View File

@@ -225,7 +225,31 @@ function Promise(promiseFunc)
var retVal = new Promise(function (r, j) { this._rej = j; });
retVal._internal._haltUncaught = true;
this._internal.once('resolved', retVal._internal.resolver);
if (this._internal.completed)
{
// This promise was already resolved, so lets check if the handler returned a promise
var rv = this._internal.emit_returnValue('resolved');
if(rv!=null)
{
if(rv._ObjectID == 'promise')
{
rv._internal.once('resolved', retVal._internal.resolver);
}
else
{
retVal._internal.resolver(rv);
}
}
else
{
this._internal.once('resolved', retVal._internal.resolver);
}
}
else
{
this._internal.once('resolved', retVal._internal.resolver);
}
this._internal.once('rejected', retVal._internal.rejector);
retVal.parentPromise = this;
this.__childPromise = retVal;