mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Added ladda library
This commit is contained in:
@@ -126,8 +126,9 @@ List of Definitions
|
||||
* [KoLite](https://github.com/CodeSeven/kolite) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Leaflet](https://github.com/Leaflet/Leaflet) (by [Vladimir](https://github.com/rgripper))
|
||||
* [Libxmljs](https://github.com/polotek/libxmljs) (by [François de Campredon](https://github.com/fdecampredon))
|
||||
* [ladda](https://github.com/hakimel/Ladda) (by [Danil Flores](https://github.com/dflor003))
|
||||
* [linq.js](http://linqjs.codeplex.com/) (by [Marcin Najder](https://github.com/marcinnajder))
|
||||
* [Livestamp.js](https://github.com/mattbradley/livestampjs) (by [Vincent Bortone] (https://github.com/vbortone))
|
||||
* [Livestamp.js](https://github.com/mattbradley/livestampjs) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr))
|
||||
* [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/))
|
||||
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
|
||||
|
||||
20
ladda/ladda-tests.ts
Normal file
20
ladda/ladda-tests.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
/// <reference path="ladda.d.ts" />
|
||||
|
||||
// Test bind
|
||||
Ladda.bind('button.ladda-button', { timeout: 42, callback: btn => alert('Clicked!!!') });
|
||||
Ladda.bind('button.ladda-button');
|
||||
Ladda.bind(document.createElement('button'), {});
|
||||
Ladda.bind(document.createElement('button'));
|
||||
|
||||
// Test stop all
|
||||
Ladda.stopAll();
|
||||
|
||||
// Test create
|
||||
var btnElement = document.createElement('button');
|
||||
var laddaBtn = Ladda.create(btnElement);
|
||||
|
||||
// Test operations via chaining
|
||||
laddaBtn.start().stop().toggle().setProgress(42).enable().disable().start();
|
||||
|
||||
// Test isLoading
|
||||
console.assert(laddaBtn.isLoading() === true);
|
||||
35
ladda/ladda.d.ts
vendored
Normal file
35
ladda/ladda.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// Type definitions for jStorage 0.4.0
|
||||
// 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: HTMLElement): ILaddaButton;
|
||||
|
||||
function stopAll(): void;
|
||||
}
|
||||
Reference in New Issue
Block a user