import { EventTypes } from '../../events/EventTypes.js';
import { PlatformBindings } from './PlatformBindings.js';
/**
 * The base class for file access bindings.
 */
export class FileBindings extends PlatformBindings {
    async initialize() {
        window.addEventListener(EventTypes.Filesystem.requestSaveFile, this.handleRequestSaveFile.bind(this));
        window.addEventListener(EventTypes.Filesystem.requestOpenFile, this.handleRequestOpenFile.bind(this));
        window.addEventListener(EventTypes.Filesystem.writeFile, this.handleWriteFile.bind(this));
        window.addEventListener(EventTypes.Filesystem.readFile, this.handleReadFile.bind(this));
    }
    handleRequestSaveFile(e) {
        const event = e;
        event.detail.result = this.saveFileDialog(event.detail.options);
    }
    handleRequestOpenFile(e) {
        const event = e;
        event.detail.result = this.openFileDialog(event.detail.options);
    }
    handleWriteFile(e) {
        const event = e;
        event.detail.result = this.writeFile(event.detail.path, event.detail.contents, event.detail.options);
    }
    handleReadFile(e) {
        const event = e;
        event.detail.result = this.readFile(event.detail.path, event.detail.options);
    }
}
//# sourceMappingURL=FileBindings.js.map