mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 23:57:19 +02:00
Update better-xcloud.user.js
This commit is contained in:
parent
057da5b3ea
commit
05eddce11e
6
dist/better-xcloud.user.js
vendored
6
dist/better-xcloud.user.js
vendored
@ -4280,12 +4280,12 @@ class VibrationManager {
|
|||||||
static supportDeviceVibration() {
|
static supportDeviceVibration() {
|
||||||
return !!window.navigator.vibrate;
|
return !!window.navigator.vibrate;
|
||||||
}
|
}
|
||||||
static updateGlobalVars() {
|
static updateGlobalVars(stopVibration = !0) {
|
||||||
if (window.BX_ENABLE_CONTROLLER_VIBRATION = VibrationManager.supportControllerVibration() ? getPref(PrefKey.CONTROLLER_ENABLE_VIBRATION) : !1, window.BX_VIBRATION_INTENSITY = getPref(PrefKey.CONTROLLER_VIBRATION_INTENSITY) / 100, !VibrationManager.supportDeviceVibration()) {
|
if (window.BX_ENABLE_CONTROLLER_VIBRATION = VibrationManager.supportControllerVibration() ? getPref(PrefKey.CONTROLLER_ENABLE_VIBRATION) : !1, window.BX_VIBRATION_INTENSITY = getPref(PrefKey.CONTROLLER_VIBRATION_INTENSITY) / 100, !VibrationManager.supportDeviceVibration()) {
|
||||||
window.BX_ENABLE_DEVICE_VIBRATION = !1;
|
window.BX_ENABLE_DEVICE_VIBRATION = !1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
window.navigator.vibrate(0);
|
stopVibration && window.navigator.vibrate(0);
|
||||||
const value = getPref(PrefKey.CONTROLLER_DEVICE_VIBRATION);
|
const value = getPref(PrefKey.CONTROLLER_DEVICE_VIBRATION);
|
||||||
let enabled;
|
let enabled;
|
||||||
if (value === "on")
|
if (value === "on")
|
||||||
@ -4328,7 +4328,7 @@ class VibrationManager {
|
|||||||
VibrationManager.#playDeviceVibration(data);
|
VibrationManager.#playDeviceVibration(data);
|
||||||
}
|
}
|
||||||
static initialSetup() {
|
static initialSetup() {
|
||||||
window.addEventListener("gamepadconnected", VibrationManager.updateGlobalVars), window.addEventListener("gamepaddisconnected", VibrationManager.updateGlobalVars), VibrationManager.updateGlobalVars(), window.addEventListener(BxEvent.DATA_CHANNEL_CREATED, (e) => {
|
window.addEventListener("gamepadconnected", (e) => VibrationManager.updateGlobalVars()), window.addEventListener("gamepaddisconnected", (e) => VibrationManager.updateGlobalVars()), VibrationManager.updateGlobalVars(!1), window.addEventListener(BxEvent.DATA_CHANNEL_CREATED, (e) => {
|
||||||
const dataChannel = e.dataChannel;
|
const dataChannel = e.dataChannel;
|
||||||
if (!dataChannel || dataChannel.label !== "input")
|
if (!dataChannel || dataChannel.label !== "input")
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user