keeweb/app/scripts/auto-type/helper/auto-type-helper-win32.js

26 lines
710 B
JavaScript
Raw Normal View History

2019-09-15 14:16:32 +02:00
import { AutoTypeNativeHelper } from 'auto-type/helper/auto-type-native-helper';
import { Launcher } from 'comp/launcher';
2016-04-19 20:03:02 +02:00
2020-06-01 16:53:51 +02:00
const AutoTypeHelper = function () {};
2016-04-19 20:03:02 +02:00
2020-06-01 16:53:51 +02:00
AutoTypeHelper.prototype.getActiveWindowInfo = function (callback) {
2016-04-24 14:08:46 +02:00
Launcher.spawn({
2016-07-24 09:53:34 +02:00
cmd: AutoTypeNativeHelper.getHelperPath(),
2016-04-24 14:08:46 +02:00
args: ['--window-info'],
2019-08-18 10:17:09 +02:00
complete(err, out) {
2019-08-16 23:05:39 +02:00
if (err) {
return callback(err);
}
const [id, title, url] = out.trim().split('\n');
const windowInfo = {
id,
title,
url
};
return callback(null, windowInfo);
2016-04-24 14:08:46 +02:00
}
});
2016-04-19 20:03:02 +02:00
};
2019-09-15 14:16:32 +02:00
export { AutoTypeHelper };