/** * Mask object for context masquerade. It is used to artificially restrict the capabilities of context instances. * It is intended to simplify cross-browser testing without actually using different browsers. * * A mask can be instantiated in four different ways: * 1. by creating the object and explicitly configuring all values as required. * 2. from a preset identifier (all presets are stored in assets/masquerade.json). * 3. from an extension hash * 4. from GET parameters, either 'msqrd_p=' or 'msqrd_h='. * * Intended use; when the context's static masquerade is set, all subsequent instances apply that mask: * ``` * Context.masquerade = ContextMasquerade.fromHash('288M01-o'); * ``` */ export declare class ContextMasquerade { /** @see {@link presets} */ protected static readonly MASQUERADE_JSON: Array; /** @see {@link backend} */ protected _backend: string; /** @see {@link extensionsStrive} */ protected _extensionsStrive: string[]; /** @see {@link extensionsConceal} */ protected _extensionsConceal: string[]; /** @see {@link functionsUndefine} */ protected _functionsUndefine: string[]; /** * Generates a mask based on an extensions hash (encoding backend and extensions_strive). If extensions are strived * for, all extensions that are not explicitly mentioned will be added to the list of concealed extensions. * @param hash - Hash that is to be decoded for backend and extensions data. */ static fromHash(hash: string): ContextMasquerade; /** * Creates a context mask based on a preset. Note that the presence of an extensions_hash overrides the backend, * extensions_strive, as well as extensions_conceal. Only the functions_undefine will be preserved in that case. * @param identifier - Name of a preset as specified in masquerade.json. */ static fromPreset(identifier: string): ContextMasquerade; /** * Tries to generate a mask based on GET parameters: if msqrd_h is present, its value is interpreted as * extensions hash and a mask is generated from hash. If no hash was found, presence of msqrd_p is evaluated and if * found, a mask is generated from preset identifier. */ static fromGET(): ContextMasquerade | undefined; static presets(): Array; /** * Defines the backend (currently either 'webgl1' or 'webgl2'). */ get backend(): string; /** * Extensions that the context should strive to support. The support can only go as far as the extensions are * actually supported. */ get extensionsStrive(): Array; /** * Extensions that the context should conceal support of. This only affects supported extensions, which will * be reported to be not supported. */ get extensionsConceal(): Array; /** * Functions that the context should delete during construction. Since WebGL context functions cannot be deleted * they are undefined instead. */ get functionsUndefine(): Array; } export declare namespace ContextMasquerade { /** * Interfaces required to prevent implicit any when parsing masquerade.json. */ interface Preset { identifier: string; backend?: string; extensions_hash?: string; extensions_strive?: Array; extensions_conceal?: Array; functions_undefine?: Array; } }