git ssb

0+

cel-desktop / ssb-pkg



Tree: 938b7ea4cfaa3cef6e1690b9ef3ea8bd7a0d2de1

Files: 938b7ea4cfaa3cef6e1690b9ef3ea8bd7a0d2de1 / test / test-50-many-arrow-functions / test-z-creator.js

752 bytesRaw
1'use strict';
2
3let 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
16for (let i = 0; i < 140; i += 1) {
17 s += 'ee.on(\'message\', (data) => {\n' +
18 ' console.log(data);\n' +
19 '});\n';
20}
21
22s += 'ee.emit(\'message\', \'hooray\');\n';
23
24s = '\'use strict\';\n' +
25 '\n' + s;
26
27require('fs').writeFileSync(
28 'test-x-index.js', s
29);
30

Built with git-ssb-web