1.0.0 • Published 1 year ago

emitevent v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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.