Hi,
I’ve been playing around with clientside callbacks today (to hopefully attach to wasm runtime). However, importing external javascript in any of my files in /assets will cause the following error:
Cannot read properties of undefined (reading ‘*’)
where * is the name of the js-defined callback. Is there a possibility to statically (once) import js-functions from other files and call them from the clientside callback function?
My /assets/custom-script.js looks like
import * as external from "./external"
window.dash_clientside = Object.assign({}, window.dash_clientside, {
clientside: {
call_greeting: function(name) {
return external.greet(name);
}
}
});
Dynamic imports almost works though (allowing promised values as of Dash 2.4?)
window.dash_clientside.clientside = {
call_greeting: function(name) {
return import("./external").then((module) => {
return module.greet(name)
})
}
}
However, using such dynamic import, the wasm runtime would somehow be started at each function call, which probably would be excessive?
Thanks!