jooooock / wasm-demo

Home Page:https://jooooock.github.io/wasm-demo/src/index

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wasm-demo

项目起源于这篇文章: https://juejin.cn/post/7345423755948785718

修改hello_wasm.js中的addHeapObject函数,替换Location对象:

function addHeapObject(obj) {
+    // 替换掉location
+    if (obj instanceof Location) {
+        obj = {
+            "origin": "https://leemotive.github.io",
+        }
+    }

    if (heap_next === heap.length) heap.push(heap.length + 1);
    const idx = heap_next;
    heap_next = heap[idx];

    heap[idx] = obj;
    return idx;
}

About

https://jooooock.github.io/wasm-demo/src/index


Languages

Language:JavaScript 91.3%Language:HTML 8.7%