-
Notifications
You must be signed in to change notification settings - Fork 5
Introducing Scopes #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introducing Scopes #102
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
type Channels = (keyof typeof this.channelLookup)[]; | ||
(Object.keys(this.channelLookup) as Channels).forEach((channelName) => this.dispose(channelName)); | ||
|
||
if (this._parent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to remove ourselves from the parents children array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've currently got it set up so that there is no children's array anymore. Since messages only propagate up, I didn't have a use for storing children
I'm going to close this PR for now and reraise it later with some rewrites |
I have added the concept of Scopes to the MessageBroker. This is a mechanism for building a tree of message brokers in which messages will propagate up the tree until either the root is reacher, or a broker is found which has a subscriber to handle the message.
One outstanding question on this implementation is if the semantics for disposing of a scope is complete. Currently you can
.destroy()
a broker, which will unlink it from its parent meaning messages will no longer propagate up. Should this functionality do anything else? E.g. should it unlink itself from any children scopes as well?