mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-09 14:47:43 +02:00
Migrate more events to EventBus
This commit is contained in:
@@ -4,7 +4,7 @@ import { Toast } from "@utils/toast";
|
||||
import { ceilToNearest, floorToNearest } from "@/utils/utils";
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { getPref, setPref } from "@/utils/settings-storages/global-settings-storage";
|
||||
import { BxEvent } from "@/utils/bx-event";
|
||||
import { BxEventBus } from "@/utils/bx-event-bus";
|
||||
|
||||
export enum SpeakerState {
|
||||
ENABLED,
|
||||
@@ -71,8 +71,8 @@ export class SoundShortcut {
|
||||
SoundShortcut.setGainNodeVolume(targetValue);
|
||||
Toast.show(`${t('stream')} ❯ ${t('volume')}`, status, { instant: true });
|
||||
|
||||
BxEvent.dispatch(window, BxEvent.SPEAKER_STATE_CHANGED, {
|
||||
speakerState: targetValue === 0 ? SpeakerState.MUTED : SpeakerState.ENABLED,
|
||||
BxEventBus.Stream.emit('speaker.state.changed', {
|
||||
state: targetValue === 0 ? SpeakerState.MUTED : SpeakerState.ENABLED,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -84,9 +84,9 @@ export class SoundShortcut {
|
||||
const status = $media.muted ? t('muted') : t('unmuted');
|
||||
Toast.show(`${t('stream')} ❯ ${t('volume')}`, status, { instant: true });
|
||||
|
||||
BxEvent.dispatch(window, BxEvent.SPEAKER_STATE_CHANGED, {
|
||||
speakerState: $media.muted ? SpeakerState.MUTED : SpeakerState.ENABLED,
|
||||
})
|
||||
BxEventBus.Stream.emit('speaker.state.changed', {
|
||||
state: $media.muted ? SpeakerState.MUTED : SpeakerState.ENABLED,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user