From 5b24cc731f19ab65dc030b102c90476aa79e287e Mon Sep 17 00:00:00 2001 From: euforic Date: Thu, 27 Jun 2013 12:05:13 -0700 Subject: [PATCH 1/2] move android special external url path to platform code --- build/liveview.js | 12 ++++++++---- build/liveview.min.js | 2 +- hook/lvhook.js | 6 ------ lib/platform/require.js | 12 ++++++++---- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/build/liveview.js b/build/liveview.js index 7da02a3..a7a379b 100644 --- a/build/liveview.js +++ b/build/liveview.js @@ -387,8 +387,13 @@ Module._includeNative = function(){ * @api private */ -Module.patch = function (globalCtx, port, url) { - Module._url = url || 'FSERVER_HOST'; +Module.patch = function (globalCtx, url, port) { + + var defaultURL = (process.platform === 'android' && process.hardware === 'sdk') + ? '10.0.2.2' + : 'FSERVER_HOST'; + + Module._url = url || defaultURL; Module._port = port || 8324; Module._requireNative = globalCtx.require; Module.evtServer && Module.evtServer.close(); @@ -543,7 +548,6 @@ Module.prototype._getRemoteSource = function(file,timeout){ request.cache = false; request.open("GET", file); request.send(); - while(!rsp){ if (request.readyState === 4 ) { if (request.status !== 200) { @@ -553,7 +557,7 @@ Module.prototype._getRemoteSource = function(file,timeout){ rsp = request.responseText; } else if ((expireTime - (new Date()).getTime()) <= 0) { rsp = true; - throw new Error('[LiveView]', 'File Server unavailable. Host Unreachable'); + throw new Error('[LiveView] File Server unavailable. Host Unreachable'); } } diff --git a/build/liveview.min.js b/build/liveview.min.js index dac8951..20c3907 100644 --- a/build/liveview.min.js +++ b/build/liveview.min.js @@ -1 +1 @@ -function Emitter(obj){if(obj){return mixin(obj)}}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks[event]=this._callbacks[event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){var self=this;this._callbacks=this._callbacks||{};function on(){self.off(event,on);fn.apply(this,arguments)}fn._off=on;this.on(event,on);return this};Emitter.prototype.off=function(event,fn){this._callbacks=this._callbacks||{};var callbacks=this._callbacks[event];if(!callbacks){return this}if(1==arguments.length){delete this._callbacks[event];return this}var i=callbacks.indexOf(fn._off||fn);if(~i){callbacks.splice(i,1)}return this};Emitter.prototype.emit=function(event){this._callbacks=this._callbacks||{};var args=[].slice.call(arguments,1);var callbacks=this._callbacks[event];if(callbacks){callbacks=callbacks.slice(0);for(var i=0,len=callbacks.length;i Date: Thu, 27 Jun 2013 12:06:28 -0700 Subject: [PATCH 2/2] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 344c1a4..65ac628 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "liveview", - "version": "0.1.25", + "version": "0.1.26", "description": "Titanium Live Realtime App Development", "main": "index.js", "private": true,