Skip to content

Commit

Permalink
Simplification function name
Browse files Browse the repository at this point in the history
  • Loading branch information
esanzgar committed Jun 30, 2021
1 parent 08b3503 commit 4f24e7c
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/shared/communicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export class PortFinder {
return new Promise((resolve, reject) => {
// `guest` <-> `sidebar` communication
if (options.channel === 'guestToSidebar' && options.port === 'guest') {
this._requestPortAndListenForAnswerWithPolling({
this._requestPortWithPolling({
...options,
reject,
resolve,
Expand All @@ -402,7 +402,7 @@ export class PortFinder {

// `host` <-> `sidebar` communication
if (options.channel === 'hostToSidebar' && options.port === 'sidebar') {
this._requestPortAndListenForAnswer({ ...options, reject, resolve });
this._requestPort({ ...options, reject, resolve });
return;
}

Expand All @@ -411,7 +411,7 @@ export class PortFinder {
options.channel === 'notebookToSidebar' &&
options.port === 'notebook'
) {
this._requestPortAndListenForAnswer({ ...options, reject, resolve });
this._requestPort({ ...options, reject, resolve });
return;
}

Expand All @@ -437,13 +437,7 @@ export class PortFinder {
*
* @param {RequestPortOptions} options
*/
_requestPortAndListenForAnswer({
channel,
hostFrame,
port,
reject,
resolve,
}) {
_requestPort({ channel, hostFrame, port, reject, resolve }) {
// The resolution of the promise is guaranteed, however, as defensive
// programming technique, it's better to reject the request after
// certain amount of time.
Expand Down Expand Up @@ -475,13 +469,7 @@ export class PortFinder {
*
* @param {RequestPortOptions} options
*/
_requestPortAndListenForAnswerWithPolling({
channel,
hostFrame,
port,
reject,
resolve,
}) {
_requestPortWithPolling({ channel, hostFrame, port, reject, resolve }) {
// The `host` frame maybe busy loading heavy documents, that's why the
// waiting period is longer before we reject the request.
const timeoutId = window.setTimeout(
Expand Down

0 comments on commit 4f24e7c

Please sign in to comment.