Skip to content

Commit b6e0c21

Browse files
committed
Merge branch 'bisubus-master'
2 parents 196d9cd + bc902ce commit b6e0c21

File tree

6 files changed

+173
-61
lines changed

6 files changed

+173
-61
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# windows-api-show-window [![Build Status](https://travis-ci.org/oledid-js/windows-api-show-window.svg?branch=master)](https://travis-ci.org/oledid-js/windows-api-show-window) [![npm](https://img.shields.io/npm/dt/windows-api-show-window.svg)](https://www.npmjs.com/package/windows-api-show-window) [![npm](https://img.shields.io/npm/v/windows-api-show-window.svg)](https://www.npmjs.com/package/windows-api-show-window)
2-
Call ShowWindow from node via [ffi](https://github.com/node-ffi/node-ffi)
2+
Call ShowWindow from node via [ffi-napi](https://github.com/node-ffi-napi/node-ffi-napi)
33

44
Win32 only!
55

package-lock.json

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
{
22
"name": "windows-api-show-window",
3-
"version": "0.1.2",
4-
"description": "Call ShowWindow from node via ffi",
3+
"version": "0.2.0",
4+
"description": "Call ShowWindow from node via ffi-napi",
55
"main": "src/index.js",
66
"scripts": {
77
"build": "tsc --newline lf",
88
"pretest": "npm run build",
9-
"test": "npm run lint && echo Run manual test with ctrl + r: node.exe [path-to-repo]/test/index.js",
10-
"lint": "tslint -t stylish -c tslint.json -e **/*.d.ts src/**/*.ts test/**/*.ts && tslint -t stylish -c jslint.json src/**/*.js test/**/*.js",
9+
"test": "echo Run manual test with ctrl + r: node.exe [path-to-repo]/test/index.js",
1110
"prepublish": "in-publish && npm test || not-in-publish"
1211
},
1312
"files": [
@@ -24,22 +23,25 @@
2423
"show window",
2524
"hide window"
2625
],
27-
"author": "Ole Morten Didriksen <[email protected]>",
26+
"author": "Ole Morten Didriksen <[email protected]> (https://github.com/oledid)",
2827
"license": "MIT",
28+
"contributors": [
29+
"Ole Morten Didriksen <[email protected]> (https://github.com/oledid)",
30+
"bisubus (https://github.com/bisubus)"
31+
],
2932
"bugs": {
3033
"url": "https://github.com/oledid-js/windows-api-show-window/issues"
3134
},
3235
"homepage": "https://github.com/oledid-js/windows-api-show-window#readme",
3336
"dependencies": {
34-
"ffi": "^2.2.0",
35-
"ref": "^1.3.4"
37+
"ffi-napi": "^3.0.1",
38+
"ref-napi": "^2.0.1"
3639
},
3740
"devDependencies": {
38-
"@types/ffi": "0.0.19",
41+
"@types/ffi-napi": "2.4.3",
3942
"@types/node": "^6.0.0",
40-
"@types/ref": "0.0.28",
43+
"@types/ref-napi": "1.4.1",
4144
"in-publish": "^2.0.0",
42-
"tslint": "^4.4.2",
4345
"typescript": "^2.1.6"
4446
}
4547
}

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import * as path from "path";
2-
import * as ffi from "ffi";
1+
import * as ffi from "ffi-napi";
32
import * as os from "os";
4-
const ref = require("ref");
3+
import * as ref from "ref-napi";
54

65
let HWND = 0;
76

@@ -17,6 +16,7 @@ const user32 = ffi.Library("user32", {
1716
const getHwndEnumWindowProc = ffi.Callback("bool", ["long", "int"], (hWnd, lParam) => {
1817
const lpdwProcessId = ref.alloc(ref.types.int);
1918
user32.GetWindowThreadProcessId(hWnd, lpdwProcessId);
19+
// @ts-ignore: just a missing type definition
2020
const actualNumber = lpdwProcessId.deref();
2121
if (actualNumber.toString() === lParam.toString()) {
2222
HWND = hWnd;

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"strictNullChecks": true,
1818
"types": [
1919
"node",
20-
"ffi",
21-
"ref"
20+
"ffi-napi",
21+
"ref-napi"
2222
]
2323
},
2424
"include": [

tslint.json

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)