Skip to content
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

chore(accouncement): Rename ControllerMessenger to Messenger #5092

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/announcement-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Bump `@metamask/base-controller` from `^7.0.0` to `^7.1.0` ([#5079](https://github.com/MetaMask/core/pull/5079))
- Rename `AnnouncementControllerMessenger` to `AnnouncementMessenger` ([#5092](https://github.com/MetaMask/core/pull/5092))
- The old name is preserved as an alias, so this is not a breaking change.

## [7.0.2]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ControllerMessenger } from '@metamask/base-controller';
import { Messenger } from '@metamask/base-controller';

import type {
AnnouncementControllerState,
Expand All @@ -17,11 +17,11 @@ const name = 'AnnouncementController';
* @returns A restricted controller messenger.
*/
function getRestrictedMessenger() {
const controllerMessenger = new ControllerMessenger<
const messenger = new Messenger<
AnnouncementControllerActions,
AnnouncementControllerEvents
>();
return controllerMessenger.getRestricted({
return messenger.getRestricted({
name,
allowedActions: [],
allowedEvents: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
ControllerGetStateAction,
ControllerStateChangeEvent,
RestrictedControllerMessenger,
RestrictedMessenger,
} from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';

Expand Down Expand Up @@ -66,7 +66,7 @@ const metadata = {
},
};

export type AnnouncementControllerMessenger = RestrictedControllerMessenger<
export type AnnouncementMessenger = RestrictedMessenger<
typeof controllerName,
AnnouncementControllerActions,
AnnouncementControllerEvents,
Expand All @@ -80,7 +80,7 @@ export type AnnouncementControllerMessenger = RestrictedControllerMessenger<
export class AnnouncementController extends BaseController<
typeof controllerName,
AnnouncementControllerState,
AnnouncementControllerMessenger
AnnouncementMessenger
> {
/**
* Creates a AnnouncementController instance.
Expand All @@ -95,7 +95,7 @@ export class AnnouncementController extends BaseController<
state,
allAnnouncements,
}: {
messenger: AnnouncementControllerMessenger;
messenger: AnnouncementMessenger;
state?: AnnouncementControllerState;
allAnnouncements: AnnouncementMap;
}) {
Expand Down
13 changes: 12 additions & 1 deletion packages/announcement-controller/src/index.ts
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No export changes, they are all preserved. The export was converted to a map in order to more easily add an alias. This way is easier to read anyway.

Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
export * from './AnnouncementController';
export type {
AnnouncementMap,
StateAnnouncementMap,
AnnouncementControllerState,
AnnouncementControllerActions,
AnnouncementControllerEvents,
AnnouncementControllerGetStateAction,
AnnouncementControllerStateChangeEvent,
AnnouncementMessenger,
AnnouncementMessenger as AnnouncementControllerMessenger,
} from './AnnouncementController';
export { AnnouncementController } from './AnnouncementController';
Loading