dont call clearclipboard in a loop
This commit is contained in:
parent
cd46f64993
commit
38fc0432c3
|
@ -186,12 +186,17 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
|||
|
||||
copyToClipboard(text: string, options?: any): void {
|
||||
const type = options ? options.type : null;
|
||||
const clearing = options ? !!options.clearing : false;
|
||||
const clearMs: number = options && options.clearMs ? options.clearMs : null;
|
||||
clipboard.writeText(text, type);
|
||||
this.messagingService.send('copiedToClipboard', {
|
||||
clipboardValue: text,
|
||||
clearMs: clearMs,
|
||||
});
|
||||
if (!clearing) {
|
||||
this.messagingService.send('copiedToClipboard', {
|
||||
clipboardValue: text,
|
||||
clearMs: clearMs,
|
||||
type: type,
|
||||
clearing: clearing,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
readFromClipboard(options?: any): Promise<string> {
|
||||
|
|
|
@ -67,7 +67,7 @@ export class SystemService implements SystemServiceAbstraction {
|
|||
this.clearClipboardTimeoutFunction = async () => {
|
||||
const clipboardValueNow = await this.platformUtilsService.readFromClipboard();
|
||||
if (clipboardValue === clipboardValueNow) {
|
||||
this.platformUtilsService.copyToClipboard('');
|
||||
this.platformUtilsService.copyToClipboard('', { clearing: true });
|
||||
}
|
||||
};
|
||||
this.clearClipboardTimeout = setTimeout(async () => {
|
||||
|
|
Loading…
Reference in New Issue