本文整理匯總了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,
})
);
}
});