Merge pull request #1 from borisyankov/master

Updating to master.
This commit is contained in:
Steve Fenton
2014-07-25 08:08:46 +01:00
14 changed files with 816 additions and 41 deletions
+3
View File
@@ -13,6 +13,7 @@ All definitions files include a header with the author and editors, so at some p
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
* [angularLocalStorage](https://github.com/agrublev/angularLocalStorage) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
* [AngularUI](http://angular-ui.github.io/) (by [Michel Salib](https://github.com/michelsalib))
* [Angular Hotkeys](https://github.com/chieffancypants/angular-hotkeys/) (by [Jason Zhao](https://github.com/jlz27))
* [Angular Protractor](https://github.com/angular/protractor) (by [Bill Armstrong](https://github.com/BillArmstrong))
* [Angular Translate](http://pascalprecht.github.io/angular-translate/) (by [Michel Salib](https://github.com/michelsalib))
* [Angular UI Bootstrap](http://angular-ui.github.io/bootstrap) (by [Brian Surowiec](https://github.com/xt0rted))
@@ -39,6 +40,7 @@ All definitions files include a header with the author and editors, so at some p
* [Box2DWeb](http://code.google.com/p/box2dweb/) (by [Josh Baldwin](https://github.com/jbaldwin/))
* [Breeze](http://www.breezejs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Browser Harness](https://github.com/scriby/browser-harness) (by [Chris Scribner](https://github.com/scriby))
* [bucks](https://github.com/CyberAgent/bucks.js) (by [Shunsuke Ohtani](https://github.com/zaneli))
* [CasperJS](http://casperjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
* [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle))
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
@@ -277,6 +279,7 @@ All definitions files include a header with the author and editors, so at some p
* [Q-io](https://github.com/kriskowal/q-io) (by [Bart van der Schoor](https://github.com/Bartvds))
* [QUnit](http://qunitjs.com/) (by [Diullei Gomes](https://github.com/Diullei))
* [Raven.js](https://github.com/getsentry/raven-js) (by [Santi Albo](https://github.com/santialbo))
* [Recaptcha.js](https://www.google.com/recaptcha) (by [Brent Jenkins](https://github.com/brentj73))
* [Rickshaw](http://code.shutterstock.com/rickshaw/) (by [Blake Niemyjski](https://github.com/niemyjski))
* [Riot.js](https://github.com/moot/riotjs) (by [vvakame](https://github.com/vvakame))
* [Restify](https://github.com/mcavage/node-restify) (by [Bret Little](https://github.com/blittle))
+2 -2
View File
@@ -41,7 +41,7 @@ declare module aa {
[settingName: string]: any;
}
export interface IFormExtensionsProvider extends ng.auto.IProvider {
export interface IFormExtensionsProvider extends ng.IServiceProvider {
defaultLabelStrategy:string;
defaultFieldGroupStrategy:string;
defaultValMsgPlacementStrategy:string;
@@ -88,7 +88,7 @@ declare module aa {
message:string;
}
export interface INotifyConfigProvider extends ng.auto.IProvider {
export interface INotifyConfigProvider extends ng.IServiceProvider {
notifyConfigs:any;
defaultTargetContainerName:string;
defaultNotifyConfig:string;
+16
View File
@@ -0,0 +1,16 @@
/// <reference path="../angularjs/angular.d.ts" />
/// <reference path="angular-hotkeys.d.ts" />
var scope: ng.IScope;
var hotkeyProvider: ng.hotkeys.HotkeysProvider;
var hotkeyObj: ng.hotkeys.Hotkey;
hotkeyProvider.add("mod+s", "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} );
hotkeyProvider.add(hotkeyObj);
hotkeyProvider.bindTo(scope);
hotkeyProvider.del("mod+s");
hotkeyProvider.get("mod+s");
hotkeyProvider.toggleCheatSheet();
hotkeyProvider.add(hotkeyObj.combo, hotkeyObj.description ,hotkeyObj.callback);
+34
View File
@@ -0,0 +1,34 @@
// Type definitions for angular-hotkeys
// Project: https://github.com/chieffancypants/angular-hotkeys
// Definitions by: Jason Zhao <https://github.com/jlz27>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
declare module ng.hotkeys {
interface HotkeysProvider {
template: string;
includeCheatSheet: boolean;
cheatSheetHotkey: string;
cheatSheetDescription: string;
add(combo: string, description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): void;
add(hotkeyObj: ng.hotkeys.Hotkey): void;
bindTo(scope : ng.IScope): ng.hotkeys.HotkeysProvider;
del(combo: string): void;
get(combo: string): ng.hotkeys.Hotkey;
toggleCheatSheet(): void;
}
interface Hotkey {
combo: string;
description?: string;
callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void;
}
}
+295 -25
View File
@@ -7,27 +7,27 @@
* (c) 2012 Witold Szczerba
* License: MIT
*/
angular.module('http-auth-interceptor', [])
.provider('authService', function () {
/**
* Holds all the requests which failed due to 401 response,
* so they can be re-requested in future, once login is completed.
*/
var buffer: { config: ng.IRequestConfig; deferred: ng.IDeferred<any>; }[] = [];
class AuthService {
/**
* Holds all the requests which failed due to 401 response,
* so they can be re-requested in future, once login is completed.
*/
buffer: { config: ng.IRequestConfig; deferred: ng.IDeferred<any>; }[] = [];
/**
* Required by HTTP interceptor.
* Function is attached to provider to be invisible for regular users of this service.
*/
this.pushToBuffer = function (config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
buffer.push({
config: config,
deferred: deferred
});
}
/**
* Required by HTTP interceptor.
* Function is attached to provider to be invisible for regular users of this service.
*/
pushToBuffer = function(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
this.buffer.push({
config: config,
deferred: deferred
});
}
this.$get = ['$rootScope', '$injector', <any>function ($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
$get = [
'$rootScope', '$injector', <any>function($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
var $http: ng.IHttpService; //initialized later because of circular dependency problem
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
$http = $http || $injector.get('$http');
@@ -36,20 +36,25 @@ angular.module('http-auth-interceptor', [])
});
}
function retryAll() {
for (var i = 0; i < buffer.length; ++i) {
retry(buffer[i].config, buffer[i].deferred);
for (var i = 0; i < this.buffer.length; ++i) {
retry(this.buffer[i].config, this.buffer[i].deferred);
}
buffer = [];
this.buffer = [];
}
return {
return {
loginConfirmed: function () {
$rootScope.$broadcast('event:auth-loginConfirmed');
retryAll();
}
}
}]
})
}
];
}
angular.module('http-auth-interceptor', [])
.provider('authService', AuthService)
/**
* $http interceptor.
@@ -95,6 +100,7 @@ module HttpAndRegularPromiseTests {
theAnswer: number;
letters: string[];
snack: string;
nothing?: string;
}
var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => {
@@ -139,6 +145,12 @@ module HttpAndRegularPromiseTests {
dPromise.then((snack: string) => {
$scope.snack = snack;
});
// $q.when may be called without arguments
var ePromise: ng.IPromise<void> = $q.when();
ePromise.then(() => {
$scope.nothing = "really nothing";
});
}
// Test that we can pass around a type-checked success/error Promise Callback
@@ -176,7 +188,8 @@ mod.factory(My.Namespace);
mod.filter('name', function ($scope: ng.IScope) { })
mod.filter('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.filter(My.Namespace);
mod.provider('name', function ($scope: ng.IScope) { })
mod.provider('name', function ($scope: ng.IScope) { return { $get: () => { } } })
mod.provider('name', TestProvider);
mod.provider('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.provider(My.Namespace);
mod.service('name', function ($scope: ng.IScope) { })
@@ -189,6 +202,13 @@ mod.value('name', 23);
mod.value('name', "23");
mod.value(My.Namespace);
class TestProvider implements ng.IServiceProvider {
constructor(private $scope: ng.IScope) {
}
$get() {
}
}
// Promise signature tests
var foo: ng.IPromise<number>;
@@ -251,3 +271,253 @@ test_IAttributes({
},
$attr: {}
});
// test from https://docs.angularjs.org/guide/directive
angular.module('docsSimpleDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.directive('myCustomer', function() {
return {
template: 'Name: {{customer.name}} Address: {{customer.address}}'
};
});
angular.module('docsTemplateUrlDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.directive('myCustomer', function() {
return {
templateUrl: 'my-customer.html'
};
});
angular.module('docsRestrictDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.directive('myCustomer', function() {
return {
restrict: 'E',
templateUrl: 'my-customer.html'
};
});
angular.module('docsScopeProblemExample', [])
.controller('NaomiController', ['$scope', function($scope: any) {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.controller('IgorController', ['$scope', function($scope: any) {
$scope.customer = {
name: 'Igor',
address: '123 Somewhere'
};
}])
.directive('myCustomer', function() {
return {
restrict: 'E',
templateUrl: 'my-customer.html'
};
});
angular.module('docsIsolateScopeDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
$scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' };
$scope.igor = { name: 'Igor', address: '123 Somewhere' };
}])
.directive('myCustomer', function() {
return {
restrict: 'E',
scope: {
customerInfo: '=info'
},
templateUrl: 'my-customer-iso.html'
};
});
angular.module('docsIsolationExample', [])
.controller('Controller', ['$scope', function($scope: any) {
$scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' };
$scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' };
}])
.directive('myCustomer', function() {
return {
restrict: 'E',
scope: {
customerInfo: '=info'
},
templateUrl: 'my-customer-plus-vojta.html'
};
});
angular.module('docsTimeDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
$scope.format = 'M/d/yy h:mm:ss a';
}])
.directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any): ng.IDirective {
return {
link: function(scope: any, element: any, attrs: any) {
var format: any,
timeoutId: any;
function updateTime() {
element.text(dateFilter(new Date(), format));
}
scope.$watch(attrs.myCurrentTime, function (value: any) {
format = value;
updateTime();
});
element.on('$destroy', function () {
$interval.cancel(timeoutId);
});
// start the UI update process; save the timeoutId for canceling
timeoutId = $interval(function () {
updateTime(); // update DOM
}, 1000);
}
};
}]);
angular.module('docsTransclusionDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
$scope.name = 'Tobias';
}])
.directive('myDialog', function() {
return {
restrict: 'E',
transclude: true,
templateUrl: 'my-dialog.html'
};
});
angular.module('docsTransclusionExample', [])
.controller('Controller', ['$scope', function($scope: any) {
$scope.name = 'Tobias';
}])
.directive('myDialog', function() {
return {
restrict: 'E',
transclude: true,
scope: {},
templateUrl: 'my-dialog.html',
link: function (scope: any, element: any) {
scope.name = 'Jeff';
}
};
});
angular.module('docsIsoFnBindExample', [])
.controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) {
$scope.name = 'Tobias';
$scope.hideDialog = function () {
$scope.dialogIsHidden = true;
$timeout(function () {
$scope.dialogIsHidden = false;
}, 2000);
};
}])
.directive('myDialog', function() {
return {
restrict: 'E',
transclude: true,
scope: {
'close': '&onClose'
},
templateUrl: 'my-dialog-close.html'
};
});
angular.module('dragModule', [])
.directive('myDraggable', ['$document', function($document: any) {
return function(scope: any, element: any, attr: any) {
var startX = 0, startY = 0, x = 0, y = 0;
element.css({
position: 'relative',
border: '1px solid red',
backgroundColor: 'lightgrey',
cursor: 'pointer'
});
element.on('mousedown', function(event: any) {
// Prevent default dragging of selected content
event.preventDefault();
startX = event.pageX - x;
startY = event.pageY - y;
$document.on('mousemove', mousemove);
$document.on('mouseup', mouseup);
});
function mousemove(event: any) {
y = event.pageY - startY;
x = event.pageX - startX;
element.css({
top: y + 'px',
left: x + 'px'
});
}
function mouseup() {
$document.off('mousemove', mousemove);
$document.off('mouseup', mouseup);
}
};
}]);
angular.module('docsTabsExample', [])
.directive('myTabs', function() {
return {
restrict: 'E',
transclude: true,
scope: {},
controller: function($scope: any) {
var panes: any = $scope.panes = [];
$scope.select = function(pane: any) {
angular.forEach(panes, function(pane: any) {
pane.selected = false;
});
pane.selected = true;
};
this.addPane = function(pane: any) {
if (panes.length === 0) {
$scope.select(pane);
}
panes.push(pane);
};
},
templateUrl: 'my-tabs.html'
};
})
.directive('myPane', function() {
return {
require: '^myTabs',
restrict: 'E',
transclude: true,
scope: {
title: '@'
},
link: function(scope, element, attrs, tabsCtrl) {
tabsCtrl.addPane(scope);
},
templateUrl: 'my-pane.html'
};
});
+27 -9
View File
@@ -18,6 +18,15 @@ interface Function {
///////////////////////////////////////////////////////////////////////////////
declare module ng {
// not directly implemented, but ensures that constructed class implements $get
interface IServiceProviderClass {
new(...args: any[]): IServiceProvider;
}
interface IServiceProviderFactory {
(...args: any[]): IServiceProvider;
}
// All service providers extend this interface
interface IServiceProvider {
$get: any;
@@ -125,7 +134,7 @@ declare module ng {
*/
controller(name: string, inlineAnnotatedConstructor: any[]): IModule;
controller(object : Object): IModule;
directive(name: string, directiveFactory: Function): IModule;
directive(name: string, directiveFactory: IDirectiveFactory): IModule;
directive(name: string, inlineAnnotatedFunction: any[]): IModule;
directive(object: Object): IModule;
/**
@@ -146,9 +155,10 @@ declare module ng {
filter(name: string, filterFactoryFunction: Function): IModule;
filter(name: string, inlineAnnotatedFunction: any[]): IModule;
filter(object: Object): IModule;
provider(name: string, serviceProviderConstructor: Function): IModule;
provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule;
provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule;
provider(name: string, inlineAnnotatedConstructor: any[]): IModule;
provider(name: string, providerObject: auto.IProvider): IModule;
provider(name: string, providerObject: IServiceProvider): IModule;
provider(object: Object): IModule;
/**
* Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests.
@@ -565,6 +575,12 @@ declare module ng {
* @param value Value or a promise
*/
when<T>(value: T): IPromise<T>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
*
* @param value Value or a promise
*/
when(): IPromise<void>;
}
interface IPromise<T> {
@@ -969,6 +985,11 @@ declare module ng {
// and http://docs.angularjs.org/guide/directive
///////////////////////////////////////////////////////////////////////////
interface IDirectiveFactory {
(...args: any[]): IDirective;
}
interface IDirective{
compile?:
(templateElement: IAugmentedJQuery,
@@ -980,9 +1001,9 @@ declare module ng {
link?:
(scope: IScope,
instanceElement: IAugmentedJQuery,
instanceAttributes: IAttributes,
controller: any,
transclude: ITranscludeFunction
instanceAttributes?: IAttributes,
controller?: any,
transclude?: ITranscludeFunction
) => void;
name?: string;
priority?: number;
@@ -1047,9 +1068,6 @@ declare module ng {
// AUTO module (angular.js)
///////////////////////////////////////////////////////////////////////////
export module auto {
interface IProvider {
$get: any;
}
///////////////////////////////////////////////////////////////////////
// InjectorService
+3 -1
View File
@@ -22,6 +22,8 @@ interface BrowserifyObject extends NodeJS.EventEmitter {
ignore(file: string): BrowserifyObject;
transform(tr: string): BrowserifyObject;
transform(tr: Function): BrowserifyObject;
plugin(plugin: string, opts?: any): BrowserifyObject;
plugin(plugin: Function, opts?: any): BrowserifyObject;
}
declare module "browserify" {
@@ -33,4 +35,4 @@ declare module "browserify" {
}): BrowserifyObject;
export = browserify;
}
}
+222
View File
@@ -0,0 +1,222 @@
/// <reference path="bucks.d.ts"/>
function add_and_end() {
//
// new Bucks object
//
var b = new Bucks();
//
// Add and add several tasks.
//
b.add(function f1(err, res) {
return 'a';
}).add(function f2(err, res, next) {
// res => 'a'
return next(null, 3);
}).add(function f3(err, res, next) {
// res => 3
return next(new Error('error after 3'));
}).add(function f4(err, res, next) {
// err => 'error after 3'
return next(null, "recover 4");
}).add(function f5(err, res) {
// res => 'recover 4'
throw new Error('error in f5');
}).add(function f6(err, res) {
// err => 'error in f5'
throw err;
}).add(function f7(err, res) {
// err => 'error in f5'
// ignore and return
return "recover 7";
}).add(function f8(err, res, next) {
// res => 'recover 7';
throw new Error('error in f8');
}).add(function f9(err, res, next) {
// err => 'Error in f8'
// ignore error
return next(null, 'result of 9');
}).end(function last(err, results) {
// all of results
// are obtained in #end
// err => null
// results => [
// 'a',
// null,
// null,
// 'recover 4',
// null,
// null,
// 'recover 7',
// null,
// 'result of 9'
// ];
});
}
function then() {
var b = new Bucks();
b.then(function start() {
return 'start';
}).then(function second(res, next) {
// res => 'start'
return next(null, 'second')
}).end();
}
function delay() {
var b = new Bucks();
b.add(function (){ /** program */ })
.delay(1 * 1000) // 1ms
.add(function() { /** program */})
.end();
}
function error() {
var b = new Bucks();
b.then(function start() {
throw new Error('error in start');
return 'start';
}).error(function onError(e, next) {
// e => 'error in start'
return next();
}).end();
}
function final_errorback_in_end() {
//
// last error back
//
var b = new Bucks();
b.empty(
// add empty task (#end with no task cause error)
).end(function last(err, res) {
// error in last callback
throw new Error('error in end');
}, function finalErrorback(err) {
// catch uncaught error in last callback
// err => 'error in end'
});
}
function uncaught_error() {
try {
var b = new Bucks();
b.then(function () {
throw new Error('error');
}).end();
} catch(e) {
// e => 'error'
}
}
function waterfall() {
var t1: Bucks.Task = function t1(err, res) {
return 't1';
};
var t2: Bucks.Task = function t2(err, res) {
return 't2';
};
new Bucks().waterfall([t1, t2]).end(function finish(err, ress) {
// ress => ['t1', 't2']
});
// same as
new Bucks().add(t1).add(t2).end(function finish(err, ress) {
// ress => ['t1', 't2']
});
}
function parallel() {
var b = new Bucks();
b.parallel([
function task1(err, res) {
return "task1";
},
function task2(err, res, next) {
return next(null, "task2");
},
function task3(err, res, next) {
return next(new Error('passed error in task3'));
},
function task4(err, res, next) {
throw new Error('thrown error in task4');
}
]).add(function getResults(err, res, next) {
// res => {
// err: [
// null,
// null,
// [Error: passed error in task3],
// [Error: thrown error in task4]
// ],
// res: [
// 'task1',
// 'task2',
// null,
// null
// ]
// }
next();
}).end();
}
function onError() {
var onError = function (e: Error, bucks: Bucks.Bucks) {
console.log("Custom onError");
};
// Bucks.onError!!
Bucks.onError(onError);
var b0 = new Bucks();
b0
.add(function(err, next) {
throw new Error('b0');
})
.end()
;
}
function dispose() {
var b0 = new Bucks();
b0.dispose = function dispose () {
// delete b0.dummy;
}
b0
.add(function(err, next) {
// b0.dummy = "dummy";
next();
})
.end(null, null)
;
}
function debug() {
Bucks.DEBUG = true;
}
+113
View File
@@ -0,0 +1,113 @@
// Type definitions for bucks.js 0.8.3
// Project: https://github.com/CyberAgent/bucks.js
// Definitions by: Shunsuke Ohtani <https://github.com/zaneli>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Bucks {
interface BucksStatic {
/**
* bucks.js version.
*/
VERSION: string;
/**
* If set `true`, uncaught errors are logged.
*/
DEBUG: boolean;
/**
* Running bucks objects.
*/
running: Bucks[];
/**
* Not yet called `end` bucks object.
*/
living: Bucks[];
/**
* Create bucks object.
*/
new(): Bucks;
/**
* Catch all errors.
* @param onError Function called after catching error
*/
onError(onError: (err:Error, bucks:Bucks)=>any): void;
}
interface Bucks {
/**
* Add a task.
* @param task Function added async chain
*/
add(task: TaskWithNext): Bucks;
/**
* Add a task called only in case of success.
* @param onSuccess Function called only in case of success
*/
then(onSuccess: (res:any, next?:Task)=>any): Bucks;
/**
* Add a empty task.
*/
empty(): Bucks;
/**
* Add a task called only in case of error.
* @param onError Function called only in case of error
*/
error(onError: (err:Error, next?:Task)=>any): Bucks;
/**
* Add tasks in asynchronous way and join their results.
* @param tasks Functions called in asynchronous way and join their results
*/
parallel(tasks: TaskWithNext[]): Bucks;
/**
* Add tasks in asynchronous way and join their results.
* @param tasks Functions added async chain
*/
waterfall(tasks: TaskWithNext[]): Bucks;
/**
* Add delay execution.
* @param ms number millisecond for delaying
*/
delay(ms: number): Bucks;
/**
* Called when destroy async chain.
*/
dispose(): void;
/**
* Destroy this object and call last callback function.
* @param err If specify err and no callback, throw to execute failure callback
*/
destroy(err?: Error): Bucks;
/**
* Complete creating async chain and start executing.
* @param callback Last callback function
* @param errback Handler for occurring error in last callback function
*/
end(callback?: Task, errback?: (err:Error)=>any): void;
}
interface TaskWithNext {
(err?: Error, res?: any, next?: Task): any;
}
interface Task {
(err?: Error, res?: any): any;
}
}
declare var Bucks: Bucks.BucksStatic;
+5
View File
@@ -86,6 +86,11 @@ declare module CodeMirror {
or the line the widget is on require the widget to be redrawn. */
function on(line: LineWidget, eventName: 'redraw', handler: () => void ): void;
function off(line: LineWidget, eventName: 'redraw', handler: () => void ): void;
/** Various CodeMirror-related objects emit events, which allow client code to react to various situations.
Handlers for such events can be registered with the on and off methods on the objects that the event fires on.
To fire your own events, use CodeMirror.signal(target, name, args...), where target is a non-DOM-node object. */
function signal(target: any, name: string, ...args: any[]): void;
interface Editor {
+1
View File
@@ -91,6 +91,7 @@ interface GlobalizeCulture {
isRTL: boolean;
language: string;
numberFormat: GlobalizeNumberFormat;
calendar: GlobalizeCalendar;
calendars: GlobalizeCalendars;
messages: any;
}
+4 -4
View File
@@ -381,7 +381,7 @@ interface QUnitStatic extends QUnitAssert{
* @param expected Number of assertions in this test
* @param test Function to close over assertions
*/
asyncTest(name: string, expected: number, test: () => any): any;
asyncTest(name: string, expected: number, test: (assert: QUnitAssert) => any): any;
/**
* Add an asynchronous test to run. The test must include a call to start().
@@ -392,7 +392,7 @@ interface QUnitStatic extends QUnitAssert{
* @param name Title of unit being tested
* @param test Function to close over assertions
*/
asyncTest(name: string, test: () => any): any;
asyncTest(name: string, test: (assert: QUnitAssert) => any): any;
/**
* Specify how many assertions are expected to run within a test.
@@ -662,7 +662,7 @@ declare function testStart(callback: (details: TestStartCallbackObject) => any):
* @param expected Number of assertions in this test
* @param test Function to close over assertions
*/
declare function asyncTest(name: string, expected?: any, test?: () => any): any;
declare function asyncTest(name: string, expected?: any, test?: (assert: QUnitAssert) => any): any;
/**
* Add an asynchronous test to run. The test must include a call to start().
@@ -673,7 +673,7 @@ declare function asyncTest(name: string, expected?: any, test?: () => any): any;
* @param name Title of unit being tested
* @param test Function to close over assertions
*/
declare function asyncTest(name: string, test: () => any): any;
declare function asyncTest(name: string, test: (assert: QUnitAssert) => any): any;
/**
* Specify how many assertions are expected to run within a test.
+52
View File
@@ -0,0 +1,52 @@
/// <reference path="recaptcha.d.ts"/>
var recaptchaOptions: RecaptchaOptions = {
theme : 'custom',
custom_theme_widget: 'recaptcha_widget'
};
var recaptchaOptions: RecaptchaOptions = {
custom_translations: { instructions_visual: "This is my text:" }
};
var recaptchaOptions: RecaptchaOptions = {
custom_translations: {
instructions_visual: "Scrivi le due parole:",
instructions_audio: "Trascrivi ci\u00f2 che senti:",
play_again: "Riascolta la traccia audio",
cant_hear_this: "Scarica la traccia in formato MP3",
visual_challenge: "Modalit\u00e0 visiva",
audio_challenge: "Modalit\u00e0 auditiva",
refresh_btn: "Chiedi due nuove parole",
help_btn: "Aiuto",
incorrect_try_again: "Scorretto. Riprova.",
},
lang: 'it',
theme: 'red'
};
var recaptchaOptions: RecaptchaOptions = {
theme : 'white',
tabindex : 2
};
Recaptcha.create("public_key_a",
"element_id_a",
{
theme: "red",
callback: Recaptcha.focus_response_field
}
);
Recaptcha.create("public_key_b",
"element_id_b",
recaptchaOptions
);
Recaptcha.switch_type("audio");
Recaptcha.get_challenge();
Recaptcha.get_response();
Recaptcha.reload();
Recaptcha.showhelp();
Recaptcha.focus_response_field();
Recaptcha.destroy();
+39
View File
@@ -0,0 +1,39 @@
// Type definitions for Google Recaptcha
// Project: https://www.google.com/recaptcha
// Definitions by: Brent Jenkins <https://github.com/brentj73>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare class Recaptcha {
constructor();
static reload(): void;
static switch_type(newtype: string): void;
static showhelp(): void;
static get_challenge(): string;
static get_response(): string;
static focus_response_field(): void;
static create(public_key: string, element: string, options: RecaptchaOptions): void;
static destroy(): void;
}
interface RecaptchaOptions {
tabindex?: number;
theme?: string;
callback?: Function;
lang?: string;
custom_theme_widget?: string;
custom_translations?: CustomTranslations;
}
interface CustomTranslations {
visual_challenge?: string;
audio_challenge?: string;
refresh_btn?: string;
instructions_visual?: string;
instructions_audio?: string;
help_btn?: string;
play_again?: string;
cant_hear_this?: string;
incorrect_try_again?: string;
image_alt_text?: string;
privacy_and_terms?: string;
}