Files: e9d9dec1d00ff365112ca0f981bbda15e3682528 / test / test-50-many-arrow-functions / test-z-creator.js
752 bytesRaw
1 | ; |
2 | |
3 | let s = 'function EventEmitter () {\n' + |
4 | ' this.listeners = [];\n' + |
5 | '}\n' + |
6 | 'EventEmitter.prototype.on = function (name, listener) {\n' + |
7 | ' this.listeners.push(listener);\n' + |
8 | '};\n' + |
9 | 'EventEmitter.prototype.emit = function (name, data) {\n' + |
10 | ' this.listeners.some((listener) => {\n' + |
11 | ' listener(data);\n' + |
12 | ' });\n' + |
13 | '};\n' + |
14 | 'const ee = new EventEmitter();\n'; |
15 | |
16 | for (let i = 0; i < 140; i += 1) { |
17 | s += 'ee.on(\'message\', (data) => {\n' + |
18 | ' console.log(data);\n' + |
19 | '});\n'; |
20 | } |
21 | |
22 | s += 'ee.emit(\'message\', \'hooray\');\n'; |
23 | |
24 | s = '\'use strict\';\n' + |
25 | '\n' + s; |
26 | |
27 | require('fs').writeFileSync( |
28 | 'test-x-index.js', s |
29 | ); |
30 |
Built with git-ssb-web