The repo is great, but there some code inside I don't understand.
There is a global variable -- Module. However, the glue code is like a black box, how do i know what .wasm exposed. Yes, I could get some exposed fn using WebAssembly.Module.exports/imports, but in this glue code, I should need to do this by Module.ccall.
so, how can get information from glue code? like:
wam['grayScale'] = function (pixelData) {
const len = pixelData.length
const mem = _malloc(len); // get the memory of wasm
HEAPU8.set(pixelData, mem); // transfer the pixelData
_grayScale(mem, len); // trigger the grayScale fun
const filtered = HEAPU8.subarray(mem, mem + len); // get the resulted data
_free(mem); // release memory
return filtered; // return buffer
};
where could I find some explanation of the above code, like HEAPU8, or _free.
I feel a little confused.
The repo is great, but there some code inside I don't understand.
There is a global variable --
Module. However, the glue code is like a black box, how do i know what .wasm exposed. Yes, I could get some exposed fn usingWebAssembly.Module.exports/imports, but in this glue code, I should need to do this byModule.ccall.so, how can get information from glue code? like:
where could I find some explanation of the above code, like
HEAPU8, or_free.I feel a little confused.