var global = require('../internals/global');
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
-var classof = require('../internals/classof-raw');
var macrotask = require('../internals/task').set;
var IS_IOS = require('../internals/engine-is-ios');
+var IS_NODE = require('../internals/engine-is-node');
var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
+var document = global.document;
var process = global.process;
var Promise = global.Promise;
-var IS_NODE = classof(process) == 'process';
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
if (parent) parent.enter();
};
- // Node.js
- if (IS_NODE) {
- notify = function () {
- process.nextTick(flush);
- };
// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
- } else if (MutationObserver && !IS_IOS) {
+ if (!IS_IOS && !IS_NODE && MutationObserver && document) {
toggle = true;
node = document.createTextNode('');
new MutationObserver(flush).observe(node, { characterData: true });
notify = function () {
then.call(promise, flush);
};
+ // Node.js without promises
+ } else if (IS_NODE) {
+ notify = function () {
+ process.nextTick(flush);
+ };
// for other environments - macrotask based on:
// - setImmediate
// - MessageChannel