Skip to content

Instantly share code, notes, and snippets.

@brentonhouse
Forked from jasonkneen/elements.js
Created November 10, 2015 21:17
Show Gist options
  • Save brentonhouse/cb3a9e2465c93d9c1246 to your computer and use it in GitHub Desktop.
Save brentonhouse/cb3a9e2465c93d9c1246 to your computer and use it in GitHub Desktop.
In the latest TiAlloy you can specify a module tag against the <Alloy> element in XML and this will be used when creating any elements in the view, so you can override, customise etc. The problem is if you want to use multiple commonJS libraries, there's no support in the Alloy Tag -- you'd have to change the module attribute for each element --…
var o = {};
// include the modules you want - purposely did this as seperate lines so it's easier to comment out modules etc
_.extend(o, require("module1"));
_.extend(o, require("module2"));
_.extend(o, require("module3"));
// make available under a single export for use in <Alloy> tag
module.exports = o;
<Alloy module="elements">
<Window>
<Label>Hello!</Label>
</Window>
</Alloy>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment