Sha256: 47a8d47e0cd745cca697f6d944e145f02695ca422255c3d6e1c9b2b719994b1b

Contents?: true

Size: 824 Bytes

Versions: 30

Compression:

Stored size: 824 Bytes

Contents

# Vendor-prefixed APIs

On the web new APIs often have vendor prefixes while they're in an experimental
state. For example the `AudioContext` API is known as `webkitAudioContext` in
Safari at the time of this writing. The `vendor_prefix` attribute indicates
these alternative names, which are used if the normal name isn't defined.

For example to use `AudioContext` you might do:

```rust
#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen(vendor_prefix = webkit)]
    type AudioContext;

    // methods on `AudioContext` ...
}
```

Whenever `AudioContext` is used it'll use `AudioContext` if the global namespace
defines it or alternatively it'll fall back to `webkitAudioContext`.

Note that `vendor_prefix` cannot be used with `module = "..."` or
`js_namespace = ...`, so it's basically limited to web-platform APIs today.

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
wasmtime-23.0.2 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-22.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-21.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-20.0.2 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-20.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-18.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-17.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-17.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-16.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-15.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-15.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.89/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-14.0.4 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-14.0.3 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-14.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-14.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-13.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-12.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-12.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-11.0.0 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-js-imports/vendor_prefix.md
wasmtime-10.0.1 ./ext/cargo-vendor/wasm-bindgen-0.2.87/guide/src/reference/attributes/on-js-imports/vendor_prefix.md