Skip to main content

FileOpenerControls

How the file opener contract plays the person and the browser. A real adapter implements these by acting on the file input it shows.

This is an interface exported by @mapcairn/core/contracts, checked against version 0.2.0.

Signature​

import type { FileOpenerControls } from "@mapcairn/core/contracts";

interface FileOpenerControls

Methods​

cancel​

cancel(): void;

The person closes the picker without choosing.

choose​

choose(file: OpenedFile): void;

The person chooses this file in the picker that is open.

  • file (OpenedFile)

willFail​

willFail(kind: Extract<FileOpenErrorKind, "unsupported" | "unreadable">): void;

Makes later opens fail: unsupported at once, as a browser that cannot open files does, and unreadable when the person chooses a file.

  • kind (Extract<FileOpenErrorKind, "unsupported" | "unreadable">)

See also​

Source: packages/core/src/contracts/fileOpener.contract.ts:11