added definition for jquery total-storage

fixed failing test

updated CONTRIBUTORS
This commit is contained in:
JeremyCBrooks 2014-04-13 11:24:48 -04:00
parent 1c1c12eaea
commit bb05b91c9c
3 changed files with 86 additions and 0 deletions

View File

@ -151,6 +151,7 @@ All definitions files include a header with the author and editors, so at some p
* [jQuery.TinyCarousel](http://baijs.nl/tinycarousel/) (by [Christiaan Rakowski](https://github.com/csrakowski))
* [jQuery.TinyScrollbar](http://baijs.nl/tinyscrollbar/) (by [Christiaan Rakowski](https://github.com/csrakowski))
* [jQuery.tooltipster](https://github.com/iamceege/tooltipster) (by [Patrick Magee](https://github.com/pjmagee))
* [jQuery.total-storage](https://github.com/Upstatement/jquery-total-storage) (by [Jeremy Brooks](https://github.com/JeremyCBrooks/))
* [jQuery.Transit](http://ricostacruz.com/jquery.transit/) (by [MrBigDog2U](https://github.com/MrBigDog2U))
* [jQuery.Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) (by [Boris Yankov](https://github.com/borisyankov))
* [jQuery.Watermark](http://jquery-watermark.googlecode.com) (by [Anwar Javed](https://github.com/anwarjaved))

View File

@ -0,0 +1,21 @@
// Type definitions for jQueryTotalStorage 1.1.2
// Project: https://github.com/Upstatement/jquery-total-storage
// Definitions by: Jeremy Brooks <https://github.com/JeremyCBrooks/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="jquery.total-storage.d.ts"/>
//direct call
$.totalStorage("test_key1", "test_value");
var val1:string = $.totalStorage("test_key");
//set/get
$.totalStorage.setItem("test_key2", 123);
var val2:number = $.totalStorage.getItem("test_key2");
//get all items
var list = $.totalStorage.getAll();
//delete item
var deleted = $.totalStorage.deleteItem("test_key1");

View File

@ -0,0 +1,64 @@
// Type definitions for jQueryTotalStorage 1.1.2
// Project: https://github.com/Upstatement/jquery-total-storage
// Definitions by: Jeremy Brooks <https://github.com/JeremyCBrooks/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
/**
* @desc Set the value of a key to a string
* @example $.totalStorage('the_key', 'the_value');
* @desc Set the value of a key to a number
* @example $.totalStorage('the_key', 800.2);
* @desc Set the value of a key to a complex Array
* @example var myArray = new Array();
* myArray.push({name:'Jared', company:'Upstatement', zip:63124});
* myArray.push({name:'McGruff', company:'Police', zip:60652};
* $.totalStorage('people', myArray);
* //to return:
* $.totalStorage('people');
*
*/
interface JQueryTotalStorage {
/**
* @desc Set or get a key's value
* @param key Key to set.
* @param value Value to set for key. If ommited, current value for key is returned.
* @param options Not implemented.
*/
(key: string, value?: any, options?: JQueryTotalStorageOptions): any;
/**
* @desc Set a key's value
* @param key Key to set.
* @param value Value to set for key.
*/
setItem(key: string, value: any): any;
/**
* @desc Get a key's value
* @param key Key to get.
*/
getItem(key: string): any;
/**
* @desc Get all set values
*/
getAll(): any[];
/**
* @desc Delete item by key
* @param key Key of item to delete
*/
deleteItem(key: string): boolean;
}
interface JQueryTotalStorageOptions {
//not implemented...
}
interface JQueryStatic {
totalStorage: JQueryTotalStorage;
}