-
-
Notifications
You must be signed in to change notification settings - Fork 242
feat: Add Messenger parent
parameter
#6142
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
base: add-messenger-delegation
Are you sure you want to change the base?
Conversation
The methods `delegate` and `revoke` have been added to the Messenger class. These methods replace the need for the `RestrictedMessenger`. The `getRestricted` method, and the `RestrictedMessenger` class, have been removed as obsolete. See this ADR PR for details: MetaMask/decisions#53
73f9dd4
to
c07ba89
Compare
c07ba89
to
4ff719e
Compare
Add the `parent` constructor parameter to the `Messenger` class for automatic delegation of all capabilities under that messenger's namespace. This significantly reduces boilerplate, making the messenger easier to use in a similar manner to how the old `RestrictedMessenger` class wored. See this ADR PR for details: MetaMask/decisions#53
4ff719e
to
f3e18ba
Compare
parant
parameterparent
parameter
2dd241a
to
6729773
Compare
readonly #parent?: Messenger< | ||
string, | ||
Action | ActionConstraint, | ||
Event | EventConstraint | ||
>; |
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.
Is it true that 1) all of the actions and events in this messenger are eligible for delegation, and because of this, 2) all of the actions and events that the parent knows about must be known to this messenger too? If so, can we say this?
readonly #parent?: Messenger< | |
string, | |
Action | ActionConstraint, | |
Event | EventConstraint | |
>; | |
readonly #parent?: DelegatedMessenger<Action, Event>; |
parent?: Messenger< | ||
string, | ||
Action | ActionConstraint, | ||
Event | EventConstraint | ||
>; |
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.
Similar as above, can we say this?
parent?: Messenger< | |
string, | |
Action | ActionConstraint, | |
Event | EventConstraint | |
>; | |
parent?: DelegatedMessenger<Action, Event>; |
Explanation
Add the
parent
constructor parameter to theMessenger
class for automatic delegation of all capabilities under that messenger's namespace. This significantly reduces boilerplate, making the messenger easier to use in a similar manner to how the oldRestrictedMessenger
class wored.See this ADR PR for details: MetaMask/decisions#53
References
Depends upon #6132
Relates to #5626
Checklist