holder icon indicating copy to clipboard operation
holder copied to clipboard

Support Turbolinks 5

Open btrewern opened this issue 8 years ago • 1 comments

Hi, I was hoping you could support Turbolinks 5.

I think I've found what code needs to be changed but don't do much Javascript and don't understand how this code is packaged.

I think what needs to be changed is here in index.js:

if (typeof global.Turbolinks == 'object') {
  global.document.addEventListener('page:change', function() {
    Holder.run();
  });
}

to

if (typeof global.Turbolinks.controller == 'object') { // Turbolinks 5
  global.document.addEventListener('turbolinks:load', function() {
    Holder.run();
  });
} else if (typeof global.Turbolinks == 'object') { // Turbolinks Classic
  global.document.addEventListener('page:change', function() {
    Holder.run();
  });
}

I hope this makes sense.

btrewern avatar May 05 '17 10:05 btrewern

nice, thanks for the tip

imsky avatar May 05 '17 14:05 imsky