You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
532 B
15 lines
532 B
"use strict"; |
|
|
|
var ensurePlainFunction = require("../../object/ensure-plain-function") |
|
, ensureThenable = require("../../object/ensure-thenable") |
|
, microtaskDelay = require("../../function/#/microtask-delay"); |
|
|
|
module.exports = function (callback) { |
|
ensureThenable(this); |
|
ensurePlainFunction(callback); |
|
// Rely on microtaskDelay to escape eventual error swallowing |
|
this.then( |
|
microtaskDelay.call(function (value) { callback(null, value); }), |
|
microtaskDelay.call(function (reason) { callback(reason); }) |
|
); |
|
};
|
|
|