Skip to content

Commit

Permalink
feat(reactant-share): add comment for clientIds
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib committed Nov 4, 2023
1 parent ef50447 commit d875dab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/reactant-share/src/modules/portDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class PortDetector {
previousPort?: Port;

/**
* client id
* client id, it will be generated when the port is client, it is null in server port.
*/
clientId: string | null = null;

Expand All @@ -64,7 +64,10 @@ export class PortDetector {
*/
allowDisableSync = () => true;

private clientIds: string[] = [];
/**
* client ids, it will collect all the client ids when the port is server, it is an empty array in client port.
*/
clientIds: string[] = [];

constructor(
@inject(SharedAppOptions) public sharedAppOptions: ISharedAppOptions,
Expand Down Expand Up @@ -96,6 +99,7 @@ export class PortDetector {
syncClientIdsFromClientsName,
async () => {
if (this.clientId) {
// for all clients send current client id to server
transport.emit(
{ name: syncClientIdToServerName, respond: false },
this.clientId
Expand Down

0 comments on commit d875dab

Please sign in to comment.