Skip to content

Ever considered the use of queueMicrotask? #348

Description

@andreyvital

It's available as of v11—isn't it better than process.nextTick? https://nodejs.org/api/globals.html#queuemicrotaskcallback

dataloader/src/index.js

Lines 239 to 255 in d336bd1

const enqueuePostPromiseJob =
typeof process === 'object' && typeof process.nextTick === 'function'
? function (fn) {
if (!resolvedPromise) {
resolvedPromise = Promise.resolve();
}
resolvedPromise.then(() => {
process.nextTick(fn);
});
}
: typeof setImmediate === 'function'
? function (fn) {
setImmediate(fn);
}
: function (fn) {
setTimeout(fn);
};

Just a question...

Thanks,
A.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions