|
1 | 1 | (function (global, factory) { |
2 | 2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
3 | 3 | typeof define === 'function' && define.amd ? define(['exports'], factory) : |
4 | | - (factory((global['vue-apollo'] = global['vue-apollo'] || {}))); |
| 4 | + (factory((global['vue-apollo'] = {}))); |
5 | 5 | }(this, (function (exports) { 'use strict'; |
6 | 6 |
|
7 | 7 | var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; |
@@ -2352,7 +2352,118 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol |
2352 | 2352 |
|
2353 | 2353 |
|
2354 | 2354 |
|
| 2355 | +var asyncGenerator = function () { |
| 2356 | + function AwaitValue(value) { |
| 2357 | + this.value = value; |
| 2358 | + } |
| 2359 | + |
| 2360 | + function AsyncGenerator(gen) { |
| 2361 | + var front, back; |
| 2362 | + |
| 2363 | + function send(key, arg) { |
| 2364 | + return new Promise(function (resolve, reject) { |
| 2365 | + var request = { |
| 2366 | + key: key, |
| 2367 | + arg: arg, |
| 2368 | + resolve: resolve, |
| 2369 | + reject: reject, |
| 2370 | + next: null |
| 2371 | + }; |
| 2372 | + |
| 2373 | + if (back) { |
| 2374 | + back = back.next = request; |
| 2375 | + } else { |
| 2376 | + front = back = request; |
| 2377 | + resume(key, arg); |
| 2378 | + } |
| 2379 | + }); |
| 2380 | + } |
| 2381 | + |
| 2382 | + function resume(key, arg) { |
| 2383 | + try { |
| 2384 | + var result = gen[key](arg); |
| 2385 | + var value = result.value; |
| 2386 | + |
| 2387 | + if (value instanceof AwaitValue) { |
| 2388 | + Promise.resolve(value.value).then(function (arg) { |
| 2389 | + resume("next", arg); |
| 2390 | + }, function (arg) { |
| 2391 | + resume("throw", arg); |
| 2392 | + }); |
| 2393 | + } else { |
| 2394 | + settle(result.done ? "return" : "normal", result.value); |
| 2395 | + } |
| 2396 | + } catch (err) { |
| 2397 | + settle("throw", err); |
| 2398 | + } |
| 2399 | + } |
| 2400 | + |
| 2401 | + function settle(type, value) { |
| 2402 | + switch (type) { |
| 2403 | + case "return": |
| 2404 | + front.resolve({ |
| 2405 | + value: value, |
| 2406 | + done: true |
| 2407 | + }); |
| 2408 | + break; |
| 2409 | + |
| 2410 | + case "throw": |
| 2411 | + front.reject(value); |
| 2412 | + break; |
| 2413 | + |
| 2414 | + default: |
| 2415 | + front.resolve({ |
| 2416 | + value: value, |
| 2417 | + done: false |
| 2418 | + }); |
| 2419 | + break; |
| 2420 | + } |
| 2421 | + |
| 2422 | + front = front.next; |
| 2423 | + |
| 2424 | + if (front) { |
| 2425 | + resume(front.key, front.arg); |
| 2426 | + } else { |
| 2427 | + back = null; |
| 2428 | + } |
| 2429 | + } |
2355 | 2430 |
|
| 2431 | + this._invoke = send; |
| 2432 | + |
| 2433 | + if (typeof gen.return !== "function") { |
| 2434 | + this.return = undefined; |
| 2435 | + } |
| 2436 | + } |
| 2437 | + |
| 2438 | + if (typeof Symbol === "function" && Symbol.asyncIterator) { |
| 2439 | + AsyncGenerator.prototype[Symbol.asyncIterator] = function () { |
| 2440 | + return this; |
| 2441 | + }; |
| 2442 | + } |
| 2443 | + |
| 2444 | + AsyncGenerator.prototype.next = function (arg) { |
| 2445 | + return this._invoke("next", arg); |
| 2446 | + }; |
| 2447 | + |
| 2448 | + AsyncGenerator.prototype.throw = function (arg) { |
| 2449 | + return this._invoke("throw", arg); |
| 2450 | + }; |
| 2451 | + |
| 2452 | + AsyncGenerator.prototype.return = function (arg) { |
| 2453 | + return this._invoke("return", arg); |
| 2454 | + }; |
| 2455 | + |
| 2456 | + return { |
| 2457 | + wrap: function (fn) { |
| 2458 | + return function () { |
| 2459 | + return new AsyncGenerator(fn.apply(this, arguments)); |
| 2460 | + }; |
| 2461 | + }, |
| 2462 | + await: function (value) { |
| 2463 | + return new AwaitValue(value); |
| 2464 | + } |
| 2465 | + }; |
| 2466 | +}(); |
2356 | 2467 |
|
2357 | 2468 |
|
2358 | 2469 |
|
@@ -3541,6 +3652,9 @@ function install(Vue, options) { |
3541 | 3652 |
|
3542 | 3653 | ApolloProvider$1.install = install; |
3543 | 3654 |
|
| 3655 | +// eslint-disable-next-line no-undef |
| 3656 | +ApolloProvider$1.version = "3.0.0-alpha.1"; |
| 3657 | + |
3544 | 3658 | var ApolloProvider$$1 = ApolloProvider$1; |
3545 | 3659 |
|
3546 | 3660 | // Auto-install |
|
0 commit comments