@foundryapp/accessibility-node
Advanced tools
Comparing version 1.0.12 to 1.0.13
{ | ||
"name": "@foundryapp/accessibility-node", | ||
"descriptiop": "Node.js wrapper for the macOS accessibility API", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "gypfile": true, |
@@ -14,3 +14,3 @@ ## Installation & usage | ||
### `isProcessTrusted()` | ||
### `isProcessTrusted() => boolean` | ||
```javascript | ||
@@ -20,4 +20,12 @@ const isTrusted = ax.isProcessTrusted(); | ||
### `isAppRunning(bundleID: boolean) => boolean` | ||
```javascript | ||
const isRunning = ax.isAppRunning('com.app.Terminal'); | ||
``` | ||
### `launchApp(bundleID: string, (err) => void)` | ||
```javascript | ||
// The exact behavior of the launch depends on a target app but usually it means | ||
// that also a new window of that app is launched. So there's no need to call | ||
// createNewWindow(). | ||
ax.launchApp('com.apple.Terminal', (err) => { | ||
@@ -29,7 +37,22 @@ if (!err) { | ||
} | ||
}) | ||
}); | ||
``` | ||
### `createNewWindow(bundleID: string, (err) => void)` | ||
```javascript | ||
// App must be running, otherwise error is passed to a callback. | ||
// This might take a few seconds to complete. | ||
ax.createNewWindow('com.apple.Terminal', (err) => { | ||
if (!err) { | ||
console.log('Window created'); | ||
} else { | ||
console.error(err); | ||
} | ||
}); | ||
``` | ||
## TODO | ||
- Add Typescript typings |
@@ -17,2 +17,3 @@ const ax = require('../build/Release/accessibility_node.node'); | ||
const delay = promisify(setTimeout); | ||
const newWindow = promisify(ax.createNewWindow); | ||
@@ -22,3 +23,2 @@ (async function() { | ||
console.log(process.pid) | ||
console.log("Node.js AFTER RUN"); | ||
// const cw = promisify(ax.createNewWindow); | ||
@@ -32,8 +32,18 @@ // await cw('com.apple.Terminal'); | ||
*/ | ||
console.log('After launch'); | ||
if (ax.isAppRunning('com.apple.Terminal')) { | ||
console.log('APP IS RUNNING'); | ||
await newWindow('com.apple.Terminal'); | ||
} else { | ||
console.log('APP IS NOT RUNNING'); | ||
await launch(); | ||
} | ||
})() | ||
/* | ||
ax.createNewWindow('com.apple.Terminal', (err) => { | ||
console.error(err); | ||
}); | ||
*/ | ||
// console.log(ax) | ||
@@ -40,0 +50,0 @@ // ax.run('com.apple.Terminal', () => console.log('App finished running')); |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42
56
446369