Last change
on this file since b738035 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 |
|
---|
3 | var common = require('./common');
|
---|
4 | var EventEmitter = require('../');
|
---|
5 | var assert = require('assert');
|
---|
6 |
|
---|
7 | var ee = new EventEmitter();
|
---|
8 | var foo = Symbol('foo');
|
---|
9 | var listener = common.mustCall();
|
---|
10 |
|
---|
11 | ee.on(foo, listener);
|
---|
12 | assert.strictEqual(ee.listeners(foo).length, 1);
|
---|
13 | assert.strictEqual(ee.listeners(foo)[0], listener);
|
---|
14 |
|
---|
15 | ee.emit(foo);
|
---|
16 |
|
---|
17 | ee.removeAllListeners();
|
---|
18 | assert.strictEqual(ee.listeners(foo).length, 0);
|
---|
19 |
|
---|
20 | ee.on(foo, listener);
|
---|
21 | assert.strictEqual(ee.listeners(foo).length, 1);
|
---|
22 | assert.strictEqual(ee.listeners(foo)[0], listener);
|
---|
23 |
|
---|
24 | ee.removeListener(foo, listener);
|
---|
25 | assert.strictEqual(ee.listeners(foo).length, 0);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.