simple:
var promiseResolve, promiseReject;
var promise = new Promise(function(resolve, reject){
promiseResolve = resolve;
promiseReject = reject;
});
promiseResolve();
More Related Contents:
- How do I access previous promise results in a .then() chain?
- How to return many Promises and wait for them all before doing other stuff
- Can I fire and forget a promise in nodejs (ES7)?
- Promise.all: Order of resolved values
- How to dodge jQuery promises completely when chaining two async jQuery functions?
- Cancel a vanilla ECMAScript 6 Promise chain
- How can I fetch an array of URLs with Promise.all?
- What is the order of execution in JavaScript promises?
- How can I synchronously determine a JavaScript Promise’s state?
- When is the body of a Promise executed?
- ES6 Promise.all() error handle – Is .settle() needed? [duplicate]
- multiple, sequential fetch() Promise
- How do I tell if an object is a Promise?
- How to use promise in forEach loop of array to populate an object
- Should a Promise.reject message be wrapped in Error?
- Why can I not throw inside a Promise.catch handler?
- Why does the Promise constructor require a function that calls ‘resolve’ when complete, but ‘then’ does not – it returns a value instead?
- What is the best general practice to timeout a function in promise [closed]
- When would someone need to create a deferred?
- Why does the Promise object block rendering?
- How to extract data out of a Promise
- Creating a (ES6) promise without starting to resolve it
- Are JavaScript forever-pending promises bad?
- ES6 Promise replacement of async.eachLimit / async.mapLimit
- Why does JavaScript Promise then handler run after other code?
- What are the implications of the recursive joining of Promises in terms of Monads?
- When is the body of a Promise constructor callback executed?
- Promise.all is returning an array of undefined and resolves before being done
- Weird behavior with Promise throwing “Unhandled promise rejection” error
- Promise.resolve().then vs setImmediate vs nextTick