Closed zw963 closed 6 years ago
It worked now, because not import style files.
But, still not trigger for Rails applications with turbolinks enabled.
turbolinks have it's own version document.ready
, we need invoke
PNotify js init code in special callback to make it worked.
following is a example
let PNotify = require('pnotify');
require('pnotify/dist/pnotify.buttons');
window.PNotify = PNotify;
function init () {
$(".ui.dropdown").dropdown();
DragScroll.reset();
// Like DragScroll.reset(), we need load that myself for turbolinks to work.
// But following trigger code is not worked.
PNotify.reload(window);
}
if (Turbolinks.supported) {
// trubolinks use following callback to trigger js init code.
document.addEventListener("turbolinks:load", function () {
init();
});
} else {
$(function () {
init();
});
}
Nice workaround. :)
webpacker is a ruby on rails wrapper for webpack, so, i think webpacker config is same as webpack, what i expect is output a nice look tips on browser top-right corner.
following is my config for pnotify.
I try any i know es6 load method to try to make this work, but not.
following is firefox log: