1.2.1 • Published 4 years ago

@raydeck/event-manager v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@raydeck/event-manager - v1.2.1

Index

Variables

Functions

Variables

Let error

error: function

Defined in index.ts:65

Type declaration:

▸ (e: Error): void | undefined

Parameters:

NameType
eError

Const listeners

listeners: object

Defined in index.ts:1

Type declaration:

  • [ key: string]: function[]

Functions

addListener

addListener(key: string, f: function): function

Defined in index.ts:18

Add a listener for event key

Parameters:

key: string

Identifier for event to fire

f: function

Function to run on trigger

▸ (options: object): Promise‹void›

Parameters:

NameType
optionsobject

Returns: function

function to remove the listener

▸ (): void


clear

clear(key: string): void

Defined in index.ts:50

Remove all event listeners for identifier key

Parameters:

NameTypeDescription
keystringidentifier to clear

Returns: void


getListeners

getListeners(key: string): function[]

Defined in index.ts:7

get all listener functions for identifier key

Parameters:

NameType
keystring

Returns: function[]


remove

remove(key: string, f: function): void

Defined in index.ts:59

Remove one event listener Note that using the return value of addTrigger is easier API

Parameters:

key: string

Identifier for event

f: function

Pointer to function to remove

▸ (options: object): Promise‹void›

Parameters:

NameType
optionsobject

Returns: void


setError

setError(newHandler: function): void

Defined in index.ts:70

Set the error handler for trigger (default is just to permit the throw)

Parameters:

newHandler: function

▸ (e: Error): void

Parameters:

NameType
eError

Returns: void


trigger

trigger(key: string, options: object): Promise‹void›

Defined in index.ts:33

Trigger the event key. Note that if an trigger handler throws, it will stop the show.

Parameters:

NameTypeDescription
keystringidentifier for event to trigger
optionsobjectmap of options to pass to the listener functions

Returns: Promise‹void›

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago