Skip to content

Instantly share code, notes, and snippets.

@brentonhouse
Forked from zo0m/Components.js
Created September 19, 2019 14:21
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 brentonhouse/247e62fce91c1b26b1e01b503f7fd110 to your computer and use it in GitHub Desktop.
Save brentonhouse/247e62fce91c1b26b1e01b503f7fd110 to your computer and use it in GitHub Desktop.
Custom tags in go-od
const createFunctionsSet = {};
function buildCreatorFor(tagName, controllerName) {
const createFuntionName = `create${tagName}`;
createFunctionsSet[createFuntionName] = function (args) {
return Alloy.createController(controllerName, args).getView();
}
}
buildCreatorFor('BaseWindow', 'components/common/base-window/BaseWindow');
buildCreatorFor('MenuWindow', 'components/common/menu-window/MenuWindow');
buildCreatorFor('ImageViewer', 'components/common/image-viewer/ImageViewer');
buildCreatorFor('HorizontalScroller', 'components/common/horizontal-scroller/HorizontalScroller');
buildCreatorFor('LoadingContainer', 'components/common/horizontal-scroller/LoadingContainer');
module.exports = createFunctionsSet; // { createBaseWindow: function(args) {...}, createMenuWindow: function(args){...}}
Alloy
MenuWindow(module="app/ui/components")
ScrollView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment