Verwendung

Notify JavaScript when a native device connection changes.

Dieser Typ wird verwendet von event

tsx
// Notify JavaScript when a native device connection changes.
import { defineModule, event } from 'kuito';

export default defineModule('Accessory', {
  connected: event<{ name: string }>(),
  ios: { class: 'AccessoryModule' },
  android: { class: 'com.example.modules.accessory.AccessoryModule' },
});

// Implement startConnected/stopConnected on each platform. The consumer uses
// Accessory.connected.addListener(({ name }) => console.log(name)) and calls
// remove() on the returned subscription when observation is no longer needed.

Typdeklaration

ts
export interface ModuleEvent<Payload> {
  /** The platform sends the event from the first listener until the last is removed. */
  addListener(listener: (payload: Payload) => void): EventSubscription;
}

Mitglieder 1

NameTypErforderlichBeschreibung
addListener(listener: (payload: Payload) => void) => EventSubscriptionJaThe platform sends the event from the first listener until the last is removed.
addListener — Methodensignaturen

Signaturen

ts
(listener: (payload: Payload) => void): EventSubscription

Parameter

NameTypErforderlichBeschreibung
listener(payload: Payload) => voidJa—

Rückgabe

EventSubscription

Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.