Skip to content

emit-rs/emit_web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

emit_web

web

Current docs

Use emit in WebAssembly applications targeting NodeJS and the browser.

emit itself and some emitters, like emit_otlp support WebAssembly directly. This library includes support for emitting events to the Console API. It also has alternative clocks and randomness using different web features. These aren't required for configuration, but can be used to more directly control the JavaScript APIs emit makes use of.

emit_web also supports the wasm32v1-none target.

Getting started

First, add emit and emit_web to your Cargo.toml:

[dependencies.emit]
version = "1"

[dependencies.emit_web]
version = "0.3.0"

Next, configure emit to use web APIs in its runtime:

use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn setup() {
    let _ = emit::setup()
        .emit_to(emit_web::console())
        .try_init();
}

The name of this setup function doesn't matter, you'll just need to call it somewhere early in your application.

Output

emit_web will output events to the Console API, where they'll appear in browser dev tools.

emit events written to the browser console

About

Run emit on the web

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT

Stars

Watchers

Forks

Packages

 
 
 

Contributors