chore: introduce response type (#738)
This commit is contained in:
parent
c2b98dc70b
commit
601a74305c
32 changed files with 443 additions and 526 deletions
|
|
@ -31,27 +31,20 @@ const handleDialog = defineTabTool({
|
|||
type: 'destructive',
|
||||
},
|
||||
|
||||
handle: async (tab, params) => {
|
||||
handle: async (tab, params, response) => {
|
||||
response.setIncludeSnapshot();
|
||||
|
||||
const dialogState = tab.modalStates().find(state => state.type === 'dialog');
|
||||
if (!dialogState)
|
||||
throw new Error('No dialog visible');
|
||||
|
||||
if (params.accept)
|
||||
await dialogState.dialog.accept(params.promptText);
|
||||
else
|
||||
await dialogState.dialog.dismiss();
|
||||
|
||||
tab.clearModalState(dialogState);
|
||||
|
||||
const code = [
|
||||
`// <internal code to handle "${dialogState.dialog.type()}" dialog>`,
|
||||
];
|
||||
|
||||
return {
|
||||
code,
|
||||
captureSnapshot: true,
|
||||
waitForNetwork: false,
|
||||
};
|
||||
await tab.run(async () => {
|
||||
if (params.accept)
|
||||
await dialogState.dialog.accept(params.promptText);
|
||||
else
|
||||
await dialogState.dialog.dismiss();
|
||||
}, response);
|
||||
},
|
||||
|
||||
clearsModalState: 'dialog',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue