Comparing version 0.1.27 to 0.1.28
@@ -176,3 +176,3 @@ var U = require('../../utils'), | ||
code.content += state.code; | ||
if (isRoot) { code.content += 'root$ = ' + args.symbol + ';\n'; } | ||
if (isRoot) { code.content += '$.setRoot(' + args.symbol + ');\n'; } | ||
if (args.events && args.events.length > 0) { | ||
@@ -487,5 +487,5 @@ _.each(args.events, function(ev) { | ||
var copyrights = show_copyright(c.comments_before); | ||
var ast = jsp.parse(code); | ||
var newCode = exports.formatAST(ast,config,fn); | ||
return (copyrights ? copyrights + '\n' : '' ) + newCode; | ||
//var ast = jsp.parse(code); | ||
//var newCode = exports.formatAST(ast,config,fn); | ||
return (copyrights ? copyrights + '\n' : '' ) + code; //newCode; | ||
}; | ||
@@ -559,7 +559,12 @@ | ||
function do_call() { | ||
if (this[1][1] === 'expr') { | ||
var code = pro.gen_code(this[2][0]); | ||
var new_ast = ['string', STYLE_EXPR_PREFIX + code]; | ||
return new_ast; | ||
} | ||
var name = this[1][1]; | ||
var code; | ||
if (name === 'expr') { | ||
code = pro.gen_code(this[2][0]); | ||
} else if (name === 'L') { | ||
code = pro.gen_code(this); | ||
} else { | ||
return null; | ||
} | ||
return ['string', STYLE_EXPR_PREFIX + code]; | ||
}; | ||
@@ -566,0 +571,0 @@ |
@@ -7,2 +7,3 @@ /** | ||
pro = require("../../uglify-js/uglify-js").uglify, | ||
_ = require('../../lib/alloy/underscore')._, | ||
util = require('util'), | ||
@@ -223,6 +224,45 @@ colors = require('colors'), | ||
function processDot() { | ||
function processCall() { | ||
// TODO: Find a way to NOT execute this on code generated via markup | ||
var ret = handleAddAndRemove(this); | ||
if (ret) { | ||
return ret; | ||
} | ||
return null; | ||
} | ||
function processSub() { | ||
function handleAddAndRemove(ast) { | ||
var theCall = ast[1]; | ||
var theArgs = ast[2]; | ||
// make sure there's only one argument | ||
if (theArgs.length !== 1) { | ||
return null; | ||
} | ||
// make sure the call is being made by an object | ||
if (theCall[0] === 'name') { | ||
return null; | ||
} | ||
// make sure it's an add() or remove() | ||
if (theCall[2] !== 'add' && theCall[2] !== 'remove') { | ||
return null; | ||
} | ||
// TODO: check theCall to make sure it's a Ti proxy | ||
var argsStr = pro.gen_code(theArgs[0],{beautify:false}); | ||
// Need to wrap this in a self-executing function. This is because the | ||
// argument may be a function, and we don't want to call it twice and | ||
// have unexpected results. | ||
var newArgs = '(function(t) {' + | ||
'return (_.isObject(t) && t.__iamalloy__ ? t.getRoot() : t) || t;' + | ||
'})(' + argsStr + ')'; | ||
ast[2][0] = jsp.parse(newArgs)[1][0][1]; | ||
// console.log(require('util').inspect(ast, false, null)); | ||
// console.log('-'); | ||
return ast; | ||
} | ||
@@ -252,4 +292,3 @@ | ||
"var" :processVar | ||
//"dot": processDot, | ||
//"sub": processSub | ||
//"call": processCall | ||
} | ||
@@ -256,0 +295,0 @@ , function() |
@@ -36,3 +36,4 @@ var path = require('path'), | ||
"min-titanium-version":"2.0", | ||
"tags":"" | ||
"tags":"", | ||
"platforms":"android,ios,mobileweb" | ||
})); | ||
@@ -39,0 +40,0 @@ fs.writeFileSync(path.join(widgetPath, 'views', 'widget.' + CONST.FILE_EXT.VIEW), '<View id="defaultView"/>'); |
@@ -1,47 +0,8 @@ | ||
// TODO: Optimize out lifecycle events if they are not defined | ||
// instead of doing runtime checks | ||
var Alloy = require("alloy"), | ||
_ = Alloy._, | ||
A$ = Alloy.A, | ||
M$ = Alloy.M, | ||
BC$ = Alloy.Backbone.Collection; | ||
A$ = Alloy.A; | ||
exports.create = function() { | ||
var L$ = {}, | ||
root$; | ||
var $ = require('baseComponent').create(); | ||
// TODO: Move this definition into a component object module to be included | ||
// in the runtime alloy/components path | ||
var $ = { | ||
addEventListener: function(evt,callback) { | ||
if (!L$[evt]) { | ||
L$[evt] = []; | ||
} | ||
L$[evt].push(callback); | ||
}, | ||
fireEvent: function(evt,object) { | ||
if (_.isArray(L$[evt])) { | ||
for (var i = 0, l = L$[evt].length; i < l; i++) { | ||
L$[evt][i](object); | ||
} | ||
} | ||
}, | ||
removeEventListener: function(evt,callback) { | ||
if (_.isArray(L$[evt])) { | ||
Ti.API.info(L$[evt]); | ||
L$[evt] = _.without(L$[evt], callback); | ||
Ti.API.info(L$[evt]); | ||
} | ||
}, | ||
setParent: function(parent) { | ||
if (root$) { | ||
parent.add(root$); | ||
} | ||
}, | ||
getRoot: function() { | ||
return root$; | ||
} | ||
}; | ||
<%= onCreate %> | ||
@@ -48,0 +9,0 @@ |
@@ -16,3 +16,3 @@ { | ||
], | ||
"version": "0.1.27", | ||
"version": "0.1.28", | ||
"author": "Appcelerator, Inc. <info@appcelerator.com>", | ||
@@ -19,0 +19,0 @@ "maintainers": [ |
@@ -11,3 +11,4 @@ { | ||
"min-titanium-version":"2.0", | ||
"tags":"utility,loading,progress" | ||
"tags":"utility,loading,progress", | ||
"platforms":"android,ios,mobileweb" | ||
} |
@@ -11,3 +11,4 @@ { | ||
"min-titanium-version":"2.0", | ||
"tags":"utility,google,search" | ||
"tags":"utility,google,search", | ||
"platforms":"android,ios,mobileweb" | ||
} |
@@ -10,3 +10,5 @@ { | ||
"min-alloy-version": "1.0", | ||
"min-titanium-version":"2.1" | ||
"min-titanium-version":"2.1", | ||
"tags":"", | ||
"platforms":"android,ios,mobileweb" | ||
} |
@@ -11,3 +11,4 @@ { | ||
"min-titanium-version":"2.0", | ||
"tags":"utility,loading,progress" | ||
"tags":"utility,loading,progress", | ||
"platforms":"android,ios,mobileweb" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1872665
640
29394