auto-type progress

pull/1705/head
antelle 2021-01-30 16:00:57 +01:00
parent 66e1b0a089
commit a750e80ea1
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
2 changed files with 12 additions and 6 deletions

View File

@ -1,7 +1,8 @@
import { Features } from 'util/features';
import { NativeModules } from 'comp/launcher/native-modules';
import { CopyPaste } from 'comp/browser/copy-paste';
import { Logger } from 'util/logger';
import { Launcher } from 'comp/launcher';
import { Timeouts } from 'const/timeouts';
const logger = new Logger('auto-type-emitter');
@ -84,7 +85,7 @@ class AutoTypeEmitter {
key(key) {
if (typeof key === 'number') {
// TODO
// TODO: platform-specific keycodes
} else {
if (!KeyMap[key]) {
return this.callback('Bad key: ' + key);
@ -95,8 +96,12 @@ class AutoTypeEmitter {
}
copyPaste(text) {
CopyPaste.copy(text);
this.withCallback(NativeModules.kbdShortcut('V'));
setTimeout(() => {
Launcher.setClipboardText(text);
setTimeout(() => {
this.withCallback(NativeModules.kbdShortcut('V'));
}, Timeouts.AutoTypeCopyPaste);
}, Timeouts.AutoTypeCopyPaste);
}
wait(time) {
@ -108,7 +113,7 @@ class AutoTypeEmitter {
}
setDelay(delay) {
// TODO
// TODO: set delay to {delay} milliseconds between keystrokes
}
withCallback(promise) {

View File

@ -17,7 +17,8 @@ const Timeouts = {
ExternalDeviceAfterReconnect: 1000,
FieldLabelDoubleClick: 300,
NativeModuleHostRestartTime: 3000,
FastAnimation: 100
FastAnimation: 100,
AutoTypeCopyPaste: 300
};
export { Timeouts };