first version of simple clipboard API, #217

This commit is contained in:
Johannes Rieken
2018-10-08 12:38:26 +02:00
parent e202759899
commit 1580cd1846
6 changed files with 79 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { clipboard } from 'electron';
import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers';
import { MainContext, MainThreadClipboardShape } from '../node/extHost.protocol';
@extHostNamedCustomer(MainContext.MainThreadClipboard)
export class MainThreadCommands implements MainThreadClipboardShape {
dispose(): void {
// nothing
}
$readText(): Promise<string> {
return Promise.resolve(clipboard.readText());
}
$writeText(value: string): Promise<void> {
clipboard.writeText(value);
return undefined;
}
}