-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (26 loc) · 912 Bytes
/
index.js
File metadata and controls
30 lines (26 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
let platform_utils;
const noopPlatformUtils = {
getRunningInputAudioProcesses: () => {
return ['', ''];
}
};
if (process.platform === 'darwin') {
platform_utils = require("bindings")("mac_utils.node");
} else if (process.platform === 'win32') {
platform_utils = require("bindings")("win_utils.node");
} else {
console.log('node-mac-utils Unsupported platform:', process.platform);
platform_utils = noopPlatformUtils;
}
module.exports = {
// Common exports that work on all platforms
getRunningInputAudioProcesses: platform_utils.getRunningInputAudioProcesses,
INFO_ERROR_CODE: 1,
ERROR_DOMAIN: "com.MicrophoneUsageMonitor",
// Mac-specific exports
...(process.platform === 'darwin' ? {
makeKeyAndOrderFront: platform_utils.makeKeyAndOrderFront,
startMonitoringMic: platform_utils.startMonitoringMic,
stopMonitoringMic: platform_utils.stopMonitoringMic,
} : {})
};