mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 18:43:21 +08:00
Merge pull request #19233 from sculove/egjs-component-types
add typings for egjs-component
This commit is contained in:
33
types/egjs__component/egjs__component-tests.ts
Normal file
33
types/egjs__component/egjs__component-tests.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import * as Component from "@egjs/component";
|
||||
|
||||
class TestKlass extends Component {
|
||||
}
|
||||
let is = false;
|
||||
const klass = new TestKlass();
|
||||
klass.options;
|
||||
|
||||
is = klass.hasOn("click");
|
||||
klass.on("click", () => {
|
||||
});
|
||||
klass.on({
|
||||
click1: () => {
|
||||
},
|
||||
click2: e => {
|
||||
}
|
||||
});
|
||||
klass.once("click", () => {
|
||||
});
|
||||
klass.once({
|
||||
click1: () => {
|
||||
},
|
||||
click2: e => {
|
||||
}
|
||||
});
|
||||
klass.off("click", () => {
|
||||
});
|
||||
klass.off("click");
|
||||
klass.off();
|
||||
is = klass.trigger("click");
|
||||
is = klass.trigger("click", {
|
||||
test: 1
|
||||
});
|
||||
30
types/egjs__component/index.d.ts
vendored
Normal file
30
types/egjs__component/index.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Type definitions for egjs-component 2.0
|
||||
// Project: https://github.com/naver/egjs-component
|
||||
// Definitions by: Naver <https://github.com/naver>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export as namespace eg;
|
||||
|
||||
export = Component;
|
||||
declare class Component {
|
||||
constructor(options?: { [key: string]: any });
|
||||
trigger(eventName: string, customEvent?: { [key: string]: any }): boolean;
|
||||
hasOn(eventName: string): boolean;
|
||||
on(eventName: string, handlerToAttach: (event: { [key: string]: any }) => any): Component;
|
||||
on(events: { [key: string]: (event: { [key: string]: any }) => any }): Component;
|
||||
off(eventName?: string, handlerToAttach?: (event: { [key: string]: any }) => any): Component;
|
||||
once(events: { [key: string]: (event: { [key: string]: any }) => any }): Component;
|
||||
once(eventName: string, handlerToAttach: (event: { [key: string]: any }) => any): Component;
|
||||
options: { [key: string]: any };
|
||||
}
|
||||
declare namespace Component {
|
||||
function trigger(eventName: string, customEvent?: { [key: string]: any }): boolean;
|
||||
function hasOn(eventName: string): boolean;
|
||||
function on(eventName: string, handlerToAttach: (event: { [key: string]: any }) => any): Component;
|
||||
function on(events: { [key: string]: (event: { [key: string]: any }) => any }): Component;
|
||||
function off(eventName?: string, handlerToAttach?: (event: { [key: string]: any }) => any): Component;
|
||||
function once(events: { [key: string]: (event: { [key: string]: any }) => any }): Component;
|
||||
function once(eventName: string, handlerToAttach: (event: { [key: string]: any }) => any): Component;
|
||||
let options: { [key: string]: any };
|
||||
}
|
||||
25
types/egjs__component/tsconfig.json
Normal file
25
types/egjs__component/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths":{
|
||||
"@egjs/component": ["egjs__component"]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"egjs__component-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/egjs__component/tslint.json
Normal file
1
types/egjs__component/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user