add worker-timers 1

This commit is contained in:
Natsumi
2021-12-01 10:26:09 +13:00
parent b32740d46d
commit f558a1cb68
2 changed files with 13 additions and 10 deletions
+6 -5
View File
@@ -13,6 +13,7 @@ Vue.component('v-swatches', VSwatches);
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
import locale from 'element-ui/lib/locale/lang/en'; import locale from 'element-ui/lib/locale/lang/en';
import {v4 as uuidv4} from 'uuid'; import {v4 as uuidv4} from 'uuid';
import * as workerTimers from 'worker-timers';
import {appVersion} from './constants.js'; import {appVersion} from './constants.js';
import configRepository from './repository/config.js'; import configRepository from './repository/config.js';
@@ -1315,7 +1316,7 @@ speechSynthesis.getVoices();
if (userUpdateTimer !== null) { if (userUpdateTimer !== null) {
return; return;
} }
userUpdateTimer = setTimeout(function () { userUpdateTimer = workerTimers.setTimeout(() => {
userUpdateTimer = null; userUpdateTimer = null;
var {length} = userUpdateQueue; var {length} = userUpdateQueue;
for (var i = 0; i < length; ++i) { for (var i = 0; i < length; ++i) {
@@ -4156,7 +4157,7 @@ speechSynthesis.getVoices();
API.isRefreshFriendsLoading = false; API.isRefreshFriendsLoading = false;
console.error(err); console.error(err);
} }
setTimeout(() => this.updateLoop(), 500); workerTimers.setTimeout(() => this.updateLoop(), 500);
}; };
$app.data.debug = false; $app.data.debug = false;
@@ -8176,7 +8177,7 @@ speechSynthesis.getVoices();
dtNow < bias1 || dtNow < bias1 ||
this.lastLocation.playerList.size <= 1 this.lastLocation.playerList.size <= 1
) { ) {
setTimeout(() => this.photonLobbyWatcher(), 500); workerTimers.setTimeout(() => this.photonLobbyWatcher(), 500);
return; return;
} }
LogWatcher.GetEvent7().then((event7List) => { LogWatcher.GetEvent7().then((event7List) => {
@@ -9177,7 +9178,7 @@ speechSynthesis.getVoices();
np.remainingText = this.formatSeconds(np.length - np.elapsed); np.remainingText = this.formatSeconds(np.length - np.elapsed);
np.percentage = Math.round(((np.elapsed * 100) / np.length) * 10) / 10; np.percentage = Math.round(((np.elapsed * 100) / np.length) * 10) / 10;
this.updateVrNowPlaying(); this.updateVrNowPlaying();
setTimeout(() => this.updateNowPlaying(), 1000); workerTimers.setTimeout(() => this.updateNowPlaying(), 1000);
}; };
$app.methods.updateVrNowPlaying = function () { $app.methods.updateVrNowPlaying = function () {
@@ -17127,7 +17128,7 @@ speechSynthesis.getVoices();
default: default:
this.downloadProgress = downloadProgress; this.downloadProgress = downloadProgress;
} }
setTimeout(() => this.downloadVRChatCacheProgress(), 150); workerTimers.setTimeout(() => this.downloadVRChatCacheProgress(), 150);
}; };
$app.methods.showDownloadDialog = function () { $app.methods.showDownloadDialog = function () {
+7 -5
View File
@@ -8,6 +8,7 @@ import Noty from 'noty';
import Vue from 'vue'; import Vue from 'vue';
import ElementUI from 'element-ui'; import ElementUI from 'element-ui';
import locale from 'element-ui/lib/locale/lang/en'; import locale from 'element-ui/lib/locale/lang/en';
import * as workerTimers from 'worker-timers';
import MarqueeText from 'vue-marquee-text-component'; import MarqueeText from 'vue-marquee-text-component';
Vue.component('marquee-text', MarqueeText); Vue.component('marquee-text', MarqueeText);
@@ -208,9 +209,10 @@ Vue.component('marquee-text', MarqueeText);
watch: {}, watch: {},
el: '#x-app', el: '#x-app',
mounted() { mounted() {
setTimeout(function () { workerTimers.setTimeout(
AppApi.ExecuteAppFunction('vrInit', ''); () => AppApi.ExecuteAppFunction('vrInit', ''),
}, 1000); 1000
);
if (this.appType === '1') { if (this.appType === '1') {
this.updateStatsLoop(); this.updateStatsLoop();
} }
@@ -357,7 +359,7 @@ Vue.component('marquee-text', MarqueeText);
} catch (err) { } catch (err) {
console.error(err); console.error(err);
} }
setTimeout(() => this.updateStatsLoop(), 500); workerTimers.setTimeout(() => this.updateStatsLoop(), 500);
}; };
$app.methods.playNoty = function (json) { $app.methods.playNoty = function (json) {
@@ -543,7 +545,7 @@ Vue.component('marquee-text', MarqueeText);
this.cleanHudFeedLoopStatus = false; this.cleanHudFeedLoopStatus = false;
return; return;
} }
setTimeout(() => this.cleanHudFeedLoop(), 500); workerTimers.setTimeout(() => this.cleanHudFeedLoop(), 500);
}; };
$app.methods.cleanHudFeed = function () { $app.methods.cleanHudFeed = function () {