@thepassle/app-tools
Version:
Collection of tools I regularly use to build apps. Maybe they're useful to somebody else. Maybe not. Most of these are thin wrappers around native API's, like the native `<dialog>` element, `fetch` API, and `URLPattern`.
20 lines (19 loc) • 557 B
TypeScript
export type DialogNode = HTMLDialogElement & {
form: HTMLFormElement;
};
export interface DialogCallbacks {
opening?: <Parameters>(context: Context) => void;
opened?: <Parameters>(context: Context) => void;
closing?: (context: Context) => void;
closed?: (context: Context) => void;
}
export type Config = Record<string, DialogCallbacks>;
export interface OpenDialogOptions {
id: string;
parameters?: object;
}
export interface Context {
dialog: DialogNode | undefined;
id: string;
parameters?: Record<string, any>;
}