microtask-delay.js 430 B

12345678910111213141516171819202122
  1. "use strict";
  2. var nextTick = require("next-tick");
  3. module.exports = function (t, a, d) {
  4. var wasInvoked = false, args = [{}, {}], context = {};
  5. var target = t.call(function () {
  6. a(this, context);
  7. a.deep(arguments, args);
  8. wasInvoked = true;
  9. });
  10. nextTick(function () {
  11. a(wasInvoked, false);
  12. target.apply(context, args);
  13. a(wasInvoked, false);
  14. nextTick(function () {
  15. a(wasInvoked, true);
  16. d();
  17. });
  18. });
  19. };