Skip to content

Instantly share code, notes, and snippets.

@Fi3
Last active April 10, 2016 00:16
Show Gist options
  • Save Fi3/c86dc837af5c434b710966c543c86ea9 to your computer and use it in GitHub Desktop.
Save Fi3/c86dc837af5c434b710966c543c86ea9 to your computer and use it in GitHub Desktop.
'use strict';
require('babel-polyfill');//"~6.7.4"
var c = 0;
var counter = 0;
var thisNotWork = function _callee() {
return regeneratorRuntime.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
counter = counter + 1;
if (counter === 1000) {
c = 7;
} else {
thisNotWork();
};
case 3:
case 'end':
return _context.stop();
}
}
}, null, this);
};
var thisWork1 = function _callee2() {
return regeneratorRuntime.async(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
counter = counter + 1;
if (counter < 1000) {
thisWork1();
};
c = 7;
case 4:
case 'end':
return _context2.stop();
}
}
}, null, this);
};
var thisWork2 = function _callee3() {
return regeneratorRuntime.async(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
counter = counter + 1;
if (counter === 10) {
c = 7;
} else {
thisWork2();
};
case 3:
case 'end':
return _context3.stop();
}
}
}, null, this);
};
var myFunction1 = function _callee4(anotherAsyncFunction) {
return regeneratorRuntime.async(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return regeneratorRuntime.awrap(anotherAsyncFunction());
case 2:
console.log(c);
case 3:
case 'end':
return _context4.stop();
}
}
}, null, this);
};
myFunction1(thisNotWork);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment