fake-indexeddb 3.1.6 → 3.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/scheduling.js +20 -1
- package/package.json +1 -1
package/build/lib/scheduling.js
CHANGED
|
@@ -19,12 +19,31 @@ function getSetImmediateFromJsdom() {
|
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
|
|
23
|
+
// Remove this after dropping Node 8 support
|
|
24
|
+
// tslint:disable-next-line
|
|
25
|
+
var getGlobal = function () {
|
|
26
|
+
if (typeof globalThis !== 'undefined') {
|
|
27
|
+
return globalThis;
|
|
28
|
+
}
|
|
29
|
+
if (typeof global !== 'undefined') {
|
|
30
|
+
return global;
|
|
31
|
+
}
|
|
32
|
+
if (typeof self !== 'undefined') {
|
|
33
|
+
return self;
|
|
34
|
+
}
|
|
35
|
+
if (typeof window !== 'undefined') {
|
|
36
|
+
return window;
|
|
37
|
+
}
|
|
38
|
+
throw new Error('unable to locate global object');
|
|
39
|
+
};
|
|
40
|
+
var globals = getGlobal();
|
|
22
41
|
// Schedules a task to run later. Use Node.js's setImmediate if available and
|
|
23
42
|
// setTimeout otherwise. Note that options like process.nextTick or
|
|
24
43
|
// queueMicrotask will likely not work: IndexedDB semantics require that
|
|
25
44
|
// transactions are marked as not active when the event loop runs. The next
|
|
26
45
|
// tick queue and microtask queue run within the current event loop macrotask,
|
|
27
46
|
// so they'd process database operations too quickly.
|
|
28
|
-
exports.queueTask = setImmediate ||
|
|
47
|
+
exports.queueTask = globals.setImmediate ||
|
|
29
48
|
getSetImmediateFromJsdom() ||
|
|
30
49
|
(function (fn) { return setTimeout(fn, 0); });
|
package/package.json
CHANGED