DefinitelyTyped/types/domexception/webidl2js-wrapper.d.ts
ExE Boss 02dea6062f feat: Add domexception (#41390)
* feat: Add `domexception`

* fix(domexception): Hide internal implementation details
2020-01-07 16:58:23 -08:00

67 lines
2.0 KiB
TypeScript

import { Options as WebIDLConversionOptions } from 'webidl-conversions';
import { implementation as DOMExceptionImpl } from './lib/DOMException-impl';
/**
* Checks whether `obj` is a `DOMException` object with an implementation
* provided by this package.
*/
export function is(obj: unknown): obj is DOMException;
/**
* Checks whether `obj` is a `DOMException` WebIDL2JS implementation object
* provided by this package.
*/
export function isImpl(obj: unknown): obj is DOMExceptionImpl;
/**
* Converts the `DOMException` wrapper into a `DOMExceptionImpl` object.
*
* @throws {TypeError} If `obj` is not a `DOMException` wrapper instance provided by this package.
*/
export function convert(obj: unknown, options?: WebIDLConversionOptions): DOMExceptionImpl;
/**
* Creates a new `DOMException` instance.
*
* @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
* registry or a `DOMException` constructor provided by this package
* in the WebIDL2JS constructor registry.
*/
export function create(
globalObject: object,
[message, name]?: [string?, string?],
privateData?: {},
): DOMException;
/**
* Calls `create()` and returns the internal `DOMExceptionImpl`.
*
* @throws {Error} If the `globalObject` doesn't have a WebIDL2JS constructor
* registry or a `DOMException` constructor provided by this package
* in the WebIDL2JS constructor registry.
*/
export function createImpl(
globalObject: object,
[message, name]?: [string?, string?],
privateData?: {},
): DOMExceptionImpl;
/**
* Initializes the `DOMException` instance, called by `create()`.
*
* Useful when manually sub-classing a non-constructable wrapper object.
*/
export function setup<T extends DOMException>(
obj: T,
globalObject: object,
[message, name]?: [string?, string?],
privateData?: {},
): T;
/**
* Installs the `DOMException` constructor onto the `globalObject`.
*
* @throws {Error} If the target `globalObject` doesn't have an `Error` constructor.
*/
export function install(globalObject: object): void;