Skip to content

[dev] As a dev I want to distinguish between first and other browser windows #1070

Closed
@kittaakos

Description

@kittaakos

Describe the request

Why?

IDE2 can start with multiple browser windows when restoring all opened sketches. By default, the same frontend application loads in each browser window; hence the same logic runs. Running the same logic in each browser window is sometimes an undesired behavior. For example, when notifying the user about a new IDE2 version or asking the user to participate in a survey must happen in the first window.

Describe the current behavior

The current code handles "the first window" workaround in different ways. See here and here. This is a working solution, but adding a boilerplate service every time with a boolean flag can be generalized.

As a dev, I would expect to do something like this in the future:

@inject(WindowService) private readonly windowService: WindowService:

// later in code:
onStart(): void {
  this.windowService.isFirstWindow().then((first) => { if (first) { /* ask survey*/  }  );
}

In IDE2, we can customize the existing WindowService and extend it.

Arduino IDE version

Version: 2.0.0-rc7 Date: 2022-06-09T08:19:19.877Z CLI Version: 0.23.0 [899dc91b] Copyright © 2022 Arduino SA

Operating system

macOS

Operating system version

12.3.1

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details

Metadata

Metadata

Labels

topic: codeRelated to content of the project itselftype: enhancementProposed improvement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions