emscripten-core / emscripten-core/emscripten

Support custom import namespace for functions implemented in JavaScript

Open
#20,035 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Can I specify a custom import namespace for JavaScript function?

```js
mergeInto(LibraryManager.library, {
napi_create_int32: function (env, value, result) {
// ...
},
napi_create_int32__sig: 'ipip',
napi_create_int32__namespace: 'napi' // <-- instead of 'env'
})
```

compile result

```js
WebAssembly.instantiate(/* ... */, {
napi: { napi_create_int32 }
})
```

Refs: https://github.com/nodejs/node/pull/49037

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.