mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
Merge branch 'master' into release-0.9.7
Conflicts: package.json
This commit is contained in:
1
CONTRIBUTING.md
Normal file
1
CONTRIBUTING.md
Normal file
@@ -0,0 +1 @@
|
||||
Please see the [contribution guide](https://github.com/borisyankov/DefinitelyTyped/wiki/How-to-contribute) for information on how to contribute to this project.
|
||||
@@ -21,8 +21,7 @@ See the section: [How to contribute](https://github.com/borisyankov/DefinitelyTy
|
||||
Other means to get the definitions
|
||||
----------------------------------
|
||||
* [NuGet packages](http://nuget.org/packages?q=DefinitelyTyped)
|
||||
* [TypeScript definition package manager](https://github.com/Diullei/tsd)
|
||||
* [tsdpm](http://www.tsdpm.com/) - Online search
|
||||
* [TypeScript Definition package manager](https://github.com/DefinitelyTyped/tsd)
|
||||
|
||||
List of Definitions
|
||||
-------------------
|
||||
@@ -133,6 +132,7 @@ List of Definitions
|
||||
* [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/))
|
||||
* [jQuery.Cookie](https://github.com/carhartl/jquery-cookie) (by [Roy Goode](https://github.com/RoyGoode))
|
||||
* [jQuery.Cycle](http://jquery.malsup.com/cycle/) (by [François Guillot](http://fguillot.developpez.com/))
|
||||
* [jQuery.Cycle2](http://jquery.malsup.com/cycle2/) (by [Donny Nadolny](https://github.com/dnadolny))
|
||||
* [jQuery.dataTables](http://www.datatables.net) (by [Armin Sander](https://github.com/pragmatrix))
|
||||
* [jQuery.dynatree](http://code.google.com/p/dynatree/) (by [François de Campredon](https://github.com/fdecampredon))
|
||||
* [jQuery.Flot](http://www.flotcharts.org/) (by [Matt Burland](https://github.com/burlandm))
|
||||
@@ -182,6 +182,7 @@ List of Definitions
|
||||
* [Levelup](https://github.com/rvagg/node-levelup) (by [Bret Little](https://github.com/blittle))
|
||||
* [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))
|
||||
* [localForage](https://github.com/mozilla/localForage) (by [david pichsenmeister](https://github.com/3x14159265))
|
||||
* [Lodash](http://lodash.com/) (by [Brian Zengel](https://github.com/bczengel))
|
||||
* [Logg](https://github.com/dpup/node-logg) (by [Bret Little](https://github.com/blittle))
|
||||
* [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr))
|
||||
|
||||
10
bluebird/bluebird.d.ts
vendored
10
bluebird/bluebird.d.ts
vendored
@@ -3,6 +3,13 @@
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// note: these are preliminary typings using `any`: the generic versions are under construction, see:
|
||||
|
||||
// https://github.com/borisyankov/DefinitelyTyped/issues/1563
|
||||
|
||||
// https://github.com/borisyankov/DefinitelyTyped/tree/def/bluebird
|
||||
|
||||
|
||||
declare module Bluebird {
|
||||
|
||||
interface ArrayLike {
|
||||
@@ -496,3 +503,6 @@ declare module Bluebird {
|
||||
filter(values:any[], filterer:(item:any, index?:number, arrayLength?:number) => any):Promise;
|
||||
}
|
||||
}
|
||||
declare module 'bluebird' {
|
||||
export = Bluebird;
|
||||
}
|
||||
|
||||
8
express/express.d.ts
vendored
8
express/express.d.ts
vendored
@@ -122,6 +122,10 @@ declare module "express" {
|
||||
del(name: string, ...handlers: RequestFunction[]): T;
|
||||
|
||||
del(name: RegExp, ...handlers: RequestFunction[]): T;
|
||||
|
||||
patch(name: string, ...handlers: RequestFunction[]): T;
|
||||
|
||||
patch(name: RegExp, ...handlers: RequestFunction[]): T;
|
||||
}
|
||||
|
||||
export class Router implements IRouter<Router> {
|
||||
@@ -152,6 +156,10 @@ declare module "express" {
|
||||
del(name: string, ...handlers: RequestFunction[]): Router;
|
||||
|
||||
del(name: RegExp, ...handlers: RequestFunction[]): Router;
|
||||
|
||||
patch(name: string, ...handlers: RequestFunction[]): Router;
|
||||
|
||||
patch(name: RegExp, ...handlers: RequestFunction[]): Router;
|
||||
}
|
||||
|
||||
interface Handler {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
""
|
||||
@@ -1 +0,0 @@
|
||||
""
|
||||
@@ -42,9 +42,20 @@ exports = (grunt: IGrunt) => {
|
||||
var valid = false;
|
||||
valid = valid && options.sourceRoot === "default";
|
||||
valid = valid && currenttask.data.repeat > 0;
|
||||
return valid;
|
||||
|
||||
var done = this.async();
|
||||
done();
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('task-1', "", function() {
|
||||
var done = this.async();
|
||||
done(new Error('nope'));
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('task-2', "", function() {
|
||||
var done = this.async();
|
||||
done(false);
|
||||
});
|
||||
|
||||
// util methods
|
||||
var testOneArg = (a: number) => a * 2;
|
||||
@@ -61,4 +72,4 @@ exports = (grunt: IGrunt) => {
|
||||
fileMaps.length;
|
||||
fileMaps[0].src.length;
|
||||
fileMaps[0].dest;
|
||||
};
|
||||
};
|
||||
|
||||
7
gruntjs/gruntjs.d.ts
vendored
7
gruntjs/gruntjs.d.ts
vendored
@@ -816,9 +816,10 @@ declare module grunt {
|
||||
* Either false or an Error object may be passed to the done function
|
||||
* to instruct Grunt that the task has failed.
|
||||
*/
|
||||
done(success: boolean): void;
|
||||
done(error: Error): void;
|
||||
done(result: any): void;
|
||||
(success: boolean): void;
|
||||
(error: Error): void;
|
||||
(result: any): void;
|
||||
(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
25
jake/jake.d.ts
vendored
25
jake/jake.d.ts
vendored
@@ -114,7 +114,7 @@ declare module jake{
|
||||
*/
|
||||
breakOnError?:boolean;
|
||||
}
|
||||
export function exec(cmds:string[], callback?:()=>void, opts?:ExecOptions);
|
||||
export function exec(cmds:string[], callback?:()=>void, opts?:ExecOptions):void;
|
||||
|
||||
|
||||
/**
|
||||
@@ -125,10 +125,6 @@ declare module jake{
|
||||
* @event error When a shell-command
|
||||
*/
|
||||
export interface Exec extends NodeEventEmitter {
|
||||
constructor(cmds:string[], callback?:()=>void, opts?:ExecOptions);
|
||||
constructor(cmds:string[], opts?:ExecOptions, callback?:()=>void);
|
||||
constructor(cmds:string, callback?:()=>void, opts?:ExecOptions);
|
||||
constructor(cmds:string, opts?:ExecOptions, callback?:()=>void);
|
||||
append(cmd:string): void;
|
||||
run(): void;
|
||||
}
|
||||
@@ -208,11 +204,9 @@ declare module jake{
|
||||
removeAllListeners(event?: string): NodeEventEmitter;
|
||||
setMaxListeners(n: number): void;
|
||||
listeners(event: string): Function[];
|
||||
emit(event: string, arg1?: any, arg2?: any): boolean;
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class DirectoryTask{
|
||||
/**
|
||||
* @param name The name of the directory to create.
|
||||
@@ -275,7 +269,6 @@ declare module jake{
|
||||
exclude(file:FileFilter[]): void;
|
||||
exclude(...file:FileFilter[]): void;
|
||||
|
||||
|
||||
/**
|
||||
* Populates the FileList from the include/exclude rules with a list of
|
||||
* actual files
|
||||
@@ -377,12 +370,12 @@ declare module jake{
|
||||
constructor(name:string, packageFiles:string[]);
|
||||
}
|
||||
|
||||
export function addListener(event: string, listener: Function);
|
||||
export function on(event: string, listener: Function);
|
||||
export function once(event: string, listener: Function): void;
|
||||
export function removeListener(event: string, listener: Function): void;
|
||||
export function removeAllListener(event: string): void;
|
||||
export function addListener(event: string, listener: Function): NodeEventEmitter;
|
||||
export function on(event: string, listener: Function): NodeEventEmitter;
|
||||
export function once(event: string, listener: Function): NodeEventEmitter;
|
||||
export function removeListener(event: string, listener: Function): NodeEventEmitter;
|
||||
export function removeAllListener(event: string): NodeEventEmitter;
|
||||
export function setMaxListeners(n: number): void;
|
||||
export function listeners(event: string): { Function; }[];
|
||||
export function emit(event: string, arg1?: any, arg2?: any): void;
|
||||
export function listeners(event: string): Function[];
|
||||
export function emit(event: string, ...args: any[]): boolean;
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
""
|
||||
50
jquery.cycle2/jquery.cycle2-tests.ts
Normal file
50
jquery.cycle2/jquery.cycle2-tests.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="jquery.cycle2.d.ts"/>
|
||||
|
||||
// basic
|
||||
$('#element').cycle();
|
||||
|
||||
|
||||
// code snippets from http://jquery.malsup.com/cycle2/api
|
||||
$('.cycle-slideshow').cycle({
|
||||
speed: 600,
|
||||
manualSpeed: 100
|
||||
});
|
||||
|
||||
var newSlide = '<img src="pic.jpg">';
|
||||
$('.cycle-slideshow').cycle('add', newSlide);
|
||||
|
||||
$('.cycle-slideshow').cycle('destroy');
|
||||
|
||||
// goto 3rd slide
|
||||
$('.cycle-slideshow').cycle('goto', 2);
|
||||
|
||||
$('.cycle-slideshow').cycle('next');
|
||||
|
||||
$('.cycle-slideshow').cycle('pause');
|
||||
|
||||
$('.cycle-slideshow').cycle('prev');
|
||||
|
||||
$('.cycle-slideshow').cycle('reinit');
|
||||
|
||||
// remove 2nd slide
|
||||
$('.cycle-slideshow').cycle('remove', 1);
|
||||
|
||||
$('.cycle-slideshow').cycle('resume');
|
||||
|
||||
$('.cycle-slideshow').cycle('stop');
|
||||
|
||||
|
||||
// from http://jquery.malsup.com/cycle2/demo/add.php
|
||||
var images = [
|
||||
'<img src="http://malsup.github.io/images/p2.jpg">',
|
||||
'<img src="http://malsup.github.io/images/p3.jpg">',
|
||||
'<img src="http://malsup.github.io/images/p4.jpg">'
|
||||
];
|
||||
|
||||
$('button').one('click', function() {
|
||||
for (var i=0; i < images.length; i++) {
|
||||
$('.cycle-slideshow').cycle('add', images[i]);
|
||||
}
|
||||
$(this).prop('disabled', true)
|
||||
})
|
||||
143
jquery.cycle2/jquery.cycle2.d.ts
vendored
Normal file
143
jquery.cycle2/jquery.cycle2.d.ts
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
// Type definitions for jQuery Cycle2 version 2.1.2 (build 20140216)
|
||||
// Project: http://jquery.malsup.com/cycle2/ (also https://github.com/malsup/cycle2)
|
||||
// Definitions by: Donny Nadolny <https://github.com/dnadolny/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface JQuery {
|
||||
cycle: JQueryCycle2.Cycle2;
|
||||
|
||||
on(methodName: 'cycle-after', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState, outgoingSlideEl: Element, incomingSlideEl: Element, forwardFlag: boolean) => void): JQuery;
|
||||
on(methodName: 'cycle-before', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState, outgoingSlideEl: Element, incomingSlideEl: Element, forwardFlag: boolean) => void): JQuery;
|
||||
on(methodName: 'cycle-bootstrap', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState, API: JQueryCycle2.API) => void): JQuery;
|
||||
on(methodName: 'cycle-destroyed', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-finished', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-initialized', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-next', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-pager-activated', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-paused', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-post-initialize', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-pre-initialize', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-prev', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-resumed', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-slide-added', callback: (event: JQueryEventObject, jQueryWrappedSlideEl: JQuery) => void): JQuery;
|
||||
on(methodName: 'cycle-slide-removed', callback: (event: JQueryEventObject, indexOfSlideRemoved: number, removedSlideEl: Element) => void): JQuery;
|
||||
on(methodName: 'cycle-stopped', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-transition-stopped', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState) => void): JQuery;
|
||||
on(methodName: 'cycle-update-view', callback: (event: JQueryEventObject, optionHash: JQueryCycle2.OptionsWithState, slideOptionsHash: JQueryCycle2.OptionsWithState, currentSlideEl: Element) => void): JQuery;
|
||||
}
|
||||
|
||||
|
||||
declare module JQueryCycle2 {
|
||||
interface Cycle2 {
|
||||
(options?: Options): JQuery;
|
||||
(methodName: 'add', newSlide: any): JQuery; // string or JQuery
|
||||
(methodName: 'destroy'): JQuery;
|
||||
(methodName: 'goto', index: number): JQuery;
|
||||
(methodName: 'next'): JQuery;
|
||||
(methodName: 'pause'): JQuery;
|
||||
(methodName: 'prev'): JQuery;
|
||||
(methodName: 'reinit'): JQuery;
|
||||
(methodName: 'remove', index: number): JQuery;
|
||||
(methodName: 'resume'): JQuery;
|
||||
(methodName: 'stop'): JQuery;
|
||||
(methodNameDontCallMe: string, arg1DontCallMe: any, arg2DontCallMe: any): JQuery; // catch-all, shouldn't ever be called though
|
||||
}
|
||||
|
||||
interface Options {
|
||||
allowWrap?: boolean;
|
||||
autoHeight?: any; // number or string
|
||||
autoSelector?: string;
|
||||
caption?: string;
|
||||
captionTemplate?: string;
|
||||
continueAuto?: boolean;
|
||||
delay?: number;
|
||||
disabledClass?: string;
|
||||
easing?: string;
|
||||
fx?: string;
|
||||
hideNonActive?: boolean;
|
||||
loader?: any; // boolean or 'wait'
|
||||
log?: boolean;
|
||||
loop?: number;
|
||||
manualSpeed?: number;
|
||||
manualTrump?: boolean;
|
||||
next?: string;
|
||||
nextEvent?: string;
|
||||
overlay?: string;
|
||||
overlayTemplate?: string;
|
||||
pager?: string;
|
||||
pagerActivateClass?: string;
|
||||
pagerEvent?: string;
|
||||
pagerTemplate?: string;
|
||||
pauseOnHover?: any; // boolean or string
|
||||
paused?: boolean;
|
||||
prev?: string;
|
||||
prevEvent?: string;
|
||||
progressive?: string;
|
||||
random?: boolean;
|
||||
reverse?: boolean;
|
||||
slideActiveClass?: string;
|
||||
slideCss?: any;
|
||||
slideClass?: string;
|
||||
slides?: string;
|
||||
speed?: number;
|
||||
startingSlide?: number;
|
||||
swipe?: boolean;
|
||||
sync?: boolean;
|
||||
timeout?: number;
|
||||
tmplRegex?: string;
|
||||
updateView?: number;
|
||||
}
|
||||
|
||||
interface OptionsWithState extends Options {
|
||||
busy: boolean;
|
||||
currSlide: number;
|
||||
nextSlide: number;
|
||||
paused: boolean;
|
||||
slideNum: number;
|
||||
slideCount: number;
|
||||
}
|
||||
|
||||
interface API {
|
||||
add(slides: any, prepend?: boolean): void; // string or array or JQuery
|
||||
addInitialSlides(): void;
|
||||
advanceSlide(numberOfOpositions: number): boolean; // always false
|
||||
buildPagerLink(slideOptionHash: Options, slide: any /*not sure*/): void;
|
||||
buildSlideOpts(slide: any /*not sure*/): Options;
|
||||
calcFirstSlide(): void;
|
||||
calcNextSlide(): void;
|
||||
calcTx(slideOptions: Options, manual: boolean): Transition;
|
||||
destroy(): void;
|
||||
doTransition(slideOptions: Options, currEl: Element, nextEl: Element, fwdFlag: boolean, callback: Function): void;
|
||||
getComponent(nameOfComponent: string): JQuery;
|
||||
getSlideIndex(slideElement: Element): number;
|
||||
getSlideOpts(slideIndex: number): Options;
|
||||
goto(index: number): void;
|
||||
initSlide(slideOptions: Options, slide: any /*not sure*/, suggestedZindex: number): void;
|
||||
initSlideshow(): void;
|
||||
log(...args: any[]): void;
|
||||
next(): void;
|
||||
page(pagerEl: Element, targetEl: Element): void;
|
||||
pause(): void;
|
||||
postInitSlideshow(): void;
|
||||
preInitSlideshow(): void;
|
||||
prepareTx(manualFlag: boolean, fwdFlag: boolean): void;
|
||||
prev(): void;
|
||||
queueTransition(slideOptions: Options): void;
|
||||
reinit(): void;
|
||||
remove(slideIndexToRemove: number): void;
|
||||
resume(): void;
|
||||
stackSlides(currEl: Element, nextEl: Element, fwdFlag: boolean): void;
|
||||
stop(): void;
|
||||
stopTransition(): void;
|
||||
tmpl(templateString: string, optionHash: Options, slideEl: Element): void;
|
||||
trigger(eventName: String, ...args: any[]): void;
|
||||
updateView(): void;
|
||||
}
|
||||
|
||||
interface Transition {
|
||||
before(opts: Options, curr: Element, next: Element, fwd: boolean): void;
|
||||
}
|
||||
}
|
||||
@@ -568,7 +568,7 @@ function test_bind() {
|
||||
$("form").bind("submit", function (event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
$("p").bind("myCustomEvent", function (e, myName, myValue) {
|
||||
$("p").bind("myCustomEvent", function (e, myName?, myValue?) {
|
||||
$(this).text(myName + ", hi there!");
|
||||
$("span").stop().css("opacity", 1)
|
||||
.text("myName = " + myName)
|
||||
@@ -590,6 +590,70 @@ function test_bind() {
|
||||
});
|
||||
}
|
||||
|
||||
function test_unbind() {
|
||||
$("#foo").unbind();
|
||||
|
||||
$("#foo").unbind("click");
|
||||
|
||||
var handler = function () {
|
||||
alert("The quick brown fox jumps over the lazy dog.");
|
||||
};
|
||||
$("#foo").bind("click", handler);
|
||||
$("#foo").unbind("click", handler);
|
||||
|
||||
$("#foo").bind("click", function () {
|
||||
alert("The quick brown fox jumps over the lazy dog.");
|
||||
});
|
||||
|
||||
// Will NOT work
|
||||
$("#foo").unbind("click", function () {
|
||||
alert("The quick brown fox jumps over the lazy dog.");
|
||||
});
|
||||
|
||||
$("#foo").bind("click.myEvents", handler);
|
||||
|
||||
$("#foo").unbind("click");
|
||||
|
||||
$("#foo").unbind("click.myEvents");
|
||||
|
||||
$("#foo").unbind(".myEvents");
|
||||
|
||||
var timesClicked = 0;
|
||||
$("#foo").bind("click", function (event) {
|
||||
alert("The quick brown fox jumps over the lazy dog.");
|
||||
timesClicked++;
|
||||
if (timesClicked >= 3) {
|
||||
$(this).unbind(event);
|
||||
}
|
||||
});
|
||||
|
||||
function aClick() {
|
||||
$("div").show().fadeOut("slow");
|
||||
}
|
||||
$("#bind").click(function () {
|
||||
$("#theone")
|
||||
.bind("click", aClick)
|
||||
.text("Can Click!");
|
||||
});
|
||||
$("#unbind").click(function () {
|
||||
$("#theone")
|
||||
.unbind("click", aClick)
|
||||
.text("Does nothing...");
|
||||
});
|
||||
|
||||
$("p").unbind();
|
||||
|
||||
$("p").unbind("click");
|
||||
|
||||
var foo = function () {
|
||||
// Code to handle some kind of event
|
||||
};
|
||||
|
||||
$("p").bind("click", foo); // ... Now foo will be called when paragraphs are clicked ...
|
||||
|
||||
$("p").unbind("click", foo); // ... foo will no longer be called.
|
||||
}
|
||||
|
||||
function test_blur() {
|
||||
$('#target').blur(function () {
|
||||
alert('Handler for .blur() called.');
|
||||
@@ -1119,7 +1183,6 @@ function test_delay() {
|
||||
});
|
||||
}
|
||||
|
||||
/* Not existing, but not recommended either
|
||||
function test_delegate() {
|
||||
$("table").delegate("td", "click", function () {
|
||||
$(this).toggleClass("chosen");
|
||||
@@ -1137,7 +1200,7 @@ function test_delegate() {
|
||||
$("body").delegate("a", "click", function (event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
$("body").delegate("p", "myCustomEvent", function (e, myName, myValue) {
|
||||
$("body").delegate("p", "myCustomEvent", function (e, myName?, myValue?) {
|
||||
$(this).text("Hi there!");
|
||||
$("span").stop().css("opacity", 1)
|
||||
.text("myName = " + myName)
|
||||
@@ -1147,7 +1210,48 @@ function test_delegate() {
|
||||
$("p").trigger("myCustomEvent");
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
function test_undelegate() {
|
||||
function aClick() {
|
||||
$("div").show().fadeOut("slow");
|
||||
}
|
||||
$("#bind").click(function () {
|
||||
$("body")
|
||||
.delegate("#theone", "click", aClick)
|
||||
.find("#theone").text("Can Click!");
|
||||
});
|
||||
$("#unbind").click(function () {
|
||||
$("body")
|
||||
.undelegate("#theone", "click", aClick)
|
||||
.find("#theone").text("Does nothing...");
|
||||
});
|
||||
|
||||
$("p").undelegate();
|
||||
|
||||
$("p").undelegate("click");
|
||||
|
||||
var foo = function () {
|
||||
// Code to handle some kind of event
|
||||
};
|
||||
|
||||
// ... Now foo will be called when paragraphs are clicked ...
|
||||
$("body").delegate("p", "click", foo);
|
||||
|
||||
// ... foo will no longer be called.
|
||||
$("body").undelegate("p", "click", foo);
|
||||
|
||||
var foo = function () {
|
||||
// Code to handle some kind of event
|
||||
};
|
||||
|
||||
// Delegate events under the ".whatever" namespace
|
||||
$("form").delegate(":button", "click.whatever", foo);
|
||||
|
||||
$("form").delegate("input[type='text'] ", "keypress.whatever", foo);
|
||||
|
||||
// Unbind all events delegated under the ".whatever" namespace
|
||||
$("form").undelegate(".whatever");
|
||||
}
|
||||
|
||||
function test_dequeue() {
|
||||
$("button").click(function () {
|
||||
|
||||
97
jquery/jquery.d.ts
vendored
97
jquery/jquery.d.ts
vendored
@@ -2028,14 +2028,59 @@ interface JQuery {
|
||||
*/
|
||||
toggle(showOrHide: boolean): JQuery;
|
||||
|
||||
// Events
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
|
||||
* @param eventData An object containing data that will be passed to the event handler.
|
||||
* @param handler A function to execute each time the event is triggered.
|
||||
*/
|
||||
bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
|
||||
* @param handler A function to execute each time the event is triggered.
|
||||
*/
|
||||
bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
|
||||
* @param eventData An object containing data that will be passed to the event handler.
|
||||
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
|
||||
*/
|
||||
bind(eventType: string, eventData: any, preventBubble: boolean): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
|
||||
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
|
||||
*/
|
||||
bind(eventType: string, preventBubble: boolean): JQuery;
|
||||
bind(...events: any[]): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param events An object containing one or more DOM event types and functions to execute for them.
|
||||
*/
|
||||
bind(events: any): JQuery;
|
||||
|
||||
/**
|
||||
* Trigger the "blur" event on an element
|
||||
*/
|
||||
blur(): JQuery;
|
||||
/**
|
||||
* Bind an event handler to the "blur" JavaScript event
|
||||
*
|
||||
* @param handler A function to execute each time the event is triggered.
|
||||
*/
|
||||
blur(handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Bind an event handler to the "blur" JavaScript event
|
||||
*
|
||||
* @param eventData An object containing data that will be passed to the event handler.
|
||||
* @param handler A function to execute each time the event is triggered.
|
||||
*/
|
||||
blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
|
||||
/**
|
||||
@@ -2560,15 +2605,59 @@ interface JQuery {
|
||||
*/
|
||||
trigger(event: JQueryEventObject, extraParameters?: Object): JQuery;
|
||||
|
||||
/**
|
||||
* Execute all handlers attached to an element for an event.
|
||||
*
|
||||
* @param eventType A string containing a JavaScript event type, such as click or submit.
|
||||
* @param extraParameters An array of additional parameters to pass along to the event handler.
|
||||
*/
|
||||
triggerHandler(eventType: string, ...extraParameters: any[]): Object;
|
||||
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
* @param eventType A string containing a JavaScript event type, such as click or submit.
|
||||
* @param handler The function that is to be no longer executed.
|
||||
*/
|
||||
unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
* @param eventType A string containing a JavaScript event type, such as click or submit.
|
||||
* @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ).
|
||||
*/
|
||||
unbind(eventType: string, fls: boolean): JQuery;
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
* @param evt A JavaScript event object as passed to an event handler.
|
||||
*/
|
||||
unbind(evt: any): JQuery;
|
||||
|
||||
/**
|
||||
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
|
||||
*/
|
||||
undelegate(): JQuery;
|
||||
undelegate(selector: any, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
undelegate(selector: any, events: any): JQuery;
|
||||
/**
|
||||
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
|
||||
*
|
||||
* @param selector A selector which will be used to filter the event results.
|
||||
* @param eventType A string containing a JavaScript event type, such as "click" or "keydown"
|
||||
* @param handler A function to execute at the time the event is triggered.
|
||||
*/
|
||||
undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
|
||||
*
|
||||
* @param selector A selector which will be used to filter the event results.
|
||||
* @param events An object of one or more event types and previously bound functions to unbind from them.
|
||||
*/
|
||||
undelegate(selector: string, events: Object): JQuery;
|
||||
/**
|
||||
* Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.
|
||||
*
|
||||
* @param namespace A string containing a namespace to unbind all events from.
|
||||
*/
|
||||
undelegate(namespace: string): JQuery;
|
||||
|
||||
unload(handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
|
||||
@@ -71,7 +71,7 @@ function test_pagesDialogs() {
|
||||
}
|
||||
});
|
||||
|
||||
$(document).bind("pagebeforechange", function (e, data) {
|
||||
$(document).bind("pagebeforechange", function (e, data?) {
|
||||
if (typeof data.toPage === "string") {
|
||||
var u = $.mobile.path.parseUrl(data.toPage),
|
||||
re = /^#category-item/;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path="knockout.rx.d.ts"/>
|
||||
|
||||
var ax: Rx.IObservable<number>;
|
||||
var ax: Rx.Observable<number>;
|
||||
|
||||
var ao = ax.toKoObservable();
|
||||
|
||||
|
||||
10
knockout.rx/knockout.rx.d.ts
vendored
10
knockout.rx/knockout.rx.d.ts
vendored
@@ -7,20 +7,20 @@
|
||||
/// <reference path="../rx.js/rx.d.ts"/>
|
||||
|
||||
interface KnockoutSubscribableFunctions<T> {
|
||||
toObservable(event?: string): Rx.IObservable<T>;
|
||||
toObservable<TEvent>(event: string): Rx.IObservable<TEvent>;
|
||||
toObservable(event?: string): Rx.Observable<T>;
|
||||
toObservable<TEvent>(event: string): Rx.Observable<TEvent>;
|
||||
}
|
||||
|
||||
interface KnockoutObservableFunctions<T> {
|
||||
toObservableWithReplyLatest(): Rx.IObservable<T>;
|
||||
toObservableWithReplyLatest(): Rx.Observable<T>;
|
||||
}
|
||||
|
||||
interface KnockoutComputedFunctions<T> {
|
||||
toObservableWithReplyLatest(): Rx.IObservable<T>;
|
||||
toObservableWithReplyLatest(): Rx.Observable<T>;
|
||||
}
|
||||
|
||||
declare module Rx {
|
||||
interface IObservable<T> {
|
||||
interface Observable<T> {
|
||||
toKoSubscribable(): KnockoutSubscribable<T>;
|
||||
toKoObservable(initialValue?: T): KnockoutObservable<T>;
|
||||
}
|
||||
|
||||
34
localForage/localForage-tests.ts
Normal file
34
localForage/localForage-tests.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/// <reference path="localForage.d.ts" />
|
||||
|
||||
declare var localForage: lf.ILocalForage<string>
|
||||
declare var callback: lf.ICallback<string>
|
||||
declare var promise: lf.IPromise<string>
|
||||
|
||||
() => {
|
||||
localForage.clear()
|
||||
localForage.length
|
||||
localForage.key(0)
|
||||
|
||||
localForage.getItem("key", (str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
localForage.getItem("key").then((str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
|
||||
localForage.setItem("key", "value", (str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
localForage.setItem("key", "value").then((str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
|
||||
localForage.removeItem("key", (str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
localForage.removeItem("key").then((str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
|
||||
promise.then(callback)
|
||||
}
|
||||
26
localForage/localForage.d.ts
vendored
Normal file
26
localForage/localForage.d.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// Type definitions for Mozilla's localForage
|
||||
// Project: https://github.com/mozilla/localforage
|
||||
// Definitions by: david pichsenmeister <https://github.com/3x14159265>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module lf {
|
||||
interface ILocalForage<T> {
|
||||
clear(): void
|
||||
key(index: number): T
|
||||
length: number
|
||||
getItem(key: string, callback: ICallback<T>): void
|
||||
getItem(key: string): IPromise<T>
|
||||
setItem(key: string, value: T, callback: ICallback<T>): void
|
||||
setItem(key: string, value: T): IPromise<T>
|
||||
removeItem(key: string, callback: ICallback<T>): void
|
||||
removeItem(key: string): IPromise<T>
|
||||
}
|
||||
|
||||
interface ICallback<T> {
|
||||
(data: T): void
|
||||
}
|
||||
|
||||
interface IPromise<T> {
|
||||
then(callback: ICallback<T>): void
|
||||
}
|
||||
}
|
||||
2
lodash/lodash.d.ts
vendored
2
lodash/lodash.d.ts
vendored
@@ -2672,7 +2672,7 @@ declare module _ {
|
||||
**/
|
||||
memoize<T extends Function>(
|
||||
func: T,
|
||||
resolver?: (n: any) => string): T;
|
||||
resolver?: Function): T;
|
||||
}
|
||||
|
||||
//_.once
|
||||
|
||||
4
moment/moment.d.ts
vendored
4
moment/moment.d.ts
vendored
@@ -324,3 +324,7 @@ interface MomentStatic {
|
||||
}
|
||||
|
||||
declare var moment: MomentStatic;
|
||||
|
||||
declare module "moment" {
|
||||
export = moment;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "DefinitelyTyped",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"test": "node ./_infrastructure/tests/runner.js --tsc-version 0.9.7-59a846"
|
||||
}
|
||||
"scripts": {
|
||||
"test": "node ./_infrastructure/tests/runner.js --tsc-version 0.9.7-59a846"
|
||||
}
|
||||
}
|
||||
|
||||
50
restangular/restangular.d.ts
vendored
50
restangular/restangular.d.ts
vendored
@@ -24,46 +24,46 @@ interface Restangular extends RestangularCustom {
|
||||
all(route: string): RestangularCollection;
|
||||
allUrl(route: string, url: string): RestangularCollection;
|
||||
copy(fromElement: any): RestangularElement;
|
||||
withConfig(configurer: (RestangularProvider) => any): Restangular;
|
||||
restangularizeElement(parent: any, element: any, route: string, collection?, reqParams?): RestangularElement;
|
||||
withConfig(configurer: (RestangularProvider: RestangularProvider) => any): Restangular;
|
||||
restangularizeElement(parent: any, element: any, route: string, collection?: any, reqParams?: any): RestangularElement;
|
||||
restangularizeCollection(parent: any, element: any, route: string): RestangularCollection;
|
||||
stripRestangular(element: any): any;
|
||||
}
|
||||
|
||||
interface RestangularElement extends Restangular {
|
||||
get (queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
get(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
getList(subElement: any, queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
put(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
post(subElement, elementToPost, queryParams?, headers?): ng.IPromise<any>;
|
||||
remove(queryParams?, headers?): ng.IPromise<any>;
|
||||
head(queryParams?, headers?): ng.IPromise<any>;
|
||||
trace(queryParams?, headers?): ng.IPromise<any>;
|
||||
options(queryParams?, headers?): ng.IPromise<any>;
|
||||
patch(queryParams?, headers?): ng.IPromise<any>;
|
||||
post(subElement: any, elementToPost: any, queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
remove(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
head(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
trace(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
options(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
patch(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
withHttpConfig(httpConfig: RestangularRequestConfig): RestangularElement;
|
||||
getRestangularUrl(): string;
|
||||
}
|
||||
|
||||
interface RestangularCollection extends Restangular {
|
||||
getList(queryParams?, headers?): ng.IPromise<any>;
|
||||
post(elementToPost, queryParams?, headers?): ng.IPromise<any>;
|
||||
head(queryParams?, headers?): ng.IPromise<any>;
|
||||
trace(queryParams?, headers?): ng.IPromise<any>;
|
||||
options(queryParams?, headers?): ng.IPromise<any>;
|
||||
patch(queryParams?, headers?): ng.IPromise<any>;
|
||||
putElement(idx, params, headers): ng.IPromise<any>;
|
||||
getList(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
post(elementToPost: any, queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
head(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
trace(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
options(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
patch(queryParams?: any, headers?: any): ng.IPromise<any>;
|
||||
putElement(idx: any, params: any, headers: any): ng.IPromise<any>;
|
||||
withHttpConfig(httpConfig: RestangularRequestConfig): RestangularCollection;
|
||||
getRestangularUrl(): string;
|
||||
}
|
||||
|
||||
interface RestangularCustom {
|
||||
customGET(path, params?, headers?): ng.IPromise<any>;
|
||||
customGETLIST(path, params?, headers?): ng.IPromise<any>;
|
||||
customDELETE(path, params?, headers?): ng.IPromise<any>;
|
||||
customPOST(path, params?, headers?, elem?): ng.IPromise<any>;
|
||||
customPUT(path, params?, headers?, elem?): ng.IPromise<any>;
|
||||
customOperation(operation, path, params?, headers?, elem?): ng.IPromise<any>;
|
||||
addRestangularMethod(name, operation, path?, params?, headers?, elem?): ng.IPromise<any>;
|
||||
customGET(path: string, params?: any, headers?: any): ng.IPromise<any>;
|
||||
customGETLIST(path: string, params?: any, headers?: any): ng.IPromise<any>;
|
||||
customDELETE(path: string, params?: any, headers?: any): ng.IPromise<any>;
|
||||
customPOST(path: string, params?: any, headers?: any, elem?: any): ng.IPromise<any>;
|
||||
customPUT(path: string, params?: any, headers?: any, elem?: any): ng.IPromise<any>;
|
||||
customOperation(operation: string, path: string, params?: any, headers?: any, elem?: any): ng.IPromise<any>;
|
||||
addRestangularMethod(name: string, operation: string, path?: string, params?: any, headers?: any, elem?: any): ng.IPromise<any>;
|
||||
}
|
||||
|
||||
interface RestangularProvider {
|
||||
@@ -76,8 +76,8 @@ interface RestangularProvider {
|
||||
setOnElemRestangularized(callback: (elem: any, isCollection: boolean, what: string, restangular: Restangular) => any): void;
|
||||
setResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: RestangularResponse, deferred: ng.IDeferred<any>) => any): void;
|
||||
setResponseExtractor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: RestangularResponse, deferred: ng.IDeferred<any>) => any): void;
|
||||
setRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any);
|
||||
setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any) => {element: any; headers: any; params: any});
|
||||
setRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void;
|
||||
setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any) => {element: any; headers: any; params: any}): void;
|
||||
setErrorInterceptor(errorInterceptor: (response: RestangularResponse) => any): void;
|
||||
setRestangularFields(fields: {[fieldName: string]: string}): void;
|
||||
setMethodOverriders(overriders: string[]): void;
|
||||
|
||||
16
rx.js/rx.jquery.d.ts
vendored
16
rx.js/rx.jquery.d.ts
vendored
@@ -6,12 +6,18 @@
|
||||
///<reference path="../jquery/jquery.d.ts"/>
|
||||
///<reference path="rx.d.ts"/>
|
||||
|
||||
interface RxJQueryAjaxResult<T> {
|
||||
data: T;
|
||||
textStatus: string;
|
||||
jqXHR: JQueryXHR;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
ajaxAsObservable<T>(settings: JQueryAjaxSettings): Rx.Observable<T>;
|
||||
getAsObservable<T>(url: string, data: any, dataType: string): Rx.Observable<T>;
|
||||
getJSONAsObservable<T>(url: string, data: any): Rx.Observable<T>;
|
||||
getScriptAsObservable<T>(url: string, data: any): Rx.Observable<T>;
|
||||
postAsObservable<T>(url: string, data: any, dataType: string): Rx.Observable<T>;
|
||||
ajaxAsObservable<T>(settings: JQueryAjaxSettings): Rx.Observable<RxJQueryAjaxResult<T>>;
|
||||
getAsObservable<T>(url: string, data: any, dataType: string): Rx.Observable<RxJQueryAjaxResult<T>>;
|
||||
getJSONAsObservable<T>(url: string, data: any): Rx.Observable<RxJQueryAjaxResult<T>>;
|
||||
getScriptAsObservable<T>(url: string, data: any): Rx.Observable<RxJQueryAjaxResult<T>>;
|
||||
postAsObservable<T>(url: string, data: any, dataType: string): Rx.Observable<RxJQueryAjaxResult<T>>;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
|
||||
12
rx.js/rx.time.d.ts
vendored
12
rx.js/rx.time.d.ts
vendored
@@ -25,12 +25,12 @@ declare module Rx {
|
||||
|
||||
delay(dueTime: number, scheduler?: IScheduler): Observable<T>;
|
||||
throttle(dueTime: number, scheduler?: IScheduler): Observable<T>;
|
||||
windowWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<T>;
|
||||
windowWithTime(timeSpan: number, scheduler?: IScheduler): Observable<T>;
|
||||
windowWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<T>;
|
||||
bufferWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<T>;
|
||||
bufferWithTime(timeSpan: number, scheduler?: IScheduler): Observable<T>;
|
||||
bufferWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<T>;
|
||||
windowWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<Observable<T>>;
|
||||
windowWithTime(timeSpan: number, scheduler?: IScheduler): Observable<Observable<T>>;
|
||||
windowWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<Observable<T>>;
|
||||
bufferWithTime(timeSpan: number, timeShift: number, scheduler?: IScheduler): Observable<T[]>;
|
||||
bufferWithTime(timeSpan: number, scheduler?: IScheduler): Observable<T[]>;
|
||||
bufferWithTimeOrCount(timeSpan: number, count: number, scheduler?: IScheduler): Observable<T[]>;
|
||||
timeInterval(scheduler?: IScheduler): Observable<TimeInterval<T>>;
|
||||
timestamp(scheduler?: IScheduler): Observable<Timestamp<T>>;
|
||||
sample(interval: number, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
@@ -422,7 +422,7 @@ function test_misc() {
|
||||
});
|
||||
|
||||
store = new Sammy.Store({ name: 'kvo' });
|
||||
$('body').bind('set-kvo-foo', function (e, data) {
|
||||
$('body').bind('set-kvo-foo', function (e, data?) {
|
||||
Sammy.log(data.key + ' changed to ' + data.value);
|
||||
});
|
||||
store.set('foo', 'bar');
|
||||
|
||||
6
threejs/three.d.ts
vendored
6
threejs/three.d.ts
vendored
@@ -1856,6 +1856,12 @@ declare module THREE {
|
||||
|
||||
static defaultEulerOrder: string;
|
||||
// static defaultEulerOrder:EulerOrder;
|
||||
|
||||
/**
|
||||
* An object that can be used to store custom data about the Object3d.
|
||||
* It should not hold references to functions as these will not be cloned.
|
||||
*/
|
||||
userData: any;
|
||||
}
|
||||
|
||||
var Object3DIdCount: number;
|
||||
|
||||
8
underscore/underscore.d.ts
vendored
8
underscore/underscore.d.ts
vendored
@@ -100,7 +100,7 @@ interface UnderscoreStatic {
|
||||
* @param iterator Iterator function for each property on `obj`.
|
||||
* @param context 'this' object in `iterator`, optional.
|
||||
**/
|
||||
each<T extends {}>(
|
||||
each<T>(
|
||||
object: _.Dictionary<T>,
|
||||
iterator: _.ObjectIterator<T, void>,
|
||||
context?: any): void;
|
||||
@@ -116,7 +116,7 @@ interface UnderscoreStatic {
|
||||
/**
|
||||
* @see _.each
|
||||
**/
|
||||
forEach<T extends {}>(
|
||||
forEach<T>(
|
||||
object: _.Dictionary<T>,
|
||||
iterator: _.ObjectIterator<T, void >,
|
||||
context?: any): void;
|
||||
@@ -142,7 +142,7 @@ interface UnderscoreStatic {
|
||||
* @param context `this` object in `iterator`, optional.
|
||||
* @return The mapped object result.
|
||||
**/
|
||||
map<T extends {}, TResult>(
|
||||
map<T, TResult>(
|
||||
object: _.Dictionary<T>,
|
||||
iterator: _.ObjectIterator<T, TResult>,
|
||||
context?: any): TResult[];
|
||||
@@ -158,7 +158,7 @@ interface UnderscoreStatic {
|
||||
/**
|
||||
* @see _.map
|
||||
**/
|
||||
collect<T extends {}, TResult>(
|
||||
collect<T, TResult>(
|
||||
object: _.Dictionary<T>,
|
||||
iterator: _.ObjectIterator<T, TResult>,
|
||||
context?: any): TResult[];
|
||||
|
||||
61
xsockets/XSockets-tests.ts
Normal file
61
xsockets/XSockets-tests.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
/// <reference path="XSockets.d.ts" />
|
||||
|
||||
var conn = new XSockets.WebSocket('ws://localhost:4502/Generic');
|
||||
|
||||
conn.on(XSockets.Events.open,function (clientInfo) {
|
||||
console.log('Open', clientInfo);
|
||||
});
|
||||
|
||||
conn.on(XSockets.Events.onError, function (err) {
|
||||
console.log('Error', err);
|
||||
});
|
||||
|
||||
conn.on(XSockets.Events.close, function () {
|
||||
console.log('Closed');
|
||||
});
|
||||
|
||||
conn.publish('foo', {text:'Hello Real-Time World'});
|
||||
|
||||
conn.on('foo', function(data) {
|
||||
console.log('subscription to foo fired with data = ', data);
|
||||
});
|
||||
|
||||
conn.unbind('foo');
|
||||
|
||||
conn.one('foo', function(data) {
|
||||
console.log('subscription to foo fired with data = ', data);
|
||||
});
|
||||
|
||||
conn.many('foo',4, function(data) {
|
||||
console.log('subscription to foo fired with data = ', data);
|
||||
});
|
||||
|
||||
conn.on('foo', function (data) {
|
||||
console.log('subscription to foo fired with data = ', data);
|
||||
}, function (confirmation) {
|
||||
console.log('subscription confirmed',confirmation);
|
||||
conn.publish('foo', { text: 'Hello Real-Time World' });
|
||||
});
|
||||
|
||||
conn.publish(XSockets.Events.storage.set, {
|
||||
Key: "yourKey",
|
||||
Value: {
|
||||
Name: "John Doe",
|
||||
Age: 40,
|
||||
Likes: ["Beer", "Food", "Coffe"]
|
||||
}
|
||||
});
|
||||
|
||||
conn.publish(XSockets.Events.storage.remove, {Key: 'yourKey'});
|
||||
|
||||
conn.on(XSockets.Events.storage.getAll, function (data) {
|
||||
data.forEach(function (item) {
|
||||
console.log(item);
|
||||
});
|
||||
});
|
||||
|
||||
conn.publish(XSockets.Events.storage.getAll, {});
|
||||
|
||||
conn.publish('set_MyProp',{value:'New Value'});
|
||||
|
||||
conn.on('get_MyProp',function(prop){console.log('Value Of MyProp',prop)});
|
||||
1
xsockets/XSockets-tests.ts.tscparams
Normal file
1
xsockets/XSockets-tests.ts.tscparams
Normal file
@@ -0,0 +1 @@
|
||||
""
|
||||
38
xsockets/XSockets.d.ts
vendored
Normal file
38
xsockets/XSockets.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// Type definitions for XSockets.NET 3.0
|
||||
// Project: http://xsockets.net/
|
||||
// Definitions by: Jeffery Grajkowski <https://github.com/pushplay>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module XSockets {
|
||||
export class WebSocket {
|
||||
id: string;
|
||||
constructor(url: string, subprotocol?: string, settings?: any);
|
||||
on(event: string, handler: (data: any) => void, confirmation?: (arg: ConfirmationArgument) => void): void;
|
||||
one(event: string, handler: (data: any) => void, confirmation?: (arg: ConfirmationArgument) => void): void;
|
||||
many(event: string, times: number, handler: (data: any) => void, confirmation?: (arg: ConfirmationArgument) => void): void;
|
||||
unbind(event: string): void;
|
||||
publish(topic: string, data: any): void;
|
||||
}
|
||||
export interface ConfirmationArgument {
|
||||
event: string;
|
||||
}
|
||||
export module Events {
|
||||
export var close: string;
|
||||
export var onBlob: string;
|
||||
export var onError: string;
|
||||
export module bindings {
|
||||
export var completed: string;
|
||||
}
|
||||
export var open: string;
|
||||
export module pubSub {
|
||||
export var subscribe: string;
|
||||
export var unsubscribe: string;
|
||||
}
|
||||
export module storage {
|
||||
export var get: string;
|
||||
export var getAll: string;
|
||||
export var remove: string;
|
||||
export var set: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user