Skip to content

YELrhilassi/EventEmitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmittEvent

A Basic eventemitter writen in Ecmascript 6 modeled on Node.js EventEmitter. It sure wouldn't work in old browsers, but it's good enough to do the job.

Documentation

eventsNames()

Return an array of all event's names/types

  • Returns: (Array|null)

eventListeners(evnt)

return all listeners of a given event if it exist, else null.

  • Parameters: evntString — The event name.
  • Returns: (Array|null)

addListener(evnt, fn, once)

Add new event if it doesn't exist, else add it to existing one

  • Parameters:
    • evntString — The event name.
    • fnFunction — The Callback / Listener function
    • onceboolean — If Callback / Listener should run once

removeListener(evnt, fn)

Remove listeners of a given event. All listenres that match the Callback fn will be removed

  • Parameters:
    • evntString — The event name.
    • fnFunction — Function to identify the listener with.

clearEvent(evnt)

Removes the event and all its listeners.

  • Parameters: evntstring — The event name.

on(evnt, fn)

Add a listener

  • Parameters:
    • evntstring — The event name.
    • fnfn — The Callbacl function

emit(evnt)

Calls all listenres of a given event.

  • Parameters: evntString — The event name.
  • Returns: Booleantrue if the event had listeners, else false.

About

Basic eventemitter writen in Ecmascript 6. It sure wouldn't work in old browsers, but it's good enough to do the job.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published