@launchmenu/core
Version:
An environment for visual keyboard controlled applets
70 lines • 2.75 kB
TypeScript
import { IIOContext } from "./_types/IIOContext";
import { IUndoRedoFacility } from "../undoRedo/_types/IUndoRedoFacility";
import { SettingsContext } from "../settings/SettingsContext";
import { ISubscribable } from "../utils/subscribables/_types/ISubscribable";
import { Field, IDataHook } from "model-react";
import { IUILayer } from "../uiLayers/_types/IUILayer";
import { IActionBinding } from "../actions/_types/IActionBinding";
import { LMSession } from "../application/LMSession/LMSession";
export declare class IOContext implements IIOContext {
readonly undoRedo: IUndoRedoFacility;
settings: SettingsContext;
readonly contextMenuBindings: ISubscribable<IActionBinding[]>;
readonly session?: LMSession;
protected closeLayer: Promise<() => void> | undefined;
protected uiStack: Field<{
onClose?: (() => void) | undefined;
layer: IUILayer;
}[]>;
/**
* Retrieves whether running in development mode
* @param hook The hook to subscribe to changes
* @returns Whether the application is in development mode
*/
readonly isInDevMode: (hook?: IDataHook) => boolean;
/**
* Creates a new context
* @param context The context data
*/
constructor(data: {
isInDevMode?: (hook?: IDataHook) => boolean;
undoRedo?: IUndoRedoFacility;
settings?: SettingsContext;
contextMenuBindings?: ISubscribable<IActionBinding[]>;
session?: LMSession;
parent?: IIOContext;
});
/**
* Retrieves all the UI data opened in this context
* @param hook The hook to subscribe to changes
* @returns All the opened UI layers
*/
getUI(hook?: IDataHook): IUILayer[];
/**
* Opens the given UI layer
* @param layer The layer of UI data to open
* @param config Extra configuration
* @returns A function that can be used to close the opened layer
*/
open(layer: IUILayer, config?: {
/** A callback to perform when the layer is closed */
onClose?: () => void | Promise<void>;
/** The index on the stack to open this layer at */
index?: number;
}): Promise<() => Promise<void>>;
/**
* Closes the given UI layer
* @param layer The layer of UI data to close
*/
close(layer: IUILayer): Promise<void>;
/**
* Removes all layers from this context, properly destroying it
*/
destroy(): Promise<void>;
/**
* Closes all layers opened in this context
* @param closeSessionLayer Whether to also close the base session layer
*/
closeAll(closeSessionLayer?: boolean): Promise<void>;
}
//# sourceMappingURL=IOContext.d.ts.map