public
Last active

alloy.jmk for Alloy use with TiShadow

  • Download Gist
Readme.md
Markdown

It enables you to free memory between launching TiShadow builds.

Updated based on @FokkeZB's improvements

alloy.jmk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
task("post:compile", function(event,logger) {
var fs = require("fs"),
path = require("path");
if (event.alloyConfig.deployType === 'production') {
return;
}
var existing_bits = 'Alloy.createController("index");'
var tishadow_bits =
[ 'var index = Alloy.createController("index");',
'if (typeof exports !== "undefined") {',
' exports.close = function () {',
' index.getView().close();',
' };',
'}'
].join("\n");
var appjs = path.join(event.dir.resources, "app.js");
fs.writeFileSync(
appjs,
fs.readFileSync(appjs).toString().replace(existing_bits, tishadow_bits));
});
index.js
JavaScript
1 2 3 4
//Example app/controllers/index.js
$.index.addEventListener('close',function() {
// Add other cleanup bits hear if necessary
})

@FokkeZB, updated based on your improvements. Thanks.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.