UNPKG

blive-message-listener

Version:
27 lines (25 loc) 672 B
import { listenAll } from "./chunk-Y2XSM4PM.js"; // src/browser.ts import { KeepLiveWS } from "tiny-bilibili-ws/browser"; var startListen = (roomId, handler, options) => { const live = new KeepLiveWS(roomId, options?.ws); listenAll(live, roomId, handler); const listenerInstance = { live, roomId: live.roomId, online: live.online, closed: live.closed, close: () => live.close(), getAttention: () => live.getOnline(), getOnline: () => live.getOnline(), reconnect: () => live.reconnect(), heartbeat: () => live.heartbeat(), send: (op, data) => live.send(op, data) }; return listenerInstance; }; export { startListen };