Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
nolanlawson committed Jun 13, 2016
1 parent 0d3a346 commit eca12f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions dist/pouchdb.find.js
Original file line number Diff line number Diff line change
Expand Up @@ -4870,6 +4870,11 @@ if (typeof window !== 'undefined' && window.PouchDB) {
// shim for using process in browser

var process = module.exports = {};

// cached from whatever global is present so that test runners that stub it don't break things.
var cachedSetTimeout = setTimeout;
var cachedClearTimeout = clearTimeout;

var queue = [];
var draining = false;
var currentQueue;
Expand All @@ -4894,7 +4899,7 @@ function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
var timeout = cachedSetTimeout(cleanUpNextTick);
draining = true;

var len = queue.length;
Expand All @@ -4911,7 +4916,7 @@ function drainQueue() {
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
cachedClearTimeout(timeout);
}

process.nextTick = function (fun) {
Expand All @@ -4923,7 +4928,7 @@ process.nextTick = function (fun) {
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
cachedSetTimeout(drainQueue, 0);
}
};

Expand Down
Loading

0 comments on commit eca12f3

Please sign in to comment.