Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got nextTick is not a function when using 7.1.0 #80

Open
PikachuEXE opened this issue May 17, 2018 · 2 comments
Open

Got nextTick is not a function when using 7.1.0 #80

PikachuEXE opened this issue May 17, 2018 · 2 comments

Comments

@PikachuEXE
Copy link

PikachuEXE commented May 17, 2018

Original error message is l is not a function pointing to the following minified code:

f.setImmediate="function"===typeof r?r:function(a){var b=D++,c=2>arguments.length?!1:m.call(arguments,1);n[b]=!0;l(function(){n[b]&&(c?a.apply(null,c):a.call(null),f.clearImmediate(b))});return b}

After generating a not minified file, I found the following function:

exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
  var id = nextImmediateId++;
  var args = arguments.length < 2 ? false : slice.call(arguments, 1);

  immediateIds[id] = true;

  nextTick(function onNextTick() {
    if (immediateIds[id]) {
      // fn.call() is faster so we optimize for the common use-case
      // @see http://jsperf.com/call-apply-segu
      if (args) {
        fn.apply(null, args);
      } else {
        fn.call(null);
      }
      // Prevent ids from leaking
      exports.clearImmediate(id);
    }
  });

  return id;
};
@goto-bus-stop
Copy link
Member

Hmm, this works for me with 7.1.0:

setImmediate(function () {
  console.log('test')
})

Could you share an example snippet that reproduces the problem?

@PikachuEXE
Copy link
Author

Actually I cannot reproduce it with the same script file in local website
I will try to compile a file without minifying it and the get the stack trace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants