mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-11 03:09:29 +00:00
workaround for non-unique names.
Fine tuned the port unnselection when attached boards change. This should make sure we do not have to `await` for the attached boards from the backend. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
@@ -7,6 +7,21 @@ export interface AttachedBoardsChangeEvent {
|
||||
readonly oldState: Readonly<{ boards: Board[] }>;
|
||||
readonly newState: Readonly<{ boards: Board[] }>;
|
||||
}
|
||||
export namespace AttachedBoardsChangeEvent {
|
||||
|
||||
export function diff(event: AttachedBoardsChangeEvent): Readonly<{ attached: Board[], detached: Board[] }> {
|
||||
const diff = <T>(left: T[], right: T[]) => {
|
||||
return left.filter(item => right.indexOf(item) === -1);
|
||||
}
|
||||
const { boards: newBoards } = event.newState;
|
||||
const { boards: oldBoards } = event.oldState;
|
||||
return {
|
||||
detached: diff(oldBoards, newBoards),
|
||||
attached: diff(newBoards, oldBoards)
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface BoardInstalledEvent {
|
||||
readonly pkg: Readonly<BoardPackage>;
|
||||
@@ -34,10 +49,6 @@ export interface Board {
|
||||
fqbn?: string
|
||||
}
|
||||
|
||||
export interface Port {
|
||||
port?: string;
|
||||
}
|
||||
|
||||
export namespace Board {
|
||||
|
||||
export function is(board: any): board is Board {
|
||||
|
||||
Reference in New Issue
Block a user