Skip to content

napi wasm bindings #375

@devsnek

Description

@devsnek

@josephg brought up a cool idea in #374 to expose napi to wasm. This would allow shipping abi stable binaries that are also platform independent(!!)

my initial exploration shows that at most our in-core changes are basically adding __attribute__((__import_module__("napi"))) to NAPI_EXTERN if __wasm32 is defined.

We could ship the bindings themselves as a separate module or include them in core, but they aren't actually too complex:

    napi_create_array: (envPtr, resultPtr) => {
      this.refreshMemory();
      this.writeValue(resultPtr, this.store([]));
      return NAPI_OK;
    },

At that point, you can do this:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions