Last active
November 28, 2016 14:26
-
-
Save jasonkneen/0f09114f4913c00512f9 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 --…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Alloy module="elements"> | |
<Window> | |
<Label>Hello!</Label> | |
</Window> | |
</Alloy> |
it would be nice like:
<Widget src="my.widget" module="lib.from.widget>
<CustomTag />
</Widget>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So basically this allows you to have several files in your /lib folder that you can then have referenced for creating tag / elements. Basically the Window and Label elements will be processed by running through the "elements" module first, looking for .createWindow and .createLabel -- if none are found it defaults to Alloy / Ti defaults