Skip to content

Instantly share code, notes, and snippets.

@stomita
Created May 20, 2019 10:12
Show Gist options
  • Save stomita/ee85766b49b75bc3c2e932455cc08a59 to your computer and use it in GitHub Desktop.
Save stomita/ee85766b49b75bc3c2e932455cc08a59 to your computer and use it in GitHub Desktop.
{
"presets": [
["@babel/env", {
"targets": { "esmodules": true }
}]
]
}
"use strict";
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
class A {
foo() {
return _asyncToGenerator(function* () {
console.log('A#foo');
})();
}
}
class B extends A {
foo() {
var _superprop_callFoo = function _superprop_callFoo() {
return _superprop_callFoo(...arguments);
};
return _asyncToGenerator(function* () {
console.log('B#foo');
_superprop_callFoo();
})();
}
}
new B().foo();
class A {
async foo() {
console.log('A#foo');
}
}
class B extends A {
async foo() {
console.log('B#foo');
super.foo();
}
}
new B().foo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment