Closed shaktals closed 2 years ago
calledRun
is automatically generated by emscripten, so I don't think that it will keep future compatibility.
I am not too sure, but how about the following?
bls = require('./')
async function asyncInit() {
console.log('init')
await bls.init()
}
function once(f) {
return async function() {
if (!f.called) {
f.called = true
await f()
}
}
}
async function sample() {
console.log('call 1')
await once(asyncInit)()
console.log('call 2')
await once(asyncInit)()
}
sample().then(() => console.log('end'))
Best to track initialization state on the web app site, got it! 本当 に 共 ありがと お浸かり様 です よ
Hey Shigeo, hajimemashite
First, thanks for the excellent lib! On our web app we use it on multiple locations asynchronously. To avoid running
init
multiple times, I have written a small getter fn:It seems to work for now, but I'm thinking about future compatibility.
Does this method look ok to you? Would you suggest another approach?