콘텐츠로 이동

EventEmitter

이 콘텐츠는 아직 번역되지 않았습니다.

Module @netwiv/api/plugins/shell · Kind Class

import { EventEmitter } from '@netwiv/api/plugins/shell';
new EventEmitter<E extends Record<string, any>>()
addListener<N>(eventName: N, listener: (arg: E[N]): void) => EventEmitter<E>

Alias for emitter.on(eventName, listener).

listenerCount<N extends keyof E>(eventName: N): number

Returns the number of listeners listening to the event named eventName.

off<N>(eventName: N, listener: (arg: E[N]): void) => EventEmitter<E>

Removes the all specified listener from the listener array for the event eventName Returns a reference to the EventEmitter, so that calls can be chained.

on<N>(eventName: N, listener: (arg: E[N]): void) => EventEmitter<E>

Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

Returns a reference to the EventEmitter, so that calls can be chained.

once<N>(eventName: N, listener: (arg: E[N]): void) => EventEmitter<E>

Adds a one-timelistener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

Returns a reference to the EventEmitter, so that calls can be chained.

prependListener<N>(eventName: N, listener: (arg: E[N]): void) => EventEmitter<E>

Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventNameand listener will result in the listener being added, and called, multiple times.

Returns a reference to the EventEmitter, so that calls can be chained.

prependOnceListener<N>(eventName: N, listener: (arg: E[N]): void) => EventEmitter<E>

Adds a one-timelistener function for the event named eventName to the_beginning_ of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

Returns a reference to the EventEmitter, so that calls can be chained.

removeAllListeners<N>(event?: N | undefined): EventEmitter<E>

Removes all listeners, or those of the specified eventName.

Returns a reference to the EventEmitter, so that calls can be chained.

removeListener<N>(eventName: N, listener: (arg: E[N]): void) => EventEmitter<E>

Alias for emitter.off(eventName, listener).

Upstream since 2.0.0


Descriptions come from the pinned @tauri-apps/plugin-shell@2.3.6 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.