mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-11-19 23:34:02 +01:00
Rename EventBus events
This commit is contained in:
@@ -2,6 +2,7 @@ import { GamepadKey } from "@/enums/gamepad";
|
||||
import { PrefKey } from "@/enums/pref-keys";
|
||||
import { VIRTUAL_GAMEPAD_ID } from "@/modules/mkb/mkb-handler";
|
||||
import { BxEvent } from "@/utils/bx-event";
|
||||
import { BxEventBus } from "@/utils/bx-event-bus";
|
||||
import { BxLogger } from "@/utils/bx-logger";
|
||||
import { CE, isElementVisible } from "@/utils/html";
|
||||
import { setNearby } from "@/utils/navigation-utils";
|
||||
@@ -439,7 +440,7 @@ export class NavigationDialogManager {
|
||||
show(dialog: NavigationDialog, configs={}, clearStack=false) {
|
||||
this.clearGamepadHoldingInterval();
|
||||
|
||||
BxEvent.dispatch(window, BxEvent.XCLOUD_DIALOG_SHOWN);
|
||||
BxEventBus.Script.emit('dialog.shown', {});
|
||||
|
||||
// Stop xCloud's navigation polling
|
||||
window.BX_EXPOSED.disableGamepadPolling = true;
|
||||
@@ -479,7 +480,7 @@ export class NavigationDialogManager {
|
||||
// Unlock scroll bar
|
||||
document.body.classList.remove('bx-no-scroll');
|
||||
|
||||
BxEvent.dispatch(window, BxEvent.XCLOUD_DIALOG_DISMISSED);
|
||||
BxEventBus.Script.emit('dialog.dismissed', {});
|
||||
|
||||
// Hide content
|
||||
this.$overlay.classList.add('bx-gone');
|
||||
|
||||
@@ -436,7 +436,7 @@ export class SettingsDialog extends NavigationDialog {
|
||||
onCreated: (setting: SettingTabSectionItem, $elm: HTMLElement) => {
|
||||
const $range = $elm.querySelector<HTMLInputElement>('input[type=range')!;
|
||||
|
||||
BxEventBus.Script.on('settingChanged', payload => {
|
||||
BxEventBus.Script.on('setting.changed', payload => {
|
||||
const { storageKey, settingKey, settingValue } = payload;
|
||||
if (storageKey === StorageKey.GLOBAL && settingKey === PrefKey.AUDIO_VOLUME) {
|
||||
$range.value = settingValue;
|
||||
|
||||
@@ -7,6 +7,7 @@ import { t } from "@/utils/translation";
|
||||
import { SettingsDialog } from "./dialog/settings-dialog";
|
||||
import { TrueAchievements } from "@/utils/true-achievements";
|
||||
import { BxIcon } from "@/utils/bx-icon";
|
||||
import { BxEventBus } from "@/utils/bx-event-bus";
|
||||
|
||||
export enum GuideMenuTab {
|
||||
HOME = 'home',
|
||||
@@ -40,9 +41,9 @@ export class GuideMenu {
|
||||
style: ButtonStyle.FULL_WIDTH | ButtonStyle.FOCUSABLE | ButtonStyle.PRIMARY,
|
||||
onClick: () => {
|
||||
// Wait until the Guide dialog is closed
|
||||
window.addEventListener(BxEvent.XCLOUD_DIALOG_DISMISSED, e => {
|
||||
BxEventBus.Script.once('xcloudDialogDismissed', () => {
|
||||
setTimeout(() => SettingsDialog.getInstance().show(), 50);
|
||||
}, { once: true });
|
||||
});
|
||||
|
||||
// Close all xCloud's dialogs
|
||||
this.closeGuideMenu();
|
||||
|
||||
Reference in New Issue
Block a user