Skip to content

Commit a56100a

Browse files
committed
reexport the event-target-shim
1 parent 02101f9 commit a56100a

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"scripts": {
3030
"lint": "eslint --max-warnings 0 . && tsc --noEmit",
3131
"lintfix": "eslint --max-warnings 0 --fix . && tsc --noEmit",
32-
"prepare": "husky install && bob build",
32+
"copy-vendor-types": "node scripts/copy-vendor-types.js",
33+
"build": "bob build && npm run copy-vendor-types",
34+
"prepare": "husky install && npm run build",
3335
"format": "tools/format.sh"
3436
},
3537
"bugs": {

scripts/copy-vendor-types.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
6+
const root = path.join(__dirname, '..');
7+
const src = path.join(root, 'src/vendor/event-target-shim/index.d.ts');
8+
const dest = path.join(root, 'lib/typescript/vendor/event-target-shim/index.d.ts');
9+
10+
if (!fs.existsSync(src)) {
11+
console.error('copy-vendor-types: missing', src);
12+
process.exit(1);
13+
}
14+
fs.mkdirSync(path.dirname(dest), { recursive: true });
15+
fs.copyFileSync(src, dest);

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ if (WebRTCModule === null) {
88
}`);
99
}
1010

11+
import { Event, EventTarget, getEventAttributeValue, setEventAttributeValue } from './vendor/event-target-shim';
1112
import { setupNativeEvents } from './EventEmitter';
1213
import Logger from './Logger';
1314
import mediaDevices from './MediaDevices';
@@ -40,6 +41,10 @@ Logger.enable(`${Logger.ROOT_PREFIX}:*`);
4041
setupNativeEvents();
4142

4243
export {
44+
Event,
45+
EventTarget,
46+
getEventAttributeValue,
47+
setEventAttributeValue,
4348
RTCIceCandidate,
4449
RTCPeerConnection,
4550
RTCSessionDescription,

0 commit comments

Comments
 (0)