Add new typing for electron-clipboard-extended (#34845)

* Add new typing for electron-clipboard-extended

* Update types/electron-clipboard-extended/index.d.ts

Add listener param of off function

Co-Authored-By: Jungwoo-An <o1o9814@naver.com>
This commit is contained in:
Jungwoo An
2019-04-29 11:39:53 -07:00
committed by Armando Aguirre
parent dc09e01c62
commit c80715e62e
5 changed files with 51 additions and 0 deletions
@@ -0,0 +1,9 @@
import * as Clipboard from 'electron-clipboard-extended';
Clipboard.on('text-changed', () => Clipboard.readText())
.on('image-chnaged', () => Clipboard.readImage())
.once('text-changed', () => Clipboard.readText())
.startWatching();
Clipboard.off('text-changed');
Clipboard.stopWatching();
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for electron-clipboard-extended 1.x
// Project: https://github.com/arjun-g/electron-clipboard-extended
// Definitions by: Jungwoo An <https://github.com/Jungwoo-An>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.3
import * as Electron from 'electron';
interface ClipboardExtended extends Electron.Clipboard {
off: (event: string, listener?: () => void) => void;
startWatching: () => void;
stopWatching: () => void;
}
declare const clipboard: ClipboardExtended;
export = clipboard;
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"electron": "latest"
}
}
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6", "dom"],
"noEmit": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "electron-clipboard-extended-tests.ts"]
}
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}