simen-keyboard-listener 1.0.5 → 1.0.7
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.
- package/LICENSE +21 -21
- package/README.md +69 -69
- package/dist/index.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +13 -0
- package/dist/index.mjs +12 -0
- package/package.json +57 -57
- package/prebuilds/darwin-arm64/simen_keyboard_listener.node +0 -0
- package/src/native/binding.gyp +40 -40
- package/src/native/package.json +14 -14
- package/src/native/simen_keyboard_listener.cc +660 -627
- /package/prebuilds/win32-x64/{simen-keyboard-listener-native.node → simen_keyboard_listener.node} +0 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Simen
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Simen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
# simen-keyboard-listener
|
|
2
|
-
|
|
3
|
-
Native global keyboard listener for macOS and Windows. Captures keyboard events system-wide, including special keys like FN that cannot be detected via standard DOM events.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install simen-keyboard-listener
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { getGlobalKeyboardListener } from 'simen-keyboard-listener';
|
|
15
|
-
|
|
16
|
-
const listener = getGlobalKeyboardListener();
|
|
17
|
-
|
|
18
|
-
listener.addListener((event, isDown) => {
|
|
19
|
-
console.log(`Key: ${event.name}, State: ${event.state}`);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
// Later, to stop listening:
|
|
23
|
-
listener.removeListener(myListener);
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## API
|
|
27
|
-
|
|
28
|
-
### `getGlobalKeyboardListener(): IGlobalKeyboardListener`
|
|
29
|
-
|
|
30
|
-
Returns the singleton keyboard listener instance.
|
|
31
|
-
|
|
32
|
-
### `IGlobalKeyboardListener`
|
|
33
|
-
|
|
34
|
-
- `addListener(listener: IGlobalKeyListener): void` - Add a key event listener
|
|
35
|
-
- `removeListener(listener: IGlobalKeyListener): void` - Remove a listener
|
|
36
|
-
- `kill(): void` - Stop the listener (only when no listeners remain)
|
|
37
|
-
|
|
38
|
-
### `IGlobalKeyEvent`
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
interface IGlobalKeyEvent {
|
|
42
|
-
readonly name: string; // e.g. "FN", "LEFT SHIFT", "A", "ESCAPE"
|
|
43
|
-
readonly state: 'DOWN' | 'UP';
|
|
44
|
-
}
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Supported Keys
|
|
48
|
-
|
|
49
|
-
- **Modifiers**: FN (macOS), SHIFT, CTRL, ALT, META (Cmd/Win)
|
|
50
|
-
- **Letters**: A-Z
|
|
51
|
-
- **Numbers**: 0-9
|
|
52
|
-
- **Function keys**: F1-F12 (Windows)
|
|
53
|
-
- **Special**: ESCAPE, SPACE, RETURN, TAB, BACKSPACE, DELETE
|
|
54
|
-
- **Arrows**: UP, DOWN, LEFT, RIGHT
|
|
55
|
-
|
|
56
|
-
## Platform Support
|
|
57
|
-
|
|
58
|
-
- macOS (x64, arm64)
|
|
59
|
-
- Windows (x64, arm64)
|
|
60
|
-
|
|
61
|
-
## Requirements
|
|
62
|
-
|
|
63
|
-
- Node.js >= 18.0.0
|
|
64
|
-
- macOS: Accessibility permission required
|
|
65
|
-
- Windows: No special permissions needed
|
|
66
|
-
|
|
67
|
-
## License
|
|
68
|
-
|
|
69
|
-
MIT
|
|
1
|
+
# simen-keyboard-listener
|
|
2
|
+
|
|
3
|
+
Native global keyboard listener for macOS and Windows. Captures keyboard events system-wide, including special keys like FN that cannot be detected via standard DOM events.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install simen-keyboard-listener
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { getGlobalKeyboardListener } from 'simen-keyboard-listener';
|
|
15
|
+
|
|
16
|
+
const listener = getGlobalKeyboardListener();
|
|
17
|
+
|
|
18
|
+
listener.addListener((event, isDown) => {
|
|
19
|
+
console.log(`Key: ${event.name}, State: ${event.state}`);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Later, to stop listening:
|
|
23
|
+
listener.removeListener(myListener);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
### `getGlobalKeyboardListener(): IGlobalKeyboardListener`
|
|
29
|
+
|
|
30
|
+
Returns the singleton keyboard listener instance.
|
|
31
|
+
|
|
32
|
+
### `IGlobalKeyboardListener`
|
|
33
|
+
|
|
34
|
+
- `addListener(listener: IGlobalKeyListener): void` - Add a key event listener
|
|
35
|
+
- `removeListener(listener: IGlobalKeyListener): void` - Remove a listener
|
|
36
|
+
- `kill(): void` - Stop the listener (only when no listeners remain)
|
|
37
|
+
|
|
38
|
+
### `IGlobalKeyEvent`
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
interface IGlobalKeyEvent {
|
|
42
|
+
readonly name: string; // e.g. "FN", "LEFT SHIFT", "A", "ESCAPE"
|
|
43
|
+
readonly state: 'DOWN' | 'UP';
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Supported Keys
|
|
48
|
+
|
|
49
|
+
- **Modifiers**: FN (macOS), SHIFT, CTRL, ALT, META (Cmd/Win)
|
|
50
|
+
- **Letters**: A-Z
|
|
51
|
+
- **Numbers**: 0-9
|
|
52
|
+
- **Function keys**: F1-F12 (Windows)
|
|
53
|
+
- **Special**: ESCAPE, SPACE, RETURN, TAB, BACKSPACE, DELETE
|
|
54
|
+
- **Arrows**: UP, DOWN, LEFT, RIGHT
|
|
55
|
+
|
|
56
|
+
## Platform Support
|
|
57
|
+
|
|
58
|
+
- macOS (x64, arm64)
|
|
59
|
+
- Windows (x64, arm64)
|
|
60
|
+
|
|
61
|
+
## Requirements
|
|
62
|
+
|
|
63
|
+
- Node.js >= 18.0.0
|
|
64
|
+
- macOS: Accessibility permission required
|
|
65
|
+
- Windows: No special permissions needed
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
package/dist/index.d.mts
CHANGED
|
@@ -23,5 +23,14 @@ declare function getGlobalKeyboardListener(): IGlobalKeyboardListener;
|
|
|
23
23
|
* This function is kept for backward compatibility but now returns the singleton.
|
|
24
24
|
*/
|
|
25
25
|
declare function createGlobalKeyboardListener(): IGlobalKeyboardListener;
|
|
26
|
+
/**
|
|
27
|
+
* Check if the app has permission to listen to global keyboard events.
|
|
28
|
+
* - On macOS: checks accessibility permission (System Preferences > Security & Privacy > Accessibility)
|
|
29
|
+
* - On Windows: always returns true (no special permission needed)
|
|
30
|
+
* - On other platforms: returns false
|
|
31
|
+
*
|
|
32
|
+
* Call this before starting the listener to provide better UX when permission is missing.
|
|
33
|
+
*/
|
|
34
|
+
declare function checkKeyboardPermission(): boolean;
|
|
26
35
|
|
|
27
|
-
export { type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, createGlobalKeyboardListener, getGlobalKeyboardListener };
|
|
36
|
+
export { type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, checkKeyboardPermission, createGlobalKeyboardListener, getGlobalKeyboardListener };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,5 +23,14 @@ declare function getGlobalKeyboardListener(): IGlobalKeyboardListener;
|
|
|
23
23
|
* This function is kept for backward compatibility but now returns the singleton.
|
|
24
24
|
*/
|
|
25
25
|
declare function createGlobalKeyboardListener(): IGlobalKeyboardListener;
|
|
26
|
+
/**
|
|
27
|
+
* Check if the app has permission to listen to global keyboard events.
|
|
28
|
+
* - On macOS: checks accessibility permission (System Preferences > Security & Privacy > Accessibility)
|
|
29
|
+
* - On Windows: always returns true (no special permission needed)
|
|
30
|
+
* - On other platforms: returns false
|
|
31
|
+
*
|
|
32
|
+
* Call this before starting the listener to provide better UX when permission is missing.
|
|
33
|
+
*/
|
|
34
|
+
declare function checkKeyboardPermission(): boolean;
|
|
26
35
|
|
|
27
|
-
export { type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, createGlobalKeyboardListener, getGlobalKeyboardListener };
|
|
36
|
+
export { type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, checkKeyboardPermission, createGlobalKeyboardListener, getGlobalKeyboardListener };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
checkKeyboardPermission: () => checkKeyboardPermission,
|
|
33
34
|
createGlobalKeyboardListener: () => createGlobalKeyboardListener,
|
|
34
35
|
getGlobalKeyboardListener: () => getGlobalKeyboardListener
|
|
35
36
|
});
|
|
@@ -161,8 +162,20 @@ function getGlobalKeyboardListener() {
|
|
|
161
162
|
function createGlobalKeyboardListener() {
|
|
162
163
|
return getGlobalKeyboardListener();
|
|
163
164
|
}
|
|
165
|
+
function checkKeyboardPermission() {
|
|
166
|
+
if (process.platform !== "darwin" && process.platform !== "win32") {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
try {
|
|
170
|
+
const addon = getNativeAddon();
|
|
171
|
+
return addon.checkPermission();
|
|
172
|
+
} catch {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
164
176
|
// Annotate the CommonJS export names for ESM import in node:
|
|
165
177
|
0 && (module.exports = {
|
|
178
|
+
checkKeyboardPermission,
|
|
166
179
|
createGlobalKeyboardListener,
|
|
167
180
|
getGlobalKeyboardListener
|
|
168
181
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -132,7 +132,19 @@ function getGlobalKeyboardListener() {
|
|
|
132
132
|
function createGlobalKeyboardListener() {
|
|
133
133
|
return getGlobalKeyboardListener();
|
|
134
134
|
}
|
|
135
|
+
function checkKeyboardPermission() {
|
|
136
|
+
if (process.platform !== "darwin" && process.platform !== "win32") {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const addon = getNativeAddon();
|
|
141
|
+
return addon.checkPermission();
|
|
142
|
+
} catch {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
135
146
|
export {
|
|
147
|
+
checkKeyboardPermission,
|
|
136
148
|
createGlobalKeyboardListener,
|
|
137
149
|
getGlobalKeyboardListener
|
|
138
150
|
};
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "simen-keyboard-listener",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Native global keyboard listener for macOS and Windows",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"module": "./dist/index.mjs",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.mjs",
|
|
12
|
-
"require": "./dist/index.js"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist",
|
|
17
|
-
"prebuilds",
|
|
18
|
-
"src/native/binding.gyp",
|
|
19
|
-
"src/native/package.json",
|
|
20
|
-
"src/native/simen_keyboard_listener.cc"
|
|
21
|
-
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build:native": "node-gyp rebuild --directory=src/native",
|
|
24
|
-
"build:ts": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
25
|
-
"build": "npm run build:native && npm run build:ts",
|
|
26
|
-
"prebuild": "prebuildify --napi --strip --cwd src/native",
|
|
27
|
-
"prepublishOnly": "npm run build:ts"
|
|
28
|
-
},
|
|
29
|
-
"keywords": [
|
|
30
|
-
"keyboard",
|
|
31
|
-
"hotkey",
|
|
32
|
-
"global",
|
|
33
|
-
"native",
|
|
34
|
-
"addon",
|
|
35
|
-
"macos",
|
|
36
|
-
"windows"
|
|
37
|
-
],
|
|
38
|
-
"author": "Simen",
|
|
39
|
-
"license": "MIT",
|
|
40
|
-
"repository": {
|
|
41
|
-
"type": "git",
|
|
42
|
-
"url": "https://github.com/user/simen-keyboard-listener"
|
|
43
|
-
},
|
|
44
|
-
"engines": {
|
|
45
|
-
"node": ">=18.0.0"
|
|
46
|
-
},
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"node-addon-api": "^8.0.0"
|
|
49
|
-
},
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@types/node": "^20.0.0",
|
|
52
|
-
"node-gyp": "^10.0.0",
|
|
53
|
-
"prebuildify": "^6.0.1",
|
|
54
|
-
"tsup": "^8.0.0",
|
|
55
|
-
"typescript": "^5.0.0"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "simen-keyboard-listener",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "Native global keyboard listener for macOS and Windows",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"prebuilds",
|
|
18
|
+
"src/native/binding.gyp",
|
|
19
|
+
"src/native/package.json",
|
|
20
|
+
"src/native/simen_keyboard_listener.cc"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build:native": "node-gyp rebuild --directory=src/native",
|
|
24
|
+
"build:ts": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
25
|
+
"build": "npm run build:native && npm run build:ts",
|
|
26
|
+
"prebuild": "prebuildify --napi --strip --cwd src/native --out ../../prebuilds",
|
|
27
|
+
"prepublishOnly": "npm run build:ts"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"keyboard",
|
|
31
|
+
"hotkey",
|
|
32
|
+
"global",
|
|
33
|
+
"native",
|
|
34
|
+
"addon",
|
|
35
|
+
"macos",
|
|
36
|
+
"windows"
|
|
37
|
+
],
|
|
38
|
+
"author": "Simen",
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/user/simen-keyboard-listener"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=18.0.0"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"node-addon-api": "^8.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^20.0.0",
|
|
52
|
+
"node-gyp": "^10.0.0",
|
|
53
|
+
"prebuildify": "^6.0.1",
|
|
54
|
+
"tsup": "^8.0.0",
|
|
55
|
+
"typescript": "^5.0.0"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
File without changes
|
package/src/native/binding.gyp
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"targets": [
|
|
3
|
-
{
|
|
4
|
-
"target_name": "simen_keyboard_listener",
|
|
5
|
-
"sources": [
|
|
6
|
-
"simen_keyboard_listener.cc"
|
|
7
|
-
],
|
|
8
|
-
"include_dirs": [
|
|
9
|
-
"<!@(node -p \"require('node-addon-api').include\")"
|
|
10
|
-
],
|
|
11
|
-
"defines": [
|
|
12
|
-
"NAPI_DISABLE_CPP_EXCEPTIONS"
|
|
13
|
-
],
|
|
14
|
-
"cflags!": [ "-fno-exceptions" ],
|
|
15
|
-
"cflags_cc!": [ "-fno-exceptions" ],
|
|
16
|
-
"xcode_settings": {
|
|
17
|
-
"GCC_ENABLE_CPP_EXCEPTIONS": "NO",
|
|
18
|
-
"CLANG_CXX_LIBRARY": "libc++",
|
|
19
|
-
"MACOSX_DEPLOYMENT_TARGET": "11.0"
|
|
20
|
-
},
|
|
21
|
-
"msvs_settings": {
|
|
22
|
-
"VCCLCompilerTool": { "ExceptionHandling": 0 }
|
|
23
|
-
},
|
|
24
|
-
"conditions": [
|
|
25
|
-
["OS=='mac'", {
|
|
26
|
-
"xcode_settings": {
|
|
27
|
-
"OTHER_LDFLAGS": [
|
|
28
|
-
"-framework", "ApplicationServices"
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
}],
|
|
32
|
-
["OS=='win'", {
|
|
33
|
-
"libraries": [
|
|
34
|
-
"User32.lib"
|
|
35
|
-
]
|
|
36
|
-
}]
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"targets": [
|
|
3
|
+
{
|
|
4
|
+
"target_name": "simen_keyboard_listener",
|
|
5
|
+
"sources": [
|
|
6
|
+
"simen_keyboard_listener.cc"
|
|
7
|
+
],
|
|
8
|
+
"include_dirs": [
|
|
9
|
+
"<!@(node -p \"require('node-addon-api').include\")"
|
|
10
|
+
],
|
|
11
|
+
"defines": [
|
|
12
|
+
"NAPI_DISABLE_CPP_EXCEPTIONS"
|
|
13
|
+
],
|
|
14
|
+
"cflags!": [ "-fno-exceptions" ],
|
|
15
|
+
"cflags_cc!": [ "-fno-exceptions" ],
|
|
16
|
+
"xcode_settings": {
|
|
17
|
+
"GCC_ENABLE_CPP_EXCEPTIONS": "NO",
|
|
18
|
+
"CLANG_CXX_LIBRARY": "libc++",
|
|
19
|
+
"MACOSX_DEPLOYMENT_TARGET": "11.0"
|
|
20
|
+
},
|
|
21
|
+
"msvs_settings": {
|
|
22
|
+
"VCCLCompilerTool": { "ExceptionHandling": 0 }
|
|
23
|
+
},
|
|
24
|
+
"conditions": [
|
|
25
|
+
["OS=='mac'", {
|
|
26
|
+
"xcode_settings": {
|
|
27
|
+
"OTHER_LDFLAGS": [
|
|
28
|
+
"-framework", "ApplicationServices"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}],
|
|
32
|
+
["OS=='win'", {
|
|
33
|
+
"libraries": [
|
|
34
|
+
"User32.lib"
|
|
35
|
+
]
|
|
36
|
+
}]
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
package/src/native/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "simen-keyboard-listener-native",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"gypfile": true,
|
|
6
|
-
"scripts": {
|
|
7
|
-
"install": "node-gyp rebuild",
|
|
8
|
-
"build": "node-gyp rebuild",
|
|
9
|
-
"clean": "node-gyp clean"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"node-addon-api": "^8.0.0"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "simen-keyboard-listener-native",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"gypfile": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"install": "node-gyp rebuild",
|
|
8
|
+
"build": "node-gyp rebuild",
|
|
9
|
+
"clean": "node-gyp clean"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"node-addon-api": "^8.0.0"
|
|
13
|
+
}
|
|
14
|
+
}
|