[clipboard] isSupported() is a static method. (#22931)

This commit is contained in:
Renaud Chaput
2018-01-17 13:39:51 -08:00
committed by Wesley Wigham
parent 496c843d48
commit b9a24abe42
2 changed files with 19 additions and 16 deletions
+14 -14
View File
@@ -1,28 +1,28 @@
import * as Clipboard from 'clipboard';
import * as Clipboard from "clipboard";
const cb1 = new Clipboard('.btn');
const cb2 = new Clipboard(document.getElementById('id'), {
action: elem => 'copy'
const cb1 = new Clipboard(".btn");
const cb2 = new Clipboard(document.getElementById("id"), {
action: elem => "copy"
});
const cb3 = new Clipboard(document.querySelectorAll('query'), {
const cb3 = new Clipboard(document.querySelectorAll("query"), {
text: elem => null
});
const cb4 = new Clipboard('.btn', {
const cb4 = new Clipboard(".btn", {
target: elem => null
});
const cb5 = new Clipboard('.btn', {
action: elem => 'copy',
const cb5 = new Clipboard(".btn", {
action: elem => "copy",
target: elem => null
});
cb1.destroy();
cb1.isSupported();
Clipboard.isSupported();
cb2.on('success', e => {
console.info('Action:', e.action);
console.info('Text:', e.text);
console.info('Trigger:', e.trigger);
cb2.on("success", e => {
console.info("Action:", e.action);
console.info("Text:", e.text);
console.info("Trigger:", e.trigger);
e.clearSelection();
});
cb2.on('error', e => { });
cb2.on("error", e => {});
+5 -2
View File
@@ -4,7 +4,10 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Clipboard {
constructor(selector: (string | Element | NodeListOf<Element>), options?: Clipboard.Options);
constructor(
selector: string | Element | NodeListOf<Element>,
options?: Clipboard.Options
);
/**
* Subscribes to events that indicate the result of a copy/cut operation.
@@ -22,7 +25,7 @@ declare class Clipboard {
/**
* Checks if clipboard.js is supported
*/
isSupported(): boolean;
static isSupported(): boolean;
}
declare namespace Clipboard {