From 0a97ad7431f2473e8ea66685867344c678c0b3bc Mon Sep 17 00:00:00 2001 From: euforic Date: Thu, 25 Jul 2013 15:20:18 -0700 Subject: [PATCH] add platform specific folder support --- build/liveview.js | 5 +++-- build/liveview.min.js | 2 +- lib/fserver.js | 8 ++++++++ lib/platform/process.js | 2 +- lib/platform/require.js | 3 ++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/build/liveview.js b/build/liveview.js index c5a5201..ded5b4f 100644 --- a/build/liveview.js +++ b/build/liveview.js @@ -17,7 +17,7 @@ function Process() { this.moduleLoadList = []; this.versions = {}; this.arch = Ti.Platform.architecture; - this.platform = Ti.Platform.name; + this.platform = Ti.Platform.osname; this.hardware = ('' + Ti.Platform.model).replace('google_'); } @@ -468,7 +468,7 @@ Module.connectServer = function() { Module.include = function(ctx,id) { var file = id.replace('.js', ''); - var src = Module.prototype._getRemoteSource(file,10000); + var src = Module.prototype._getRemoteSource(file,1000); eval.call(ctx,src); }; @@ -538,6 +538,7 @@ Module.prototype._getRemoteSource = function(file,timeout){ var file = 'http://' + Module._url + ':' + Module._port + '/' + (file || this.id) + '.js'; request.cache = false; request.open("GET", file); + request.setRequestHeader('x-platform', process.platform); request.send(); while(!rsp){ if (request.readyState === 4 ) { diff --git a/build/liveview.min.js b/build/liveview.min.js index a4a245a..b51e7ac 100644 --- a/build/liveview.min.js +++ b/build/liveview.min.js @@ -1 +1 @@ -!function(globalScope){function Process(){if(!(this instanceof Process))return new Process;this.title="titanium";this.version="";this.moduleLoadList=[];this.versions={};this.arch=Ti.Platform.architecture;this.platform=Ti.Platform.name;this.hardware=(""+Ti.Platform.model).replace("google_")}Process.prototype.__proto__=Emitter.prototype;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