mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 17:08:21 +08:00
Merge pull request #13536 from DanielRosenwasser/clipboard-umd
Fixed up 'clipboard' to be a UMD-style module.
This commit is contained in:
101
clipboard/index.d.ts
vendored
101
clipboard/index.d.ts
vendored
@@ -1,58 +1,57 @@
|
||||
// Type definitions for clipboard.js 1.5.9
|
||||
// Type definitions for clipboard.js 1.5
|
||||
// Project: https://github.com/zenorocha/clipboard.js
|
||||
// Definitions by: Andrei Kurosh <https://github.com/impworks>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'clipboard' {
|
||||
class Clipboard {
|
||||
constructor(selector: (string | Element | NodeListOf<Element>), options?: Clipboard.Options);
|
||||
declare class Clipboard {
|
||||
constructor(selector: (string | Element | NodeListOf<Element>), options?: Clipboard.Options);
|
||||
|
||||
/**
|
||||
* Subscribes to events that indicate the result of a copy/cut operation.
|
||||
* @param type {String} Event type ('success' or 'error').
|
||||
* @param handler Callback function.
|
||||
*/
|
||||
on(type: "success", handler: (e: Clipboard.Event) => void): this;
|
||||
on(type: "error", handler: (e: Clipboard.Event) => void): this;
|
||||
on(type: string, handler: (e: Clipboard.Event) => void): this;
|
||||
/**
|
||||
* Subscribes to events that indicate the result of a copy/cut operation.
|
||||
* @param type {"success" | "error"} Event type ('success' or 'error').
|
||||
* @param handler Callback function.
|
||||
*/
|
||||
on(type: "success" | "error", handler: (e: Clipboard.Event) => void): this;
|
||||
on(type: string, handler: (...args: any[]) => void): this;
|
||||
|
||||
/**
|
||||
* Clears all event bindings.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
namespace Clipboard {
|
||||
interface Options {
|
||||
/**
|
||||
* Overwrites default command ('cut' or 'copy').
|
||||
* @param {Element} elem Current element
|
||||
* @returns {String} Only 'cut' or 'copy'.
|
||||
*/
|
||||
action?: (elem: Element) => string;
|
||||
|
||||
/**
|
||||
* Overwrites default target input element.
|
||||
* @param {Element} elem Current element
|
||||
* @returns {Element} <input> element to use.
|
||||
*/
|
||||
target?: (elem: Element) => Element;
|
||||
|
||||
/**
|
||||
* Returns the explicit text to copy.
|
||||
* @param {Element} elem Current element
|
||||
* @returns {String} Text to be copied.
|
||||
*/
|
||||
text?: (elem: Element) => string;
|
||||
}
|
||||
|
||||
interface Event {
|
||||
action: string;
|
||||
text: string;
|
||||
trigger: Element;
|
||||
clearSelection(): void;
|
||||
}
|
||||
}
|
||||
|
||||
export = Clipboard;
|
||||
/**
|
||||
* Clears all event bindings.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
declare namespace Clipboard {
|
||||
interface Options {
|
||||
/**
|
||||
* Overwrites default command ('cut' or 'copy').
|
||||
* @param {Element} elem Current element
|
||||
* @returns {String} Only 'cut' or 'copy'.
|
||||
*/
|
||||
action?: (elem: Element) => string;
|
||||
|
||||
/**
|
||||
* Overwrites default target input element.
|
||||
* @param {Element} elem Current element
|
||||
* @returns {Element} <input> element to use.
|
||||
*/
|
||||
target?: (elem: Element) => Element;
|
||||
|
||||
/**
|
||||
* Returns the explicit text to copy.
|
||||
* @param {Element} elem Current element
|
||||
* @returns {String} Text to be copied.
|
||||
*/
|
||||
text?: (elem: Element) => string;
|
||||
}
|
||||
|
||||
interface Event {
|
||||
action: string;
|
||||
text: string;
|
||||
trigger: Element;
|
||||
clearSelection(): void;
|
||||
}
|
||||
}
|
||||
|
||||
export = Clipboard;
|
||||
|
||||
export as namespace Clipboard;
|
||||
1
clipboard/tslint.json
Normal file
1
clipboard/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user