@foundryapp/accessibility-node
Advanced tools
Comparing version 1.0.7 to 1.0.8
{ | ||
"name": "@foundryapp/accessibility-node", | ||
"descriptiop": "Node.js wrapper for the macOS accessibility API", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "gypfile": true, |
@@ -12,3 +12,22 @@ ## Installation & usage | ||
## Methods | ||
### `isProcessTrusted()` | ||
```javascript | ||
const isTrusted = ax.isProcessTrusted(); | ||
``` | ||
### `launchApp(bundleID: string, (err) => void)` | ||
```javascript | ||
ax.launchApp('com.apple.Terminal', (err) => { | ||
if (!err) { | ||
console.log('App successfully launched'); | ||
} else { | ||
console.error(err); | ||
} | ||
}) | ||
``` | ||
## TODO | ||
- Add Typescript typings |
const ax = require('../build/Release/accessibility_node.node'); | ||
const { promisify } = require('util'); | ||
function launch() { | ||
return new Promise((resolve, reject) => { | ||
ax.launchApp('com.apple.Terminal', (err, args) => { | ||
console.log('Callback from JavaScript', args); | ||
ax.launchApp('com.apple.Terminal', (err, arg1, arg2) => { | ||
console.log('Callback from JavaScript', err, arg1, arg2); | ||
resolve(); | ||
@@ -14,31 +13,24 @@ }); | ||
function timeout() { | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => { | ||
console.log('TIMEOUT'); | ||
resolve(); | ||
}, 10 * 1000) | ||
}); | ||
function window() { | ||
} | ||
const delay = promisify(setTimeout); | ||
(async function() { | ||
await launch(); | ||
// await timeout(); | ||
// const d = promisify(launch); | ||
// await d(); | ||
// await launch(); | ||
console.log(process.pid) | ||
ax.run('com.apple.Terminal', () => console.log('App finished running')); | ||
console.log("Node.js AFTER RUN"); | ||
// const cw = promisify(ax.createNewWindow); | ||
// await cw('com.apple.Terminal'); | ||
/* | ||
ax.createNewWindow('com.apple.Terminal', (err) => { | ||
console.log('CALLBACK', err); | ||
}); | ||
*/ | ||
console.log('After launch'); | ||
})() | ||
/* | ||
launch() | ||
.then(() => console.log('Exiting')) | ||
*/ | ||
// await launch(); | ||
// ax.focusApp('com.apple.Terminal'); | ||
// | ||
setTimeout(() => console.log('exiting...'), 10 * 1000) | ||
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
441319
21
33
30