Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/chart/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ module.exports = (client) => class ChartSession {
* @param {...{}} data Packet data
*/
#handleEvent(ev, ...data) {
this.#callbacks[ev].forEach((e) => e(...data));
this.#callbacks[ev]?.forEach((e) => e(...data));
this.#callbacks.event.forEach((e) => e(ev, ...data));
}

Expand Down Expand Up @@ -531,6 +531,20 @@ module.exports = (client) => class ChartSession {
onError(cb) {
this.#callbacks.error.push(cb);
}

/**
* When the replay session cursor has moved
* @param {string} event_name
* @param {(index: number) => void} cb
* @event
*/
on(event_name,cb) {
if (!this.#callbacks[event_name]) {
this.#callbacks[event_name] = [];
}
this.#callbacks[event_name].push(cb);
}


/** @type {ChartSessionBridge} */
#chartSession = {
Expand Down