appcelerator-labs / appc-liveviewer-app

An app to load and run Titanium and Alloy code from any URL, GitHub repositories and gists.
Other
8 stars 4 forks source link

Modularize codebase.js for re-use in LiveView #38

Open FokkeZB opened 9 years ago

FokkeZB commented 9 years ago

Ideally even a native module, handling dynamic font loading and possible other stuff to be more stable and also hide the implementation from users. Maybe we can also handle require() more efficient.

var VM = require('ti.vm`);

var vm = new VM({
  codebase: Ti.Filesystem.applicationDataDirectory + 'some/path'
});

vm.require('app');

For LiveView:

vm.setResourceHandler(function(id, callback) {

  // fetch from fileserver
  callback(null, codeOrPath);

});