Jelajahi Sumber

refs #3131 removed setImmediate calls which break in the browser

Phil Murray 12 tahun lalu
induk
melakukan
c1aa661f99

+ 1 - 1
lib/pipeline/documentSources/CursorDocumentSource.js

@@ -167,7 +167,7 @@ proto.getCurrent = function getCurrent() {
  **/
 proto.setSource = function setSource(theSource, callback) {
 	if (theSource) throw new Error("CursorDocumentSource doesn't take a source"); //TODO: This needs to put back without the if once async is fully and properly supported
-	if (callback) return setImmediate(callback);
+	if (callback) return setTimeout(callback, 0);
 };
 
 /**

+ 1 - 1
lib/pipeline/documentSources/DocumentSource.js

@@ -139,7 +139,7 @@ proto.getSourceName = function getSourceName() {
 proto.setSource = function setSource(theSource, callback) {
 	if (this.source) throw new Error("It is an error to set the source more than once");
 	this.source = theSource;
-	if (callback) return setImmediate(callback);
+	if (callback) return setTimeout(callback, 0);
 };
 
 /**

+ 2 - 2
lib/pipeline/expressions/Expression.js

@@ -156,9 +156,9 @@ var FieldPathExpression = require("./FieldPathExpression"),
  * @static
  * @property opMap
  **/
-setImmediate(function(){ // Even though `opMap` is deferred, force it to load early rather than later to prevent even *more* potential silliness
+setTimeout(function(){ // Even though `opMap` is deferred, force it to load early rather than later to prevent even *more* potential silliness
 	Object.defineProperty(klass, "opMap", {value:klass.opMap});
-});
+}, 0);
 Object.defineProperty(klass, "opMap", {	//NOTE: deferred requires using a getter to allow circular requires (to maintain the ported API)
 	configurable: true,
 	get: function getOpMapOnce() {