You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			32 lines
		
	
	
		
			891 B
		
	
	
	
		
			JavaScript
		
	
			
		
		
	
	
			32 lines
		
	
	
		
			891 B
		
	
	
	
		
			JavaScript
		
	
| /**
 | |
|  * A `Promise.withResolvers` implementation that exposes the `resolve` and
 | |
|  * `reject` functions on a `Promise`.
 | |
|  *
 | |
|  * @see https://tc39.es/proposal-promise-with-resolvers/
 | |
|  */ "use strict";
 | |
| Object.defineProperty(exports, "__esModule", {
 | |
|     value: true
 | |
| });
 | |
| Object.defineProperty(exports, "DetachedPromise", {
 | |
|     enumerable: true,
 | |
|     get: function() {
 | |
|         return DetachedPromise;
 | |
|     }
 | |
| });
 | |
| class DetachedPromise {
 | |
|     constructor(){
 | |
|         let resolve;
 | |
|         let reject;
 | |
|         // Create the promise and assign the resolvers to the object.
 | |
|         this.promise = new Promise((res, rej)=>{
 | |
|             resolve = res;
 | |
|             reject = rej;
 | |
|         });
 | |
|         // We know that resolvers is defined because the Promise constructor runs
 | |
|         // synchronously.
 | |
|         this.resolve = resolve;
 | |
|         this.reject = reject;
 | |
|     }
 | |
| }
 | |
| 
 | |
| //# sourceMappingURL=detached-promise.js.map
 |