mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-19 01:03:58 +00:00
16 lines
505 B
TypeScript
16 lines
505 B
TypeScript
import type { ClientWebSocketEvents } from '@revanced/bot-api'
|
|
import { api } from '../../context'
|
|
|
|
const { client } = api
|
|
|
|
export function on<Event extends EventName>(event: Event, listener: ListenerOf<Event>) {
|
|
client.on(event, listener)
|
|
}
|
|
|
|
export function once<Event extends EventName>(event: Event, listener: ListenerOf<Event>) {
|
|
client.once(event, listener)
|
|
}
|
|
|
|
export type EventName = keyof ClientWebSocketEvents
|
|
export type ListenerOf<Event extends EventName> = ClientWebSocketEvents[Event]
|