1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-22 03:03:18 +00:00

Updated promise, so you can't resolve/reject more than once

This commit is contained in:
Bryan Roe
2019-05-16 11:17:11 -07:00
parent 679366445f
commit 5e0bc797a7
2 changed files with 3 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -67,6 +67,7 @@ function Promise(promiseFunc)
}); });
this._internal.resolver = function _resolver() this._internal.resolver = function _resolver()
{ {
if (_resolver._self.completed) { return; }
_resolver._self.errors = false; _resolver._self.errors = false;
_resolver._self.completed = true; _resolver._self.completed = true;
_resolver._self.completedArgs = []; _resolver._self.completedArgs = [];
@@ -89,6 +90,7 @@ function Promise(promiseFunc)
}; };
this._internal.rejector = function _rejector() this._internal.rejector = function _rejector()
{ {
if (_rejector._self.completed) { return; }
_rejector._self.errors = true; _rejector._self.errors = true;
_rejector._self.completed = true; _rejector._self.completed = true;
_rejector._self.completedArgs = []; _rejector._self.completedArgs = [];