parent
1a96f24f20
commit
913a7140d3
|
@ -154,8 +154,8 @@ interface LightUser {
|
|||
patron?: boolean
|
||||
}
|
||||
|
||||
// declare var SharedArrayBuffer: any | undefined;
|
||||
// declare var Atomics: any | undefined;
|
||||
declare var SharedArrayBuffer: any | undefined;
|
||||
declare var Atomics: any | undefined;
|
||||
|
||||
declare type VariantKey = 'standard' | 'chess960' | 'antichess' | 'fromPosition' | 'kingOfTheHill' | 'threeCheck' | 'atomic' | 'horde' | 'racingKings' | 'crazyhouse';
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ export class Autoplay {
|
|||
}
|
||||
|
||||
private schedule(): void {
|
||||
this.timeout = window.setTimeout(() => {
|
||||
this.timeout = setTimeout(() => {
|
||||
if (this.move()) this.schedule();
|
||||
}, this.nextDelay());
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ function moveTableAttributes(ctrl: AnalyseCtrl, fen: Fen) {
|
|||
});
|
||||
},
|
||||
postpatch: (_, vnode) => {
|
||||
window.setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
const el = vnode.elm as HTMLElement;
|
||||
ctrl.explorer.setHovering($(el).attr('data-fen'), $(el).find('tr:hover').attr('data-uci'));
|
||||
}, 100);
|
||||
|
|
|
@ -71,7 +71,7 @@ export function make(root: AnalyseCtrl): RetroCtrl {
|
|||
});
|
||||
if (ucis.includes(fault.node.uci!)) {
|
||||
explorerCancelPlies.push(fault.node.ply);
|
||||
window.setTimeout(jumpToNext, 100);
|
||||
setTimeout(jumpToNext, 100);
|
||||
} else {
|
||||
cur.openingUcis = ucis;
|
||||
current(cur);
|
||||
|
|
|
@ -25,7 +25,7 @@ export default function(element: HTMLElement, ctrl: AnalyseCtrl) {
|
|||
|
||||
if (!li.AnalyseNVUI) {
|
||||
li.pubsub.on('analysis.comp.toggle', (v: boolean) => {
|
||||
window.setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
(v ? $menu.find('[data-panel="computer-analysis"]') : $menu.find('span:eq(1)')).trigger('mousedown');
|
||||
}, 50);
|
||||
});
|
||||
|
@ -101,7 +101,7 @@ export default function(element: HTMLElement, ctrl: AnalyseCtrl) {
|
|||
});
|
||||
} catch (e) {}
|
||||
if (panel == 'computer-analysis' && $("#acpl-chart").length)
|
||||
window.setTimeout(startAdvantageChart, 200);
|
||||
setTimeout(startAdvantageChart, 200);
|
||||
};
|
||||
$menu.on('mousedown', 'span', function(this: HTMLElement) {
|
||||
const panel = $(this).data('panel');
|
||||
|
|
|
@ -49,7 +49,7 @@ export function make(send: SocketSend, ctrl: AnalyseCtrl): Socket {
|
|||
clearCache();
|
||||
|
||||
// forecast mode: reload when opponent moves
|
||||
if (!ctrl.synthetic) window.setTimeout(function() {
|
||||
if (!ctrl.synthetic) setTimeout(function() {
|
||||
send("startWatching", ctrl.data.game.id);
|
||||
}, 1000);
|
||||
|
||||
|
@ -119,14 +119,14 @@ export function make(send: SocketSend, ctrl: AnalyseCtrl): Socket {
|
|||
|
||||
function sendAnaDests(req) {
|
||||
clearTimeout(anaDestsTimeout);
|
||||
if (anaDestsCache[req.path]) window.setTimeout(function() {
|
||||
if (anaDestsCache[req.path]) setTimeout(function() {
|
||||
handlers.dests(anaDestsCache[req.path]);
|
||||
}, 300);
|
||||
else {
|
||||
withoutStandardVariant(req);
|
||||
addStudyData(req);
|
||||
send('anaDests', req);
|
||||
anaDestsTimeout = window.setTimeout(function() {
|
||||
anaDestsTimeout = setTimeout(function() {
|
||||
console.log(req, 'resendAnaDests');
|
||||
sendAnaDests(req);
|
||||
}, 3000);
|
||||
|
@ -138,7 +138,7 @@ export function make(send: SocketSend, ctrl: AnalyseCtrl): Socket {
|
|||
withoutStandardVariant(req);
|
||||
addStudyData(req, true);
|
||||
send('anaMove', req);
|
||||
anaMoveTimeout = window.setTimeout(() => sendAnaMove(req), 3000);
|
||||
anaMoveTimeout = setTimeout(() => sendAnaMove(req), 3000);
|
||||
}
|
||||
|
||||
function sendAnaDrop(req) {
|
||||
|
@ -146,7 +146,7 @@ export function make(send: SocketSend, ctrl: AnalyseCtrl): Socket {
|
|||
withoutStandardVariant(req);
|
||||
addStudyData(req, true);
|
||||
send('anaDrop', req);
|
||||
anaMoveTimeout = window.setTimeout(() => sendAnaDrop(req), 3000);
|
||||
anaMoveTimeout = setTimeout(() => sendAnaDrop(req), 3000);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -62,7 +62,7 @@ export function ctrl(root: AnalyseCtrl): CommentForm {
|
|||
submit,
|
||||
start,
|
||||
onSetPath(chapterId: string, path: Tree.Path, node: Tree.Node, playedMyself: boolean): void {
|
||||
window.setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
const cur = current();
|
||||
if (cur && (path !== cur.path || chapterId !== cur.chapterId) && (!focus() || playedMyself)) {
|
||||
cur.chapterId = chapterId;
|
||||
|
@ -121,7 +121,7 @@ export function view(root: AnalyseCtrl): VNode {
|
|||
setupTextarea(vnode);
|
||||
const el = vnode.elm as HTMLInputElement;
|
||||
function onChange() {
|
||||
window.setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
ctrl.submit(el.value);
|
||||
}, 50);
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ export default class GamebookPlayCtrl {
|
|||
}
|
||||
this.state = state as State;
|
||||
if (!state.comment) {
|
||||
if (state.feedback === 'good') window.setTimeout(this.next, this.root.path ? 1000 : 300);
|
||||
else if (state.feedback === 'bad') window.setTimeout(this.retry, 800);
|
||||
if (state.feedback === 'good') setTimeout(this.next, this.root.path ? 1000 : 300);
|
||||
else if (state.feedback === 'bad') setTimeout(this.retry, 800);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ export default class GamebookPlayCtrl {
|
|||
onJump = () => {
|
||||
this.makeState();
|
||||
// wait for the root ctrl to make the move
|
||||
window.setTimeout(() => this.root.withCg(cg => cg.playPremove()), 100);
|
||||
setTimeout(() => this.root.withCg(cg => cg.playPremove()), 100);
|
||||
}
|
||||
|
||||
onShapeChange = shapes => {
|
||||
|
|
|
@ -19,7 +19,7 @@ export function ctrl(redraw: () => void) {
|
|||
set(n: Notif) {
|
||||
clearTimeout(timeout);
|
||||
current = n;
|
||||
timeout = window.setTimeout(function() {
|
||||
timeout = setTimeout(function() {
|
||||
current = undefined;
|
||||
redraw();
|
||||
}, n.duration);
|
||||
|
|
|
@ -60,7 +60,7 @@ export default function(root: AnalyseCtrl, studyData: StudyData, data: StudyPrac
|
|||
function onVictory(): void {
|
||||
saveNbMoves();
|
||||
sound.success();
|
||||
if (autoNext()) window.setTimeout(goToNext, 1000);
|
||||
if (autoNext()) setTimeout(goToNext, 1000);
|
||||
}
|
||||
|
||||
function saveNbMoves(): void {
|
||||
|
|
|
@ -29,7 +29,7 @@ export default class RelayCtrl {
|
|||
if (this.clockInterval) clearInterval(this.clockInterval);
|
||||
if (r) {
|
||||
c.relay = this.convertDate(r);
|
||||
if (!isFinished(c)) this.clockInterval = window.setInterval(this.redraw, 1000);
|
||||
if (!isFinished(c)) this.clockInterval = setInterval(this.redraw, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ export default class RelayCtrl {
|
|||
this.data.sync.log.push(event);
|
||||
this.data.sync.log = this.data.sync.log.slice(-20);
|
||||
this.cooldown = true;
|
||||
window.setTimeout(() => { this.cooldown = false; this.redraw(); }, 4500);
|
||||
setTimeout(() => { this.cooldown = false; this.redraw(); }, 4500);
|
||||
this.redraw();
|
||||
if (event.error) console.warn(`relay synchronisation error: ${event.error}`);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ function memberActivity(onIdle) {
|
|||
let timeout;
|
||||
let schedule = function() {
|
||||
if (timeout) clearTimeout(timeout);
|
||||
timeout = window.setTimeout(onIdle, 100);
|
||||
timeout = setTimeout(onIdle, 100);
|
||||
};
|
||||
schedule();
|
||||
return schedule;
|
||||
|
|
|
@ -151,10 +151,10 @@ function repeater(ctrl: AnalyseCtrl, action: 'prev' | 'next', e: Event) {
|
|||
control[action](ctrl);
|
||||
ctrl.redraw();
|
||||
delay = Math.max(100, delay - delay / 15);
|
||||
timeout = window.setTimeout(repeat, delay);
|
||||
timeout = setTimeout(repeat, delay);
|
||||
};
|
||||
let delay = 350;
|
||||
let timeout = window.setTimeout(repeat, 500);
|
||||
let timeout = setTimeout(repeat, 500);
|
||||
control[action](ctrl);
|
||||
const eventName = e.type == 'touchstart' ? 'touchend' : 'mouseup';
|
||||
document.addEventListener(eventName, () => clearTimeout(timeout), {once: true});
|
||||
|
|
|
@ -15,7 +15,7 @@ export function makeWatchdog(name: string): Watchdog {
|
|||
disarmSoon() {
|
||||
if (failed || disarming) return;
|
||||
disarming = true;
|
||||
window.setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
// delayed to detect potential tab crash
|
||||
prop(0);
|
||||
console.log('watchdog disarmed (delayed): ' + name);
|
||||
|
@ -83,7 +83,7 @@ class WebWorker extends AbstractWorker {
|
|||
start(work: Work): Promise<void> {
|
||||
// wait for boot
|
||||
return this.protocol.promise.then(protocol => {
|
||||
const timeout = new Promise((_, reject) => window.setTimeout(reject, 1000));
|
||||
const timeout = new Promise((_, reject) => setTimeout(reject, 1000));
|
||||
return Promise.race([protocol.stop(), timeout]).catch(() => {
|
||||
// reboot if not stopped after 1s
|
||||
this.destroy();
|
||||
|
@ -209,7 +209,7 @@ export class Pool {
|
|||
const worker = new Promise<AbstractWorker>((resolve, reject) => {
|
||||
const currentWorker = this.workers[this.token];
|
||||
currentWorker.stop().then(() => resolve(currentWorker));
|
||||
window.setTimeout(reject, 50);
|
||||
setTimeout(reject, 50);
|
||||
});
|
||||
|
||||
return worker.catch(() => {
|
||||
|
@ -244,7 +244,7 @@ export class Pool {
|
|||
worker.start(work);
|
||||
}).catch(function(error) {
|
||||
console.log(error);
|
||||
window.setTimeout(() => window.lichess.reload(), 10000);
|
||||
setTimeout(() => window.lichess.reload(), 10000);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ export default function(ctrl: Ctrl): Array<VNode | undefined> {
|
|||
const autoScroll = (el.scrollTop === 0 || (el.scrollTop > (el.scrollHeight - el.clientHeight - 100)));
|
||||
if (autoScroll) {
|
||||
el.scrollTop = 999999;
|
||||
window.setTimeout((_: any) => el.scrollTop = 999999, 300)
|
||||
setTimeout((_: any) => el.scrollTop = 999999, 300)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -85,7 +85,7 @@ let mouchListener: EventListener;
|
|||
|
||||
const setupHooks = (ctrl: Ctrl, chatEl: HTMLElement) => {
|
||||
chatEl.addEventListener('keypress',
|
||||
(e: KeyboardEvent) => window.setTimeout(() => {
|
||||
(e: KeyboardEvent) => setTimeout(() => {
|
||||
const el = e.target as HTMLInputElement,
|
||||
txt = el.value,
|
||||
pub = ctrl.opts.public;
|
||||
|
|
|
@ -13,7 +13,7 @@ export function runner(hacks: () => void, throttleMs: number = 100) {
|
|||
|
||||
function schedule() {
|
||||
timeout && clearTimeout(timeout);
|
||||
timeout = window.setTimeout(runHacks, 500);
|
||||
timeout = setTimeout(runHacks, 500);
|
||||
}
|
||||
|
||||
runHacks();
|
||||
|
|
|
@ -52,7 +52,7 @@ export const menuHover = () => window.lichess.raf(function() {
|
|||
// set previous coordinates for next comparison
|
||||
state.pX = cX; state.pY = cY;
|
||||
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
||||
state.timeoutId = window.setTimeout(compare, interval );
|
||||
state.timeoutId = setTimeout(compare, interval );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -74,7 +74,7 @@ export const menuHover = () => window.lichess.raf(function() {
|
|||
// update "current" X and Y position based on mousemove
|
||||
$el.off(mousemove, track).on(mousemove, track);
|
||||
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
||||
state.timeoutId = window.setTimeout(compare, interval );
|
||||
state.timeoutId = setTimeout(compare, interval );
|
||||
} else { // "mouseleave"
|
||||
// do nothing if not already active
|
||||
if (!state.isActive) return;
|
||||
|
|
|
@ -29,6 +29,6 @@ export default function(msg: string | (() => string)) {
|
|||
if (document.hasFocus() || !('Notification' in window)) return;
|
||||
if (Notification.permission === 'granted') {
|
||||
// increase chances that the first tab can put a local storage lock
|
||||
window.setTimeout(notify, 10 + Math.random() * 500, msg);
|
||||
setTimeout(notify, 10 + Math.random() * 500, msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,5 +82,5 @@ function addNag(el: HTMLElement) {
|
|||
}, { once: true });
|
||||
}
|
||||
|
||||
window.setTimeout(() => storage.set(true), 15000);
|
||||
setTimeout(() => storage.set(true), 15000);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,6 @@ export default function throttle(delay: number, callback: (...args: any[]) => vo
|
|||
if (timer) clearTimeout(timer);
|
||||
|
||||
if (elapsed > delay) exec();
|
||||
else timer = window.setTimeout(exec, delay - elapsed);
|
||||
else timer = setTimeout(exec, delay - elapsed);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ function applyBackground(data: BackgroundData, list: Background[]) {
|
|||
link.type = 'text/css';
|
||||
link.rel = 'stylesheet';
|
||||
link.href = $(this).attr('href').replace('.' + prev + '.', '.' + key + '.');
|
||||
link.onload = () => window.setTimeout(() => this.remove(), 100);
|
||||
link.onload = () => setTimeout(() => this.remove(), 100);
|
||||
document.head.appendChild(link);
|
||||
});
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ export default class LobbyController {
|
|||
this.startWatching();
|
||||
|
||||
if (this.playban) {
|
||||
if (this.playban.remainingSecond < 86400) window.setTimeout(li.reload, this.playban.remainingSeconds * 1000);
|
||||
if (this.playban.remainingSecond < 86400) setTimeout(li.reload, this.playban.remainingSeconds * 1000);
|
||||
}
|
||||
else {
|
||||
setInterval(() => {
|
||||
|
@ -95,7 +95,7 @@ export default class LobbyController {
|
|||
else {
|
||||
this.stepping = true;
|
||||
if (this.tab === 'real_time') this.redraw();
|
||||
window.setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
this.stepping = false;
|
||||
this.doFlushHooks();
|
||||
}, 500);
|
||||
|
@ -104,7 +104,7 @@ export default class LobbyController {
|
|||
};
|
||||
|
||||
private flushHooksSchedule(): number {
|
||||
return window.setTimeout(this.flushHooks, 8000);
|
||||
return setTimeout(this.flushHooks, 8000);
|
||||
}
|
||||
|
||||
setTab = (tab: Tab) => {
|
||||
|
@ -204,14 +204,14 @@ export default class LobbyController {
|
|||
.map(p => p.gameId)
|
||||
.filter(id => !this.alreadyWatching.includes(id));
|
||||
if (newIds.length) {
|
||||
window.setTimeout(() => this.socket.send("startWatching", newIds.join(' ')), 2000);
|
||||
setTimeout(() => this.socket.send("startWatching", newIds.join(' ')), 2000);
|
||||
newIds.forEach(id => this.alreadyWatching.push(id));
|
||||
}
|
||||
};
|
||||
|
||||
setRedirecting = () => {
|
||||
this.redirecting = true;
|
||||
window.setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
this.redirecting = false;
|
||||
this.redraw();
|
||||
}, 4000);
|
||||
|
|
|
@ -58,7 +58,7 @@ function renderPlot(ctrl: LobbyController, hook: Hook) {
|
|||
closeDelay: 200,
|
||||
popupId: 'hook'
|
||||
}).data('powertipjq', $(renderHook(ctrl, hook)));
|
||||
window.setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
(vnode.elm as HTMLElement).classList.remove('new');
|
||||
}, 20);
|
||||
},
|
||||
|
|
|
@ -57,14 +57,14 @@ export default function(opts, redraw: () => void): Controller {
|
|||
vm.initialNode = tree.nodeAtPath(initialPath);
|
||||
|
||||
setPath(treePath.init(initialPath));
|
||||
window.setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
jump(initialPath);
|
||||
redraw();
|
||||
}, 500);
|
||||
|
||||
// just to delay button display
|
||||
vm.canViewSolution = false;
|
||||
window.setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
vm.canViewSolution = true;
|
||||
redraw();
|
||||
}, 5000);
|
||||
|
@ -180,7 +180,7 @@ export default function(opts, redraw: () => void): Controller {
|
|||
};
|
||||
|
||||
var revertUserMove = function() {
|
||||
window.setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
withGround(function(g) { g.cancelPremove(); });
|
||||
userJump(treePath.init(vm.path));
|
||||
redraw();
|
||||
|
@ -209,7 +209,7 @@ export default function(opts, redraw: () => void): Controller {
|
|||
}
|
||||
} else if (progress && progress.orig) {
|
||||
vm.lastFeedback = 'good';
|
||||
window.setTimeout(function() {
|
||||
setTimeout(function() {
|
||||
socket.sendAnaMove(progress);
|
||||
}, 500);
|
||||
}
|
||||
|
|
|
@ -28,19 +28,19 @@ export default function(opts) {
|
|||
var sendAnaMove = function(req) {
|
||||
clearTimeout(anaMoveTimeout);
|
||||
opts.send('anaMove', req);
|
||||
anaMoveTimeout = window.setTimeout(function() {
|
||||
anaMoveTimeout = setTimeout(function() {
|
||||
sendAnaMove(req);
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
var sendAnaDests = function(req) {
|
||||
clearTimeout(anaDestsTimeout);
|
||||
if (anaDestsCache[req.path]) window.setTimeout(function() {
|
||||
if (anaDestsCache[req.path]) setTimeout(function() {
|
||||
handlers.dests(anaDestsCache[req.path]);
|
||||
}, 10);
|
||||
else {
|
||||
opts.send('anaDests', req);
|
||||
anaDestsTimeout = window.setTimeout(function() {
|
||||
anaDestsTimeout = setTimeout(function() {
|
||||
sendAnaDests(req);
|
||||
}, 3000);
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ export class ClockController {
|
|||
|
||||
private scheduleTick = (time: Millis, extraDelay: Millis) => {
|
||||
if (this.tickCallback !== undefined) clearTimeout(this.tickCallback);
|
||||
this.tickCallback = window.setTimeout(
|
||||
this.tickCallback = setTimeout(
|
||||
this.tick,
|
||||
// changing the value of active node confuses the chromevox screen reader
|
||||
// so update the clock less often
|
||||
|
|
|
@ -82,7 +82,7 @@ export default class RoundController {
|
|||
this.goneBerserk[d.player.color] = d.player.berserk;
|
||||
this.goneBerserk[d.opponent.color] = d.opponent.berserk;
|
||||
|
||||
window.setTimeout(() => { this.firstSeconds = false; this.redraw(); }, 3000);
|
||||
setTimeout(() => { this.firstSeconds = false; this.redraw(); }, 3000);
|
||||
|
||||
this.socket = makeSocket(opts.socketSend, this);
|
||||
|
||||
|
@ -106,12 +106,12 @@ export default class RoundController {
|
|||
this.trans = li.trans(opts.i18n);
|
||||
this.noarg = this.trans.noarg;
|
||||
|
||||
window.setTimeout(this.delayedInit, 200);
|
||||
setTimeout(this.delayedInit, 200);
|
||||
|
||||
window.setTimeout(this.showExpiration, 350);
|
||||
setTimeout(this.showExpiration, 350);
|
||||
|
||||
if (!document.referrer || document.referrer.indexOf('/service-worker.js') === -1)
|
||||
window.setTimeout(this.showYourMoveNotification, 500);
|
||||
setTimeout(this.showYourMoveNotification, 500);
|
||||
|
||||
// at the end:
|
||||
li.pubsub.on('jump', ply => { this.jump(parseInt(ply)); this.redraw(); });
|
||||
|
@ -139,7 +139,7 @@ export default class RoundController {
|
|||
private showExpiration = () => {
|
||||
if (!this.data.expiration) return;
|
||||
this.redraw();
|
||||
window.setTimeout(this.showExpiration, 250);
|
||||
setTimeout(this.showExpiration, 250);
|
||||
}
|
||||
|
||||
private onUserMove = (orig: cg.Key, dest: cg.Key, meta: cg.MoveMetadata) => {
|
||||
|
@ -434,7 +434,7 @@ export default class RoundController {
|
|||
// with explosions and premoves
|
||||
// https://github.com/ornicar/lila/issues/343
|
||||
const premoveDelay = d.game.variant.key === 'atomic' ? 100 : 1;
|
||||
window.setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
if (!this.chessground.playPremove() && !this.playPredrop()) {
|
||||
promotion.cancel(this);
|
||||
this.showYourMoveNotification();
|
||||
|
@ -502,7 +502,7 @@ export default class RoundController {
|
|||
this.redraw();
|
||||
this.autoScroll();
|
||||
this.onChange();
|
||||
if (d.tv) window.setTimeout(li.reload, 10000);
|
||||
if (d.tv) setTimeout(li.reload, 10000);
|
||||
speech.status(this);
|
||||
};
|
||||
|
||||
|
@ -510,7 +510,7 @@ export default class RoundController {
|
|||
this.challengeRematched = true;
|
||||
xhr.challengeRematch(this.data.game.id).then(() => {
|
||||
li.challengeApp.open();
|
||||
if (li.once('rematch-challenge')) window.setTimeout(() => {
|
||||
if (li.once('rematch-challenge')) setTimeout(() => {
|
||||
li.hopscotch(function() {
|
||||
window.hopscotch.configure({
|
||||
i18n: { doneBtn: 'OK, got it' }
|
||||
|
@ -569,7 +569,7 @@ export default class RoundController {
|
|||
this.socket.sendLoading('resign');
|
||||
clearTimeout(this.resignConfirm);
|
||||
} else {
|
||||
this.resignConfirm = window.setTimeout(() => this.resign(false), 3000);
|
||||
this.resignConfirm = setTimeout(() => this.resign(false), 3000);
|
||||
}
|
||||
this.redraw();
|
||||
} else if (this.resignConfirm) {
|
||||
|
@ -595,7 +595,7 @@ export default class RoundController {
|
|||
clearTimeout(this.loadingTimeout);
|
||||
if (v) {
|
||||
this.loading = true;
|
||||
this.loadingTimeout = window.setTimeout(() => {
|
||||
this.loadingTimeout = setTimeout(() => {
|
||||
this.loading = false;
|
||||
this.redraw();
|
||||
}, duration);
|
||||
|
@ -608,7 +608,7 @@ export default class RoundController {
|
|||
|
||||
setRedirecting = () => {
|
||||
this.redirecting = true;
|
||||
window.setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
this.redirecting = false;
|
||||
this.redraw();
|
||||
}, 2500);
|
||||
|
@ -632,7 +632,7 @@ export default class RoundController {
|
|||
};
|
||||
|
||||
private onChange = () => {
|
||||
if (this.opts.onChange) window.setTimeout(() => this.opts.onChange(this.data), 150);
|
||||
if (this.opts.onChange) setTimeout(() => this.opts.onChange(this.data), 150);
|
||||
};
|
||||
|
||||
forceResignable = (): boolean => {
|
||||
|
@ -654,7 +654,7 @@ export default class RoundController {
|
|||
clearTimeout(this.drawConfirm);
|
||||
this.drawConfirm = undefined;
|
||||
} else if (v) {
|
||||
if (this.data.pref.confirmResign) this.drawConfirm = window.setTimeout(() => {
|
||||
if (this.data.pref.confirmResign) this.drawConfirm = setTimeout(() => {
|
||||
this.offerDraw(false);
|
||||
}, 3000);
|
||||
else this.doOfferDraw();
|
||||
|
|
|
@ -52,7 +52,7 @@ window.lichess.keyboardMove = function(opts: any) {
|
|||
clear();
|
||||
}
|
||||
} else if (submitOpts.yourMove && v.length > 1) {
|
||||
window.setTimeout(window.lichess.sound.error, 500);
|
||||
setTimeout(window.lichess.sound.error, 500);
|
||||
opts.input.value = '';
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -43,10 +43,10 @@ window.lichess.RoundNVUI = function(redraw: Redraw) {
|
|||
drawable: { enabled: false },
|
||||
coordinates: false
|
||||
}));
|
||||
if (variantNope) window.setTimeout(() => notify.set(variantNope), 3000);
|
||||
if (variantNope) setTimeout(() => notify.set(variantNope), 3000);
|
||||
}
|
||||
return h('div.nvui', {
|
||||
hook: onInsert(_ => window.setTimeout(() => notify.set(gameText(ctrl)), 2000))
|
||||
hook: onInsert(_ => setTimeout(() => notify.set(gameText(ctrl)), 2000))
|
||||
}, [
|
||||
h('h1', gameText(ctrl)),
|
||||
h('h2', 'Game info'),
|
||||
|
|
|
@ -28,10 +28,10 @@ function startTicker() {
|
|||
function tick() {
|
||||
if (!document.hasFocus()) {
|
||||
F[1 - curFaviconIdx]();
|
||||
tickerTimer = window.setTimeout(tick, 1000);
|
||||
tickerTimer = setTimeout(tick, 1000);
|
||||
}
|
||||
}
|
||||
if (!tickerTimer) tickerTimer = window.setTimeout(tick, 200);
|
||||
if (!tickerTimer) tickerTimer = setTimeout(tick, 200);
|
||||
}
|
||||
|
||||
export function init() {
|
||||
|
|
|
@ -17,7 +17,7 @@ export default class TransientMove {
|
|||
current: number | undefined = undefined;
|
||||
|
||||
register = () => {
|
||||
this.current = window.setTimeout(this.expire, 5000);
|
||||
this.current = setTimeout(this.expire, 5000);
|
||||
}
|
||||
|
||||
clear = () => {
|
||||
|
|
|
@ -57,7 +57,7 @@ export function renderResult(ctrl: RoundController): VNode | undefined {
|
|||
h('p.status', {
|
||||
hook: util.onInsert(() => {
|
||||
if (ctrl.autoScroll) ctrl.autoScroll();
|
||||
else window.setTimeout(() => ctrl.autoScroll(), 200);
|
||||
else setTimeout(() => ctrl.autoScroll(), 200);
|
||||
})
|
||||
}, [
|
||||
viewStatus(ctrl),
|
||||
|
|
|
@ -40,7 +40,7 @@ export default class TournamentController {
|
|||
this.socket = makeSocket(opts.socketSend, this);
|
||||
this.page = this.data.standing.page;
|
||||
this.focusOnMe = tour.isIn(this);
|
||||
window.setTimeout(() => this.disableClicks = false, 1500);
|
||||
setTimeout(() => this.disableClicks = false, 1500);
|
||||
this.loadPage(this.data.standing);
|
||||
this.scrollToMe();
|
||||
sound.end(this.data);
|
||||
|
@ -79,7 +79,7 @@ export default class TournamentController {
|
|||
|
||||
redirectFirst = (gameId: string, rightNow?: boolean) => {
|
||||
const delay = (rightNow || document.hasFocus()) ? 10 : (1000 + Math.random() * 500);
|
||||
window.setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
if (this.lastStorage.get() !== gameId) {
|
||||
this.lastStorage.set(gameId);
|
||||
window.lichess.redirect('/' + gameId);
|
||||
|
@ -139,7 +139,7 @@ export default class TournamentController {
|
|||
private startWatching(id: string) {
|
||||
if (id !== this.watchingGameId) {
|
||||
this.watchingGameId = id;
|
||||
window.setTimeout(() => this.socket.send("startWatching", id), 1000);
|
||||
setTimeout(() => this.socket.send("startWatching", id), 1000);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ function doCountDown(targetTime: number) {
|
|||
|
||||
if (bestTick > 0) {
|
||||
let nextTick = Math.min(10, bestTick - 1);
|
||||
countDownTimeout = window.setTimeout(curCounter, 1000 *
|
||||
countDownTimeout = setTimeout(curCounter, 1000 *
|
||||
Math.min(1.1, Math.max(0.8, (secondsToStart - nextTick))));
|
||||
}
|
||||
|
||||
|
@ -50,11 +50,11 @@ export function countDown(data: TournamentData) {
|
|||
if (countDownTimeout) return;
|
||||
if (data.secondsToStart > 60 * 60 * 24) return;
|
||||
|
||||
countDownTimeout = window.setTimeout(
|
||||
countDownTimeout = setTimeout(
|
||||
doCountDown(performance.now() + 1000 * data.secondsToStart - 100),
|
||||
900); // wait 900ms before starting countdown.
|
||||
|
||||
window.setTimeout(li.sound.warmup, (data.secondsToStart - 15) * 1000);
|
||||
setTimeout(li.sound.warmup, (data.secondsToStart - 15) * 1000);
|
||||
|
||||
// Preload countdown sounds.
|
||||
for (let i = 10; i>=0; i--) li.sound.load('countDown' + i);
|
||||
|
|
|
@ -42,7 +42,7 @@ export function join(ctrl: TournamentController): VNode {
|
|||
insert(vnode) {
|
||||
const el = vnode.elm as HTMLElement;
|
||||
el.style.animation = `tour-delay ${delay}s linear`;
|
||||
window.setTimeout(() => {
|
||||
setTimeout(() => {
|
||||
if (delay === ctrl.data.me.pauseDelay) {
|
||||
ctrl.data.me.pauseDelay = 0;
|
||||
ctrl.redraw();
|
||||
|
|
Loading…
Reference in New Issue