deferred.js 661 B

123456789101112131415161718192021222324252627
  1. /**
  2. * Wrapper class for promise with external resolve and reject.
  3. */
  4. export class Deferred {
  5. /**
  6. * The resolve method of the promise associated with this deferred object.
  7. */
  8. get resolve() {
  9. return this._resolve;
  10. }
  11. /**
  12. * The reject method of the promise associated with this deferred object.
  13. */
  14. get reject() {
  15. return this._reject;
  16. }
  17. /**
  18. * Constructor for this deferred object.
  19. */
  20. constructor() {
  21. this.promise = new Promise((resolve, reject) => {
  22. this._resolve = resolve;
  23. this._reject = reject;
  24. });
  25. }
  26. }
  27. //# sourceMappingURL=deferred.js.map