UNPKG

@bitblit/asyncglk

Version:
52 lines (51 loc) 1.91 kB
import * as GlkOte from '../common/glkote.js'; import * as protocol from '../../common/protocol.js'; import Metrics from './metrics.js'; import { DOM } from './shared.js'; interface AutosaveState { graphics_bg?: [number, string][]; history?: string[]; transcript_recorder_session?: string; } /** A GlkOte implementation for the web * * WebGlkOte requires the following HTML divs to be present (though the id names can be varied through the options): * * ``` * <div id="gameport"> * <div id="windowport"></div> * <div id="loadingpane">Loading...</div> * <div id="errorpane" style="display:none;"><div id="errorcontent"></div></div> * </div> * ``` */ export default class WebGlkOte extends GlkOte.GlkOteBase implements GlkOte.GlkOte { dom: DOM; metrics_calculator: Metrics; private showing_error; private showing_loading; private transcript_recorder?; private windows; constructor(); init(options: GlkOte.GlkOteOptions): Promise<void>; protected autorestore(data: AutosaveState): void; protected cancel_inputs(windows: protocol.InputUpdate[]): void; protected capabilities(): string[]; protected disable(disable: boolean): void; private embellish_error; error(error: Error | string): void; protected exit(): void; getdomcontext(): HTMLElement | undefined; getdomid(name: string): string; private hide_loading; save_allstate(): AutosaveState; send_event(ev: Partial<protocol.Event>): void; setdomcontext(val: HTMLElement): void; protected set_page_bg(colour: string): void; update(data: protocol.Update): void; protected update_content(content: protocol.ContentUpdate[]): void; protected update_inputs(windows: protocol.InputUpdate[]): void; protected update_windows(windows: protocol.WindowUpdate[]): void; warning(msg: any): void; } export {};