Last active
September 19, 2019 14:21
-
-
Save zo0m/ee36f12217afc1bce5c9d99b0e59a747 to your computer and use it in GitHub Desktop.
Custom tags in go-od
This file contains 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
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){...}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment