It is a small library for the management of events
Emmit
It is a small library for the management of events, this is based on the library mitt, but it is built according to a class.
yarn add -D emmit
npm install -D emmit
Instance
Emmitt operates like any event manager
-- -------------------- ---- ------- ------ ----- ---- -------- --- ------ - --- ------ --- --------------- - ------------------------------ -- -------- ----- ---- -- --- -------------- - --------------------------- -- -------- --- ----- -- -----------------------
as you will notice every time you store an event emmit returns an unsubscribe for the stored event.
Subscribers in the instance
You can define an object that already stores events from the instance of emmit
let events = new Emmit({ jump : [()=>{ // listener event jump }] })
HomePage
https://github.com/UpperCod/emmit#readme
Repository
git+https://github.com/UpperCod/emmit.git
来源:JavaScript中文网 ,转载请注明来源 https://www.javascriptcn.com/post/600572cd81e8991b448e9003