-
-
Notifications
You must be signed in to change notification settings - Fork 137
/
Copy path.markdown-doctest-setup.js
66 lines (56 loc) · 1.14 KB
/
.markdown-doctest-setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
var xstream = require('./index').default;
var eventsModule = require('events');
function noop () {}
class FakeEventTarget {
constructor() {}
emit(x) {
if (typeof this.handler !== 'function') {
return;
}
this.handler.call(void 0, x);
}
addEventListener(e, handler, capture) {
this.event = e;
this.handler = handler;
this.capture = capture;
}
removeEventListener(e, handler, capture) {
this.removedEvent = e;
this.removedCapture = capture;
this.handler = this.event = this.capture = void 0;
}
dispatchEvent(event) {
return true;
}
querySelector() {
return this;
}
}
module.exports = {
require: {
xstream: xstream,
events: eventsModule,
},
regexRequire: {
'xstream/extra/(.*)': function (_, extra) {
return require('./extra/' + extra).default;
}
},
globals: {
xs: xstream,
stream: xstream.empty(),
A: xstream.never(),
B: xstream.never(),
setInterval: noop,
console: {
log: noop,
error: noop
},
document: new FakeEventTarget(),
listener: {
next: noop,
error: noop,
complete: noop
}
}
}