Skip to content

Commit

Permalink
Fix and simplify aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
Gudahtt committed Dec 13, 2024
1 parent f7f0b15 commit 9c00587
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 44 deletions.
17 changes: 1 addition & 16 deletions packages/base-controller/src/Messenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,19 +459,4 @@ export class Messenger<
}
}

/**
* A message broker for "actions" and "events".
*
* The messenger allows registering functions as 'actions' that can be called elsewhere,
* and it allows publishing and subscribing to events. Both actions and events are identified by
* unique strings.
*
* @template Action - A type union of all Action types.
* @template Event - A type union of all Event types.
* @deprecated This has been renamed to `Messenger`.
*/
export const ControllerMessenger = Messenger;
export type ControllerMessenger<
Action extends ActionConstraint,
Event extends EventConstraint,
> = Messenger<Action, Event>;
export { Messenger as ControllerMessenger };
29 changes: 1 addition & 28 deletions packages/base-controller/src/RestrictedMessenger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,31 +430,4 @@ export class RestrictedMessenger<
}
}

/**
* Constructs a restricted messenger
*
* The provided allowlists grant the ability to call the listed actions and subscribe to the
* listed events. The "name" provided grants ownership of any actions and events under that
* namespace. Ownership allows registering actions and publishing events, as well as
* unregistering actions and clearing event subscriptions.
*
* @param options - Options.
* @param options.controllerMessenger - The messenger instance that is being wrapped. (deprecated)
* @param options.messenger - The messenger instance that is being wrapped.
* @param options.name - The name of the thing this messenger will be handed to (e.g. the
* controller name). This grants "ownership" of actions and events under this namespace to the
* restricted messenger returned.
* @param options.allowedActions - The list of actions that this restricted messenger should be
* allowed to call.
* @param options.allowedEvents - The list of events that this restricted messenger should be
* allowed to subscribe to.
* @deprecated This has been renamed to `RestrictedMessenger`.
*/
export const RestrictedControllerMessenger = RestrictedMessenger;
export type RestrictedControllerMessenger<
Namespace extends string,
Action extends ActionConstraint,
Event extends EventConstraint,
AllowedAction extends string,
AllowedEvent extends string,
> = RestrictedMessenger<Namespace, Action, Event, AllowedAction, AllowedEvent>;
export { RestrictedMessenger as RestrictedControllerMessenger };

0 comments on commit 9c00587

Please sign in to comment.