mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 10:35:22 +08:00
Merge pull request #16519 from kenneth-igaw/master
add homeworks as type definition.
This commit is contained in:
93
types/homeworks/homeworks-tests.ts
Normal file
93
types/homeworks/homeworks-tests.ts
Normal file
@@ -0,0 +1,93 @@
|
||||
const element: JQuery = $('#element');
|
||||
const target: JQuery = $('#target');
|
||||
|
||||
element.checkbox({
|
||||
/* Empty options */
|
||||
}).bind('change', (event: HomeWorksEventObject) => {
|
||||
/* HomeWorks native event */
|
||||
});
|
||||
|
||||
element.converter({
|
||||
/* Empty options */
|
||||
});
|
||||
|
||||
element.dropdown({
|
||||
/* Empty options */
|
||||
});
|
||||
|
||||
const dropdownHandlerTarget: JQuery = element.addHandler(target);
|
||||
|
||||
element.input({
|
||||
/* Empty options */
|
||||
}).bind('change', (event: HomeWorksEventObject) => {
|
||||
/* HomeWorks native event */
|
||||
});
|
||||
|
||||
element.modal({
|
||||
/* Any options */
|
||||
}).each(() => {
|
||||
/* Chaining */
|
||||
});
|
||||
element.modal('show');
|
||||
element.modal('hide');
|
||||
element.modal('open');
|
||||
element.modal('close');
|
||||
|
||||
notification('title', 'content', 'url', 'success');
|
||||
|
||||
element.ripple({
|
||||
/* Object options */
|
||||
});
|
||||
element.start({
|
||||
x: 1,
|
||||
y: 2
|
||||
});
|
||||
|
||||
element.spinner({
|
||||
type: 'any',
|
||||
empty: 'any'
|
||||
}).bind('change', (event: HomeWorksEventObject) => {
|
||||
/* HomeWorks native event */
|
||||
});
|
||||
|
||||
element.step('method');
|
||||
element.step({
|
||||
active: 0
|
||||
}).bind('move', (event: HomeWorksStepEventObject) => {
|
||||
/* HomeWorks step event */
|
||||
});
|
||||
|
||||
element.tab('method');
|
||||
element.tab({
|
||||
active: 0
|
||||
}).bind('move', (event: HomeWorksTabEventObject) => {
|
||||
/* HomeWorks step event */
|
||||
});
|
||||
|
||||
toast('hello homeworks');
|
||||
toast({
|
||||
message: 'hello homeworks'
|
||||
});
|
||||
|
||||
element.toggle({
|
||||
placeholder: 'placeholder'
|
||||
}).bind('change', (event: HomeWorksEventObject) => {
|
||||
/* HomeWorks native event */
|
||||
});
|
||||
|
||||
element.upload({
|
||||
url: 'url',
|
||||
type: 'type',
|
||||
data: {},
|
||||
dest: 'dest',
|
||||
isBtn: true,
|
||||
beforeStart() {
|
||||
},
|
||||
complete(data: any) {
|
||||
},
|
||||
success(data?: any, state?: any, xhr?: any) {
|
||||
},
|
||||
error(xhr?: any, state?: any, error?: any) {
|
||||
},
|
||||
extensions: 'any'
|
||||
});
|
||||
212
types/homeworks/index.d.ts
vendored
Normal file
212
types/homeworks/index.d.ts
vendored
Normal file
@@ -0,0 +1,212 @@
|
||||
// Type definitions for homeworks 1.0
|
||||
// Project: https://github.com/IGAWorksDev/homeworks/
|
||||
// Definitions by: Kenneth Ceyer <https://github.com/KennethanCeyer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
/**
|
||||
* * [MAIN]
|
||||
* @ EVENT
|
||||
*
|
||||
*/
|
||||
|
||||
declare interface HomeWorksEventObject {
|
||||
element: JQuery;
|
||||
value: string;
|
||||
checked?: boolean;
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
bind(eventType: string, handler: (...parameters: any[]) => void): JQuery;
|
||||
knock(): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ CHECKBOX
|
||||
*
|
||||
*/
|
||||
interface CheckboxOptions {
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
checkbox(options?: CheckboxOptions): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ CONVERTER
|
||||
*
|
||||
*/
|
||||
|
||||
interface ConverterOptions {
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
converter(options?: ConverterOptions): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ DROPDOIWN
|
||||
*
|
||||
*/
|
||||
|
||||
interface DropdownOptions {
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
dropdown(options?: DropdownOptions): JQuery;
|
||||
addHandler(target: JQuery): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ INPUT
|
||||
*
|
||||
*/
|
||||
|
||||
interface InputOptions {
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
input(options?: InputOptions): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ MODAL
|
||||
*
|
||||
*/
|
||||
|
||||
declare interface JQuery {
|
||||
modal(options?: any): JQuery;
|
||||
modal(method?: string, options?: any): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ NOTIFICATION
|
||||
*
|
||||
*/
|
||||
|
||||
declare function notification(title: string, content: string, url: string, status?: string): void;
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ RIPPLE
|
||||
*
|
||||
*/
|
||||
|
||||
interface RippleStartOptions {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
ripple(options?: any): JQuery;
|
||||
start(options?: RippleStartOptions): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ SPINNER
|
||||
*
|
||||
*/
|
||||
|
||||
interface SpinnerOptions {
|
||||
type?: any;
|
||||
empty?: any;
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
spinner(options?: SpinnerOptions): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ STEP
|
||||
*
|
||||
*/
|
||||
|
||||
interface StepOptions {
|
||||
active?: number;
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
step(method?: string): JQuery;
|
||||
step(options?: StepOptions): JQuery;
|
||||
}
|
||||
|
||||
declare interface HomeWorksStepEventObject {
|
||||
header: JQuery[];
|
||||
index: number;
|
||||
length: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ TAB
|
||||
*
|
||||
*/
|
||||
|
||||
interface TabOptions {
|
||||
active?: number;
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
tab(method?: string): JQuery;
|
||||
tab(options?: TabOptions): JQuery;
|
||||
}
|
||||
|
||||
declare interface HomeWorksTabEventObject {
|
||||
header: JQuery[];
|
||||
index: number;
|
||||
length: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ TOAST
|
||||
*
|
||||
*/
|
||||
|
||||
declare function toast(message: any): void;
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ TOGGLE
|
||||
*
|
||||
*/
|
||||
|
||||
interface ToggleOptions {
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
toggle(options: ToggleOptions): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* * [COMPONENT]
|
||||
* @ UPLOAD
|
||||
*
|
||||
*/
|
||||
|
||||
interface UploadOptions {
|
||||
url: string;
|
||||
type?: string;
|
||||
data?: any;
|
||||
dest?: string;
|
||||
isBtn?: boolean;
|
||||
beforeStart?: () => void;
|
||||
complete?: (data?: any) => void;
|
||||
success?: (data?: any, state?: any, xhr?: any) => void;
|
||||
error?: (xhr?: any, state?: any, error?: any) => void;
|
||||
extensions?: any;
|
||||
}
|
||||
|
||||
declare interface JQuery {
|
||||
upload(options?: UploadOptions): JQuery;
|
||||
}
|
||||
22
types/homeworks/tsconfig.json
Normal file
22
types/homeworks/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"homeworks-tests.ts"
|
||||
]
|
||||
}
|
||||
9
types/homeworks/tslint.json
Normal file
9
types/homeworks/tslint.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-empty-interface": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"prefer-method-signature": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user