mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-17 12:16:38 +08:00
Added jQuery.Cookie definitions and tests
This commit is contained in:
129
README.md
129
README.md
@@ -1,65 +1,66 @@
|
||||
DefinitelyTyped
|
||||
===============
|
||||
|
||||
TypeScript type definitions repository for popular JavaScript libraries.
|
||||
|
||||
The project aims to provide *high quality* definitions for the most popular libraries out there.
|
||||
|
||||
Complete
|
||||
--------
|
||||
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
|
||||
* [async](https://github.com/caolan/async) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Backbone.js](http://backbonejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Bootstrap](http://twitter.github.com/bootstrap/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [bootstrap.datepicker](https://github.com/eternicode/bootstrap-datepicker) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Breeze](http://www.breezejs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [CodeMirror](http://codemirror.net) (by [Fran<EFBFBD>ois de Campredon](https://github.com/fdecampredon))
|
||||
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [dynatree](http://code.google.com/p/dynatree/) (by [Fran<EFBFBD>ois de Campredon](https://github.com/fdecampredon))
|
||||
* [d3.js](http://d3js.org/) (from TypeScript samples)
|
||||
* [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Express](http://expressjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Fancybox](http://fancybox.net/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Foundation](http://foundation.zurb.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [GoogleMaps](https://developers.google.com/maps/) (by [Esben Nepper](https://github.com/eNepper))
|
||||
* [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Highcharts]http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
|
||||
* [History.js](https://github.com/balupton/History.js/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [Impress.js](https://github.com/bartaz/impress.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery](http://jquery.com/) (from TypeScript samples)
|
||||
* [jQuery Mobile](http://jquerymobile.com) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery UI](http://jqueryui.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos))
|
||||
* [jQuery.Globalize](https://github.com/jquery/globalize) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery.Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Knockback](http://kmalakoff.github.com/knockback/) (by [Marcel Binot](https://github.com/docgit))
|
||||
* [Knockout.js](http://knockoutjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [linq.js](http://linqjs.codeplex.com/) (by [Marcin Najder](https://github.com/marcinnajder))
|
||||
* [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
|
||||
* [Mustache.js](https://github.com/janl/mustache.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Node.js](http://nodejs.org/) (from TypeScript samples)
|
||||
* [node_redis](https://github.com/mranney/node_redis) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [PreloadJS](http://www.createjs.com/#!/PreloadJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [QUnit](http://qunitjs.com/) (by [Diullei Gomes](https://github.com/Diullei))
|
||||
* [Raphael](http://raphaeljs.com/) (by [CheCoxshall](https://github.com/CheCoxshall))
|
||||
* [require.js](http://requirejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [Sammy.js](http://sammyjs.org/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Select2](http://ivaynberg.github.com/select2/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [SignalR](http://www.asp.net/signalr) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Sugar](http://sugarjs.com/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [Teechart](http://www.steema.com) (by [Steema](http://www.steema.com))
|
||||
* [Toastr](https://github.com/CodeSeven/toastr) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [TweenJS](http://www.createjs.com/#!/TweenJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [tween.js](https://github.com/sole/tween.js/) (by [Adam R. Smith](https://github.com/sunetos))
|
||||
* [Ubuntu Unity Web API](https://launchpad.net/libunity-webapps) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [Underscore.js](http://underscorejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
DefinitelyTyped
|
||||
===============
|
||||
|
||||
TypeScript type definitions repository for popular JavaScript libraries.
|
||||
|
||||
The project aims to provide *high quality* definitions for the most popular libraries out there.
|
||||
|
||||
Complete
|
||||
--------
|
||||
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
|
||||
* [async](https://github.com/caolan/async) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Backbone.js](http://backbonejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Bootstrap](http://twitter.github.com/bootstrap/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [bootstrap.datepicker](https://github.com/eternicode/bootstrap-datepicker) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Breeze](http://www.breezejs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [CodeMirror](http://codemirror.net) (by [Fran<EFBFBD>ois de Campredon](https://github.com/fdecampredon))
|
||||
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [dynatree](http://code.google.com/p/dynatree/) (by [Fran<EFBFBD>ois de Campredon](https://github.com/fdecampredon))
|
||||
* [d3.js](http://d3js.org/) (from TypeScript samples)
|
||||
* [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Express](http://expressjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Fancybox](http://fancybox.net/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Foundation](http://foundation.zurb.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [GoogleMaps](https://developers.google.com/maps/) (by [Esben Nepper](https://github.com/eNepper))
|
||||
* [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Highcharts]http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
|
||||
* [History.js](https://github.com/balupton/History.js/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [Impress.js](https://github.com/bartaz/impress.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery](http://jquery.com/) (from TypeScript samples)
|
||||
* [jQuery Mobile](http://jquerymobile.com) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery UI](http://jqueryui.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos))
|
||||
* [jQuery.Cookie](https://github.com/carhartl/jquery-cookie) (by [Roy Goode](https://github.com/RoyGoode))
|
||||
* [jQuery.Globalize](https://github.com/jquery/globalize) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery.Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Knockback](http://kmalakoff.github.com/knockback/) (by [Marcel Binot](https://github.com/docgit))
|
||||
* [Knockout.js](http://knockoutjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [linq.js](http://linqjs.codeplex.com/) (by [Marcin Najder](https://github.com/marcinnajder))
|
||||
* [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
|
||||
* [Mustache.js](https://github.com/janl/mustache.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Node.js](http://nodejs.org/) (from TypeScript samples)
|
||||
* [node_redis](https://github.com/mranney/node_redis) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [PreloadJS](http://www.createjs.com/#!/PreloadJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [QUnit](http://qunitjs.com/) (by [Diullei Gomes](https://github.com/Diullei))
|
||||
* [Raphael](http://raphaeljs.com/) (by [CheCoxshall](https://github.com/CheCoxshall))
|
||||
* [require.js](http://requirejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [Sammy.js](http://sammyjs.org/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Select2](http://ivaynberg.github.com/select2/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [SignalR](http://www.asp.net/signalr) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Sugar](http://sugarjs.com/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [Teechart](http://www.steema.com) (by [Steema](http://www.steema.com))
|
||||
* [Toastr](https://github.com/CodeSeven/toastr) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [TweenJS](http://www.createjs.com/#!/TweenJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [tween.js](https://github.com/sole/tween.js/) (by [Adam R. Smith](https://github.com/sunetos))
|
||||
* [Ubuntu Unity Web API](https://launchpad.net/libunity-webapps) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [Underscore.js](http://underscorejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Underscore.js (Typed)](http://underscorejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
37
jquery.cookie/jquery.cookie-tests.ts
Normal file
37
jquery.cookie/jquery.cookie-tests.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
///<reference path="../jquery/jquery-1.8.d.ts" />
|
||||
///<reference path="jquery.cookie.d.ts" />
|
||||
|
||||
class TestObject {
|
||||
text: string;
|
||||
value: number;
|
||||
|
||||
constructor (text: string, value: number) {
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
class CookieOptions implements JQueryCookieOptions {
|
||||
expires: number;
|
||||
path: string;
|
||||
domain: string;
|
||||
secure: bool;
|
||||
}
|
||||
|
||||
$.cookie("the_cookie", "the_value");
|
||||
|
||||
console.log($.cookie("the_cookie"));
|
||||
|
||||
var testObject = new TestObject("Hello World", 5);
|
||||
|
||||
var cookieOptions = new CookieOptions();
|
||||
cookieOptions.path = "/";
|
||||
cookieOptions.domain = "jquery.com";
|
||||
|
||||
$.cookie.json = true;
|
||||
|
||||
$.cookie("test", testObject, cookieOptions);
|
||||
|
||||
var result = <TestObject>$.cookie("test");
|
||||
|
||||
console.log(result.text);
|
||||
31
jquery.cookie/jquery.cookie.d.ts
vendored
Normal file
31
jquery.cookie/jquery.cookie.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Type definitions for jQuery Cookie Plugin 1.3
|
||||
// Project: https://github.com/carhartl/jquery-cookie
|
||||
// Definitions by: Roy Goode <https://github.com/RoyGoode/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery-1.8.d.ts" />
|
||||
|
||||
interface JQueryCookieOptions {
|
||||
expires?: number;
|
||||
path?: string;
|
||||
domain?: string;
|
||||
secure?: bool;
|
||||
}
|
||||
|
||||
interface JQueryCookieStatic {
|
||||
raw?: bool;
|
||||
json?: bool;
|
||||
|
||||
(name: string): any;
|
||||
(name: string, value: string): void;
|
||||
(name: string, value: string, options: JQueryCookieOptions): void;
|
||||
(name: string, value: any): void;
|
||||
(name: string, value: any, options: JQueryCookieOptions): void;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
cookie?: JQueryCookieStatic;
|
||||
|
||||
removeCookie(name: string): bool;
|
||||
removeCookie(name: string, options: JQueryCookieOptions): bool;
|
||||
}
|
||||
Reference in New Issue
Block a user