Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | exports.ParentNamespace = void 0;
|
---|
4 | const namespace_1 = require("./namespace");
|
---|
5 | class ParentNamespace extends namespace_1.Namespace {
|
---|
6 | constructor(server) {
|
---|
7 | super(server, "/_" + ParentNamespace.count++);
|
---|
8 | this.children = new Set();
|
---|
9 | }
|
---|
10 | /**
|
---|
11 | * @private
|
---|
12 | */
|
---|
13 | _initAdapter() {
|
---|
14 | /* no-op */
|
---|
15 | }
|
---|
16 | emit(ev, ...args) {
|
---|
17 | this.children.forEach((nsp) => {
|
---|
18 | nsp._rooms = this._rooms;
|
---|
19 | nsp._flags = this._flags;
|
---|
20 | nsp.emit(ev, ...args);
|
---|
21 | });
|
---|
22 | this._rooms.clear();
|
---|
23 | this._flags = {};
|
---|
24 | return true;
|
---|
25 | }
|
---|
26 | createChild(name) {
|
---|
27 | const namespace = new namespace_1.Namespace(this.server, name);
|
---|
28 | namespace._fns = this._fns.slice(0);
|
---|
29 | this.listeners("connect").forEach((listener) => namespace.on("connect", listener));
|
---|
30 | this.listeners("connection").forEach((listener) => namespace.on("connection", listener));
|
---|
31 | this.children.add(namespace);
|
---|
32 | this.server._nsps.set(name, namespace);
|
---|
33 | return namespace;
|
---|
34 | }
|
---|
35 | }
|
---|
36 | exports.ParentNamespace = ParentNamespace;
|
---|
37 | ParentNamespace.count = 0;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.