listen
이 콘텐츠는 아직 번역되지 않았습니다.
Module @netwiv/api/event · Kind Function
import { listen } from '@netwiv/api/event';Listen to an emitted event to any {@link EventTargettarget}.
Signature
Section titled “Signature”function listen<T>(event: EventName, handler: EventCallback<T>, options?: Options | undefined): Promise<UnlistenFn>Example
Section titled “Example”import { listen } from '@netwiv/api/event';const unlisten = await listen<string>('error', (event) => { console.log(`Got error, payload: ${event.payload}`);});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();Upstream since 1.0.0
Descriptions come from the pinned @tauri-apps/api@2.11.1 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.