mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-19 05:03:32 +08:00
Merge pull request #9948 from vvatanabe/tinycopy
add tinycopy type definitions
This commit is contained in:
17
tinycopy/tinycopy-tests.ts
Normal file
17
tinycopy/tinycopy-tests.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/// <reference path="tinycopy.d.ts" />
|
||||
|
||||
import TinyCopy from 'tinycopy';
|
||||
|
||||
TinyCopy.exec('test', (err, data) => {});
|
||||
|
||||
var trigger_1 = document.getElementById('trigger_1');
|
||||
var target_1 = document.getElementById('target');
|
||||
new TinyCopy(trigger_1, target_1)
|
||||
.on('success', function(data) {})
|
||||
.on('error', function(err) {});
|
||||
|
||||
var trigger_2 = document.getElementById('trigger_2');
|
||||
var target_2 = 'test';
|
||||
new TinyCopy(trigger_2, target_2)
|
||||
.on('success', function(data) {})
|
||||
.on('error', function(err) {});
|
||||
14
tinycopy/tinycopy.d.ts
vendored
Normal file
14
tinycopy/tinycopy.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// Type definitions for tinycopy 2.1.2
|
||||
// Project: https://github.com/vvatanabe/tinycopy
|
||||
// Definitions by: Yuichi Watanabe <https://github.com/vvatanabe>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "tinycopy" {
|
||||
export default class TinyCopy {
|
||||
constructor(trigger: Element, target: (string | Element | NodeListOf<Element>));
|
||||
on(type: "success", action: (data: string) => void): this;
|
||||
on(type: "error", action: (err: Error) => void): this;
|
||||
on(type: string, action: (e: (string | Error)) => void): this;
|
||||
static exec(value: string, callback: (err?: Error, data?: string) => void): void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user