Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(import) Add Imports.Namespace to set the current import namespace #29

Merged
merged 2 commits into from
Jun 4, 2019

Commits on Jun 4, 2019

  1. feat(import) Add Imports.Namespace to set the current import namesp…

    …ace.
    
    Basically, this patch allows to define imported function in any
    namepace. The `Imports.Namespace` sets the current namespce for the
    next defined imported functions:
    
    ```go
    wasm.NewImports().Namespace("ns").Append("f", f, C.f)
    ```
    
    By default, the namespace is `env`, so both statements are identical:
    
    ```go
    wasm.NewImports().Namespace("env").Append(…)
    wasm.NewImports().Append(…)
    ```
    
    To register imported functions in different namespaces, one writes:
    
    ```go
    wasm.NewImports().Namespace("ns1").Append(…).Append(…).Namespace("ns2").Append(…).Append(…)…
    ```
    Hywan committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    516f774 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0f7e593 View commit details
    Browse the repository at this point in the history