mirror of
https://github.com/Mintplex-Labs/nut.js.git
synced 2026-07-19 14:06:17 -04:00
Feature/445/config interfaces (#446)
* (#445) Extracted config interfaces for keyboard, mouse and screen * (#445) Export config interfaces
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { AssertClass } from "./lib/assert.class";
|
||||
import { ClipboardClass } from "./lib/clipboard.class";
|
||||
import { KeyboardClass } from "./lib/keyboard.class";
|
||||
import { MouseClass } from "./lib/mouse.class";
|
||||
import { KeyboardClass, KeyboardConfig } from "./lib/keyboard.class";
|
||||
import { MouseClass, MouseConfig } from "./lib/mouse.class";
|
||||
import { createMovementApi } from "./lib/movement.function";
|
||||
import { ScreenClass } from "./lib/screen.class";
|
||||
import { ScreenClass, ScreenConfig } from "./lib/screen.class";
|
||||
import { LineHelper } from "./lib/util/linehelper.class";
|
||||
import { createWindowApi } from "./lib/window.function";
|
||||
import providerRegistry from "./lib/provider/provider-registry.class";
|
||||
@@ -13,8 +13,11 @@ export {
|
||||
AssertClass,
|
||||
ClipboardClass,
|
||||
KeyboardClass,
|
||||
KeyboardConfig,
|
||||
MouseClass,
|
||||
MouseConfig,
|
||||
ScreenClass,
|
||||
ScreenConfig,
|
||||
providerRegistry,
|
||||
};
|
||||
|
||||
|
||||
+11
-4
@@ -8,6 +8,16 @@ const inputIsString = (input: (string | Key)[]): input is string[] => {
|
||||
return input.every((elem: string | Key) => typeof elem === "string");
|
||||
};
|
||||
|
||||
/**
|
||||
* Config object for {@link KeyboardClass} class
|
||||
*/
|
||||
export interface KeyboardConfig {
|
||||
/**
|
||||
* Configures the delay between single key events
|
||||
*/
|
||||
autoDelayMs: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link KeyboardClass} class provides methods to emulate keyboard input
|
||||
*/
|
||||
@@ -15,10 +25,7 @@ export class KeyboardClass {
|
||||
/**
|
||||
* Config object for {@link KeyboardClass} class
|
||||
*/
|
||||
public config = {
|
||||
/**
|
||||
* Configures the delay between single key events
|
||||
*/
|
||||
public config: KeyboardConfig = {
|
||||
autoDelayMs: 300,
|
||||
};
|
||||
|
||||
|
||||
+16
-11
@@ -8,22 +8,27 @@ import {
|
||||
} from "./mouse-movement.function";
|
||||
import { ProviderRegistry } from "./provider/provider-registry.class";
|
||||
|
||||
/**
|
||||
* Config object for {@link MouseClass} class
|
||||
*/
|
||||
export interface MouseConfig {
|
||||
/**
|
||||
* Configures the delay between single mouse events
|
||||
*/
|
||||
autoDelayMs: number;
|
||||
|
||||
/**
|
||||
* Configures the speed in pixels/second for mouse movement
|
||||
*/
|
||||
mouseSpeed: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link MouseClass} class provides methods to emulate mouse input
|
||||
*/
|
||||
export class MouseClass {
|
||||
/**
|
||||
* Config object for {@link MouseClass} class
|
||||
*/
|
||||
public config = {
|
||||
/**
|
||||
* Configures the delay between single mouse events
|
||||
*/
|
||||
public config: MouseConfig = {
|
||||
autoDelayMs: 100,
|
||||
|
||||
/**
|
||||
* Configures the speed in pixels/second for mouse movement
|
||||
*/
|
||||
mouseSpeed: 1000,
|
||||
};
|
||||
|
||||
|
||||
+30
-22
@@ -45,36 +45,44 @@ function validateSearchRegion(search: Region, screen: Region) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Config object for {@link ScreenClass} class
|
||||
*/
|
||||
export interface ScreenConfig {
|
||||
/**
|
||||
* Configures the required matching percentage for template images to be declared as a match
|
||||
*/
|
||||
confidence: number;
|
||||
|
||||
/**
|
||||
* Configure whether to auto highlight all search results or not
|
||||
*/
|
||||
autoHighlight: boolean;
|
||||
/**
|
||||
* Configure highlighting duration
|
||||
*/
|
||||
highlightDurationMs: number;
|
||||
|
||||
/**
|
||||
* Configure opacity of highlight window
|
||||
*/
|
||||
highlightOpacity: number;
|
||||
|
||||
/**
|
||||
* Configures the path from which template images are loaded from
|
||||
*/
|
||||
resourceDirectory: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ScreenClass} class provides methods to access screen content of a systems main display
|
||||
*/
|
||||
export class ScreenClass {
|
||||
/**
|
||||
* Config object for {@link ScreenClass} class
|
||||
*/
|
||||
public config = {
|
||||
/**
|
||||
* Configures the required matching percentage for template images to be declared as a match
|
||||
*/
|
||||
public config: ScreenConfig = {
|
||||
confidence: 0.99,
|
||||
|
||||
/**
|
||||
* Configure whether to auto highlight all search results or not
|
||||
*/
|
||||
autoHighlight: false,
|
||||
/**
|
||||
* Configure highlighting duration
|
||||
*/
|
||||
highlightDurationMs: 500,
|
||||
|
||||
/**
|
||||
* Configure opacity of highlight window
|
||||
*/
|
||||
highlightOpacity: 0.25,
|
||||
|
||||
/**
|
||||
* Configures the path from which template images are loaded from
|
||||
*/
|
||||
resourceDirectory: cwd(),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user