本文整理汇总了TypeScript中common/notification.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: notifyNew
function notifyNew() {
if (!data || data.pager.currentPage !== 1) return;
const notif = data.pager.currentPageResults.find(n => !n.read);
if (!notif) return;
opts.pulse();
if (!li.quietMode) li.sound.newPM();
const text = asText(notif);
if (text) notify(text);
}
示例2: notify
data.in.forEach(c => {
if (li.once('c-' + c.id)) {
if (!li.quietMode && data.in.length <= 3) {
opts.show();
li.sound.newChallenge();
}
c.challenger && notify(showUser(c.challenger) + ' challenges you!');
opts.pulse();
}
});
示例3: curCounter
return function curCounter() {
let secondsToStart = targetTime - Date.now() / 1000;
// always play the 0 sound before completing.
let bestTick = Math.max(0, Math.round(secondsToStart));
if (bestTick <= 10) li.sound['countDown' + bestTick]();
if (bestTick > 0) {
let nextTick = Math.min(10, bestTick - 1);
countDownTimeout = setTimeout(curCounter, 1000 *
Math.min(1.1, Math.max(0.8, (secondsToStart - nextTick))));
}
if (!started && bestTick <= 10) {
started = true;
notify('The tournament is starting!');
}
};
示例4: make
export function make(send: SocketSend, ctrl: RoundController): RoundSocket {
function reload(o: Incoming, isRetry?: boolean) {
// avoid reload if possible!
if (o && o.t) {
ctrl.setLoading(false);
handlers[o.t](o.d);
}
else xhr.reload(ctrl).then(data => {
if (li.socket.getVersion() > data.player.version) {
// race condition! try to reload again
if (isRetry) li.reload(); // give up and reload the page
else reload(o, true);
}
else ctrl.reload(data);
});
};
const handlers: Handlers = {
takebackOffers(o) {
ctrl.setLoading(false);
ctrl.data.player.proposingTakeback = o[ctrl.data.player.color];
const fromOp = ctrl.data.opponent.proposingTakeback = o[ctrl.data.opponent.color];
if (fromOp) notify(ctrl.trans('yourOpponentProposesATakeback'));
ctrl.redraw();
},
move: ctrl.apiMove,
drop: ctrl.apiMove,
reload,
redirect: ctrl.setRedirecting,
clockInc(o) {
if (ctrl.clock) {
ctrl.clock.addTime(o.color, o.time);
ctrl.redraw();
}
},
cclock(o) {
if (ctrl.corresClock) {
ctrl.data.correspondence.white = o.white;
ctrl.data.correspondence.black = o.black;
ctrl.corresClock.update(o.white, o.black);
ctrl.redraw();
}
},
crowd(o) {
game.setOnGame(ctrl.data, 'white', o['white']);
game.setOnGame(ctrl.data, 'black', o['black']);
ctrl.redraw();
},
// end: function(winner) { } // use endData instead
endData(o: ApiEnd) {
ctrl.endWithData(o);
},
rematchOffer(by: Color) {
ctrl.data.player.offeringRematch = by === ctrl.data.player.color;
const fromOp = ctrl.data.opponent.offeringRematch = by === ctrl.data.opponent.color;
if (fromOp) notify(ctrl.trans('yourOpponentWantsToPlayANewGameWithYou'));
ctrl.redraw();
},
rematchTaken(nextId: string) {
ctrl.data.game.rematch = nextId;
if (!ctrl.data.player.spectator) ctrl.setLoading(true);
else ctrl.redraw();
},
drawOffer(by) {
ctrl.data.player.offeringDraw = by === ctrl.data.player.color;
const fromOp = ctrl.data.opponent.offeringDraw = by === ctrl.data.opponent.color;
if (fromOp) notify(ctrl.trans('yourOpponentOffersADraw'));
ctrl.redraw();
},
berserk(color: Color) {
ctrl.setBerserk(color);
},
gone(isGone) {
if (!ctrl.data.opponent.ai) {
game.setIsGone(ctrl.data, ctrl.data.opponent.color, isGone);
ctrl.redraw();
}
},
checkCount(e) {
ctrl.data.player.checks = ctrl.data.player.color == 'white' ? e.white : e.black;
ctrl.data.opponent.checks = ctrl.data.opponent.color == 'white' ? e.white : e.black;
ctrl.redraw();
},
simulPlayerMove(gameId: string) {
if (
ctrl.opts.userId &&
ctrl.data.simul &&
ctrl.opts.userId == ctrl.data.simul.hostId &&
gameId !== ctrl.data.game.id &&
ctrl.moveOn.get() &&
ctrl.chessground.state.turnColor !== ctrl.chessground.state.movable.color) {
ctrl.setRedirecting();
sound.move();
li.hasToReload = true;
location.href = '/' + gameId;
}
},
simulEnd(simul: game.Simul) {
li.loadCssPath('modal');
//.........这里部分代码省略.........