mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-02 22:41:31 +01:00
first version of simple clipboard API, #217
This commit is contained in:
27
src/vs/workbench/api/electron-browser/mainThreadClipboard.ts
Normal file
27
src/vs/workbench/api/electron-browser/mainThreadClipboard.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user