Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
kittaakos opened this issue Jun 17, 2022 · 0 comments · Fixed by #1282
Closed
3 tasks done

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

kittaakos opened this issue Jun 17, 2022 · 0 comments · Fixed by #1282
Assignees
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@kittaakos
Copy link
Contributor

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
@kittaakos kittaakos added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jun 17, 2022
kittaakos pushed a commit that referenced this issue Aug 3, 2022
kittaakos pushed a commit that referenced this issue Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants