mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-08 06:08:27 +02:00
Move bx-events/exposed/flags files to utils/
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
import { AppInterface } from "../utils/global";
|
||||
|
||||
export enum BxEvent {
|
||||
JUMP_BACK_IN_READY = 'bx-jump-back-in-ready',
|
||||
POPSTATE = 'bx-popstate',
|
||||
|
||||
STREAM_LOADING = 'bx-stream-loading',
|
||||
STREAM_STARTING = 'bx-stream-starting',
|
||||
STREAM_STARTED = 'bx-stream-started',
|
||||
STREAM_PLAYING = 'bx-stream-playing',
|
||||
STREAM_STOPPED = 'bx-stream-stopped',
|
||||
STREAM_ERROR_PAGE = 'bx-stream-error-page',
|
||||
|
||||
STREAM_MENU_SHOWN = 'bx-stream-menu-shown',
|
||||
STREAM_MENU_HIDDEN = 'bx-stream-menu-hidden',
|
||||
|
||||
STREAM_WEBRTC_CONNECTED = 'bx-stream-webrtc-connected',
|
||||
STREAM_WEBRTC_DISCONNECTED = 'bx-stream-webrtc-disconnected',
|
||||
|
||||
CUSTOM_TOUCH_LAYOUTS_LOADED = 'bx-custom-touch-layouts-loaded',
|
||||
|
||||
REMOTE_PLAY_READY = 'bx-remote-play-ready',
|
||||
REMOTE_PLAY_FAILED = 'bx-remote-play-failed',
|
||||
|
||||
XCLOUD_SERVERS_READY = 'bx-servers-ready',
|
||||
|
||||
DATA_CHANNEL_CREATED = 'bx-data-channel-created',
|
||||
}
|
||||
|
||||
export namespace BxEvent {
|
||||
export function dispatch(target: HTMLElement | Window, eventName: string, data?: any) {
|
||||
if (!eventName) {
|
||||
alert('BxEvent.dispatch(): eventName is null');
|
||||
return;
|
||||
}
|
||||
|
||||
const event = new Event(eventName);
|
||||
|
||||
if (data) {
|
||||
for (const key in data) {
|
||||
(event as any)[key] = data[key];
|
||||
}
|
||||
}
|
||||
|
||||
AppInterface && AppInterface.onEvent(eventName);
|
||||
target.dispatchEvent(event);
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
import { STATES } from "../utils/global";
|
||||
|
||||
export const BxExposed = {
|
||||
onPollingModeChanged: (mode: 'All' | 'None') => {
|
||||
if (!STATES.isPlaying) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const $screenshotBtn = document.querySelector('.bx-screenshot-button');
|
||||
const $touchControllerBar = document.getElementById('bx-touch-controller-bar');
|
||||
|
||||
if (mode !== 'None') {
|
||||
// Hide screenshot button
|
||||
$screenshotBtn && $screenshotBtn.classList.add('bx-gone');
|
||||
|
||||
// Hide touch controller bar
|
||||
$touchControllerBar && $touchControllerBar.classList.add('bx-gone');
|
||||
} else {
|
||||
// Show screenshot button
|
||||
$screenshotBtn && $screenshotBtn.classList.remove('bx-gone');
|
||||
|
||||
// Show touch controller bar
|
||||
$touchControllerBar && $touchControllerBar.classList.remove('bx-gone');
|
||||
}
|
||||
},
|
||||
};
|
@@ -1,25 +0,0 @@
|
||||
type BxFlags = {
|
||||
CheckForUpdate?: boolean;
|
||||
PreloadRemotePlay?: boolean;
|
||||
PreloadUi?: boolean;
|
||||
EnableXcloudLogging?: boolean;
|
||||
SafariWorkaround?: boolean;
|
||||
|
||||
UseDevTouchLayout?: boolean;
|
||||
}
|
||||
|
||||
// Setup flags
|
||||
const DEFAULT_FLAGS: BxFlags = {
|
||||
CheckForUpdate: true,
|
||||
PreloadRemotePlay: true,
|
||||
PreloadUi: false,
|
||||
EnableXcloudLogging: false,
|
||||
SafariWorkaround: true,
|
||||
|
||||
UseDevTouchLayout: false,
|
||||
}
|
||||
|
||||
const BX_FLAGS = Object.assign(DEFAULT_FLAGS, window.BX_FLAGS || {});
|
||||
delete window.BX_FLAGS;
|
||||
|
||||
export { BX_FLAGS }
|
@@ -1,7 +1,7 @@
|
||||
import { MkbPreset } from "./mkb-preset";
|
||||
import { GamepadKey, MkbPresetKey, GamepadStick, MouseMapTo } from "./definitions";
|
||||
import { createButton, Icon, ButtonStyle, CE } from "../../utils/html";
|
||||
import { BxEvent } from "../bx-event";
|
||||
import { BxEvent } from "../../utils/bx-event";
|
||||
import { PrefKey, getPref } from "../preferences";
|
||||
import { Toast } from "../../utils/toast";
|
||||
import { t } from "../translation";
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { STATES } from "../utils/global";
|
||||
import { BX_FLAGS } from "./bx-flags";
|
||||
import { BX_FLAGS } from "../utils/bx-flags";
|
||||
import { getPref, PrefKey } from "./preferences";
|
||||
import { VibrationManager } from "./vibration-manager";
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { STATES, AppInterface } from "../utils/global";
|
||||
import { CE, createButton, ButtonStyle, Icon } from "../utils/html";
|
||||
import { Toast } from "../utils/toast";
|
||||
import { BxEvent } from "./bx-event";
|
||||
import { BxEvent } from "../utils/bx-event";
|
||||
import { getPref, PrefKey, setPref } from "./preferences";
|
||||
import { t } from "./translation";
|
||||
import { localRedirect } from "./ui/ui";
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { t } from "../translation";
|
||||
import { BxEvent } from "../bx-event";
|
||||
import { BxEvent } from "../../utils/bx-event";
|
||||
import { CE } from "../../utils/html";
|
||||
import { STATES } from "../../utils/global";
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { PrefKey } from "../preferences"
|
||||
import { BxEvent } from "../bx-event"
|
||||
import { BxEvent } from "../../utils/bx-event"
|
||||
import { getPref } from "../preferences"
|
||||
import { StreamBadges } from "./stream-badges"
|
||||
import { CE } from "../../utils/html"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { STATES } from "../../utils/global";
|
||||
import { Icon } from "../../utils/html";
|
||||
import { BxEvent } from "../bx-event";
|
||||
import { BxEvent } from "../../utils/bx-event";
|
||||
import { PrefKey, getPref } from "../preferences";
|
||||
import { t } from "../translation";
|
||||
import { StreamBadges } from "./stream-badges";
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { NATIVE_FETCH, STATES } from "../utils/global";
|
||||
import { CE } from "../utils/html";
|
||||
import { Toast } from "../utils/toast";
|
||||
import { BxEvent } from "./bx-event";
|
||||
import { BX_FLAGS } from "./bx-flags";
|
||||
import { BxEvent } from "../utils/bx-event";
|
||||
import { BX_FLAGS } from "../utils/bx-flags";
|
||||
import { getPref, PrefKey } from "./preferences";
|
||||
import { t } from "./translation";
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { STATES } from "../../utils/global";
|
||||
import { Icon, CE, createButton, ButtonStyle } from "../../utils/html";
|
||||
import { UserAgent } from "../../utils/user-agent";
|
||||
import { BxEvent } from "../bx-event";
|
||||
import { BxEvent } from "../../utils/bx-event";
|
||||
import { MkbRemapper } from "../mkb/mkb-remapper";
|
||||
import { getPref, PrefKey, toPrefElement } from "../preferences";
|
||||
import { setupScreenshotButton } from "../screenshot";
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { AppInterface } from "../utils/global";
|
||||
import { BxEvent } from "./bx-event";
|
||||
import { BxEvent } from "../utils/bx-event";
|
||||
import { PrefKey, getPref } from "./preferences";
|
||||
|
||||
const VIBRATION_DATA_MAP = {
|
||||
|
Reference in New Issue
Block a user