Skip to content

Instantly share code, notes, and snippets.

@dtothefp
Created April 20, 2019 16:04
Show Gist options
  • Save dtothefp/a717c4e54f5b313d4f5e339731368204 to your computer and use it in GitHub Desktop.
Save dtothefp/a717c4e54f5b313d4f5e339731368204 to your computer and use it in GitHub Desktop.
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
var wait = function wait() {
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
return new Promise(function (res) {
return setTimeout(res, duration);
});
};
export default
/*#__PURE__*/
_asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var duration,
_args = arguments;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
duration = _args.length > 0 && _args[0] !== undefined ? _args[0] : 500;
console.log('WAITING', wait);
_context.next = 4;
return wait(duration);
case 4:
console.log('DONE');
case 5:
case "end":
return _context.stop();
}
}
}, _callee);
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment