本文整理汇总了TypeScript中common/actions.actions.downloadQueued方法的典型用法代码示例。如果您正苦于以下问题:TypeScript actions.downloadQueued方法的具体用法?TypeScript actions.downloadQueued怎么用?TypeScript actions.downloadQueued使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common/actions.actions
的用法示例。
在下文中一共展示了actions.downloadQueued方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
watcher.on(actions.queueCaveReinstall, async (store, action) => {
const { caveId } = action.payload;
await mcall(messages.InstallQueue, {
caveId,
reason: DownloadReason.Reinstall,
queueDownload: true,
});
store.dispatch(actions.downloadQueued({}));
});
示例2: async
watcher.on(actions.queueGameUpdate, async (store, action) => {
const { update } = action.payload;
const { game, upload, build } = update;
await call(messages.InstallQueue, {
caveId: update.itemId,
game,
upload,
build,
reason: DownloadReason.Update,
queueDownload: true,
});
store.dispatch(actions.downloadQueued({}));
});
示例3: performInstallQueue
async function performInstallQueue({
store,
logger,
game,
upload,
build,
}: {
store: IStore;
logger: Logger;
game: Game;
upload: Upload;
build: Build;
}) {
const installLocationId = defaultInstallLocation(store);
await withLogger(logger)(
messages.InstallQueue,
{
game,
upload,
build,
installLocationId,
queueDownload: true,
},
client => {
client.on(messages.PickUpload, async ({ uploads }) => {
const { title } = game;
const modalRes = await promisedModal(
store,
modalWidgets.pickUpload.make({
window: "root",
title: ["pick_install_upload.title", { title }],
message: ["pick_install_upload.message", { title }],
coverUrl: game.coverUrl,
stillCoverUrl: game.stillCoverUrl,
bigButtons: map(uploads, (candidate, index) => {
return {
...makeUploadButton(candidate),
action: modalWidgets.pickUpload.action({
pickedUploadIndex: index,
}),
};
}),
buttons: ["cancel"],
widgetParams: {},
})
);
if (modalRes) {
return { index: modalRes.pickedUploadIndex };
} else {
// that tells butler to abort
return { index: -1 };
}
});
client.on(messages.ExternalUploadsAreBad, async () => {
const modalRes = await promisedModal(
store,
modalWidgets.naked.make({
window: "root",
title: "Dragons be thar",
message:
"You've chosen to install an external upload. Those are supported poorly.",
detail:
"There's a chance it won't install at all.\n\nAlso, we won't be able to check for updates.",
bigButtons: [
{
label: "Install it anyway",
tags: [{ label: "Consequences be damned" }],
icon: "fire",
action: actions.modalResponse({}),
},
"nevermind",
],
widgetParams: null,
})
);
if (!modalRes) {
return { whatever: false };
}
// ahh damn.
return { whatever: true };
});
}
);
store.dispatch(actions.downloadQueued({}));
}