summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts/select-file.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-12-10 01:22:22 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-12-10 01:22:22 +0900
commit46c02807647bf61188267bfb05db0eeb53660be8 (patch)
tree9fe395c3528366f205f9181b59309fe934ede0a5 /packages/client/src/scripts/select-file.ts
parentUpdate .eslintrc.js (diff)
downloadsharkey-46c02807647bf61188267bfb05db0eeb53660be8.tar.gz
sharkey-46c02807647bf61188267bfb05db0eeb53660be8.tar.bz2
sharkey-46c02807647bf61188267bfb05db0eeb53660be8.zip
refactor(client): :sparkles:
Diffstat (limited to 'packages/client/src/scripts/select-file.ts')
-rw-r--r--packages/client/src/scripts/select-file.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/client/src/scripts/select-file.ts b/packages/client/src/scripts/select-file.ts
index 0c6bd7ccde..6019890444 100644
--- a/packages/client/src/scripts/select-file.ts
+++ b/packages/client/src/scripts/select-file.ts
@@ -1,8 +1,9 @@
import * as os from '@/os';
import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
+import { DriveFile } from 'misskey-js/built/entities';
-export function selectFile(src: any, label: string | null, multiple = false) {
+function select(src: any, label: string | null, multiple: boolean): Promise<DriveFile | DriveFile[]> {
return new Promise((res, rej) => {
const chooseFileFromPc = () => {
const input = document.createElement('input');
@@ -86,3 +87,11 @@ export function selectFile(src: any, label: string | null, multiple = false) {
}], src);
});
}
+
+export function selectFile(src: any, label: string | null = null): Promise<DriveFile> {
+ return select(src, label, false) as Promise<DriveFile>;
+}
+
+export function selectFiles(src: any, label: string | null = null): Promise<DriveFile[]> {
+ return select(src, label, true) as Promise<DriveFile[]>;
+}