mirror of
https://github.com/SrIzan10/vdo.ninja.git
synced 2026-05-01 11:05:24 +00:00
20 lines
464 B
JavaScript
20 lines
464 B
JavaScript
import { EventBus } from './event-bus.js';
|
|
|
|
export const LEVEL_EVENT = 'level';
|
|
export const CLIP_EVENT = 'clip';
|
|
export const SILENCE_EVENT = 'silence';
|
|
|
|
class LevelBus extends EventBus {
|
|
publishLevel(payload) {
|
|
this.emit(LEVEL_EVENT, payload);
|
|
if (payload?.clipped) {
|
|
this.emit(CLIP_EVENT, payload);
|
|
}
|
|
if (payload?.silent) {
|
|
this.emit(SILENCE_EVENT, payload);
|
|
}
|
|
}
|
|
}
|
|
|
|
export const levelBus = new LevelBus();
|