mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-20 11:38:50 +08:00
Merge pull request #6464 from johnmbaughman/bootstrap-switch-release
Bootstrap Switch release
This commit is contained in:
25
bootstrap-switch/bootstrap-switch-tests.ts
Normal file
25
bootstrap-switch/bootstrap-switch-tests.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="bootstrap-switch.d.ts" />
|
||||
|
||||
function test_cases() {
|
||||
$('#switch').bootstrapSwitch();
|
||||
|
||||
$('#switch').bootstrapSwitch({
|
||||
state: false
|
||||
});
|
||||
|
||||
$('#switch').bootstrapSwitch({
|
||||
state: false,
|
||||
disabled: true
|
||||
});
|
||||
|
||||
//var mySwitch = $('#switch').get(0);
|
||||
//mySwitch.toggleAnimate();
|
||||
|
||||
$('#switch').bootstrapSwitch('state', true, true);
|
||||
|
||||
|
||||
$('#switch').on('switchChange.bootstrapSwitch', (event) => {
|
||||
console.log($(event.target).val());
|
||||
});
|
||||
}
|
||||
102
bootstrap-switch/bootstrap-switch.d.ts
vendored
Normal file
102
bootstrap-switch/bootstrap-switch.d.ts
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
// Type definitions for Bootstrap Switch
|
||||
// Project: http://www.bootstrap-switch.org/
|
||||
// Definitions by: John M. Baughman <https://github.com/johnmbaughman>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* bootstrap-switch - v3.3.2 Copyright (c) 2012-2013 Mattia Larentis
|
||||
* Available via the Apache license.
|
||||
* see: http://www.bootstrap-switch.org/ or https://github.com/nostalgiaz/bootstrap-switch for details.
|
||||
*/
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare module BootstrapSwitch {
|
||||
interface BootstrapSwitchChangeEventObject extends JQueryEventObject {
|
||||
state: boolean
|
||||
}
|
||||
|
||||
interface BootstrapSwitchEventObject extends JQueryEventObject { }
|
||||
|
||||
interface BootstrapSwitchOptions {
|
||||
state?: boolean;
|
||||
size?: string;
|
||||
animate?: boolean;
|
||||
disabled?: boolean;
|
||||
readonly?: boolean;
|
||||
indeterminate?: boolean;
|
||||
invers?: boolean;
|
||||
radioAllOff?: boolean;
|
||||
onColor?: string;
|
||||
offColor?: string;
|
||||
onText?: string;
|
||||
offText?: string;
|
||||
labelText?: string;
|
||||
handleWidth?: string;
|
||||
labelWidth?: string;
|
||||
baseClass?: string;
|
||||
wrapperClass?: string;
|
||||
onInit?: any;
|
||||
onSwitchChange?: any;
|
||||
}
|
||||
|
||||
interface Switch {
|
||||
toggleAnimate(): JQuery;
|
||||
toggleDisabled(): JQuery;
|
||||
toggleReadonly(): JQuery;
|
||||
toggleIndeterminate(): JQuery;
|
||||
toggleInverse(): JQuery;
|
||||
destroy(): JQuery;
|
||||
|
||||
state(): boolean;
|
||||
state(value: any): JQuery;
|
||||
state(value: any, skip: boolean): JQuery;
|
||||
toggleState(skip?: boolean): JQuery;
|
||||
radioAllOff(): boolean;
|
||||
radioAllOff(state: boolean): JQuery;
|
||||
size(): string;
|
||||
size(size: string): JQuery;
|
||||
animate(): boolean;
|
||||
animate(state: boolean): JQuery;
|
||||
disabled(): boolean;
|
||||
disabled(state: boolean): JQuery;
|
||||
toggleDisabled(): JQuery;
|
||||
readonly(): boolean;
|
||||
readonly(state: boolean): JQuery;
|
||||
toggleReadOnly(): JQuery;
|
||||
onColor(): string;
|
||||
onColor(color: string): JQuery;
|
||||
offColor(): string;
|
||||
offColor(color: string): JQuery;
|
||||
onText(): string;
|
||||
onText(text: string): JQuery;
|
||||
offText(): string;
|
||||
offText(text: string): JQuery;
|
||||
labelText(): string;
|
||||
labelText(text: string): JQuery;
|
||||
baseClass(): string;
|
||||
baseClass(text: string): JQuery;
|
||||
wrapperClass(): string;
|
||||
wrapperClass(text: string): JQuery;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
bootstrapSwitch(): JQuery;
|
||||
bootstrapSwitch(options: BootstrapSwitch.BootstrapSwitchOptions): JQuery;
|
||||
bootstrapSwitch(method: string): JQuery;
|
||||
bootstrapSwitch(method: string, param: any): JQuery;
|
||||
bootstrapSwitch(method: string, param1: any, param2: any): JQuery;
|
||||
|
||||
off(events: "init.bootstrapSwitch", selector?: string, handler?: (eventobject: BootstrapSwitch.BootstrapSwitchEventObject) => any): JQuery;
|
||||
off(events: "init.bootstrapSwitch", handler?: (eventobject: BootstrapSwitch.BootstrapSwitchEventObject) => any): JQuery;
|
||||
|
||||
off(events: "switchChange.bootstrapSwitch", selector?: string, handler?: (eventobject: BootstrapSwitch.BootstrapSwitchChangeEventObject) => any): JQuery;
|
||||
off(events: "switchChange.bootstrapSwitch", handler?: (eventobject: BootstrapSwitch.BootstrapSwitchChangeEventObject) => any): JQuery;
|
||||
|
||||
on(events: "init.bootstrapSwitch", selector?: string, handler?: (eventobject: BootstrapSwitch.BootstrapSwitchEventObject) => any): JQuery;
|
||||
on(events: "init.bootstrapSwitch", handler?: (eventobject: BootstrapSwitch.BootstrapSwitchEventObject) => any): JQuery;
|
||||
|
||||
on(events: "switchChange.bootstrapSwitch", selector?: string, handler?: (eventobject: BootstrapSwitch.BootstrapSwitchChangeEventObject) => any): JQuery;
|
||||
on(events: "switchChange.bootstrapSwitch", handler?: (eventobject: BootstrapSwitch.BootstrapSwitchChangeEventObject) => any): JQuery;
|
||||
}
|
||||
Reference in New Issue
Block a user