Last active
December 25, 2015 20:39
-
-
Save westonplatter/7036455 to your computer and use it in GitHub Desktop.
How are other people ensuring that, 1) JS frameworkinitializers are properly kicking off2) page/DOM specific bindings are being set@westonplatter
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
| // How are other people ensuring that, | |
| // | |
| // 1) JS frameworkinitializers are properly kicking off | |
| // 2) page/DOM specific bindings are being set | |
| // | |
| // @westonplatter | |
| // | |
| // | |
| // PS: Workspace is a Marionette JS application module | |
| executeOnce = -> | |
| Workspace.start() | |
| executeEachRequest = -> | |
| $('#fileupload'). | |
| fileupload(sequentialUploads: false). | |
| bind('fileuploaddone', (e, data) -> | |
| asset = new Workspace.Models.Asset(data.result, {}) | |
| asset_view = new Workspace.Views.Assets.Item({model: asset}) | |
| $('#list').append(asset_view.render().el); | |
| ) | |
| $ -> | |
| executeOnce() | |
| executeEachRequest() | |
| $(document).on "page:change", -> | |
| executeEachRequest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment