本文整理汇总了TypeScript中common/actions.actions.gameUpdateCheckStatus方法的典型用法代码示例。如果您正苦于以下问题:TypeScript actions.gameUpdateCheckStatus方法的具体用法?TypeScript actions.gameUpdateCheckStatus怎么用?TypeScript actions.gameUpdateCheckStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common/actions.actions
的用法示例。
在下文中一共展示了actions.gameUpdateCheckStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
watcher.on(actions.checkForGameUpdates, async (store, action) => {
reschedule(store);
if (!store.getState().setup.done) {
return;
}
store.dispatch(
actions.gameUpdateCheckStatus({
checking: true,
progress: 0,
})
);
try {
store.dispatch(
actions.gameUpdateCheckStatus({
checking: true,
progress: 0,
})
);
const res = await mcall(messages.CheckUpdate, {}, convo => {
hookLogging(convo, logger);
convo.on(messages.GameUpdateAvailable, async ({ update }) => {
store.dispatch(actions.gameUpdateAvailable({ update }));
});
convo.on(messages.Progress, async ({ progress }) => {
store.dispatch(
actions.gameUpdateCheckStatus({
checking: true,
progress,
})
);
});
});
if (!isEmpty(res.updates)) {
for (const update of res.updates) {
store.dispatch(actions.gameUpdateAvailable({ update }));
}
}
if (!isEmpty(res.warnings)) {
logger.warn(`Got warnings when checking for updates: `);
for (const w of res.warnings) {
logger.warn(w);
}
}
} finally {
store.dispatch(
actions.gameUpdateCheckStatus({
checking: false,
progress: -1,
})
);
}
});
示例2: async
watcher.on(actions.checkForGameUpdates, async (store, action) => {
reschedule(store);
if (!store.getState().setup.done) {
return;
}
store.dispatch(
actions.gameUpdateCheckStatus({
checking: true,
progress: 0,
})
);
try {
store.dispatch(
actions.gameUpdateCheckStatus({
checking: true,
progress: 0,
})
);
// TODO: let butler page through the caves instead,
// this is too much back and forth
const { caves } = await call(messages.FetchCaves, {});
if (isEmpty(caves)) {
return;
}
logger.info(`Checking updates for ${caves.length} games`);
let items: CheckUpdateItem[] = [];
for (const cave of caves) {
try {
items.push(await prepareUpdateItem(cave));
} catch (e) {
logger.error(
`Won't be able to check ${cave.id} for upgrade: ${e.stack}`
);
}
}
try {
await performUpdateCheck(store, items);
} catch (e) {
logger.error(
`While performing ${items.length} update checks: ${e.stack}`
);
}
} finally {
store.dispatch(
actions.gameUpdateCheckStatus({
checking: false,
progress: -1,
})
);
}
});