From e3ba54260a73acaca1d36fed54179668f446fc88 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Sat, 24 Feb 2024 18:55:05 +0100 Subject: feat(web): file open and save In-place saving is only supported in Chromium. --- subprojects/frontend/types/filesystemAccess.d.ts | 25 ++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'subprojects/frontend/types') diff --git a/subprojects/frontend/types/filesystemAccess.d.ts b/subprojects/frontend/types/filesystemAccess.d.ts index 000cd2a5..e9accc77 100644 --- a/subprojects/frontend/types/filesystemAccess.d.ts +++ b/subprojects/frontend/types/filesystemAccess.d.ts @@ -5,7 +5,6 @@ */ interface FilePickerOptions { - suggestedName?: string; id?: string; types?: { description?: string; @@ -13,11 +12,29 @@ interface FilePickerOptions { }[]; } +interface FilePickerSaveOptions extends FilePickerOptions { + suggestedName?: string; +} + interface Window { showOpenFilePicker?: ( - options?: FilePickerOptions, - ) => Promise; + options?: FilePickerOpenOptions, + ) => Promise; showSaveFilePicker?: ( - options?: FilePickerOptions, + options?: FilePickerSaveOptions, ) => Promise; } + +interface FileSystemHandlePermissionDescriptor { + mode?: 'read' | 'readwrite'; +} + +interface FileSystemHandle { + queryPermission?: ( + options?: FileSystemHandlePermissionDescriptor, + ) => Promise; + + requestPermission?: ( + options?: FileSystemHandlePermissionDescriptor, + ) => Promise; +} -- cgit v1.2.3-54-g00ecf