vim-webgl-component
Version:
A demonstration app built on top of the vim-webgl-viewer
68 lines (67 loc) • 2.37 kB
TypeScript
/**
* @module viw-webgl-component
*/
import * as VIM from 'vim-webgl-viewer/';
import { LoadRequest } from '../helpers/loadRequest';
import { ModalRef } from '../panels/modal';
type AddSettings = {
/**
* Controls whether to frame the camera on a vim everytime it is updated.
* Default: true
*/
autoFrame?: boolean;
/**
* Controls whether to initially load the vim content or not.
* Default: false
*/
loadEmpty?: boolean;
};
export type OpenSettings = VIM.VimPartialSettings & AddSettings;
export type LoadingError = {
url: string;
error: string;
};
/**
* Provides functionality for asynchronously opening sources and tracking progress.
* Includes event emitters for progress updates and completion notifications.
*/
export declare class ComponentLoader {
private _viewer;
private _modal;
constructor(viewer: VIM.Viewer, modal: ModalRef);
/**
* Event emitter for progress updates.
*/
onProgress(p: VIM.IProgressLogs): void;
/**
* Event emitter for completion notifications.
*/
onDone(): void;
/**
* Event emitter for error notifications.
*/
onError(e: LoadingError): void;
/**
* Asynchronously opens a vim at source, applying the provided settings.
* @param source The source to open, either as a string or ArrayBuffer.
* @param settings Partial settings to apply to the opened source.
* @param onProgress Optional callback function to track progress during opening.
* Receives progress logs as input.
*/
open(source: VIM.RequestSource, settings: OpenSettings, onProgress?: (p: VIM.IProgressLogs) => void): Promise<VIM.Vim>;
/**
* Creates a new load request for the provided source and settings.
* @param source The url to the vim file or a buffer of the file.
* @param settings Settings to apply to vim file.
* @returns A new load request instance to track progress and get result.
*/
request(source: VIM.RequestSource, settings: VIM.VimPartialSettings): LoadRequest;
add(vim: VIM.Vim, settings?: AddSettings): void;
/**
* Removes the vim from the viewer and disposes it.
* @param vim Vim to remove from the viewer.
*/
remove(vim: VIM.Vim): void;
private initVim;
}
export {};