From c7bb3abf196cebb2f652a132ab5760b54c780a7a Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Fri, 22 Nov 2019 11:47:09 +0100 Subject: [PATCH] Updated doc, code style changes. Signed-off-by: Akos Kitta --- .../src/node/boards-service-impl.ts | 16 ++++++++-------- .../src/node/library-service-impl.ts | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arduino-ide-extension/src/node/boards-service-impl.ts b/arduino-ide-extension/src/node/boards-service-impl.ts index ef265a37..8f3f05d6 100644 --- a/arduino-ide-extension/src/node/boards-service-impl.ts +++ b/arduino-ide-extension/src/node/boards-service-impl.ts @@ -28,11 +28,11 @@ export class BoardsServiceImpl implements BoardsService { protected discoveryTimer: NodeJS.Timeout | undefined; /** * Poor man's serial discovery: - * Stores the state of the currently discovered, attached boards. - * This state is updated via periodical polls. + * Stores the state of the currently discovered and attached boards. + * This state is updated via periodical polls. If there diff, a change event will be sent out to the frontend. */ - protected _attachedBoards: { boards: Board[] } = { boards: [] }; - protected _availablePorts: { ports: Port[] } = { ports: [] }; + protected attachedBoards: { boards: Board[] } = { boards: [] }; + protected availablePorts: { ports: Port[] } = { ports: [] }; protected client: BoardsServiceClient | undefined; protected readonly queue = new PQueue({ autoStart: true, concurrency: 1 }); @@ -42,8 +42,8 @@ export class BoardsServiceImpl implements BoardsService { this.discoveryLogger.trace('Discovering attached boards and available ports...'); this.doGetAttachedBoardsAndAvailablePorts().then(({ boards, ports }) => { const update = (oldBoards: Board[], newBoards: Board[], oldPorts: Port[], newPorts: Port[], message: string) => { - this._attachedBoards = { boards: newBoards }; - this._availablePorts = { ports: newPorts }; + this.attachedBoards = { boards: newBoards }; + this.availablePorts = { ports: newPorts }; this.discoveryLogger.info(`${message} - Discovered boards: ${JSON.stringify(newBoards)} and available ports: ${JSON.stringify(newPorts)}`); if (this.client) { this.client.notifyAttachedBoardsChanged({ @@ -109,11 +109,11 @@ export class BoardsServiceImpl implements BoardsService { } async getAttachedBoards(): Promise<{ boards: Board[] }> { - return this._attachedBoards; + return this.attachedBoards; } async getAvailablePorts(): Promise<{ ports: Port[] }> { - return this._availablePorts; + return this.availablePorts; } private async doGetAttachedBoardsAndAvailablePorts(): Promise<{ boards: Board[], ports: Port[] }> { diff --git a/arduino-ide-extension/src/node/library-service-impl.ts b/arduino-ide-extension/src/node/library-service-impl.ts index ca969fa1..1da4f2e1 100644 --- a/arduino-ide-extension/src/node/library-service-impl.ts +++ b/arduino-ide-extension/src/node/library-service-impl.ts @@ -46,6 +46,7 @@ export class LibraryServiceImpl implements LibraryService { .filter(item => !!item.getLatest()) .slice(0, 50) .map(item => { + // TODO: This seems to contain only the latest item instead of all of the items. const availableVersions = item.getReleasesMap().getEntryList().map(([key, _]) => key); let installedVersion: string | undefined; const installed = installedLibsIdx.get(item.getName());