source: trip-planner-front/node_modules/events/tests/symbols.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 627 bytes
Line 
1'use strict';
2
3var common = require('./common');
4var EventEmitter = require('../');
5var assert = require('assert');
6
7var ee = new EventEmitter();
8var foo = Symbol('foo');
9var listener = common.mustCall();
10
11ee.on(foo, listener);
12assert.strictEqual(ee.listeners(foo).length, 1);
13assert.strictEqual(ee.listeners(foo)[0], listener);
14
15ee.emit(foo);
16
17ee.removeAllListeners();
18assert.strictEqual(ee.listeners(foo).length, 0);
19
20ee.on(foo, listener);
21assert.strictEqual(ee.listeners(foo).length, 1);
22assert.strictEqual(ee.listeners(foo)[0], listener);
23
24ee.removeListener(foo, listener);
25assert.strictEqual(ee.listeners(foo).length, 0);
Note: See TracBrowser for help on using the repository browser.