mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-04 04:40:05 +02:00
add some packages
This commit is contained in:
68
node_modules/core-js/modules/_microtask.js
generated
vendored
Normal file
68
node_modules/core-js/modules/_microtask.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
var global = require('./_global');
|
||||
var macrotask = require('./_task').set;
|
||||
var Observer = global.MutationObserver || global.WebKitMutationObserver;
|
||||
var process = global.process;
|
||||
var Promise = global.Promise;
|
||||
var isNode = require('./_cof')(process) == 'process';
|
||||
|
||||
module.exports = function () {
|
||||
var head, last, notify;
|
||||
|
||||
var flush = function () {
|
||||
var parent, fn;
|
||||
if (isNode && (parent = process.domain)) parent.exit();
|
||||
while (head) {
|
||||
fn = head.fn;
|
||||
head = head.next;
|
||||
try {
|
||||
fn();
|
||||
} catch (e) {
|
||||
if (head) notify();
|
||||
else last = undefined;
|
||||
throw e;
|
||||
}
|
||||
} last = undefined;
|
||||
if (parent) parent.enter();
|
||||
};
|
||||
|
||||
// Node.js
|
||||
if (isNode) {
|
||||
notify = function () {
|
||||
process.nextTick(flush);
|
||||
};
|
||||
// browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
|
||||
} else if (Observer && !(global.navigator && global.navigator.standalone)) {
|
||||
var toggle = true;
|
||||
var node = document.createTextNode('');
|
||||
new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
|
||||
notify = function () {
|
||||
node.data = toggle = !toggle;
|
||||
};
|
||||
// environments with maybe non-completely correct, but existent Promise
|
||||
} else if (Promise && Promise.resolve) {
|
||||
var promise = Promise.resolve();
|
||||
notify = function () {
|
||||
promise.then(flush);
|
||||
};
|
||||
// for other environments - macrotask based on:
|
||||
// - setImmediate
|
||||
// - MessageChannel
|
||||
// - window.postMessag
|
||||
// - onreadystatechange
|
||||
// - setTimeout
|
||||
} else {
|
||||
notify = function () {
|
||||
// strange IE + webpack dev server bug - use .call(global)
|
||||
macrotask.call(global, flush);
|
||||
};
|
||||
}
|
||||
|
||||
return function (fn) {
|
||||
var task = { fn: fn, next: undefined };
|
||||
if (last) last.next = task;
|
||||
if (!head) {
|
||||
head = task;
|
||||
notify();
|
||||
} last = task;
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user