asyncGeneratorDelegate.js 991 B

123456789101112131415161718192021222324
  1. var OverloadYield = require("./OverloadYield.js");
  2. function _asyncGeneratorDelegate(inner) {
  3. var iter = {},
  4. waiting = !1;
  5. function pump(key, value) {
  6. return waiting = !0, value = new Promise(function (resolve) {
  7. resolve(inner[key](value));
  8. }), {
  9. done: !1,
  10. value: new OverloadYield(value, 1)
  11. };
  12. }
  13. return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () {
  14. return this;
  15. }, iter.next = function (value) {
  16. return waiting ? (waiting = !1, value) : pump("next", value);
  17. }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) {
  18. if (waiting) throw waiting = !1, value;
  19. return pump("throw", value);
  20. }), "function" == typeof inner["return"] && (iter["return"] = function (value) {
  21. return waiting ? (waiting = !1, value) : pump("return", value);
  22. }), iter;
  23. }
  24. module.exports = _asyncGeneratorDelegate, module.exports.__esModule = true, module.exports["default"] = module.exports;