node-domexception/.history/index_20210527204833.js
raw| 1 | /*! blob-to-buffer. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */ |
| 2 | |
| 3 | if (!globalThis.DOMException) { |
| 4 | const { MessageChannel } = require('worker_threads') |
| 5 | const port = new MessageChannel().port1 |
| 6 | const ab = new ArrayBuffer() |
| 7 | try { port.postMessage(ab, [ab, ab]) } |
| 8 | catch (err) { globalThis.DOMException = err.constructor } |
| 9 | } |
| 10 | |
| 11 | module.exports = globalThis.DOMException |