Rename EventBus to BxEventBus

This commit is contained in:
redphx
2024-12-08 20:09:12 +07:00
parent de7bf3edc7
commit 741bc9a4e5
21 changed files with 130 additions and 125 deletions

View File

@@ -1,7 +1,7 @@
import { AppInterface, STATES } from "@utils/global";
import { BxEvent } from "@utils/bx-event";
import { StreamSettings } from "@/utils/stream-settings";
import { EventBus } from "@/utils/event-bus";
import { BxEventBus } from "@/utils/bx-event-bus";
const VIBRATION_DATA_MAP = {
gamepadIndex: 8,
@@ -48,7 +48,7 @@ export class DeviceVibrationManager {
}
});
EventBus.Script.on('deviceVibrationUpdated', () => this.setupDataChannel());
BxEventBus.Script.on('deviceVibrationUpdated', () => this.setupDataChannel());
}
private setupDataChannel() {

View File

@@ -18,7 +18,7 @@ import { MkbPopup } from "./mkb-popup";
import type { MkbConvertedPresetData } from "@/types/presets";
import { StreamSettings } from "@/utils/stream-settings";
import { ShortcutAction } from "@/enums/shortcut-actions";
import { EventBus } from "@/utils/event-bus";
import { BxEventBus } from "@/utils/bx-event-bus";
const PointerToMouseButton = {
1: 0,
@@ -640,7 +640,7 @@ export class EmulatedMkbHandler extends MkbHandler {
static setupEvents() {
if (isFullVersion()) {
EventBus.Stream.on('statePlaying', () => {
BxEventBus.Stream.on('statePlaying', () => {
if (STATES.currentStream.titleInfo?.details.hasMkbSupport) {
// Enable native MKB in Android app
NativeMkbHandler.getInstance()?.init();
@@ -650,7 +650,7 @@ export class EmulatedMkbHandler extends MkbHandler {
});
if (EmulatedMkbHandler.isAllowed()) {
EventBus.Script.on('mkbSettingUpdated', () => {
BxEventBus.Script.on('mkbSettingUpdated', () => {
EmulatedMkbHandler.getInstance()?.refreshPresetData();
});
}

View File

@@ -6,7 +6,7 @@ import type { MkbHandler } from "./base-mkb-handler";
import { NativeMkbHandler } from "./native-mkb-handler";
import { StreamSettings } from "@/utils/stream-settings";
import { KeyHelper } from "./key-helper";
import { EventBus } from "@/utils/event-bus";
import { BxEventBus } from "@/utils/bx-event-bus";
type MkbPopupType = 'virtual' | 'native';
@@ -24,7 +24,7 @@ export class MkbPopup {
constructor() {
this.render();
EventBus.Script.on('keyboardShortcutsUpdated', () => {
BxEventBus.Script.on('keyboardShortcutsUpdated', () => {
const $newButton = this.createActivateButton();
this.$btnActivate.replaceWith($newButton);
this.$btnActivate = $newButton;

View File

@@ -6,7 +6,7 @@ import { getPref } from "@/utils/settings-storages/global-settings-storage"
import { StreamStatsCollector, type StreamStatGrade } from "@/utils/stream-stats-collector"
import { BxLogger } from "@/utils/bx-logger"
import { StreamStat } from "@/enums/pref-values"
import { EventBus } from "@/utils/event-bus"
import { BxEventBus } from "@/utils/bx-event-bus"
export class StreamStats {
@@ -230,7 +230,7 @@ export class StreamStats {
}
static setupEvents() {
EventBus.Stream.on('statePlaying', () => {
BxEventBus.Stream.on('statePlaying', () => {
const PREF_STATS_QUICK_GLANCE = getPref(PrefKey.STATS_QUICK_GLANCE_ENABLED);
const PREF_STATS_SHOW_WHEN_PLAYING = getPref(PrefKey.STATS_SHOW_WHEN_PLAYING);

View File

@@ -5,7 +5,7 @@ import { t } from "@utils/translation.ts";
import { StreamBadges } from "./stream-badges.ts";
import { StreamStats } from "./stream-stats.ts";
import { SettingsDialog } from "../ui/dialog/settings-dialog.ts";
import { EventBus } from "@/utils/event-bus.ts";
import { BxEventBus } from "@/utils/bx-event-bus.ts";
export class StreamUiHandler {
@@ -243,7 +243,7 @@ export class StreamUiHandler {
// Error Page: .PureErrorPage.ErrorScreen
if (className.includes('PureErrorPage')) {
EventBus.Stream.emit('stateError', {});
BxEventBus.Stream.emit('stateError', {});
return;
}

View File

@@ -30,7 +30,7 @@ import { SuggestionsSetting } from "./settings/suggestions";
import { StreamSettings } from "@/utils/stream-settings";
import { MkbExtraSettings } from "./settings/mkb-extra";
import { BxExposed } from "@/utils/bx-exposed";
import { EventBus } from "@/utils/event-bus";
import { BxEventBus } from "@/utils/bx-event-bus";
type SettingTabSectionItem = Partial<{
@@ -436,7 +436,7 @@ export class SettingsDialog extends NavigationDialog {
onCreated: (setting: SettingTabSectionItem, $elm: HTMLElement) => {
const $range = $elm.querySelector<HTMLInputElement>('input[type=range')!;
EventBus.Script.on('settingChanged', payload => {
BxEventBus.Script.on('settingChanged', payload => {
const { storageKey, settingKey, settingValue } = payload;
if (storageKey === StorageKey.GLOBAL && settingKey === PrefKey.AUDIO_VOLUME) {
$range.value = settingValue;