public void unsubscribe(RouteAware routeAware) { D.assert(routeAware != null); foreach (R route in this._listeners.Keys) { HashSet<RouteAware> subscribers = this._listeners[route]; subscribers?.Remove(routeAware); } }
public void subscribe(RouteAware routeAware, R route) { D.assert(routeAware != null); D.assert(route != null); HashSet<RouteAware> subscribers = this._listeners.putIfAbsent(route, () => new HashSet<RouteAware>()); if (subscribers.Add(routeAware)) { routeAware.didPush(); } }