(#7120) - Dont use nextTick in browser builds, and switch to setTimeout
diff --git a/package.json b/package.json index 23c8e62..f827b90 100644 --- a/package.json +++ b/package.json
@@ -41,7 +41,6 @@ "double-ended-queue": "2.1.0-0", "fetch-cookie": "0.7.0", "fruitdown": "1.0.2", - "immediate": "3.0.6", "inherits": "2.0.3", "level": "3.0.0", "level-codec": "7.0.1", @@ -116,14 +115,12 @@ }, "// greenkeeper": [ "// chai-as-promised is pinned because of breaking changes in 6.0.0", - "// immediate is pinned to use the same version as lie for a smaller bundle", "// readable-stream has breaking changes in 2.0.0", "// stream-to-promise is pinned because there's a breaking change in 2.0.0" ], "greenkeeper": { "ignore": [ "chai-as-promised", - "immediate", "readable-stream", "stream-to-promise" ]
diff --git a/packages/node_modules/pouchdb-find/src/utils.js b/packages/node_modules/pouchdb-find/src/utils.js index 571bfc3..dab8d9e 100644 --- a/packages/node_modules/pouchdb-find/src/utils.js +++ b/packages/node_modules/pouchdb-find/src/utils.js
@@ -4,6 +4,8 @@ parseField } from 'pouchdb-selector-core'; +import { nextTick } from 'pouchdb-utils'; + function once(fun) { var called = false; return getArguments(function (args) { @@ -38,7 +40,7 @@ // if it was a callback, create a new callback which calls it, // but do so async so we don't trap any errors usedCB = function (err, resp) { - process.nextTick(function () { + nextTick(function () { tempCB(err, resp); }); }; @@ -84,11 +86,11 @@ function promisedCallback(promise, callback) { promise.then(function (res) { - process.nextTick(function () { + nextTick(function () { callback(null, res); }); }, function (reason) { - process.nextTick(function () { + nextTick(function () { callback(reason); }); }); @@ -230,4 +232,4 @@ promisedCallback, toPromise, uniq -}; \ No newline at end of file +};
diff --git a/packages/node_modules/pouchdb-utils/src/nextTick-browser.js b/packages/node_modules/pouchdb-utils/src/nextTick-browser.js index 0198297..ed1a04d 100644 --- a/packages/node_modules/pouchdb-utils/src/nextTick-browser.js +++ b/packages/node_modules/pouchdb-utils/src/nextTick-browser.js
@@ -1,13 +1,3 @@ -// Custom nextTick() shim for browsers. In node, this will just be process.nextTick(). We -// avoid using process.nextTick() directly because the polyfill is very large and we don't -// need all of it (see: https://github.com/defunctzombie/node-process). -// "immediate" 3.0.8 is used by lie, and it's a smaller version of the latest "immediate" -// package, so it's the one we use. // When we use nextTick() in our codebase, we only care about not releasing Zalgo // (see: http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony). -// Microtask vs macrotask doesn't matter to us. So we're free to use the fastest -// (least latency) option, which is "immediate" due to use of microtasks. -// All of our nextTicks are isolated to this one function so we can easily swap out one -// implementation for another. -import immediate from 'immediate'; -export default immediate; \ No newline at end of file +export default setTimeout;