mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-24 01:26:10 +00:00
slightly better reconnecting experience.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
@@ -107,6 +107,20 @@ export class BoardsServiceClientImpl implements BoardsServiceClient {
|
||||
return this._boardsConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* `true` if the `config.selectedBoard` is defined; hence can compile against the board. Otherwise, `false`.
|
||||
*/
|
||||
canVerify(config: BoardsConfig.Config | undefined = this.boardsConfig): config is BoardsConfig.Config & { selectedBoard: Board } {
|
||||
return !!config && !!config.selectedBoard;
|
||||
}
|
||||
|
||||
/**
|
||||
* `true` if the `canVerify` and the `config.selectedPort` is also set with FQBN, hence can upload to board. Otherwise, `false`.
|
||||
*/
|
||||
canUploadTo(config: BoardsConfig.Config | undefined = this.boardsConfig): config is RecursiveRequired<BoardsConfig.Config> {
|
||||
return this.canVerify(config) && !!config.selectedPort && !!config.selectedBoard.fqbn;
|
||||
}
|
||||
|
||||
protected saveState(): Promise<void> {
|
||||
return this.storageService.setData('latest-valid-boards-config', this.latestValidBoardsConfig);
|
||||
}
|
||||
@@ -118,12 +132,4 @@ export class BoardsServiceClientImpl implements BoardsServiceClient {
|
||||
}
|
||||
}
|
||||
|
||||
protected canVerify(config: BoardsConfig.Config | undefined): config is BoardsConfig.Config & { selectedBoard: Board } {
|
||||
return !!config && !!config.selectedBoard;
|
||||
}
|
||||
|
||||
protected canUploadTo(config: BoardsConfig.Config | undefined): config is RecursiveRequired<BoardsConfig.Config> {
|
||||
return this.canVerify(config) && !!config.selectedPort && !!config.selectedBoard.fqbn;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user