mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-08 20:06:32 +00:00
Updated doc, code style changes.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
c3e2aa4feb
commit
c7bb3abf19
@ -28,11 +28,11 @@ export class BoardsServiceImpl implements BoardsService {
|
|||||||
protected discoveryTimer: NodeJS.Timeout | undefined;
|
protected discoveryTimer: NodeJS.Timeout | undefined;
|
||||||
/**
|
/**
|
||||||
* Poor man's serial discovery:
|
* Poor man's serial discovery:
|
||||||
* Stores the state of the currently discovered, attached boards.
|
* Stores the state of the currently discovered and attached boards.
|
||||||
* This state is updated via periodical polls.
|
* 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 attachedBoards: { boards: Board[] } = { boards: [] };
|
||||||
protected _availablePorts: { ports: Port[] } = { ports: [] };
|
protected availablePorts: { ports: Port[] } = { ports: [] };
|
||||||
protected client: BoardsServiceClient | undefined;
|
protected client: BoardsServiceClient | undefined;
|
||||||
protected readonly queue = new PQueue({ autoStart: true, concurrency: 1 });
|
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.discoveryLogger.trace('Discovering attached boards and available ports...');
|
||||||
this.doGetAttachedBoardsAndAvailablePorts().then(({ boards, ports }) => {
|
this.doGetAttachedBoardsAndAvailablePorts().then(({ boards, ports }) => {
|
||||||
const update = (oldBoards: Board[], newBoards: Board[], oldPorts: Port[], newPorts: Port[], message: string) => {
|
const update = (oldBoards: Board[], newBoards: Board[], oldPorts: Port[], newPorts: Port[], message: string) => {
|
||||||
this._attachedBoards = { boards: newBoards };
|
this.attachedBoards = { boards: newBoards };
|
||||||
this._availablePorts = { ports: newPorts };
|
this.availablePorts = { ports: newPorts };
|
||||||
this.discoveryLogger.info(`${message} - Discovered boards: ${JSON.stringify(newBoards)} and available ports: ${JSON.stringify(newPorts)}`);
|
this.discoveryLogger.info(`${message} - Discovered boards: ${JSON.stringify(newBoards)} and available ports: ${JSON.stringify(newPorts)}`);
|
||||||
if (this.client) {
|
if (this.client) {
|
||||||
this.client.notifyAttachedBoardsChanged({
|
this.client.notifyAttachedBoardsChanged({
|
||||||
@ -109,11 +109,11 @@ export class BoardsServiceImpl implements BoardsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getAttachedBoards(): Promise<{ boards: Board[] }> {
|
async getAttachedBoards(): Promise<{ boards: Board[] }> {
|
||||||
return this._attachedBoards;
|
return this.attachedBoards;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAvailablePorts(): Promise<{ ports: Port[] }> {
|
async getAvailablePorts(): Promise<{ ports: Port[] }> {
|
||||||
return this._availablePorts;
|
return this.availablePorts;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async doGetAttachedBoardsAndAvailablePorts(): Promise<{ boards: Board[], ports: Port[] }> {
|
private async doGetAttachedBoardsAndAvailablePorts(): Promise<{ boards: Board[], ports: Port[] }> {
|
||||||
|
@ -46,6 +46,7 @@ export class LibraryServiceImpl implements LibraryService {
|
|||||||
.filter(item => !!item.getLatest())
|
.filter(item => !!item.getLatest())
|
||||||
.slice(0, 50)
|
.slice(0, 50)
|
||||||
.map(item => {
|
.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);
|
const availableVersions = item.getReleasesMap().getEntryList().map(([key, _]) => key);
|
||||||
let installedVersion: string | undefined;
|
let installedVersion: string | undefined;
|
||||||
const installed = installedLibsIdx.get(item.getName());
|
const installed = installedLibsIdx.get(item.getName());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user