Merge branch 'master' into release-0.9.7

This commit is contained in:
vvakame
2014-02-18 17:13:52 +09:00
25 changed files with 526 additions and 72 deletions
+3
View File
@@ -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))
+83
View File
@@ -0,0 +1,83 @@
/// <reference path="angularfire.d.ts"/>
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(_ => {
});
}
]);
+41
View File
@@ -0,0 +1,41 @@
// Type definitions for AngularFire 0.6.0
// Project: http://angularfire.com
// Definitions by: Dénes Harmath <http://github.com/thSoft>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts"/>
/// <reference path="../firebase/firebase.d.ts"/>
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<any>;
}
interface AngularFireObject {
$priority: number;
}
interface AngularFireAuthService {
(firebase: Firebase): AngularFireAuth;
}
interface AngularFireAuth {
$getCurrentUser(): ng.IPromise<any>;
$login(provider: string, options?: Object): ng.IPromise<any>;
$logout(): void;
$createUser(email: string, password: string, noLogin?: boolean): ng.IPromise<any>;
$changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise<any>;
$removeUser(email: string, password: string): ng.IPromise<any>;
$sendPasswordResetEmail(email: string): ng.IPromise<any>;
}
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for Angular JS 1.2+ (ngAnimate module)
// Project: http://angularjs.org
// Definitions by: Michel Salib <michelsalib@hotmail.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// 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;
}
}
+11
View File
@@ -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<T>;
$resolved : boolean;
}
/** when creating a resource factory via IModule.factory */
@@ -122,3 +126,10 @@ declare module ng {
factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction<any>): IModule;
}
}
interface Array<T extends ng.resource.IResource<T>>
{
/** the promise of the original server interaction that created this collection. **/
$promise : ng.IPromise<Array<T>>;
$resolved : boolean;
}
+1 -1
View File
@@ -1,7 +1,7 @@
/// <reference path="angular.d.ts" />
// 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
+24 -15
View File
@@ -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;
+3
View File
@@ -107,3 +107,6 @@ interface JQuery {
affix(options?: AffixOptions): JQuery;
}
declare module "bootstrap" {
}
Vendored
+1 -1
View File
@@ -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<any>;
forEach(func: (value: any) => void ): void;
+32
View File
@@ -0,0 +1,32 @@
/// <reference path="dot.d.ts" />
var headertmpl = "<h1>{{=it.title}}</h1>";
var pagetmpl = "<h2>Here is the page using a header template< / h2 >\n"
+ "{{#def.header}}\n"
+ "{{=it.name}}";
var customizableheadertmpl = "{{#def.header}}"
+ "\n{{#def.mycustominjectionintoheader || ''} }";
var pagetmplwithcustomizableheader = "<h2>Here is the page with customized header template</h2>\n"
+ "{{##def.mycustominjectionintoheader:\n"
+ " <div>{{=it.title}} is not {{=it.name}}</div>\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);
+50
View File
@@ -0,0 +1,50 @@
// Type definitions for doT v1.0.1
// Project: https://github.com/olado/doT
// Definitions by: ZombieHunter <https://github.com/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;
}
+11 -2
View File
@@ -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 { }
+2
View File
@@ -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;
+1 -1
View File
@@ -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;
+1
View File
@@ -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;
+2 -1
View File
@@ -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;
+55
View File
@@ -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");
(<any>event).user = "foo";
(<any>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] }),
+29 -10
View File
@@ -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;
+2 -2
View File
@@ -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;
+92 -31
View File
@@ -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.
+12 -4
View File
@@ -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);
@@ -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.');
});
});
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for socket.io nodejs client
// Project: http://socket.io/
// Definitions by: Maido Kaara <https://github.com/v3rm0n>
// 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;
}
}
+3 -3
View File
@@ -2133,7 +2133,7 @@ interface Array<T> {
* }, 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 {
+3 -1
View File
@@ -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<string>