mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-15 17:47:49 +08:00
Merge pull request #11896 from markwongsk/master
Added clipboard-js definitions and tests
This commit is contained in:
6
clipboard-js/clipboard-js-tests.ts
Normal file
6
clipboard-js/clipboard-js-tests.ts
Normal 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
clipboard-js/clipboard-js.d.ts
vendored
Normal file
18
clipboard-js/clipboard-js.d.ts
vendored
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user