of method

Namespace of(
  1. dynamic name, [
  2. dynamic fn
])

Implementation

Namespace of(name, [fn]) {
  if (name.toString()[0] != '/') {
    name = '/' + name;
  }

  if (!nsps.containsKey(name)) {
    var nsp = Namespace(this, name);
    nsps[name] = nsp;
  }
  if (fn != null) nsps[name]!.on('connect', fn);
  return nsps[name]!;
}