mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 09:05:45 +00:00
e27f135b3b
MozReview-Commit-ID: 9TSQ0Cw82B --HG-- rename : devtools/shared/promise_defer.js => devtools/shared/defer.js rename : devtools/shared/tests/unit/test_promise_defer.js => devtools/shared/tests/unit/test_defer.js extra : transplant_source : %20Kh%D2%21%E9%F9%D1%17L%BD%AC%E5%29%1A%11%06%A9.%98
23 lines
636 B
JavaScript
23 lines
636 B
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
/**
|
|
* Returns a deferred object, with a resolve and reject property.
|
|
* https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Deferred
|
|
*/
|
|
module.exports = function defer() {
|
|
let resolve, reject;
|
|
let promise = new Promise(function () {
|
|
resolve = arguments[0];
|
|
reject = arguments[1];
|
|
});
|
|
return {
|
|
resolve: resolve,
|
|
reject: reject,
|
|
promise: promise
|
|
};
|
|
};
|