@infinite-canvas-tutorial/webcomponents
Version:
WebComponents UI implementation
31 lines (30 loc) • 1.18 kB
TypeScript
/**
* borrow from https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/filesystem.ts#L80
*/
import { MIME_TYPES } from '@infinite-canvas-tutorial/ecs';
export declare const debounce: <T extends any[]>(fn: (...args: T) => void, timeout: number) => {
(...args: T): void;
flush(): void;
cancel(): void;
};
/**
* borrow from https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/filesystem.ts
*/
type FILE_EXTENSION = Exclude<keyof typeof MIME_TYPES, 'binary'>;
export declare const fileOpen: <M extends boolean | undefined = false>(opts: {
extensions?: FILE_EXTENSION[];
description: string;
multiple?: M;
}) => Promise<M extends false | undefined ? File : File[]>;
export declare const fileSave: (blob: Blob | Promise<Blob>, opts: {
/** supply without the extension */
name: string;
/** file extension */
extension: FILE_EXTENSION;
mimeTypes?: string[];
description: string;
/** existing FileSystemHandle */
fileHandle?: FileSystemFileHandle | null;
}) => Promise<FileSystemFileHandle>;
export declare function getDataURL(file: Blob | File): Promise<string>;
export {};