github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/webaccessibleresourcesmv2/bindings/ffi_bindings.ts (about)

     1  import { importModule, Application, heap, Pointer } from "@ffi";
     2  
     3  importModule("plat/js/webext/webaccessibleresourcesmv2", (A: Application) => {
     4    const WEBEXT = typeof globalThis.browser === "undefined" ? globalThis.chrome : globalThis.browser;
     5  
     6    return {
     7      "store_ManifestKeys": (ptr: Pointer, ref: heap.Ref<any>) => {
     8        const x = A.H.get<any>(ref);
     9  
    10        if (typeof x === "undefined") {
    11          A.store.Bool(ptr + 4, false);
    12          A.store.Ref(ptr + 0, undefined);
    13        } else {
    14          A.store.Bool(ptr + 4, true);
    15          A.store.Ref(ptr + 0, x["web_accessible_resources"]);
    16        }
    17      },
    18      "load_ManifestKeys": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => {
    19        const x = create === A.H.TRUE ? {} : A.H.get<any>(ref);
    20  
    21        x["web_accessible_resources"] = A.load.Ref(ptr + 0, undefined);
    22        return create === A.H.TRUE ? A.H.push(x) : ref;
    23      },
    24    };
    25  });