Skip to content

Commit

Permalink
Change name of the types to be singular
Browse files Browse the repository at this point in the history
  • Loading branch information
esanzgar committed Oct 12, 2021
1 parent d91b8d5 commit f86dfbf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/annotator/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default class Sidebar {
this.show();
});

/** @type {Array<[import('../types/bridge-events').BridgeEvents, function]>} */
/** @type {Array<[import('../types/bridge-events').BridgeEvent, function]>} */
const eventHandlers = [
['loginRequested', this.onLoginRequest],
['logoutRequested', this.onLogoutRequest],
Expand Down
4 changes: 2 additions & 2 deletions src/shared/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Bridge {
* Make a method call on all channels, collect the results and pass them to a
* callback when all results are collected.
*
* @param {import('../types/bridge-events').BridgeEvents} method - Name of remote method to call.
* @param {import('../types/bridge-events').BridgeEvent} method - Name of remote method to call.
* @param {any[]} args - Arguments to method. Final argument is an optional
* callback with this type: `(error: string|Error|null, ...result: any[]) => void`.
* This callback, if any, will be triggered once a response (via `postMessage`)
Expand Down Expand Up @@ -132,7 +132,7 @@ export class Bridge {
* Register a listener to be invoked when any connected channel sends a
* message to this `Bridge`.
*
* @param {import('../types/bridge-events').BridgeEvents} method
* @param {import('../types/bridge-events').BridgeEvent} method
* @param {(...args: any[]) => void} listener -- Final argument is an optional
* callback of the type: `(error: string|Error|null, ...result: any[]) => void`.
* This callback must be invoked in order to respond (via `postMessage`)
Expand Down
2 changes: 1 addition & 1 deletion src/sidebar/services/frame-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export class FrameSyncService {
/**
* Send an RPC message to the host frame.
*
* @param {import('../../types/bridge-events').BridgeEvents} method
* @param {import('../../types/bridge-events').BridgeEvent} method
* @param {any[]} args
*/
notifyHost(method, ...args) {
Expand Down
18 changes: 9 additions & 9 deletions src/types/bridge-events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* Events that the sidebar sends to the host
*/
type SidebarToHostEvents = {
type SidebarToHostEvent = {
/**
* The sidebar is asking the host to open the sidebar.
*/
Expand Down Expand Up @@ -65,7 +65,7 @@ type SidebarToHostEvents = {
/**
* Events that the host sends to the sidebar
*/
type HostToSidebarEvents = {
type HostToSidebarEvent = {
/**
* The host is asking the sidebar to delete a frame using an identifier
*/
Expand All @@ -80,7 +80,7 @@ type HostToSidebarEvents = {
/**
* Events that the sidebar sends to the guest/s
*/
type SidebarToGuestEvents = {
type SidebarToGuestEvent = {
/**
* The sidebar is asking the guest/s to focus on certain annotations.
*/
Expand Down Expand Up @@ -110,7 +110,7 @@ type SidebarToGuestEvents = {
/**
* Events that the guest sends to the sidebar
*/
type GuestToSidebarEvents = {
type GuestToSidebarEvent = {
/**
* The guest is asking the sidebar to create an annotation
*/
Expand Down Expand Up @@ -142,9 +142,9 @@ type GuestToSidebarEvents = {
TOGGLE_ANNOTATION_SELECTION: 'toggleAnnotationSelection';
};

export type BridgeEvents =
export type BridgeEvent =
| 'connect'
| SidebarToHostEvents[keyof SidebarToHostEvents]
| HostToSidebarEvents[keyof HostToSidebarEvents]
| SidebarToGuestEvents[keyof SidebarToGuestEvents]
| GuestToSidebarEvents[keyof GuestToSidebarEvents];
| SidebarToHostEvent[keyof SidebarToHostEvent]
| HostToSidebarEvent[keyof HostToSidebarEvent]
| SidebarToGuestEvent[keyof SidebarToGuestEvent]
| GuestToSidebarEvent[keyof GuestToSidebarEvent];

0 comments on commit f86dfbf

Please sign in to comment.