Skip to content

Instantly share code, notes, and snippets.

@pegli
Created February 3, 2014 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pegli/8794143 to your computer and use it in GitHub Desktop.
Save pegli/8794143 to your computer and use it in GitHub Desktop.
var c = require('window_view_controller').createController();
<!--
Alloy compiler converts this to a module named "window_view".
-->
<Alloy>
<Window title="My Window">
<Label id="title"/>
<Label id="subtitle" onClick="subtitle_click"/>
</Window>
</Alloy>
// custom controller creation function
exports.createController = function() {
// pull in a view by filename
var view = require('window_view')(this);
view.subtitle_click = function(e) {
// implement click event handler
};
view.label1.text = 'This is a title';
view.label2.color = 'red';
view.open();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment