Home Reference Source
import Mitt from 'rtc-engine/js/util/Mitt.js'
public class | source

Mitt

이벤트 이미터 기능을 제공하는 클래스.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

all: Map<string|symbol, EventHandler<any>[]>

이벤트별 이벤트 핸들러들

Method Summary

Public Methods
public

addEventListener(type: string | symbol, handler: EventHandler<any>): *

on() 메소드의 alias

public

emit(type: string | symbol, evt: Any)

Invoke all handlers for the given type.

public

off(type: string | symbol, handler: EventHandler<any>})

Remove an event handler for the given type.

public

on(type: string | symbol, handler: EventHandler<any>): *

Register an event handler for the given type.

public

once(type: *, handler: *)

public

removeEventListener(type: string | symbol, handler: EventHandler<any>): *

off() 메소드의 alias

Public Constructors

public constructor() source

Public Members

public all: Map<string|symbol, EventHandler<any>[]> source

이벤트별 이벤트 핸들러들

Public Methods

public addEventListener(type: string | symbol, handler: EventHandler<any>): * source

on() 메소드의 alias

Params:

NameTypeAttributeDescription
type string | symbol

Type of event to listen for, or '*' for all events

handler EventHandler<any>

Function to call in response to given event

Return:

*

public emit(type: string | symbol, evt: Any) source

Invoke all handlers for the given type. If present, '*' handlers are invoked after type-matched handlers.

Note: Manually firing '*' handlers is not supported.

Params:

NameTypeAttributeDescription
type string | symbol

The event type to invoke

evt Any
  • optional

Any value (object is recommended and powerful), passed to each handler

public off(type: string | symbol, handler: EventHandler<any>}) source

Remove an event handler for the given type. If handler is omitted, all handlers of the given type are removed.

Params:

NameTypeAttributeDescription
type string | symbol

Type of event to unregister handler from, or '*'

handler EventHandler<any>}
  • optional

Handler function to remove

public on(type: string | symbol, handler: EventHandler<any>): * source

Register an event handler for the given type.

Params:

NameTypeAttributeDescription
type string | symbol

Type of event to listen for, or '*' for all events

handler EventHandler<any>

Function to call in response to given event

Return:

*

public once(type: *, handler: *) source

Params:

NameTypeAttributeDescription
type *
handler *

public removeEventListener(type: string | symbol, handler: EventHandler<any>): * source

off() 메소드의 alias

Params:

NameTypeAttributeDescription
type string | symbol

Type of event to unregister handler from, or '*'

handler EventHandler<any>
  • optional

Handler function to remove

Return:

*