Unison
Unison copied to clipboard
DOMContentLoaded fired before loading Unison
I'm using Unison with Require.js
require.config({
paths: {
unison: '../bower_components/unison/js/unison'
},
shim: {
'unison': { exports: 'Unison' }
}
});
But then, Unison is loaded after DOMContentLoaded event, and because Unison is registering listener to that event to initialize itself, it will not start correctly.
doc.addEventListener('DOMContentLoaded', function(){
unisonReady = win.getComputedStyle(head, null).getPropertyValue('clear') !== 'none';
breakpoints.update();
});
I managed to fix it, but I'm not sure if it's good approach
if (document.readyState == "complete" || document.readyState == "loaded") {
// init()
} else {
doc.addEventListener('DOMContentLoaded', function(){
// init();
});
}
+1, ran into this same scenario. @Strajk you may want to look at #15 , it looks like a solve for this