From f86dfbf1a503e0042b8d03f6e9bd4157fc0eb5a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Sanz=20Garc=C3=ADa?= Date: Tue, 12 Oct 2021 14:42:26 +0200 Subject: [PATCH] Change name of the types to be singular --- src/annotator/sidebar.js | 2 +- src/shared/bridge.js | 4 ++-- src/sidebar/services/frame-sync.js | 2 +- src/types/bridge-events.d.ts | 18 +++++++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/annotator/sidebar.js b/src/annotator/sidebar.js index 91326aa064d..7515347932a 100644 --- a/src/annotator/sidebar.js +++ b/src/annotator/sidebar.js @@ -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], diff --git a/src/shared/bridge.js b/src/shared/bridge.js index dd3507e8ec4..06651c226cc 100644 --- a/src/shared/bridge.js +++ b/src/shared/bridge.js @@ -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`) @@ -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`) diff --git a/src/sidebar/services/frame-sync.js b/src/sidebar/services/frame-sync.js index 94fa260b808..71b631d7f65 100644 --- a/src/sidebar/services/frame-sync.js +++ b/src/sidebar/services/frame-sync.js @@ -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) { diff --git a/src/types/bridge-events.d.ts b/src/types/bridge-events.d.ts index 03c3005c205..e65ee3b98e8 100644 --- a/src/types/bridge-events.d.ts +++ b/src/types/bridge-events.d.ts @@ -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. */ @@ -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 */ @@ -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. */ @@ -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 */ @@ -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];