Basically, committing the sin of temporarily overr...
# package-development
d
Basically, committing the sin of temporarily overriding jQuery's
ready
function so I can queue the ready event handlers, wait for my Vite script to load, then de-queue and call the handlers In the loader:
Copy code
js
const ready = $.prototype.ready;

let queued = [];
$.prototype.ready = function ( fn ) {
  queued.push( fn );
};

$.enableReady = function() {
  queued.forEach((x) => {
    ready.call(this, x);
  })
  
  $.prototype.ready = ready;
}

let script = document.createElement("script");
script.type = "module";
script.src = "/backoffice/src/main.ts";
document.getElementsByTagName('head')[0].appendChild(script);
In my Vite script:
Copy code
js
if ( $.enableReady ) {
  $.enableReady()
}