Skip to content

Commit

Permalink
chore(accouncement): Rename ControllerMessenger to Messenger.
Browse files Browse the repository at this point in the history
Rename `ControllerMessenger` to `Messenger` in the `@metamask/announcement-controller`
package. The `AnnouncementControllerMessenger` type export was renamed to
`AnnouncementMessenger`, but the old name is preserved as an alias.

Relates to #4538
  • Loading branch information
Gudahtt committed Dec 20, 2024
1 parent f8e5f2e commit cf4fc18
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
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
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';

0 comments on commit cf4fc18

Please sign in to comment.