Added ladda library

This commit is contained in:
Danil Flores
2013-06-21 23:09:43 -04:00
parent 50f6e3ccfc
commit bca57e2d23
3 changed files with 57 additions and 1 deletions

View File

@@ -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
View 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
View 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;
}