版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1 год назад
12345678910111213141516171819202122232425262728293031
  1. # DOMException
  2. This package implements the [`DOMException`](https://heycam.github.io/webidl/#idl-DOMException) class, from web browsers. It exists in service of [jsdom](https://github.com/jsdom/jsdom) and related packages.
  3. Example usage:
  4. ```js
  5. const DOMException = require("domexception");
  6. const e1 = new DOMException("Something went wrong", "BadThingsError");
  7. console.assert(e1.name === "BadThingsError");
  8. console.assert(e1.code === 0);
  9. const e2 = new DOMException("Another exciting error message", "NoModificationAllowedError");
  10. console.assert(e2.name === "NoModificationAllowedError");
  11. console.assert(e2.code === 7);
  12. console.assert(DOMException.INUSE_ATTRIBUTE_ERR === 10);
  13. ```
  14. ## APIs
  15. This package exposes two flavors of the `DOMException` interface depending on the imported module.
  16. ### `domexception` module
  17. This module default-exports the `DOMException` interface constructor.
  18. ### `domexception/webidl2js-wrapper` module
  19. This module exports the `DOMException` [interface wrapper API](https://github.com/jsdom/webidl2js#for-interfaces) generated by [webidl2js](https://github.com/jsdom/webidl2js).