main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.8 KB
|
Rev | Line | |
---|
[d565449] | 1 | function _usingCtx() {
|
---|
| 2 | var r = "function" == typeof SuppressedError ? SuppressedError : function (r, e) {
|
---|
| 3 | var n = Error();
|
---|
| 4 | return n.name = "SuppressedError", n.error = r, n.suppressed = e, n;
|
---|
| 5 | },
|
---|
| 6 | e = {},
|
---|
| 7 | n = [];
|
---|
| 8 | function using(r, e) {
|
---|
| 9 | if (null != e) {
|
---|
| 10 | if (Object(e) !== e) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
---|
| 11 | if (r) var o = e[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
---|
| 12 | if (void 0 === o && (o = e[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r)) var t = o;
|
---|
| 13 | if ("function" != typeof o) throw new TypeError("Object is not disposable.");
|
---|
| 14 | t && (o = function o() {
|
---|
| 15 | try {
|
---|
| 16 | t.call(e);
|
---|
| 17 | } catch (r) {
|
---|
| 18 | return Promise.reject(r);
|
---|
| 19 | }
|
---|
| 20 | }), n.push({
|
---|
| 21 | v: e,
|
---|
| 22 | d: o,
|
---|
| 23 | a: r
|
---|
| 24 | });
|
---|
| 25 | } else r && n.push({
|
---|
| 26 | d: e,
|
---|
| 27 | a: r
|
---|
| 28 | });
|
---|
| 29 | return e;
|
---|
| 30 | }
|
---|
| 31 | return {
|
---|
| 32 | e: e,
|
---|
| 33 | u: using.bind(null, !1),
|
---|
| 34 | a: using.bind(null, !0),
|
---|
| 35 | d: function d() {
|
---|
| 36 | var o,
|
---|
| 37 | t = this.e,
|
---|
| 38 | s = 0;
|
---|
| 39 | function next() {
|
---|
| 40 | for (; o = n.pop();) try {
|
---|
| 41 | if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);
|
---|
| 42 | if (o.d) {
|
---|
| 43 | var r = o.d.call(o.v);
|
---|
| 44 | if (o.a) return s |= 2, Promise.resolve(r).then(next, err);
|
---|
| 45 | } else s |= 1;
|
---|
| 46 | } catch (r) {
|
---|
| 47 | return err(r);
|
---|
| 48 | }
|
---|
| 49 | if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();
|
---|
| 50 | if (t !== e) throw t;
|
---|
| 51 | }
|
---|
| 52 | function err(n) {
|
---|
| 53 | return t = t !== e ? new r(n, t) : n, next();
|
---|
| 54 | }
|
---|
| 55 | return next();
|
---|
| 56 | }
|
---|
| 57 | };
|
---|
| 58 | }
|
---|
| 59 | module.exports = _usingCtx, module.exports.__esModule = true, module.exports["default"] = module.exports; |
---|
Note:
See
TracBrowser
for help on using the repository browser.