Automatic testing would be Cool. • As for iOS version, Mac is required. • Now Titanium SDK 4.1.0.GA support Windows Native. But I don’t have Windows machine.
value of vm.runInContext is the context of the execution result (≒Assertion!) var vm = require(‘vm’), context = vm.createContext({ require: require, module: module, exports: exports, console: console, setTimeout: setTimeout, setInterval: setInterval, clearTimeout: clearTimeout, clearInterval: clearInterval, JSON: JSON, alert: function(e) { console.log(e); } }), result = vm.runInContext(‘console.log(\’ Hello, world.\’);’, context);
does it work? • It might work! But I have to add all Titanium APIs var vm = require(‘vm’), context = vm.createContext({ Ti: { UI: { createWindow: function(){} } } }), result = vm.runInContext(‘var win = Ti.UI.createWindow();’, context);
Titanium API on Node.js without Titanium SDK • The exception error can be sent when the deprecated properties or methods are found • No screen transitions. Of course there is no screens!
build”/“appc run” are also OK. • The point is exporting the code under resources folder. • Then, “npm test” $ alloy compile ——config platform=ios $ npm test > [email protected] test /Users/ Kosuke/src/sandbox > mocha test.js iOS index.js ✓ should does not throw exception in the Controller 1 passing (10ms)
and the optimized classic code will be exported under Resources folder. • The result will be returned as the context, when the code was sent to ti-slag and executed in VM environment. • Compiled alloy controller is module.exports and has been seen. So execute this.
argument “module”. • If you set the module name to require here, it’ll be loaded. Enjoy! var context = slag(‘./ Resources/iphone/alloy/ controllers/index.js’, { titanium: ‘4.0.0.GA’, platfrom: ‘ios’, module: { ‘ti.map’: { // ࣗͰ͕ΜΕ } } });
• Alloy works under ti-slag like Titanium SDK • It’s OK to send Alloy context to ti-slag’s module(BaseController.js will be needed as well) • Refer k0sukey/ti-slag/test.js for detail
can be used without any changes, because Alloy context will be deployed in ti-slag • To have EventListener using add/get/remove events which are added in [email protected] assert.doesNotThrow(function(){ context.Controller(); var listeners = context.getListener(); });