mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-09 03:30:09 +00:00
@@ -1,5 +1,29 @@
|
||||
/// <reference path="ladda.d.ts" />
|
||||
|
||||
// Automatically trigger the loading animation on click
|
||||
Ladda.bind('input[type=submit]');
|
||||
|
||||
// Same as the above but automatically stops after two seconds
|
||||
Ladda.bind('input[type=submit]', { timeout: 2000 });
|
||||
|
||||
// Create a new instance of ladda for the specified button
|
||||
var l = Ladda.create(document.querySelector('.my-button'));
|
||||
|
||||
// Start loading
|
||||
l.start();
|
||||
|
||||
// Will display a progress bar for 50% of the button width
|
||||
l.setProgress(0.5);
|
||||
|
||||
// Stop loading
|
||||
l.stop();
|
||||
|
||||
// Toggle between loading/not loading states
|
||||
l.toggle();
|
||||
|
||||
// Check the current state
|
||||
l.isLoading();
|
||||
|
||||
// Test bind
|
||||
Ladda.bind('button.ladda-button', { timeout: 42, callback: btn => alert('Clicked!!!') });
|
||||
Ladda.bind('button.ladda-button');
|
||||
@@ -17,4 +41,4 @@ var laddaBtn = Ladda.create(btnElement);
|
||||
laddaBtn.start().stop().toggle().setProgress(42).enable().disable().start();
|
||||
|
||||
// Test isLoading
|
||||
console.assert(laddaBtn.isLoading() === true);
|
||||
console.assert(laddaBtn.isLoading() === true);
|
||||
|
||||
6
ladda/ladda.d.ts
vendored
6
ladda/ladda.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for jStorage 0.4.0
|
||||
// Type definitions for Ladda 0.7.0
|
||||
// Project: https://github.com/hakimel/Ladda
|
||||
// Definitions by: Danil Flores <https://github.com/dflor003/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -29,7 +29,7 @@ declare module Ladda {
|
||||
function bind(target: HTMLElement, options?: ILaddaOptions): void;
|
||||
function bind(cssSelector: string, options?: ILaddaOptions): void;
|
||||
|
||||
function create(button: HTMLElement): ILaddaButton;
|
||||
function create(button: Element): ILaddaButton;
|
||||
|
||||
function stopAll(): void;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user