From aa37925dc5d59208de8240c46eca8e832ca13645 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Thu, 9 Oct 2014 11:34:38 -0700 Subject: [PATCH] Use setTimeout when setImmediate is not available. setImemdiate is not supoorted by webit and gecko, causing this to fail most client side loopback apps. --- lib/remote-connector.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/remote-connector.js b/lib/remote-connector.js index 118d637..f20fd40 100644 --- a/lib/remote-connector.js +++ b/lib/remote-connector.js @@ -49,7 +49,11 @@ RemoteConnector.initialize = function(dataSource, callback) { var connector = dataSource.connector = new RemoteConnector(dataSource.settings); connector.connect(); - setImmediate(callback); + if (typeof setImmediate === 'function') { + setImmediate(callback); + } else { + setTimeout(callback); + } }; RemoteConnector.prototype.define = function(definition) {