From 42e276d3d4aa0ac8a4782b022ef508a1dfc938af Mon Sep 17 00:00:00 2001 From: "Jan T. Sott" Date: Tue, 25 Feb 2020 19:51:52 +0100 Subject: [PATCH] atom: add missing methods (#42549) * atom: add missing methods * fix linter errors * fix linter errors * fix linter errors * fix jsdoc format * fix jsdoc format * fix jsdoc format * fix return type of displayWindow() * make getWindowDomensions() return types optional * bump version occurances * fix *WindowDimension types * split arguments over lines --- types/atom/atom-tests.ts | 4 ++++ types/atom/index.d.ts | 26 +++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index 9a04b9c7b6..bb234a8718 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -157,6 +157,7 @@ function testAtomEnvironment() { bool = atom.inDevMode(); bool = atom.inSafeMode(); bool = atom.inSpecMode(); + str = atom.getAppName(); str = atom.getVersion(); bool = atom.isReleasedVersion(); num = atom.getWindowLoadTime(); @@ -190,6 +191,9 @@ function testAtomEnvironment() { bool = atom.isFullScreen(); atom.setFullScreen(true); atom.toggleFullScreen(); + atom.displayWindow(); + obj = atom.getWindowDimensions(); + atom.setWindowDimensions({ x: 0, y: 0, width: 640, height: 480 }); // Messaging the User atom.beep(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index 5fb38fba96..97debc0dce 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package Atom 1.36 +// Type definitions for non-npm package Atom 1.40 // Project: https://github.com/atom/atom // Definitions by: GlenCFL // smhxx @@ -7,7 +7,7 @@ // TypeScript Version: 2.3 // NOTE: only those classes exported within this file should be retain that status below. -// https://github.com/atom/atom/blob/v1.36.0/exports/atom.js +// https://github.com/atom/atom/blob/v1.40.0/exports/atom.js /// @@ -121,6 +121,9 @@ export interface AtomEnvironment { /** Returns a boolean that is true if the current window is running specs. */ inSpecMode(): boolean; + /** Get the full name of this Atom release (e.g. "Atom", "Atom Beta") */ + getAppName(): string; + /** Get the version of the Atom application. */ getVersion(): string; @@ -199,6 +202,23 @@ export interface AtomEnvironment { /** Toggle the full screen state of the current window. */ toggleFullScreen(): void; + /** + * Restores the full screen and maximized state after the window has resized to prevent resize + * glitches. + */ + displayWindow(): Promise; + + /** Get the dimensions of this window. */ + getWindowDimensions(): { x: number, y: number, width: number, height: number }; + + /** Set the dimensions of the window. */ + setWindowDimensions(dimensions: { + x?: number, + y?: number, + width?: number, + height?: number + }): Promise; + // Messaging the User /** Visually and audibly trigger a beep. */ beep(): void; @@ -5968,7 +5988,7 @@ export interface TextEditorObservedEvent { // information under certain contexts. // NOTE: the config schema with these defaults can be found here: -// https://github.com/atom/atom/blob/v1.36.0/src/config-schema.js +// https://github.com/atom/atom/blob/v1.40.0/src/config-schema.js /** * Allows you to strongly type Atom configuration variables. Additional key:value * pairings merged into this interface will result in configuration values under