Created
February 2, 2017 07:34
-
-
Save somethvictory/ebd83264a85dd9730efd0919e0eede1c to your computer and use it in GitHub Desktop.
Load all common js related code then load js page by page
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
IDByMe.Initializer = | |
exec: (pageName) -> | |
if pageName && IDByMe[pageName] | |
IDByMe[pageName]['init']() | |
currentPage: -> | |
return '' unless $('body').attr('id') | |
bodyId = $('body').attr('id').split('-') | |
action = IDByMe.Util.capitalize(bodyId[1]) | |
controller = IDByMe.Util.capitalize(bodyId[0]) | |
controller + action | |
init: -> | |
IDByMe.Initializer.exec('Common') | |
if @currentPage() | |
IDByMe.Initializer.exec(@currentPage()) | |
$(document).on 'ready page:load', -> | |
IDByMe.Initializer.init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment