UNPKG

@mlightcad/common

Version:

The common package provides shared utilities and base classes that are used across the RealDWG-Web ecosystem. This package contains fundamental components for color management, event handling, logging, performance monitoring, and file loading operations.

58 lines 2.61 kB
import { AcCmLoader, AcCmLoaderProgressCallback } from './AcCmLoader'; import { AcCmLoadingManager, AcCmOnErrorCallback, AcCmOnLoadCallback } from './AcCmLoadingManager'; /** * The response type. Valid values are: * - text or empty string (default) - returns the data as String. * - arraybuffer - loads the data into a ArrayBuffer and returns that. * - blob - returns the data as a Blob. * - document - parses the file using the DOMParser. * - json - parses the file using JSON.parse. */ type AcCmResponseType = '' | 'text' | 'arraybuffer' | 'blob' | 'document' | 'json'; /** * A low level class for loading resources with 'Fetch', used internally by most loaders. It can also * be used directly to load any file type that does not have a loader. */ export declare class AcCmFileLoader extends AcCmLoader { /** * The expected mimeType. Default is undefined. */ mimeType?: DOMParserSupportedType; /** * The expected response type. Default is undefined. */ responseType?: AcCmResponseType; /** * Create a new AcCmFileLoader instance. * @param manager The loadingManager for the loader to use. Default is DefaultLoadingManager. */ constructor(manager?: AcCmLoadingManager); /** * Load the URL and pass the response to the onLoad function. * @param url The path or URL to the file. This can also be a Data URI. * @param onLoad (optional) — Will be called when loading completes. * @param onProgress (optional) — Will be called while load progresses. * @param onError (optional) — Will be called if an error occurs. */ load(url: string, onLoad: AcCmOnLoadCallback, onProgress: AcCmLoaderProgressCallback, onError: AcCmOnErrorCallback): void; /** * Change the response type. Valid values are: * - text or empty string (default) - returns the data as String. * - arraybuffer - loads the data into a ArrayBuffer and returns that. * - blob - returns the data as a Blob. * - document - parses the file using the DOMParser. * - json - parses the file using JSON.parse. * @param value * @returns Return this object */ setResponseType(value: AcCmResponseType): this; /** * Set the expected mimeType of the file being loaded. Note that in many cases this will be determined * automatically, so by default it is undefined. * @param value The expected mimeType of the file being loaded. * @returns Return this object. */ setMimeType(value: DOMParserSupportedType): this; } export {}; //# sourceMappingURL=AcCmFileLoader.d.ts.map