Added clipboard-js definitions and tests

This commit is contained in:
Mark Wong Siang Kai
2016-10-10 20:37:59 -07:00
parent f9351fd6d2
commit c34293775d
2 changed files with 24 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
/// <reference path="clipboard-js.d.ts" />
clipboard.copy("Hello World");
clipboard.copy(document.body).then(() => console.log("success"));
clipboard.paste().then(val => console.log(val));
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for clipboard-js 0.3.1
// Project: https://github.com/lgarron/clipboard.js
// Definitions by: Mark Wong Siang Kai <https://github.com/markwongsk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace clipboard {
interface IClipboardJsStatic {
copy(val: string | Element): Promise<void>;
paste(): Promise<string>;
}
}
declare var clipboard: clipboard.IClipboardJsStatic;
declare module 'clipboard-js' {
export = clipboard;
}