node-selection
Advanced tools
Comparing version
@@ -5,7 +5,3 @@ { | ||
"name": "Mac", | ||
"includePath": [ | ||
"${workspaceFolder}/**", | ||
"/usr/local/include/**", | ||
"${env.USERPROFILE}\\AppData\\Local\\node-gyp\\Cache\\17.7.1\\include\\**" | ||
], | ||
"includePath": ["${workspaceFolder}/**", "/usr/local/include/**"], | ||
"defines": [], | ||
@@ -16,3 +12,3 @@ "macFrameworkPath": [ | ||
"cStandard": "c17", | ||
"cppStandard": "c++11" | ||
"cppStandard": "c++17" | ||
} | ||
@@ -19,0 +15,0 @@ ], |
@@ -41,4 +41,59 @@ { | ||
"xtr1common": "cpp", | ||
"xutility": "cpp" | ||
"xutility": "cpp", | ||
"__bit_reference": "cpp", | ||
"__bits": "cpp", | ||
"__config": "cpp", | ||
"__debug": "cpp", | ||
"__errc": "cpp", | ||
"__hash_table": "cpp", | ||
"__locale": "cpp", | ||
"__mutex_base": "cpp", | ||
"__node_handle": "cpp", | ||
"__nullptr": "cpp", | ||
"__split_buffer": "cpp", | ||
"__string": "cpp", | ||
"__threading_support": "cpp", | ||
"__tree": "cpp", | ||
"__tuple": "cpp", | ||
"array": "cpp", | ||
"bitset": "cpp", | ||
"chrono": "cpp", | ||
"clocale": "cpp", | ||
"complex": "cpp", | ||
"cstdarg": "cpp", | ||
"cwctype": "cpp", | ||
"ios": "cpp", | ||
"istream": "cpp", | ||
"locale": "cpp", | ||
"mutex": "cpp", | ||
"optional": "cpp", | ||
"ostream": "cpp", | ||
"ratio": "cpp", | ||
"set": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"string_view": "cpp", | ||
"system_error": "cpp", | ||
"variant": "cpp", | ||
"__functional_base": "cpp", | ||
"iterator": "cpp", | ||
"charconv": "cpp", | ||
"format": "cpp", | ||
"forward_list": "cpp", | ||
"iomanip": "cpp", | ||
"map": "cpp", | ||
"stop_token": "cpp", | ||
"thread": "cpp", | ||
"xfacet": "cpp", | ||
"xiosbase": "cpp", | ||
"xlocale": "cpp", | ||
"xlocbuf": "cpp", | ||
"xlocinfo": "cpp", | ||
"xlocmes": "cpp", | ||
"xlocmon": "cpp", | ||
"xlocnum": "cpp", | ||
"xloctime": "cpp", | ||
"xtree": "cpp" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
const { checkAccessibilityPermissions, getSelection } = require('node-selection'); | ||
const { checkAccessibilityPermissions, getSelection } = require('../..'); | ||
@@ -13,4 +13,4 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(() => resolve(), ms)); | ||
try { | ||
const { text } = await getSelection(); | ||
console.log('current selection:', text); | ||
const selection = await getSelection(); | ||
console.log('current selection:', selection); | ||
} catch (error) { | ||
@@ -17,0 +17,0 @@ console.error('error', error); |
@@ -11,5 +11,4 @@ { | ||
"electron": "^18.0.1", | ||
"electron-rebuild": "^3.2.7", | ||
"node-selection": "file:../.." | ||
"electron-rebuild": "^3.2.7" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
const { checkAccessibilityPermissions, getSelection } = require('node-selection'); | ||
const { checkAccessibilityPermissions, getSelection } = require('../..'); | ||
@@ -13,4 +13,4 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(() => resolve(), ms)); | ||
try { | ||
const { text } = await getSelection(); | ||
console.log('current selection:', text); | ||
const selection = await getSelection(); | ||
console.log('current selection:', selection); | ||
} catch (error) { | ||
@@ -17,0 +17,0 @@ console.error('error', error); |
@@ -8,3 +8,11 @@ export interface CheckAccessibilityPermissionsOptions { | ||
text?: string; | ||
process?: ProcessInfo; | ||
} | ||
export interface ProcessInfo { | ||
pid?: number; | ||
name?: string; | ||
bundleIdentifier?: string; | ||
} | ||
export function getSelection(): Promise<Selection>; |
@@ -5,5 +5,2 @@ const { checkAccessibilityPermissions, getSelection } = require('node-gyp-build')(__dirname); | ||
exports.getSelection = async () => { | ||
const text = await getSelection(); | ||
return { text }; | ||
}; | ||
exports.getSelection = getSelection; |
{ | ||
"name": "node-selection", | ||
"version": "0.1.7", | ||
"version": "0.2.0-alpha.0", | ||
"description": "Get current selected text by using system accessibility APIs", | ||
@@ -5,0 +5,0 @@ "gypfile": true, |
@@ -47,2 +47,6 @@ # node-selection | ||
- `text`: `<string>` | `<undefined>` Current selected text. | ||
- `process`: `Object` | `<undefined>` | ||
- `pid`: `<number>` | `<undefined>` The process ID. | ||
- `name`: `<string>` | `<undefined>` The filename of the process. | ||
- `bundleIdentifier`: `<string>` | `<undefined>` The bundle identifier of the process (macOS only). | ||
@@ -53,4 +57,4 @@ ```js | ||
try { | ||
const { text } = await getSelection(); | ||
console.log('current selection:', text); | ||
const { text, process } = await getSelection(); | ||
console.log('current selection:', { text, process }); | ||
} catch (error) { | ||
@@ -57,0 +61,0 @@ // no valid selection |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
556671
2.38%4474
0.09%68
6.25%25
-3.85%