Update task.js

This commit is contained in:
Namhyeon Go 2021-07-28 13:49:04 +09:00 committed by GitHub
parent 15d33178c6
commit 02138ab366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,9 +205,36 @@ function setInterval(f, delay) {
__taskQueue__.put(task);
}
function Promise(executor) {
this.length = 1;
this.executor = executor;
this.all = function(iterable) {
// todo
};
this.race = function(iterable) {
// todo
};
this.reject = function(reason) {
// todo
};
this.resolve = function(reason) {
// todo
};
this.then = function(successCallback, failureCallback) {
// todo
};
this.catch = function(failureCallback) {
// todo
};
this.executor(this.resolve, this.reject);
}
exports.__taskQueue__ = __taskQueue__;
exports.setTimeout = setTimeout;
exports.setInterval = setInterval;
exports.Promise = Promise;
////////////////////////////////////////////////////
// END Global functions
////////////////////////////////////////////////////