mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-09 10:28:32 +00:00
Can check if the current window is the first one.
Closes #1070 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { DefaultWindowService as TheiaDefaultWindowService } from '@theia/core/lib/browser/window/default-window-service';
|
||||
import { ContainerModule } from '@theia/core/shared/inversify';
|
||||
import { DefaultWindowService } from './default-window-service';
|
||||
import { WindowServiceExt } from './window-service-ext';
|
||||
|
||||
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
||||
bind(DefaultWindowService).toSelf().inSingletonScope();
|
||||
rebind(TheiaDefaultWindowService).toService(DefaultWindowService);
|
||||
bind(WindowServiceExt).toService(DefaultWindowService);
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
import { DefaultWindowService as TheiaDefaultWindowService } from '@theia/core/lib/browser/window/default-window-service';
|
||||
import { injectable } from '@theia/core/shared/inversify';
|
||||
import { WindowServiceExt } from './window-service-ext';
|
||||
|
||||
@injectable()
|
||||
export class DefaultWindowService
|
||||
extends TheiaDefaultWindowService
|
||||
implements WindowServiceExt
|
||||
{
|
||||
/**
|
||||
* The default implementation always resolves to `true`.
|
||||
* IDE2 does not use it. It's currently an electron-only app.
|
||||
*/
|
||||
async isFirstWindow(): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
export const WindowServiceExt = Symbol('WindowServiceExt');
|
||||
export interface WindowServiceExt {
|
||||
/**
|
||||
* Returns with a promise that resolves to `true` if the current window is the first window.
|
||||
*/
|
||||
isFirstWindow(): Promise<boolean>;
|
||||
}
|
||||
Reference in New Issue
Block a user