Created
January 10, 2018 12:58
-
-
Save metaskills/8eabf6df1b144f4fcf2c9cc3c28e387b to your computer and use it in GitHub Desktop.
Turbolinks & jQuery ReConstructor Pattern
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
class Toolbar | |
constructor: -> | |
document.addEventListener 'turbolinks:before-cache', @turboBeforeCache | |
@reConstructor() | |
reConstructor: -> | |
@registerWaypoint() | |
registerWaypoint: -> | |
# ... | |
turboBeforeCache: (e) => | |
# ... | |
document.addEventListener 'turbolinks:load', -> | |
ProductCatalog.Toolbar?.reConstructor() | |
jQuery -> | |
ProductCatalog.Toolbar = new Toolbar() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment