Home Manual Reference Source Test Repository
import EventHandler from 'reptar/lib/plugin/event-handler.js'
public class | source

EventHandler

Method Summary

Public Methods
public

addEventHandler(eventName: *, handler: *)

public

async processEventHandlers(eventName: string, args: *): Promise

Processes our queue of event handlers for a given eventName.

Public Methods

public addEventHandler(eventName: *, handler: *) source

Params:

NameTypeAttributeDescription
eventName *
handler *

public async processEventHandlers(eventName: string, args: *): Promise source

Processes our queue of event handlers for a given eventName. If a handler returns 'undefined' then we give the next handler the original arguments so that every handler gets to touch the data.

Params:

NameTypeAttributeDescription
eventName string

Event key where the handlers live.

args *

Arguments.

Return:

Promise

Promise that resolves to the ending value of the promise chain.