Skip to content

Instantly share code, notes, and snippets.

@zo0m
Last active September 19, 2019 14:21
Show Gist options
  • Save zo0m/ee36f12217afc1bce5c9d99b0e59a747 to your computer and use it in GitHub Desktop.
Save zo0m/ee36f12217afc1bce5c9d99b0e59a747 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