/
opt
/
canhelp
/
node_modules
/
node-domexception
/
.history
/
/opt/canhelp/node_modules/node-domexception/.history
mkdir
upload
Name
Size
Mode
Actions
index_20210527203842.js
0
0644
edit
dl
rm
index_20210527203947.js
262
0644
edit
dl
rm
index_20210527204259.js
279
0644
edit
dl
rm
index_20210527204418.js
305
0644
edit
dl
rm
index_20210527204756.js
384
0644
edit
dl
rm
index_20210527204833.js
395
0644
edit
dl
rm
index_20210527211208.js
446
0644
edit
dl
rm
index_20210527211248.js
448
0644
edit
dl
rm
index_20210527212722.js
780
0644
edit
dl
rm
index_20210527212731.js
780
0644
edit
dl
rm
index_20210527212746.js
448
0644
edit
dl
rm
index_20210527212900.js
474
0644
edit
dl
rm
index_20210527213022.js
497
0644
edit
dl
rm
index_20210527213822.js
500
0644
edit
dl
rm
index_20210527213843.js
508
0644
edit
dl
rm
index_20210527213852.js
510
0644
edit
dl
rm
index_20210527213910.js
461
0644
edit
dl
rm
index_20210527214034.js
461
0644
edit
dl
rm
index_20210527214643.js
1189
0644
edit
dl
rm
index_20210527214654.js
1189
0644
edit
dl
rm
index_20210527214700.js
461
0644
edit
dl
rm
package_20210527203733.json
537
0644
edit
dl
rm
package_20210527203825.json
478
0644
edit
dl
rm
package_20210527204621.json
521
0644
edit
dl
rm
package_20210527204913.json
633
0644
edit
dl
rm
package_20210527204925.json
633
0644
edit
dl
rm
package_20210527205145.json
716
0644
edit
dl
rm
package_20210527205156.json
716
0644
edit
dl
rm
README_20210527203617.md
76
0644
edit
dl
rm
README_20210527212714.md
1670
0644
edit
dl
rm
README_20210527213345.md
1524
0644
edit
dl
rm
README_20210527213411.md
1534
0644
edit
dl
rm
README_20210527213803.md
1602
0644
edit
dl
rm
README_20210527214323.md
1686
0644
edit
dl
rm
README_20210527214408.md
1686
0644
edit
dl
rm
test_20210527205603.js
0
0644
edit
dl
rm
test_20210527205957.js
64
0644
edit
dl
rm
test_20210527210021.js
63
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/node-domexception/.history/README_20210527214408.md
(1686B)
# DOMException An implementation of the DOMException class from NodeJS This package exposes the [`DOMException`](https://developer.mozilla.org/en-US/docs/Web/API/DOMException) class that comes from NodeJS itself. (including all of the deprecated legacy codes) NodeJS has it built in, but it's not globally available, and you can't require/import it from somewhere. The only possible way is to use some web-ish tools that have been introduced into NodeJS that throws an error and catch the constructor. This way you will have the same class that NodeJS has and you can check if the error is a instance of DOMException. The instanceof check would not have worked with a custom class such as the DOMException provided by domenic which also is much larger in size since it has to re-construct the hole class from the ground up. (plz don't depend on this package in any other environment other than node >=10.5) ```js import DOMException from 'node-domexception' import { MessageChannel } from 'worker_threads' async function hello() { const port = new MessageChannel().port1 const ab = new ArrayBuffer() port.postMessage(ab, [ab, ab]) } hello().catch(err => { console.assert(err.name === 'DataCloneError') console.assert(err.code === 25) console.assert(err instanceof DOMException) }) const e1 = new DOMException('Something went wrong', 'BadThingsError') console.assert(e1.name === 'BadThingsError') console.assert(e1.code === 0) const e2 = new DOMException('Another exciting error message', 'NoModificationAllowedError') console.assert(e2.name === 'NoModificationAllowedError') console.assert(e2.code === 7) console.assert(DOMException.INUSE_ATTRIBUTE_ERR === 10) ```
Save
cmd:
run