Open arkmediastudio opened 11 years ago
You might be interested on viewing this lines of code: https://github.com/HubSpot/offline/blob/master/js/ui.js#L141
I don't know how turbolinks actually works in details, but i also have issue with the rendering the UI and events because currently I'm injecting the script on-fly and the DOMContentLoaded
off course not being triggered.
@zackbloom perhaps we could simply expose Offline.init
so that it can be initialized manually. @adisuryadi that would have solved your issue, correct?
That's not really going to help unfortunately, the init which happens in Offline.init
will bind XHR, but not much else.
@adamschwartz for my problem I changed offline.js to be loaded via bower instead, so then brunch build it with other assets and run on init. Works like charm, i need to manually added the main prop on bower.json override though:
"offline": {
"main": [
"offline.min.js",
"./themes/offline-theme-default.css"
]
}
because brunch need it for picking the main files to build.
@zackbloom @adisuryadi should we make that the default bower.json configuration?
Anyone got this to work?
+1... it would be great to expose a method initialize Offline.js manually, so that it can be used with Turbolinks. Otherwise, turbolinks replaces the Offline.js dom elements on page change.
That or allow users to allow init to bind to custom events. For example, with turbolinks, you'd want to bind to turbolinks:load
instead of DOMContentLoaded
. In the interim, you can make this change yourself.
Hi
can you please help to get offline work with turbolinks https://github.com/rails/turbolinks/. when i use turbolinks to fetch pages there is no offline-ui class in body tag. i know this could be a problem with how turbolinks work, but is there any work around to get it working.
Thanks