frontend/js/core/events.js in trestle-0.9.0 vs frontend/js/core/events.js in trestle-0.9.1
- old
+ new
@@ -1,7 +1,9 @@
import $ from 'jquery'
+import turbolinks from './turbolinks'
+
// The ready function sets up a callback to run on each page load.
//
// Trestle.ready(function() {
// ...
// });
@@ -39,8 +41,10 @@
ready(function () {
triggerInit(document)
})
// Trigger the page load events.
-$(document).on('ready turbolinks:load', function () {
- triggerReady()
-})
+if (turbolinks) {
+ $(document).on('turbolinks:load', triggerReady)
+} else {
+ $(document).ready(triggerReady)
+}