#event-listener #listener #set-max-listeners

bin+lib rust_event_listener

NodeJS like Event Listener library for rust!

1 unstable release

0.1.0 Mar 10, 2022

#19 in #event-listener

GPL-2.0 license

12KB
164 lines

Rust Event Listener

Crates.io Version Documentation

NodeJS like Event Listener library for rust!

    //Create new emitter
    let mut emitter = EventListener::new();

    //Set max listeners
    emitter.set_max_listeners(10);

    //Add listener
    emitter.on("test", Box::new(|name, d| {
        println!("Emited: {} {:#?}", name, d);
    }));

    emitter.emit("test", 1);

Examples

You can find examples here

No runtime deps