mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-06 13:18:27 +02:00
EventBus (#590)
* Replace BxEvent.TITLE_INFO_READY with Event Bus * Migrate more events * Migrate stream events to event bus * Migrate preset events * Migrate more * Fix dispatching "input" event twice in Number Stepper
This commit is contained in:
@@ -10,10 +10,10 @@ import { hasGamepad } from "./gamepad";
|
||||
import { MkbMappingPresetsTable } from "./local-db/mkb-mapping-presets-table";
|
||||
import type { GamepadKey } from "@/enums/gamepad";
|
||||
import { MkbPresetKey, MouseConstant } from "@/enums/mkb";
|
||||
import { BxEvent } from "./bx-event";
|
||||
import { KeyboardShortcutDefaultId, KeyboardShortcutsTable } from "./local-db/keyboard-shortcuts-table";
|
||||
import { ShortcutAction } from "@/enums/shortcut-actions";
|
||||
import { KeyHelper } from "@/modules/mkb/key-helper";
|
||||
import { EventBus } from "./event-bus";
|
||||
|
||||
|
||||
export type StreamSettingsData = {
|
||||
@@ -110,7 +110,7 @@ export class StreamSettings {
|
||||
}
|
||||
|
||||
StreamSettings.settings.deviceVibrationIntensity = intensity;
|
||||
BxEvent.dispatch(window, BxEvent.DEVICE_VIBRATION_CHANGED);
|
||||
EventBus.Script.emit('deviceVibrationUpdated', {});
|
||||
}
|
||||
|
||||
static async refreshMkbSettings() {
|
||||
@@ -148,7 +148,7 @@ export class StreamSettings {
|
||||
settings.mkbPreset = converted;
|
||||
|
||||
setPref(PrefKey.MKB_P1_MAPPING_PRESET_ID, orgPreset.id);
|
||||
BxEvent.dispatch(window, BxEvent.MKB_UPDATED);
|
||||
EventBus.Script.emit('mkbSettingUpdated', {});
|
||||
}
|
||||
|
||||
static async refreshKeyboardShortcuts() {
|
||||
@@ -159,7 +159,7 @@ export class StreamSettings {
|
||||
settings.keyboardShortcuts = null;
|
||||
|
||||
setPref(PrefKey.KEYBOARD_SHORTCUTS_IN_GAME_PRESET_ID, presetId);
|
||||
BxEvent.dispatch(window, BxEvent.KEYBOARD_SHORTCUTS_UPDATED);
|
||||
EventBus.Script.emit('keyboardShortcutsUpdated', {});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ export class StreamSettings {
|
||||
settings.keyboardShortcuts = converted;
|
||||
|
||||
setPref(PrefKey.KEYBOARD_SHORTCUTS_IN_GAME_PRESET_ID, orgPreset.id);
|
||||
BxEvent.dispatch(window, BxEvent.KEYBOARD_SHORTCUTS_UPDATED);
|
||||
EventBus.Script.emit('keyboardShortcutsUpdated', {});
|
||||
}
|
||||
|
||||
static async refreshAllSettings() {
|
||||
|
Reference in New Issue
Block a user