source: trip-planner-front/node_modules/socket.io/dist/parent-namespace.js@ 571e0df

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

primeNG components

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[6a3a178]1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.ParentNamespace = void 0;
4const namespace_1 = require("./namespace");
5class 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() {
[e29cc2e]14 const broadcast = (packet, opts) => {
15 this.children.forEach((nsp) => {
16 nsp.adapter.broadcast(packet, opts);
17 });
18 };
19 // @ts-ignore FIXME is there a way to declare an inner class in TypeScript?
20 this.adapter = { broadcast };
[6a3a178]21 }
22 emit(ev, ...args) {
23 this.children.forEach((nsp) => {
24 nsp.emit(ev, ...args);
25 });
26 return true;
27 }
28 createChild(name) {
29 const namespace = new namespace_1.Namespace(this.server, name);
30 namespace._fns = this._fns.slice(0);
31 this.listeners("connect").forEach((listener) => namespace.on("connect", listener));
32 this.listeners("connection").forEach((listener) => namespace.on("connection", listener));
33 this.children.add(namespace);
34 this.server._nsps.set(name, namespace);
35 return namespace;
36 }
37}
38exports.ParentNamespace = ParentNamespace;
39ParentNamespace.count = 0;
Note: See TracBrowser for help on using the repository browser.