@overwolf/ow-electron-packages-types 1.1.2-beta.3 → 1.1.2-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types.d.ts +80 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overwolf/ow-electron-packages-types",
3
- "version": "1.1.2-beta.3",
3
+ "version": "1.1.2-beta.5",
4
4
  "description": "Type definition file for autocompletion and documentation purposes for ow-electron packages",
5
5
  "license": "MIT",
6
6
  "types": "types.d.ts",
package/types.d.ts CHANGED
@@ -5574,7 +5574,7 @@ interface IOverwolfOverlayApi extends EventEmitter {
5574
5574
  */
5575
5575
  exitExclusiveMode(): void;
5576
5576
 
5577
- /**
5577
+ /**
5578
5578
  * Install ow-electron helpers to
5579
5579
  * `%CommonProgramFiles%\<app-name>\` with UAC elevation.
5580
5580
  * Allows injection into high elevation games.
@@ -5620,20 +5620,20 @@ interface IOverwolfOverlayApi extends EventEmitter {
5620
5620
  * }
5621
5621
  * ```
5622
5622
  * @returns Resolves when installation completes.
5623
- *
5624
- *
5625
- *
5623
+ *
5624
+ *
5625
+ *
5626
5626
  */
5627
5627
  installHighElevationHelper?(): Promise<void>;
5628
5628
 
5629
5629
  /**
5630
5630
  * Returns true if ow-electron helpers is already installed in
5631
5631
  * `%CommonProgramFiles%\<app-name>\`.
5632
- *
5632
+ *
5633
5633
  * @returns `true` if the helper is installed and ready.
5634
- *
5634
+ *
5635
5635
  * @example
5636
- * ```ts
5636
+ * ```ts
5637
5637
  * const installed: boolean = await api.isHighElevationHelperInstalled();
5638
5638
  * if (!installed) {
5639
5639
  * // Prompt the user to run the one-time setup before injecting into elevated games
@@ -5642,6 +5642,64 @@ interface IOverwolfOverlayApi extends EventEmitter {
5642
5642
  */
5643
5643
  isHighElevationHelperInstalled?(): Promise<boolean>;
5644
5644
 
5645
+ /**
5646
+ * Captures the current game frame and saves it to disk.
5647
+ *
5648
+ * Only one screenshot can be in progress at a time. Calling this method
5649
+ * while a previous capture is still pending will reject immediately —
5650
+ * wait for the returned promise to settle before issuing the next call.
5651
+ *
5652
+ * The output format is resolved by precedence: an explicit `format`
5653
+ * argument wins; otherwise the extension already present in `filePath`
5654
+ * (`.jpg`/`.jpeg` or `.bmp`) is used; otherwise it defaults to `'bmp'`.
5655
+ * The file extension is then normalized to match the resolved format, so
5656
+ * an existing extension is rewritten rather than doubled (e.g.
5657
+ * `shot.jpg` stays `shot.jpg`, and `shot.png` with `format: 'jpg'` becomes
5658
+ * `shot.jpg`).
5659
+ *
5660
+ * Internally all backends (D3D9, D3D11, D3D12, Vulkan) capture as BMP
5661
+ * first and transcode to JPEG on demand, ensuring correct colors across
5662
+ * all graphics APIs and formats.
5663
+ *
5664
+ * @param filePath - Absolute path (UTF-8) where the image will be saved.
5665
+ * @param format - Output image format: `'jpg'` or `'bmp'`. When omitted,
5666
+ * the extension in `filePath` is used, falling back to `'bmp'`.
5667
+ * @returns A promise that resolves with the absolute path the file was
5668
+ * actually written to, including the normalized extension (which may
5669
+ * differ from `filePath`).
5670
+ *
5671
+ * @throws `'no active game'` — the overlay is not currently injected into
5672
+ * any game. Wait for the `game-injected` event before calling.
5673
+ * @throws `'screenshot already in progress'` — a previous capture has not
5674
+ * yet completed. Await the previous promise before calling again.
5675
+ * @throws `'no active graphics device'` — the game has no active GPU
5676
+ * device at this moment (e.g. the game window is minimized or in a
5677
+ * device-lost state). Try again once the game is in the foreground.
5678
+ * @throws `'capture failed: <backend>'` — the GPU-side readback failed
5679
+ * (e.g. staging texture creation, memory map, or WIC encode error).
5680
+ *
5681
+ * @example
5682
+ * ```ts
5683
+ * overlay.on('game-injected', () => {
5684
+ * overlay.hotkeys.register(
5685
+ * { name: 'screenshot', keyCode: 'F9', passthrough: false },
5686
+ * async (hotkey, state) => {
5687
+ * if (state !== 'pressed') return;
5688
+ * const ts = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
5689
+ * const filePath = path.join(app.getPath('pictures'), `screenshot_${ts}`);
5690
+ * try {
5691
+ * const savedPath = await overlay.takeScreenshot(filePath, 'jpg');
5692
+ * console.log('screenshot written to', savedPath); // ...filePath.jpg
5693
+ * } catch (err) {
5694
+ * console.error('Screenshot failed:', err.message);
5695
+ * }
5696
+ * }
5697
+ * );
5698
+ * });
5699
+ * ```
5700
+ */
5701
+ takeScreenshot(filePath: string, format?: 'jpg' | 'bmp'): Promise<void>;
5702
+
5645
5703
  /**
5646
5704
  * Fires when an internal error occurs within the overlay system.
5647
5705
  */
@@ -5655,7 +5713,10 @@ interface IOverwolfOverlayApi extends EventEmitter {
5655
5713
  * @param listener - Callback with game launch event and game metadata.
5656
5714
  * @see {@link GameInfo}.
5657
5715
  */
5658
- on(eventName: 'game-launched', listener: (event: GameLaunchEvent, gameInfo: GameInfo) => void): this;
5716
+ on(
5717
+ eventName: 'game-launched',
5718
+ listener: (event: GameLaunchEvent, gameInfo: GameInfo) => void,
5719
+ ): this;
5659
5720
 
5660
5721
  /**
5661
5722
  * Fires when a registered game process terminates.
@@ -5675,7 +5736,10 @@ interface IOverwolfOverlayApi extends EventEmitter {
5675
5736
  *
5676
5737
  * @see {@link GameInfo}.
5677
5738
  */
5678
- on(eventName: 'game-exit', listener: (gameInfo: GameInfo, wasInjected: boolean) => void): this;
5739
+ on(
5740
+ eventName: 'game-exit',
5741
+ listener: (gameInfo: GameInfo, wasInjected: boolean) => void,
5742
+ ): this;
5679
5743
 
5680
5744
  /**
5681
5745
  * Fires when the overlay is ready and successfully injected into the game.
@@ -5695,7 +5759,7 @@ interface IOverwolfOverlayApi extends EventEmitter {
5695
5759
  */
5696
5760
  on(
5697
5761
  eventName: 'game-injection-error',
5698
- listener: (gameInfo: GameInfo, error: string, ...args: any[]) => void
5762
+ listener: (gameInfo: GameInfo, error: string, ...args: any[]) => void,
5699
5763
  ): this;
5700
5764
 
5701
5765
  /**
@@ -5711,8 +5775,8 @@ interface IOverwolfOverlayApi extends EventEmitter {
5711
5775
  listener: (
5712
5776
  window: GameWindowInfo,
5713
5777
  gameInfo: GameInfo,
5714
- focus: boolean
5715
- ) => void
5778
+ focus: boolean,
5779
+ ) => void,
5716
5780
  ): this;
5717
5781
 
5718
5782
  /**
@@ -5729,8 +5793,8 @@ interface IOverwolfOverlayApi extends EventEmitter {
5729
5793
  listener: (
5730
5794
  window: GameWindowInfo,
5731
5795
  gameInfo: GameInfo,
5732
- reason?: GameWindowUpdateReason
5733
- ) => void
5796
+ reason?: GameWindowUpdateReason,
5797
+ ) => void,
5734
5798
  ): this;
5735
5799
 
5736
5800
  /**
@@ -5743,7 +5807,7 @@ interface IOverwolfOverlayApi extends EventEmitter {
5743
5807
  */
5744
5808
  on(
5745
5809
  eventName: 'game-input-interception-changed',
5746
- listener: (info: GameInputInterception) => void
5810
+ listener: (info: GameInputInterception) => void,
5747
5811
  ): this;
5748
5812
 
5749
5813
  /**
@@ -5755,7 +5819,7 @@ interface IOverwolfOverlayApi extends EventEmitter {
5755
5819
  */
5756
5820
  on(
5757
5821
  eventName: 'game-input-exclusive-mode-changed',
5758
- listener: (info: GameInputInterception) => void
5822
+ listener: (info: GameInputInterception) => void,
5759
5823
  ): this;
5760
5824
  }
5761
5825