// a) on load: import './override.css' function onMount() { // this should be code that's safe to run eagerly (no danger of race conditions of any kind). Application codebase will call onMount() as soon as it can. ... } // b) on demand (UI events) window.bonsaiCallback = function () { ... // any synchronous code can happen right away, but for any communication with our application codebase, there should be a way how to send a message (event): application.send(...) } // Listener for messages from application application.receive((msg) => {...})