File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export interface ClipboardActionProvider {
2626 * @param {string } text The text to copy to the clipboard
2727 * @memberof ClipboardActionProvider
2828 */
29- copy ( text : string ) : void ;
29+ copy ( text : string ) : Promise < void > ;
3030
3131 /**
3232 * paste should allow to paste the current text on the system's clipboard
Original file line number Diff line number Diff line change @@ -5,16 +5,29 @@ export class ClipboardAction implements ClipboardActionProvider {
55 constructor ( ) {
66 }
77
8- public hasText ( ) : Promise < boolean > {
9- return Promise . resolve ( clippy . readSync ( ) . length > 0 ) ;
8+ public async hasText ( ) : Promise < boolean > {
9+ return new Promise < boolean > ( ( resolve , reject ) => {
10+ try {
11+ const content = clippy . readSync ( ) ;
12+ resolve ( content . length > 0 ) ;
13+ } catch ( e ) {
14+ reject ( e ) ;
15+ }
16+ } ) ;
1017 }
1118
1219 public clear ( ) : Promise < boolean > {
13- throw new Error ( "Method not implemented." ) ;
20+ return Promise . reject ( "Method not implemented." ) ;
1421 }
1522
16- public copy ( text : string ) : void {
17- clippy . writeSync ( text ) ;
23+ public async copy ( text : string ) : Promise < void > {
24+ return new Promise < void > ( ( resolve , reject ) => {
25+ try {
26+ clippy . writeSync ( text ) ;
27+ } catch ( e ) {
28+ reject ( e ) ;
29+ }
30+ } ) ;
1831 }
1932
2033 public async paste ( ) : Promise < string > {
You can’t perform that action at this time.
0 commit comments