diff --git a/README.md b/README.md index 251263010..5e94c6003 100755 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ List of Definitions * [Ace Cloud9 Editor](http://ace.ajax.org/) (by [Diullei Gomes](https://github.com/Diullei)) * [Add To Home Screen] (http://cubiq.org/add-to-home-screen) (by [James Wilkins] (http://www.codeplex.com/site/users/view/jamesnw)) * [AmCharts](http://www.amcharts.com/) (by [Covobonomo](https://github.com/covobonomo/)) +* [AngularFire](https://www.firebase.com/docs/angular/reference.html) (by [Dénes Harmath](https://github.com/thSoft)) * [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes)) * [AngularUI](http://angular-ui.github.io/) (by [Michel Salib](https://github.com/michelsalib)) * [Angular Protractor](https://github.com/angular/protractor) (by [Bill Armstrong](https://github.com/BillArmstrong)) @@ -63,6 +64,7 @@ List of Definitions * [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) (by [Maksim Kozhukh](http://github.com/mkozhukh)) * [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) (by [Jon Egerton](https://github.com/jonegerton)) * [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton)) +* [doT](https://github.com/olado/doT) (by [ZombieHunter](https://github.com/ZombieHunter)) * [dust](http://linkedin.github.com/dustjs) (by [Marcelo Dezem](https://github.com/mdezem)) * [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) * [EasyStar](http://easystarjs.com/) (by [Magnus Gustafsson](https://github.com/Borundin)) @@ -233,6 +235,7 @@ List of Definitions * [SlickGrid](https://github.com/mleibman/SlickGrid) (by [Josh Baldwin](https://github.com/jbaldwin)) * [smoothie](https://github.com/joewalnes/smoothie) (by [Mike H. Hawley](https://github.com/mikehhawley)) * [socket.io](http://socket.io) (by [William Orr](https://github.com/worr)) +* [socket.io-client](http://socket.io) (by [Maido Kaara](https://github.com/v3rm0n)) * [SockJS](https://github.com/sockjs/sockjs-client) (by [Emil Ivanov](https://github.com/vladev)) * [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)) diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts new file mode 100644 index 000000000..e3a04712c --- /dev/null +++ b/angularfire/angularfire-tests.ts @@ -0,0 +1,83 @@ +/// + +var myapp = angular.module("myapp", ["firebase"]); + +interface AngularFireScope extends ng.IScope { + items: AngularFire; + remoteItems: RemoteItems; +} + +interface RemoteItems { + bar: string; +} + +var url = "https://myapp.firebaseio.com"; + +myapp.controller("MyController", ["$scope", "$firebase", + function($scope: AngularFireScope, $firebase: AngularFireService) { + $scope.items = $firebase(new Firebase(url)); + $scope.items.$add({ foo: "bar" }); + $scope.items.$remove("foo"); + $scope.items.$remove(); + $scope.items.$save(); + var child = $scope.items.$child("foo"); + child.$remove(); + $scope.items.$set({ bar: "baz" }); + var keys = $scope.items.$getIndex(); + keys.forEach(function(key, i) { + console.log(i, $scope.items[key]); + }); + $scope.items.$on("loaded", function() { + console.log("Initial data received!"); + }); + $scope.items.$on("change", function() { + console.log("A remote change was applied locally!"); + }); + $scope.items.$off('loaded'); + function stopSync() { + $scope.items.$off(); + } + $scope.items.$bind($scope, "remoteItems"); + $scope.remoteItems.bar = "foo"; + $scope.items.$bind($scope, "remote").then(function(unbind) { + unbind(); + $scope.remoteItems.bar = "foo"; + }); + } +]); + +var foo: AngularFireObject = { + $priority: 0 +}; + +interface AngularFireAuthScope extends ng.IScope { + loginObj: AngularFireAuth; +} + +myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin", + function($scope: AngularFireAuthScope, $firebaseSimpleLogin: AngularFireAuthService) { + var dataRef = new Firebase(url); + $scope.loginObj = $firebaseSimpleLogin(dataRef); + $scope.loginObj.$getCurrentUser().then(_ => { + }); + var email = 'my@email.com'; + var password = 'mypassword'; + $scope.loginObj.$login('password', { + email: email, + password: password + }).then(function(user) { + console.log('Logged in as: ', user.uid); + }, function(error) { + console.error('Login failed: ', error); + }); + $scope.loginObj.$logout(); + $scope.loginObj.$createUser(email, password).then(_ => { + }); + $scope.loginObj.$changePassword(email, password, password).then(_ => { + }); + $scope.loginObj.$removeUser(email, password).then(_ => { + }); + $scope.loginObj.$sendPasswordResetEmail(email).then(_ => { + }); + } +]); \ No newline at end of file diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts new file mode 100644 index 000000000..3f2b0aa10 --- /dev/null +++ b/angularfire/angularfire.d.ts @@ -0,0 +1,41 @@ +// Type definitions for AngularFire 0.6.0 +// Project: http://angularfire.com +// Definitions by: Dénes Harmath +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +interface AngularFireService { + (firebase: Firebase): AngularFire; +} + +interface AngularFire { + $add(value: any): void; + $remove(key?: string): void; + $save(key?: string): void; + $child(key: string): AngularFire; + $set(value: any): void; + $getIndex(): string[]; + $on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; + $off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; + $bind($scope: ng.IScope, modelName: string): ng.IPromise; +} + +interface AngularFireObject { + $priority: number; +} + +interface AngularFireAuthService { + (firebase: Firebase): AngularFireAuth; +} + +interface AngularFireAuth { + $getCurrentUser(): ng.IPromise; + $login(provider: string, options?: Object): ng.IPromise; + $logout(): void; + $createUser(email: string, password: string, noLogin?: boolean): ng.IPromise; + $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; + $removeUser(email: string, password: string): ng.IPromise; + $sendPasswordResetEmail(email: string): ng.IPromise; +} diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts new file mode 100644 index 000000000..696e6f834 --- /dev/null +++ b/angularjs/angular-animate.d.ts @@ -0,0 +1,21 @@ +// Type definitions for Angular JS 1.2+ (ngAnimate module) +// Project: http://angularjs.org +// Definitions by: Michel Salib +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +/////////////////////////////////////////////////////////////////////////////// +// ngAnimate module (angular-animate.js) +/////////////////////////////////////////////////////////////////////////////// +declare module ng.animate { + + /////////////////////////////////////////////////////////////////////////// + // AnimateService + // see http://docs.angularjs.org/api/ngAnimate.$animate + /////////////////////////////////////////////////////////////////////////// + interface IAnimateService extends ng.IAnimateService { + enabled(value?: boolean, element?: JQuery): boolean; + } +} diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index eebed96c3..c26bc9fe8 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -105,6 +105,10 @@ declare module ng.resource { $delete(dataOrParams: any, success: Function): T; $delete(success: Function, error?: Function): T; $delete(params: any, data: any, success?: Function, error?: Function): T; + + /** the promise of the original server interaction that created this instance. **/ + $promise : ng.IPromise; + $resolved : boolean; } /** when creating a resource factory via IModule.factory */ @@ -122,3 +126,10 @@ declare module ng { factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule; } } + +interface Array> +{ + /** the promise of the original server interaction that created this collection. **/ + $promise : ng.IPromise>; + $resolved : boolean; +} diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 18f5ccb4e..4ce311698 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -1,7 +1,7 @@ /// // issue: https://github.com/borisyankov/DefinitelyTyped/issues/369 -https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js +// https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js /** * @license HTTP Auth Interceptor Module for AngularJS * (c) 2012 Witold Szczerba diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index a8c1d991d..b369a271f 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -79,7 +79,7 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface IModule { animation(name: string, animationFactory: Function): IModule; - animation(name: string, inlineAnnotadedFunction: any[]): IModule; + animation(name: string, inlineAnnotatedFunction: any[]): IModule; animation(object: Object): IModule; /** configure existing services. Use this method to register work which needs to be performed on module loading @@ -88,29 +88,29 @@ declare module ng { /** configure existing services. Use this method to register work which needs to be performed on module loading */ - config(inlineAnnotadedFunction: any[]): IModule; + config(inlineAnnotatedFunction: any[]): IModule; constant(name: string, value: any): IModule; constant(object: Object): IModule; controller(name: string, controllerConstructor: Function): IModule; - controller(name: string, inlineAnnotadedConstructor: any[]): IModule; + controller(name: string, inlineAnnotatedConstructor: any[]): IModule; controller(object : Object): IModule; directive(name: string, directiveFactory: Function): IModule; - directive(name: string, inlineAnnotadedFunction: any[]): IModule; + directive(name: string, inlineAnnotatedFunction: any[]): IModule; directive(object: Object): IModule; factory(name: string, serviceFactoryFunction: Function): IModule; - factory(name: string, inlineAnnotadedFunction: any[]): IModule; + factory(name: string, inlineAnnotatedFunction: any[]): IModule; factory(object: Object): IModule; filter(name: string, filterFactoryFunction: Function): IModule; - filter(name: string, inlineAnnotadedFunction: any[]): IModule; + filter(name: string, inlineAnnotatedFunction: any[]): IModule; filter(object: Object): IModule; provider(name: string, serviceProviderConstructor: Function): IModule; - provider(name: string, inlineAnnotadedConstructor: any[]): IModule; + provider(name: string, inlineAnnotatedConstructor: any[]): IModule; provider(name: string, providerObject: auto.IProvider): IModule; provider(object: Object): IModule; run(initializationFunction: Function): IModule; - run(inlineAnnotadedFunction: any[]): IModule; + run(inlineAnnotatedFunction: any[]): IModule; service(name: string, serviceConstructor: Function): IModule; - service(name: string, inlineAnnotadedConstructor: any[]): IModule; + service(name: string, inlineAnnotatedConstructor: any[]): IModule; service(object: Object): IModule; value(name: string, value: any): IModule; value(object: Object): IModule; @@ -570,7 +570,7 @@ declare module ng { interface IControllerProvider extends IServiceProvider { register(name: string, controllerConstructor: Function): void; - register(name: string, dependencyAnnotadedConstructor: any[]): void; + register(name: string, dependencyAnnotatedConstructor: any[]): void; } /////////////////////////////////////////////////////////////////////////// @@ -799,10 +799,19 @@ declare module ng { inheritedData(key: string, value: any): JQuery; inheritedData(obj: { [key: string]: any; }): JQuery; inheritedData(key?: string): any; - - } + /////////////////////////////////////////////////////////////////////// + // AnimateService + // see http://docs.angularjs.org/api/ng.$animate + /////////////////////////////////////////////////////////////////////// + interface IAnimateService { + addClass(element: JQuery, className: string, done?: Function): void; + enter(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void; + leave(element: JQuery, done?: Function): void; + move(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void; + removeClass(element: JQuery, className: string, done?: Function): void; + } /////////////////////////////////////////////////////////////////////////// // AUTO module (angular.js) @@ -818,11 +827,11 @@ declare module ng { /////////////////////////////////////////////////////////////////////// interface IInjectorService { annotate(fn: Function): string[]; - annotate(inlineAnnotadedFunction: any[]): string[]; + annotate(inlineAnnotatedFunction: any[]): string[]; get(name: string): any; has(name: string): boolean; instantiate(typeConstructor: Function, locals?: any): any; - invoke(inlineAnnotadedFunction: any[]): any; + invoke(inlineAnnotatedFunction: any[]): any; invoke(func: Function, context?: any, locals?: any): any; } @@ -839,7 +848,7 @@ declare module ng { decorator(name: string, decorator: Function): void; decorator(name: string, decoratorInline: any[]): void; factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider; - factory(name: string, inlineAnnotadedFunction: any[]): ng.IServiceProvider; + factory(name: string, inlineAnnotatedFunction: any[]): ng.IServiceProvider; provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider; provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider; service(name: string, constructor: Function): ng.IServiceProvider; diff --git a/bootstrap/bootstrap.d.ts b/bootstrap/bootstrap.d.ts index c14bf61d4..b9fe9cd59 100644 --- a/bootstrap/bootstrap.d.ts +++ b/bootstrap/bootstrap.d.ts @@ -107,3 +107,6 @@ interface JQuery { affix(options?: AffixOptions): JQuery; } + +declare module "bootstrap" { +} diff --git a/d3/d3.d.ts b/d3/d3.d.ts index ec3f94147..4bce47e2b 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -847,7 +847,7 @@ declare module D3 { export interface Set{ has(value: any): boolean; - Add(value: any): any; + add(value: any): any; remove(value: any): boolean; values(): Array; forEach(func: (value: any) => void ): void; diff --git a/dot/dot-tests.ts b/dot/dot-tests.ts new file mode 100644 index 000000000..59e6cff75 --- /dev/null +++ b/dot/dot-tests.ts @@ -0,0 +1,32 @@ +/// + +var headertmpl = "

{{=it.title}}

"; + +var pagetmpl = "

Here is the page using a header template< / h2 >\n" + + "{{#def.header}}\n" + + "{{=it.name}}"; + +var customizableheadertmpl = "{{#def.header}}" + + "\n{{#def.mycustominjectionintoheader || ''} }"; + +var pagetmplwithcustomizableheader = "

Here is the page with customized header template

\n" + + "{{##def.mycustominjectionintoheader:\n" + + "
{{=it.title}} is not {{=it.name}}
\n" + + "#}}\n" + + "{{#def.customheader}}\n" + + "{{=it.name}}"; + +var def = { + header: headertmpl, + customheader: customizableheadertmpl +}; +var data = { + title: "My title", + name: "My name" +}; + +var pagefn = doT.template(pagetmpl, undefined, def); +var content = pagefn(data); + +pagefn = doT.template(pagetmplwithcustomizableheader, undefined, def); +var contentcustom = pagefn(data); diff --git a/dot/dot.d.ts b/dot/dot.d.ts new file mode 100644 index 000000000..2ab677c26 --- /dev/null +++ b/dot/dot.d.ts @@ -0,0 +1,50 @@ +// Type definitions for doT v1.0.1 +// Project: https://github.com/olado/doT +// Definitions by: ZombieHunter +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var doT: doT.doTStatic; + +declare module doT { + + interface doTStatic { + /** + * Version number + */ + version: string; + /** + * Default template settings + */ + templateSettings: TemplateSettings; + + /** + * Compile template + */ + template(tmpl: string, c?: TemplateSettings, def?: Object): Function; + + /** + * For express + */ + compile(tmpl: string, def?: Object): Function; + } + + interface TemplateSettings { + evaluate: RegExp; + interpolate: RegExp; + encode: RegExp; + use: RegExp; + useParams: RegExp; + define: RegExp; + defineParams: RegExp; + conditional: RegExp; + iterate: RegExp; + varname: string; + strip: boolean; + append: boolean; + selfcontained: boolean; + } +} + +interface String { + encodeHTML(): string; +} \ No newline at end of file diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 4657ac5cb..9bde2eca6 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -346,6 +346,10 @@ declare module Ember { The call will be delayed until the DOM has become ready. **/ ready: Function; + /** + Application's router. + **/ + Router: Router; } /** This module implements Observer-friendly Array-like behavior. This mixin is picked up by the @@ -1569,8 +1573,13 @@ declare module Ember { static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; + map(callback: Function): Router; + } + class RouterDSL { + resource(name: string, options?: {}, callback?: Function): void; + resource(name: string, callback: Function): void; + route(name: string, options?: {}): void; } - var RouterDSL: Function; var SHIM_ES5: boolean; var STRINGS: boolean; class Select extends View { @@ -2261,7 +2270,7 @@ declare module Em { class RenderBuffer extends Ember.RenderBuffer { } class Route extends Ember.Route { } class Router extends Ember.Router { } - var RouterDSL: typeof Ember.RouterDSL; + class RouterDSL extends Ember.RouterDSL { } var SHIM_ES5: typeof Ember.SHIM_ES5; var STRINGS: typeof Ember.STRINGS; class Select extends Ember.Select { } diff --git a/express/express.d.ts b/express/express.d.ts index b97888998..6d87249cd 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -1451,6 +1451,8 @@ declare module "express" { * @param callback or username * @param realm */ + export function basicAuth(callback: (user: string, pass: string, fn : Function) => void, realm?: string): Handler; + export function basicAuth(callback: (user: string, pass: string) => boolean, realm?: string): Handler; export function basicAuth(user: string, pass: string, realm?: string): Handler; diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts index 83f9ca84b..bac32fbc6 100644 --- a/firebase/firebase.d.ts +++ b/firebase/firebase.d.ts @@ -53,7 +53,7 @@ declare class Firebase implements IFirebaseQuery { toString(): string; set(value: any, onComplete?: (error: any) => void): void; update(value: any, onComplete?: (error: any) => void): void; - remove(onComplete?: (error: any) => void); + remove(onComplete?: (error: any) => void): void; push(value: any, onComplete?: (error: any) => void): Firebase; setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void; setWithPriority(value: any, priority: number, onComplete?: (error: any) => void): void; diff --git a/google.visualization/google.visualization.d.ts b/google.visualization/google.visualization.d.ts index d478cf9aa..553c8e654 100644 --- a/google.visualization/google.visualization.d.ts +++ b/google.visualization/google.visualization.d.ts @@ -76,6 +76,7 @@ declare module google { addRows(array: any[]): number; getFilteredRows(filters: DataTableCellFilter[]): number[]; getFormattedValue(rowIndex: number, columnIndex: number): string; + getValue(rowIndex: number, columnIndex: number): any; getNumberOfColumns(): number; getNumberOfRows(): number; removeRow(rowIndex: number): void; diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index ebe11fda9..4589e09f0 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -113,7 +113,8 @@ declare module google.maps { scaleControl?: boolean; scaleControlOptions?: ScaleControlOptions; scrollwheel?: boolean; - streetView?: boolean; + streetView?: StreetViewPanorama; + streetViewControl?: boolean; streetViewControlOptions?: StreetViewControlOptions; styles?: MapTypeStyle[]; tilt?: number; diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index c3fc3032f..57ba838ee 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -754,6 +754,61 @@ function test_submit() { $("#target").submit(); } +function test_trigger() { + + $("#foo").on("click", function () { + alert($(this).text()); + }); + $("#foo").trigger("click"); + + $("#foo").on("custom", function (event, param1?, param2?) { + alert(param1 + "\n" + param2); + }); + $("#foo").trigger("custom", ["Custom", "Event"]); + + $("button:first").click(function () { + update($("span:first")); + }); + + $("button:last").click(function () { + $("button:first").trigger("click"); + update($("span:last")); + }); + + function update(j) { + var n = parseInt(j.text(), 10); + j.text(n + 1); + } + + $("form:first").trigger("submit"); + + var event = jQuery.Event("submit"); + $("form:first").trigger(event); + if (event.isDefaultPrevented()) { + // Perform an action... + } + + $("p") + .click(function (event, a, b) { + // When a normal click fires, a and b are undefined + // for a trigger like below a refers to "foo" and b refers to "bar" + }) + .trigger("click", ["foo", "bar"]); + + var event = jQuery.Event("logged"); + (event).user = "foo"; + (event).pass = "bar"; + $("body").trigger(event); + + // Adapted from jQuery documentation which may be wrong on this occasion + var event2 = jQuery.Event("logged"); + $("body").trigger(event2, { + type: "logged", + user: "foo", + pass: "bar" + }); +} + function test_clone() { $('.hello').clone().appendTo('.goodbye'); var $elem = $('#elem').data({ "arr": [1] }), diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 0d26a8253..235022bf9 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -18,6 +18,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ + /** * Interface for the AJAX setting that will configure the AJAX request */ @@ -485,14 +486,6 @@ interface JQueryAnimationOptions { specialEasing?: Object; } -/** - * The interface used to specify easing functions. - */ -interface JQueryEasing { - linear(p: number): number; - swing(p: number): number; -} - /** * Static members of jQuery (those on $ and jQuery themselves) */ @@ -2538,8 +2531,34 @@ interface JQuery { */ submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - trigger(eventType: string, ...extraParameters: any[]): JQuery; - trigger(event: JQueryEventObject): JQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(eventType: string, extraParameters?: any[]): JQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(eventType: string, extraParameters?: Object): JQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param event A jQuery.Event object. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(event: JQueryEventObject, extraParameters?: any[]): JQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param event A jQuery.Event object. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(event: JQueryEventObject, extraParameters?: Object): JQuery; triggerHandler(eventType: string, ...extraParameters: any[]): Object; diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 3a1823a92..41cc3214d 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -714,7 +714,7 @@ declare module JQueryUI { distance?: number; } - interface keyCode { + interface KeyCode { BACKSPACE: number; COMMA: number; DELETE: number; @@ -751,7 +751,7 @@ declare module JQueryUI { buttonset: Button; datepicker: Datepicker; dialog: Dialog; - keyCode: keyCode; + keyCode: KeyCode; menu: Menu; progressbar: Progressbar; slider: Slider; diff --git a/mapsjs/mapsjs.d.ts b/mapsjs/mapsjs.d.ts index 46367fc50..a71cb1ad5 100644 --- a/mapsjs/mapsjs.d.ts +++ b/mapsjs/mapsjs.d.ts @@ -428,7 +428,7 @@ declare module 'mapsjs' { * @param {number} [idx] Index of the line for which to compute the distance. * @returns {number} Distance in meters of the line. */ - getActualDistance(idx: number): number; + getActualDistance(idx?: number): number; /** * Determines whether this polyline intersects a given geometry. @@ -509,7 +509,7 @@ declare module 'mapsjs' { * @param {number} [idx] Index of the ring for which to compute the area. * @returns {number} Area in square meters of the ring. */ - getActualArea(idx: number): number; + getActualArea(idx?: number): number; /** * Calculates perimeter of a ring in a polygon by index according @@ -518,7 +518,7 @@ declare module 'mapsjs' { * @param {number} [idx] Index of the ring for which to compute the perimeter. * @returns {number} Length in meters of the perimeter of the ring. */ - getActualPerimeter(idx: number): number; + getActualPerimeter(idx?: number): number; /** * Determines whether this polygon intersects a given geometry. @@ -548,7 +548,7 @@ declare module 'mapsjs' { * @class geometryStyle */ export class geometryStyle { - constructor(); + constructor(options?: styleObj); /** * Gets path outline thickness in pixels. @@ -899,8 +899,14 @@ declare module 'mapsjs' { * @class styledGeometry */ export class styledGeometry { - constructor(geom: geometry, gStyle: geometryStyle); + constructor(geom: geometry, gStyle?: geometryStyle); + /** + * Set this styledGeometry's geometry. + * @param {geometry} g A new Geometry. + */ + setGeometry(g: geometry): void; + /** * Set this styledGeometry's geometryStyle. * @param {geometryStyle} gs A new styledGeometry. @@ -912,6 +918,12 @@ declare module 'mapsjs' { * @returns {geometry} The underlying geometry. */ getGeometry(): geometry; + + /** + * Gets the styledGeometry's underlying geometryStyle object. + * @returns {geometryStyle} The underlying geometry style. + */ + getGeometryStyle(): geometryStyle; /** * Gets path outline thickness in pixels. @@ -933,7 +945,7 @@ declare module 'mapsjs' { /** * Gets path outline opacity in decimal format. - * @returns {number} Outline opacity. + * @param {number} Outline opacity. */ setOutlineColor(c: string): void; @@ -1322,6 +1334,11 @@ declare module 'mapsjs' { ulX: number; ulY: number; }; + + /** + * Unbind all associations with this tile layer to facilitate garbage collection + */ + dispose(): void; } /** @@ -2221,8 +2238,53 @@ declare module 'mapsjs' { * @returns {number} maxY coord as integer */ maxY: number; - } - + } + + interface extentChangeStatsObj { + + centerX: number; + centerY: number; + centerLat: number; + centerLon: number; + zoomLevel: number; + mapScale: number; + mapScaleProjected: number; + mapUnitsPerPixel: number; + extents: envelope; + } + + interface repositionStatsObj { + + centerX: number; + centerY: number; + zoomLevel: number; + mapUnitsPerPixel: number; + } + + interface beginDigitizeOptions { + key?: string; + shapeType: string; + geometryStyle?: geometryStyle; + styledGeometry?: styledGeometry; + nodeTapAndHoldAction?: (setIdx: number, idx: number) => boolean; + nodeMoveAction?: (x: number, y: number, actionType: string) => any; + shapeChangeAction?: () => void; + envelopeEndAction?: (env: envelope) => void; + circleEndAction?: (circle: geometry.polygon) => void; + suppressNodeAdd?: boolean; + leavePath?: boolean; + } + + + interface styleObj { + fillColor?: string; + fillOpacity?: number; + outlineColor?: string; + outlineOpacity?: number; + outlineThicknessPix?: number + dashArray?: string; + } + interface mapsjsWidget { /** @@ -2512,12 +2574,18 @@ declare module 'mapsjs' { * content area DOM. If an attempt to add a geometry is made with the same * key, the geometry is swapped out. You must remove using removePathGeometry * for resource cleanup. - * @param {styleGeometry} styledGeom THe styledGeometry to render. - * @param {string} key String used to tie a geometry to its SVG + * @param {styleGeometry} styledGeom The styledGeometry to render. + * @param {string} key String used to tie a geometry to its SVG + * @param {function} addAction optional function that is called when mapsjs adds an svg element to the DOM representing this styledGeometry. + * @param {function} removeAction optional function that is called when mapsjs adds an svg element to the DOM representing this styledGeometry. * rendering in the DOM. * @returns {element} The SVG element which was added to the DOM. */ - addPathGeometry(styledGeom: styledGeometry, key: string): void; + addPathGeometry( + styledGeom: styledGeometry, + key: string, + addAction?: (svg: SVGElement) => void, + removeAction?: (svg: SVGElement) => void): SVGElement; /** * Updates an existing path geometry to reflect a style change. @@ -2529,41 +2597,34 @@ declare module 'mapsjs' { /** * Removes a styledGeometry from display. * @param {string} key The key of the geometry to remove. + * @returns {element} The SVG element which was removed from the DOM. */ - removePathGeometry(key: string): void; + removePathGeometry(key?: string): SVGElement; /** * Initiates digitization on the map control. This creates a new * geometry and adds verticies to the geometry accord to mouse * click locations. * @param {object} options JavaScript object of the form { key, - * shapeType, geometryStyle, nodeTapAndHoldAction, nodeMoveAction, - * shapeChangeAction, envelopeEndAction, supressNodeAdd, leavePath } + * shapeType, geometryStyle, styledGeometry, nodeTapAndHoldAction, nodeMoveAction, + * shapeChangeAction, envelopeEndAction, circleEndAction, supressNodeAdd, leavePath } * where key is a a string associated with this geometry, shapeType - * is the type of shape this geometry is, one of 'point', 'path', or - * 'polygon', geometryStyle is a geometryStyle which should be applied - * to the digitized geometry, nodeTapAndHoldAction is a callback invoked + * is the type of shape this geometry is, one of 'polygon', 'polyline', 'multipoint', 'envelope' or 'circle', + * geometryStyle is a geometryStyle which should be applied + * to the digitized geometry, styledGeometry is an optional styledGeometry for existing paths to edit, set this to enter edit mode, + * nodeTapAndHoldAction is a callback invoked * when any point in the geometry is clicked and held and has the * signature nodeTapAndHoldAction(setIdx, idx), nodeMoveAction is a * callback invoked after any node is dragged to a new location and * has signature nodeMoveAction(x, y, actionType), shapeChangeAction * is a callback that is invoked after the geometry shape changes and, - * has signature shapeChangeAction(), envelopeEndAction is a callback + * has signature shapeChangeAction(shape), envelopeEndAction is a callback * invoked after an envelope is created and has signature envelopeEndAction(envelope), + * circleEndAction is similar to envelopeEndAction but takes a geometry.polygon representing the circle, * and leavePath is a flag that indicates whether the digitized shape * should be left on the map after digitization is complete. */ - beginDigitize(options: { - key?: string; - shapeType: string; - geometryStyle?: geometryStyle; - nodeTapAndHoldAction?: (setIdx: number, idx: number) => boolean; - nodeMoveAction?: (x: number, y: number, actionType: string) => any; - shapeChangeAction?: () => void; - envelopeEndAction?: (env: envelope) => void; - suppressNodeAdd?: boolean; - leavePath?: boolean; - }): void; + beginDigitize(options: beginDigitizeOptions): void; endDigitize(): void; /** @@ -2606,7 +2667,7 @@ declare module 'mapsjs' { * the form { centerX, centerY, centerLat, centerLon, zoomLevel, mapScale, * mapScaleProjected, mapUnitsPerPixel, extents }. */ - setExtentChangeCompleteAction(action: (vals: {}) => void): void; + setExtentChangeCompleteAction(action: (vals: extentChangeStatsObj) => void): void; /** * Set the function called when map content (map tiles and fixed elements) are @@ -2616,7 +2677,7 @@ declare module 'mapsjs' { * completes repositioning with signature action(object) where object * is of the form { centerX, centerY, zoomLevel, mapUnitsPerPixel }. */ - setContentRepositionAction(action: (vals: {}) => void): void; + setContentRepositionAction(action: (vals: repositionStatsObj) => void): void; /** * Sets function called when map is clicked or tapped. diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index dca2915c5..3427d6de4 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -112,8 +112,8 @@ declare module Marionette { function unbindEntityEvents(target, entity, bindings); class Callbacks { - add(callback, contextOverride): void; - run(options, context): void; + add(callback:Function, contextOverride:any): void; + run(options:any, context:any): void; reset(): void; } @@ -269,11 +269,18 @@ declare module Marionette { render(): Layout; removeRegion(name: string); } + + interface AppRouterOptions extends Backbone.RouterOptions { + appRoutes: any; + controller: any; + } class AppRouter extends Backbone.Router { - constructor(options?: any); - processAppRoutes(controller: Controller, appRoutes: any); + constructor(options?: AppRouterOptions); + processAppRoutes(controller: any, appRoutes: any); + appRoute(route:string, methodName:string):void; + } class Application extends Backbone.Events { @@ -288,6 +295,7 @@ declare module Marionette { addInitializer(initializer); start(options?); addRegions(regions); + closeRegions(): void; removeRegion(region: Region); getRegion(regionName: string): Region; module(moduleNames, moduleDefinition); diff --git a/socket.io-client/socket.io-client-tests.ts b/socket.io-client/socket.io-client-tests.ts new file mode 100644 index 000000000..7b5f96747 --- /dev/null +++ b/socket.io-client/socket.io-client-tests.ts @@ -0,0 +1,10 @@ +import io = require('socket.io-client'); + +var socket = io.connect('http://localhost:80'); + +socket.on('connect', function () { + console.log('Connected!'); + socket.emit('event', 'some test data', function () { + console.log('Sent some data.'); + }); +}); diff --git a/socket.io-client/socket.io-client.d.ts b/socket.io-client/socket.io-client.d.ts new file mode 100644 index 000000000..e4c6e0e38 --- /dev/null +++ b/socket.io-client/socket.io-client.d.ts @@ -0,0 +1,33 @@ +// Type definitions for socket.io nodejs client +// Project: http://socket.io/ +// Definitions by: Maido Kaara +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "socket.io-client" { + + export function connect(host: string, details?: any): Socket; + + interface EventEmitter { + emit(name: string, ...data: any[]): any; + on(ns: string, fn: Function): EventEmitter; + addListener(ns: string, fn: Function): EventEmitter; + removeListener(ns: string, fn: Function): EventEmitter; + removeAllListeners(ns: string): EventEmitter; + once(ns: string, fn: Function): EventEmitter; + listeners(ns: string): Function[]; + } + + interface SocketNamespace extends EventEmitter { + of(name: string): SocketNamespace; + send(data: any, fn: Function): SocketNamespace; + emit(name: string): SocketNamespace; + } + + interface Socket extends EventEmitter { + of(name: string): SocketNamespace; + connect(fn: Function): Socket; + packet(data: any): Socket; + flushBuffer(): void; + disconnect(): Socket; + } +} diff --git a/sugar/sugar.d.ts b/sugar/sugar.d.ts index ca21b3e7c..e5f9c97d7 100644 --- a/sugar/sugar.d.ts +++ b/sugar/sugar.d.ts @@ -2133,7 +2133,7 @@ interface Array { * }, 2, true); **/ each( - fn: (element: T, index: number, array: T[]) => boolean, + fn: (element: T, index?: number, array?: T[]) => any, index?: number, loop?: boolean): T[]; @@ -3386,7 +3386,7 @@ interface ObjectStatic { * }); * **/ - watch(obj: any, prop: string, fn: (prop: string, oldVal: any, newVal: any) => any): void; + watch(obj: any, prop: string, fn: (prop?: string, oldVal?: any, newVal?: any) => any): void; } interface Object { @@ -3836,7 +3836,7 @@ interface Object { * }); * **/ - watch(prop: string, fn: (prop: string, oldVal: any, newVal: any) => any): void; + watch(prop: string, fn: (prop?: string, oldVal?: any, newVal?: any) => any): void; } interface Function { diff --git a/underscore.string/underscore.string.d.ts b/underscore.string/underscore.string.d.ts index d016dc908..db9ec042d 100644 --- a/underscore.string/underscore.string.d.ts +++ b/underscore.string/underscore.string.d.ts @@ -562,5 +562,7 @@ interface UnderscoreStringStaticExports { toBoolean(str: string, trueValues?: any[], falseValues?: any[]): boolean; } - +declare module "underscore.string" { +export = UnderscoreStringStatic; +} // TODO interface UnderscoreString extends Underscore