The gloo_events::EventListener Struct used to manage DOM event listeners. It is higher level and is easier to use than using web-sys and Closures to handle DOM events. EventListener is a RAII type, which when dropped, will automatically deregister the event listener and clean up the colsure's memory.
Cargo.toml
[package]
name = "web_sys_document"
version = "0.1.0"
authors = ["www.webassemblyman.com"]
edition = "2019"
[lib]
crate-type = ["cdylib"]
[dependencies]
wasm-bindgen = "0.2.50"
gloo = "0.2.0"
[dependencies.web-sys]
version = "0.3.4"
features = [
'Document',
'Element',
'HtmlElement',
'Node',
'Window',
'console',
]