Interface NextcloudEvents

Nextcloud EventBus events This can be extended to allow typing of events like:

Example

// event-bus.d.ts
// Extend the Nextcloud events interface for your custom event
declare module '@nextcloud/event-bus' {
export interface NextcloudEvents {
// mapping of 'event name' => 'event type'
'my-event': { foo: number, bar: boolean }
}
}
export {}

// your-code.ts
import { subscribe } from '@nextcloud/event-bus'
// Here the type of 'params' is infered automatically
subscribe('my-event', (params) => { console.debug(params.foo, params.bar) })
interface NextcloudEvents {
    [eventName: string | symbol]: Event;
}

Indexable

[eventName: string | symbol]: Event