Represents a theme on the file system.

interface VirtualFileSystem {
    addEventListener: (<T>(eventName, cb) => void);
    delete: ((fileKey) => Promise<void>);
    files: Map<string, ThemeAsset>;
    read: ((fileKey) => Promise<undefined | string | Buffer>);
    ready: (() => Promise<void>);
    root: string;
    unsyncedFileKeys: Set<string>;
    write: ((asset) => Promise<void>);
}

Hierarchy (view full)

Properties

addEventListener: (<T>(eventName, cb) => void)

Add callbacks to run after certain events are fired.

Type declaration

delete: ((fileKey) => Promise<void>)

Removes a file from the local disk and updates the file system

Type declaration

    • (fileKey): Promise<void>
    • Parameters

      • fileKey: string

        The key of the file to remove

      Returns Promise<void>

files: Map<string, ThemeAsset>

Local files.

read: ((fileKey) => Promise<undefined | string | Buffer>)

Reads a file from the local disk and updates the file system Returns a ThemeAsset representing the file that was read Returns undefined if the file does not exist

Type declaration

    • (fileKey): Promise<undefined | string | Buffer>
    • Parameters

      • fileKey: string

        The key of the file to read

      Returns Promise<undefined | string | Buffer>

ready: (() => Promise<void>)

Promise that resolves when all the initial files are found.

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

root: string

The root path of the theme.

unsyncedFileKeys: Set<string>

File keys that have been modified in memory and are not uploaded yet.

write: ((asset) => Promise<void>)

Writes a file to the local disk and updates the file system

Type declaration

    • (asset): Promise<void>
    • Parameters

      • asset: ThemeAsset

        The ThemeAsset representing the file to write

      Returns Promise<void>