Skip to content

Commit 823e1cd

Browse files
authored
Merge pull request #45 from nut-tree/develop
Release v0.1.0-beta.1
2 parents 6902b01 + 9863e44 commit 823e1cd

10 files changed

+1230
-1149
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,11 @@ com_crashlytics_export_strings.xml
130130
crashlytics.properties
131131
crashlytics-build.properties
132132
fabric.properties
133+
134+
# Test data
135+
/lib/provider/opencv/__mocks__/output.jpg
136+
/asdf.jpg
137+
/foo_asdf_bar.jpg
138+
/asdf.png
139+
/asdf_bar.jpg
140+
/foo_asdf.jpg

.npmignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ tslint.json
55
.vscode
66
.idea
77
.github
8-
/.gfx
8+
/.gfx
9+
/asdf.jpg
10+
/foo_asdf_bar.jpg
11+
/asdf.png
12+
/asdf_bar.jpg
13+
/foo_asdf.jpg

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# nut.js change log
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
6+
## 0.1.0-beta.1
7+
8+
- Enabled pre-built OpenCV bindings via `opencv4nodejs-prebuilt`

lib/keyboard.class.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { NativeAdapter } from "./adapter/native.adapter.class";
22
import { Key } from "./key.enum";
33

4-
export class Keyboard {
4+
type StringOrKey = string[] | Key[];
55

6-
private static inputIsString(input: string[] | Key[]): boolean {
7-
return input.every((elem: string | Key) => typeof elem === "string");
8-
}
6+
const inputIsString = (input: string[] | Key[]): input is string[] => {
7+
return input.every((elem: string | Key) => typeof elem === "string");
8+
};
9+
10+
export class Keyboard {
911

1012
public config = {
1113
autoDelayMs: 500,
@@ -18,11 +20,11 @@ export class Keyboard {
1820
this.lastAction = Date.now();
1921
}
2022

21-
public type(...input: string[] | Key[]): Promise<Keyboard> {
23+
public type(...input: StringOrKey): Promise<Keyboard> {
2224
return new Promise<Keyboard>(async resolve => {
23-
if (Keyboard.inputIsString(input)) {
25+
if (inputIsString(input)) {
2426
for (const char of input.join(" ").split("")) {
25-
await this.waitForNextTick();
27+
await this.nextTick();
2628
this.nativeAdapter.type(char);
2729
this.updateTick();
2830
}
@@ -51,7 +53,7 @@ export class Keyboard {
5153
this.lastAction = Date.now();
5254
}
5355

54-
private async waitForNextTick(): Promise<void> {
56+
private async nextTick(): Promise<void> {
5557
return new Promise<void>(resolve => {
5658
let current = Date.now();
5759
while (current - this.lastAction < this.config.autoDelayMs) {

lib/provider/opencv/image-processor.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as cv from "opencv4nodejs";
1+
import * as cv from "opencv4nodejs-prebuilt";
22
import { Image } from "../../image.class";
33
import { Region } from "../../region.class";
44

lib/provider/opencv/image-reader.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as cv from "opencv4nodejs";
1+
import * as cv from "opencv4nodejs-prebuilt";
22
import { Image } from "../../image.class";
33
import { DataSource } from "./data-source.interface";
44

lib/provider/opencv/image-writer.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as cv from "opencv4nodejs";
1+
import * as cv from "opencv4nodejs-prebuilt";
22
import { Image } from "../../image.class";
33
import { DataSink } from "./data-sink.interface";
44
import { ImageProcessor } from "./image-processor.class";

lib/provider/opencv/template-matching-finder.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as cv from "opencv4nodejs";
1+
import * as cv from "opencv4nodejs-prebuilt";
22
import * as path from "path";
33
import { Image } from "../../image.class";
44
import { MatchRequest } from "../../match-request.class";

0 commit comments

Comments
 (0)