SharedArrayBuffer error
Closed this issue · 1 comments
Liripo commented
When I try to use scran.js to read h5ad in eletron
, the error is as follows:
ReferenceError: SharedArrayBuffer is not defined
at scran__js.js?v=7e21cf8d:176:44
at Module.initialize (scran__js.js?v=7e21cf8d:6115:24)
at read_obs (App.vue:24:17)
at App.vue:34:11
at callWithErrorHandling (vue.js?v=7e21cf8d:1680:19)
at callWithAsyncErrorHandling (vue.js?v=7e21cf8d:1687:17)
at job (vue.js?v=7e21cf8d:7429:9)
at callWithErrorHandling (vue.js?v=7e21cf8d:1680:33)
at flushJobs (vue.js?v=7e21cf8d:1893:9)
code:
async function read_obs(filePath:string) {
try {
await scran.initialize();
let f = scran.initializeSparseMatrixFromHdf5(filePath,"X");
console.log(f);
} catch (error) {
console.error(error);
}
}
How to solve it?
LTLA commented
I don't know what "eletron" is. I assume you meant Electron. I'm not familiar with the Electron runtime, but you will need to somehow enable support for SharedArrayBuffer
s. Some googling provides a few possible solutions (see here), but your guess is as good as mine. In a browser context, the availability of SharedArrayBuffer
requires cross-origin isolation, which is handled in kana by a service worker. IIRC recent Node versions support SharedArrayBuffer
by default.