mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Updated Ladda definition to v0.9.4
This commit is contained in:
parent
bd9a1922e4
commit
04080791c5
@ -12,6 +12,9 @@ var l = Ladda.create(document.querySelector('.my-button'));
|
||||
// Start loading
|
||||
l.start();
|
||||
|
||||
// Start loading after a delay
|
||||
l.startAfter(300);
|
||||
|
||||
// Will display a progress bar for 50% of the button width
|
||||
l.setProgress(0.5);
|
||||
|
||||
@ -24,6 +27,9 @@ l.toggle();
|
||||
// Check the current state
|
||||
l.isLoading();
|
||||
|
||||
// Remove the element
|
||||
l.remove();
|
||||
|
||||
// Test bind
|
||||
Ladda.bind('button.ladda-button', { timeout: 42, callback: btn => alert('Clicked!!!') });
|
||||
Ladda.bind('button.ladda-button');
|
||||
|
||||
61
ladda/ladda.d.ts
vendored
61
ladda/ladda.d.ts
vendored
@ -1,35 +1,36 @@
|
||||
// Type definitions for Ladda 0.7.0
|
||||
// Type definitions for Ladda 0.9.4
|
||||
// Project: https://github.com/hakimel/Ladda
|
||||
// Definitions by: Danil Flores <https://github.com/dflor003/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Ladda {
|
||||
|
||||
interface ILaddaButton {
|
||||
start(): ILaddaButton;
|
||||
|
||||
stop(): ILaddaButton;
|
||||
|
||||
toggle(): ILaddaButton;
|
||||
|
||||
setProgress(progress: number): ILaddaButton;
|
||||
|
||||
enable(): ILaddaButton;
|
||||
|
||||
disable(): ILaddaButton;
|
||||
|
||||
isLoading(): boolean;
|
||||
}
|
||||
|
||||
interface ILaddaOptions {
|
||||
timeout?: number;
|
||||
callback?: (instance: ILaddaButton) => void;
|
||||
}
|
||||
|
||||
function bind(target: HTMLElement, options?: ILaddaOptions): void;
|
||||
function bind(cssSelector: string, options?: ILaddaOptions): void;
|
||||
|
||||
function create(button: Element): ILaddaButton;
|
||||
|
||||
function stopAll(): void;
|
||||
interface ILaddaButton {
|
||||
start(): ILaddaButton;
|
||||
startAfter(delay: number): ILaddaButton
|
||||
stop(): ILaddaButton;
|
||||
toggle(): ILaddaButton;
|
||||
setProgress(progress: number): ILaddaButton;
|
||||
enable(): ILaddaButton;
|
||||
disable(): ILaddaButton;
|
||||
isLoading(): boolean;
|
||||
remove(): void;
|
||||
}
|
||||
|
||||
interface ILaddaOptions {
|
||||
timeout?: number;
|
||||
callback?: (instance: ILaddaButton) => void;
|
||||
}
|
||||
|
||||
interface ILadda {
|
||||
bind(target: HTMLElement, options?: ILaddaOptions): void;
|
||||
bind(cssSelector: string, options?: ILaddaOptions): void;
|
||||
|
||||
create(button: Element): ILaddaButton;
|
||||
|
||||
stopAll(): void;
|
||||
}
|
||||
|
||||
declare var Ladda: ILadda;
|
||||
|
||||
declare module "ladda" {
|
||||
export = Ladda;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user