mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
Merge branch 'master' of https://github.com/borisyankov/DefinitelyTyped
This commit is contained in:
@@ -125,6 +125,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee))
|
||||
* [History.js](https://github.com/browserstate/history.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Html2Canvas.js](https://github.com/niklasvh/html2canvas/) (by [Richard Hepburn](https://github.com/rwhepburn))
|
||||
* [htmlparser2](https://github.com/fb55/htmlparser2/) (by [James Roland Cabresos](https://github.com/staticfunction))
|
||||
* [http-string-parser](https://github.com/apiaryio/http-string-parser) (by [MIZUNE Pine](https://github.com/pine613))
|
||||
* [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter))
|
||||
@@ -138,6 +139,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [IxJS (Interactive extensions)](https://github.com/Reactive-Extensions/IxJS) (by [Igor Oleinikov](https://github.com/Igorbek))
|
||||
* [jake](https://github.com/mde/jake) (by [Kon](http://phyzkit.net/))
|
||||
* [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Jasmine-data_driven_tests](https://github.com/gburghardt/jasmine-data_driven_tests) (by [Anthony MacKinnon](https://github.com/AnthonyMacKinnon))
|
||||
* [Jasmine-jQuery](https://github.com/velesin/jasmine-jquery) (by [Gregor Stamac](https://github.com/gstamac))
|
||||
* [jDataView](https://github.com/jDataView/jDataView) (by [Ingvar Stepanyan](https://github.com/RReverser))
|
||||
* [JointJS](http://www.jointjs.com/) (by [Aidan Reel](http://github.com/areel))
|
||||
@@ -247,6 +249,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
|
||||
* [MongoDB](http://mongodb.github.io/node-mongodb-native/) (from TypeScript samples, updated by [Niklas Mollenhauer](https://github.com/nikeee))
|
||||
* [mongoose](http://mongoosejs.com/) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
* [morgan](https://github.com/expressjs/morgan/) (by [James Roland Cabresos](https://github.com/staticfunction/))
|
||||
* [Mousetrap](http://craig.is/killing/mice) (by [Dániel Tar](https://github.com/qcz))
|
||||
* [msgpack.js](https://github.com/uupaa/msgpack.js) (by [Shinya Mochizuki](https://github.com/enrapt-mochizuki))
|
||||
* [Mustache.js](https://github.com/janl/mustache.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -272,6 +275,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [OpenLayers](https://github.com/openlayers/openlayers) (by [Ilya Bolkhovsky](https://github.com/bolhovsky/))
|
||||
* [Optimist](https://github.com/substack/node-optimist) (by [Carlos Ballesteros Velasco](https://github.com/soywiz))
|
||||
* [Passport](http://passportjs.org/) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
* [passport-facebook](https://github.com/jaredhanson/passport-facebook) (by [James Roland Cabresos](https://github.com/staticfunction/))
|
||||
* [passport-strategy](https://github.com/jaredhanson/passport-strategy) (by [Lior Mualem](https://github.com/liorm))
|
||||
* [pathwatcher](http://atom.github.io/node-pathwatcher/) (by [vvakame](https://github.com/vvakame))
|
||||
* [Parallel.js](https://github.com/adambom/parallel.js) (by [Josh Baldwin](https://github.com/jbaldwin))
|
||||
@@ -286,8 +290,10 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [PouchDB](http://pouchdb.com) (by [Bill Sears](https://github.com/MrBigDog2U/))
|
||||
* [PreloadJS](http://www.createjs.com/#!/PreloadJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [ProgressJs](http://usablica.github.io/progress.js/) (by [Shunsuke Ohtani](https://github.com/zaneli))
|
||||
* [promise-pool](https://github.com/vilic/promise-pool) (by [VILIC VANE](https://github.com/vilic))
|
||||
* [Q](https://github.com/kriskowal/q) (by Barrie Nemetchek, Andrew Gaspar)
|
||||
* [Q-io](https://github.com/kriskowal/q-io) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [q-retry](https://github.com/vilic/q-retry) (by [VILIC VANE](https://github.com/vilic))
|
||||
* [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))
|
||||
|
||||
Vendored
+1
@@ -13,6 +13,7 @@ declare module ng.ui {
|
||||
templateUrl?: any;
|
||||
templateProvider?: () => string;
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
controllerProvider?: any;
|
||||
resolve?: {};
|
||||
url?: string;
|
||||
|
||||
+256
-217
@@ -231,11 +231,11 @@ foo.then((x) => {
|
||||
}).then((x) => {
|
||||
// Object is inferred here
|
||||
x.a = 123;
|
||||
//Try a promise
|
||||
//Try a promise
|
||||
var y: ng.IPromise<number>;
|
||||
return y;
|
||||
return y;
|
||||
}).then((x) => {
|
||||
// x is infered to be a number, which is the resolved value of a promise
|
||||
// x is infered to be a number, which is the resolved value of a promise
|
||||
x.toFixed();
|
||||
});
|
||||
|
||||
@@ -281,252 +281,291 @@ test_IAttributes({
|
||||
$attr: {}
|
||||
});
|
||||
|
||||
class SampleDirective implements ng.IDirective {
|
||||
public restrict = 'A';
|
||||
name = 'doh';
|
||||
|
||||
compile(templateElement: ng.IAugmentedJQuery) {
|
||||
return {
|
||||
post: this.link
|
||||
};
|
||||
}
|
||||
|
||||
static instance():ng.IDirective {
|
||||
return new SampleDirective();
|
||||
}
|
||||
|
||||
link(scope: ng.IScope) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class SampleDirective2 implements ng.IDirective {
|
||||
public restrict = 'EAC';
|
||||
|
||||
compile(templateElement: ng.IAugmentedJQuery) {
|
||||
return {
|
||||
pre: this.link
|
||||
};
|
||||
}
|
||||
|
||||
static instance():ng.IDirective {
|
||||
return new SampleDirective2();
|
||||
}
|
||||
|
||||
link(scope: ng.IScope) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance);
|
||||
|
||||
// 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}}'
|
||||
};
|
||||
});
|
||||
.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'
|
||||
};
|
||||
});
|
||||
.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'
|
||||
};
|
||||
});
|
||||
.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'
|
||||
};
|
||||
});
|
||||
.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'
|
||||
};
|
||||
});
|
||||
.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'
|
||||
};
|
||||
});
|
||||
.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 {
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
$scope.format = 'M/d/yy h:mm:ss a';
|
||||
}])
|
||||
.directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any) {
|
||||
|
||||
return {
|
||||
link: function(scope: any, element: any, attrs: any) {
|
||||
var format: any,
|
||||
timeoutId: any;
|
||||
return {
|
||||
link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs:ng.IAttributes) {
|
||||
var format: any,
|
||||
timeoutId: any;
|
||||
|
||||
function updateTime() {
|
||||
element.text(dateFilter(new Date(), format));
|
||||
}
|
||||
function updateTime() {
|
||||
element.text(dateFilter(new Date(), format));
|
||||
}
|
||||
|
||||
scope.$watch(attrs.myCurrentTime, function (value: any) {
|
||||
format = value;
|
||||
updateTime();
|
||||
});
|
||||
scope.$watch(attrs['myCurrentTime'], function (value: any) {
|
||||
format = value;
|
||||
updateTime();
|
||||
});
|
||||
|
||||
element.on('$destroy', function () {
|
||||
$interval.cancel(timeoutId);
|
||||
});
|
||||
element.on('$destroy', function () {
|
||||
$interval.cancel(timeoutId);
|
||||
});
|
||||
|
||||
// start the UI update process; save the timeoutId for canceling
|
||||
timeoutId = $interval(function () {
|
||||
updateTime(); // update DOM
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
}]);
|
||||
// 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'
|
||||
};
|
||||
});
|
||||
.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';
|
||||
}
|
||||
};
|
||||
});
|
||||
.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: ng.IScope, element: ng.IAugmentedJQuery) {
|
||||
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'
|
||||
};
|
||||
});
|
||||
.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;
|
||||
.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.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);
|
||||
});
|
||||
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 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);
|
||||
}
|
||||
};
|
||||
}]);
|
||||
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 = [];
|
||||
.directive('myTabs', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
scope: {},
|
||||
controller: function($scope: ng.IScope) {
|
||||
var panes: any = $scope['panes'] = [];
|
||||
|
||||
$scope.select = function(pane: any) {
|
||||
angular.forEach(panes, function(pane: any) {
|
||||
pane.selected = false;
|
||||
});
|
||||
pane.selected = true;
|
||||
};
|
||||
$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'
|
||||
};
|
||||
});
|
||||
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: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, tabsCtrl: any) {
|
||||
tabsCtrl.addPane(scope);
|
||||
},
|
||||
templateUrl: 'my-pane.html'
|
||||
};
|
||||
});
|
||||
|
||||
Vendored
+32
-21
@@ -312,10 +312,10 @@ declare module ng {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Scope
|
||||
// see http://docs.angularjs.org/api/ng.$rootScope.Scope
|
||||
// Scope and RootScope
|
||||
// see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and http://docs.angularjs.org/api/ng.$rootScope
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IScope {
|
||||
interface IRootScopeService {
|
||||
$apply(): any;
|
||||
$apply(exp: string): any;
|
||||
$apply(exp: (scope: IScope) => any): any;
|
||||
@@ -352,6 +352,7 @@ declare module ng {
|
||||
$parent: IScope;
|
||||
|
||||
$root: IRootScopeService;
|
||||
this: IRootScopeService;
|
||||
|
||||
$id: string;
|
||||
|
||||
@@ -360,6 +361,10 @@ declare module ng {
|
||||
$$phase: any;
|
||||
}
|
||||
|
||||
interface IScope extends IRootScopeService {
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
interface IAngularEvent {
|
||||
targetScope: IScope;
|
||||
currentScope: IScope;
|
||||
@@ -962,12 +967,6 @@ declare module ng {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ITemplateCacheService extends ICacheObject {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// RootScopeService
|
||||
// see http://docs.angularjs.org/api/ng.$rootScope
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IRootScopeService extends IScope {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SCEService
|
||||
// see http://docs.angularjs.org/api/ng.$sce
|
||||
@@ -1031,22 +1030,34 @@ declare module ng {
|
||||
(...args: any[]): IDirective;
|
||||
}
|
||||
|
||||
|
||||
interface IDirective{
|
||||
compile?:
|
||||
(templateElement: IAugmentedJQuery,
|
||||
templateAttributes: IAttributes,
|
||||
transclude: ITranscludeFunction
|
||||
) => any;
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
link?:
|
||||
(scope: IScope,
|
||||
interface IDirectiveLinkFn {
|
||||
(
|
||||
scope: IScope,
|
||||
instanceElement: IAugmentedJQuery,
|
||||
instanceAttributes: IAttributes,
|
||||
controller: any,
|
||||
transclude: ITranscludeFunction
|
||||
) => void;
|
||||
): void;
|
||||
}
|
||||
|
||||
interface IDirectivePrePost {
|
||||
pre?: IDirectiveLinkFn;
|
||||
post?: IDirectiveLinkFn;
|
||||
}
|
||||
|
||||
interface IDirectiveCompileFn {
|
||||
(
|
||||
templateElement: IAugmentedJQuery,
|
||||
templateAttributes: IAttributes,
|
||||
transclude: ITranscludeFunction
|
||||
): IDirectivePrePost;
|
||||
}
|
||||
|
||||
interface IDirective {
|
||||
compile?: IDirectiveCompileFn;
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
link?: IDirectiveLinkFn;
|
||||
name?: string;
|
||||
priority?: number;
|
||||
replace?: boolean;
|
||||
|
||||
+34
-165
@@ -848,14 +848,18 @@ declare module D3 {
|
||||
values(): Array<any>;
|
||||
entries(): Array<any>;
|
||||
forEach(func: (key: string, value: any) => void ): void;
|
||||
empty(): boolean;
|
||||
size(): number;
|
||||
}
|
||||
|
||||
export interface Set{
|
||||
export interface Set {
|
||||
has(value: any): boolean;
|
||||
add(value: any): any;
|
||||
add<T>(value: T): T;
|
||||
remove(value: any): boolean;
|
||||
values(): Array<any>;
|
||||
forEach(func: (value: any) => void ): void;
|
||||
empty(): boolean;
|
||||
size(): number;
|
||||
}
|
||||
|
||||
export interface Random {
|
||||
@@ -1492,7 +1496,7 @@ declare module D3 {
|
||||
/**
|
||||
* increase lightness by some exponential factor (gamma)
|
||||
*/
|
||||
brighter(k: number): Color;
|
||||
brighter(k?: number): Color;
|
||||
/**
|
||||
* decrease lightness by some exponential factor (gamma)
|
||||
*/
|
||||
@@ -2518,21 +2522,23 @@ declare module D3 {
|
||||
threshold(): ThresholdScale;
|
||||
}
|
||||
|
||||
export interface Scale {
|
||||
export interface GenericScale<S> {
|
||||
(value: any): any;
|
||||
domain: {
|
||||
(values: any[]): Scale;
|
||||
(values: any[]): S;
|
||||
(): any[];
|
||||
};
|
||||
range: {
|
||||
(values: any[]): Scale;
|
||||
(values: any[]): S;
|
||||
(): any[];
|
||||
};
|
||||
invertExtent?(y: any): any[];
|
||||
copy(): Scale;
|
||||
copy(): S;
|
||||
}
|
||||
|
||||
export interface QuantitativeScale extends Scale {
|
||||
export interface Scale extends GenericScale<Scale> { }
|
||||
|
||||
export interface GenericQuantitativeScale<S> extends GenericScale<S> {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
@@ -2546,47 +2552,17 @@ declare module D3 {
|
||||
*/
|
||||
invert(value: number): number;
|
||||
/**
|
||||
* Get or set the scale's input domain.
|
||||
*/
|
||||
domain: {
|
||||
/**
|
||||
* Set the scale's input domain.
|
||||
*
|
||||
* @param value The input domain
|
||||
*/
|
||||
(values: any[]): QuantitativeScale;
|
||||
/**
|
||||
* Get the scale's input domain.
|
||||
*/
|
||||
(): any[];
|
||||
};
|
||||
/**
|
||||
* get or set the scale's output range.
|
||||
*/
|
||||
range: {
|
||||
/**
|
||||
* Set the scale's output range.
|
||||
*
|
||||
* @param value The output range.
|
||||
*/
|
||||
(values: any[]): QuantitativeScale;
|
||||
/**
|
||||
* Get the scale's output range.
|
||||
*/
|
||||
(): any[];
|
||||
};
|
||||
/**
|
||||
* Set the scale's output range, and enable rounding.
|
||||
*
|
||||
* @param value The output range.
|
||||
*/
|
||||
rangeRound: (values: any[]) => QuantitativeScale;
|
||||
rangeRound: (values: any[]) => S;
|
||||
/**
|
||||
* get or set the scale's output interpolator.
|
||||
*/
|
||||
interpolate: {
|
||||
(): D3.Transition.Interpolate;
|
||||
(factory: D3.Transition.Interpolate): QuantitativeScale;
|
||||
(factory: D3.Transition.Interpolate): S;
|
||||
};
|
||||
/**
|
||||
* enable or disable clamping of the output range.
|
||||
@@ -2595,14 +2571,14 @@ declare module D3 {
|
||||
*/
|
||||
clamp: {
|
||||
(): boolean;
|
||||
(clamp: boolean): QuantitativeScale;
|
||||
(clamp: boolean): S;
|
||||
}
|
||||
/**
|
||||
* extend the scale domain to nice round numbers.
|
||||
*
|
||||
* @param count Optional number of ticks to exactly fit the domain
|
||||
*/
|
||||
nice(count?: number): QuantitativeScale;
|
||||
nice(count?: number): S;
|
||||
/**
|
||||
* get representative values from the input domain.
|
||||
*
|
||||
@@ -2615,22 +2591,13 @@ declare module D3 {
|
||||
* @param count Aproximate representative values to return
|
||||
*/
|
||||
tickFormat(count: number, format?: string): (n: number) => string;
|
||||
/**
|
||||
* create a new scale from an existing scale..
|
||||
*/
|
||||
copy(): QuantitativeScale;
|
||||
}
|
||||
|
||||
export interface LinearScale extends QuantitativeScale {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
* @param value Domain Value
|
||||
*/
|
||||
(value: number): number;
|
||||
}
|
||||
export interface QuantitativeScale extends GenericQuantitativeScale<QuantitativeScale> { }
|
||||
|
||||
export interface IdentityScale extends Scale {
|
||||
export interface LinearScale extends GenericQuantitativeScale<LinearScale> { }
|
||||
|
||||
export interface IdentityScale extends GenericScale<IdentityScale> {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
@@ -2657,132 +2624,31 @@ declare module D3 {
|
||||
tickFormat(count: number): (n: number) => string;
|
||||
}
|
||||
|
||||
export interface SqrtScale extends QuantitativeScale {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
* @param value Domain Value
|
||||
*/
|
||||
(value: number): number;
|
||||
}
|
||||
export interface SqrtScale extends GenericQuantitativeScale<SqrtScale> { }
|
||||
|
||||
export interface PowScale extends QuantitativeScale {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
* @param value Domain Value
|
||||
*/
|
||||
(value: number): number;
|
||||
}
|
||||
export interface PowScale extends GenericQuantitativeScale<PowScale> { }
|
||||
|
||||
export interface LogScale extends QuantitativeScale {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
* @param value Domain Value
|
||||
*/
|
||||
(value: number): number;
|
||||
}
|
||||
export interface LogScale extends GenericQuantitativeScale<LogScale> { }
|
||||
|
||||
export interface OrdinalScale extends Scale {
|
||||
/**
|
||||
* Get the range value corresponding to a given domain value.
|
||||
*
|
||||
* @param value Domain Value
|
||||
*/
|
||||
(value: any): any;
|
||||
/**
|
||||
* Get or set the scale's input domain.
|
||||
*/
|
||||
domain: {
|
||||
/**
|
||||
* Set the scale's input domain.
|
||||
*
|
||||
* @param value The input domain
|
||||
*/
|
||||
(values: any[]): OrdinalScale;
|
||||
/**
|
||||
* Get the scale's input domain.
|
||||
*/
|
||||
(): any[];
|
||||
};
|
||||
/**
|
||||
* get or set the scale's output range.
|
||||
*/
|
||||
range: {
|
||||
/**
|
||||
* Set the scale's output range.
|
||||
*
|
||||
* @param value The output range.
|
||||
*/
|
||||
(values: any[]): OrdinalScale;
|
||||
/**
|
||||
* Get the scale's output range.
|
||||
*/
|
||||
(): any[];
|
||||
};
|
||||
export interface OrdinalScale extends GenericScale<OrdinalScale> {
|
||||
rangePoints(interval: any[], padding?: number): OrdinalScale;
|
||||
rangeBands(interval: any[], padding?: number, outerPadding?: number): OrdinalScale;
|
||||
rangeRoundBands(interval: any[], padding?: number, outerPadding?: number): OrdinalScale;
|
||||
rangeBand(): number;
|
||||
rangeExtent(): any[];
|
||||
/**
|
||||
* create a new scale from an existing scale..
|
||||
*/
|
||||
copy(): OrdinalScale;
|
||||
}
|
||||
|
||||
export interface QuantizeScale extends Scale {
|
||||
(value: any): any;
|
||||
domain: {
|
||||
(values: number[]): QuantizeScale;
|
||||
(): any[];
|
||||
};
|
||||
range: {
|
||||
(values: any[]): QuantizeScale;
|
||||
(): any[];
|
||||
};
|
||||
copy(): QuantizeScale;
|
||||
}
|
||||
export interface QuantizeScale extends GenericScale<QuantizeScale> { }
|
||||
|
||||
export interface ThresholdScale extends Scale {
|
||||
(value: any): any;
|
||||
domain: {
|
||||
(values: number[]): ThresholdScale;
|
||||
(): any[];
|
||||
};
|
||||
range: {
|
||||
(values: any[]): ThresholdScale;
|
||||
(): any[];
|
||||
};
|
||||
copy(): ThresholdScale;
|
||||
}
|
||||
export interface ThresholdScale extends GenericScale<ThresholdScale> { }
|
||||
|
||||
export interface QuantileScale extends Scale {
|
||||
(value: any): any;
|
||||
domain: {
|
||||
(values: number[]): QuantileScale;
|
||||
(): any[];
|
||||
};
|
||||
range: {
|
||||
(values: any[]): QuantileScale;
|
||||
(): any[];
|
||||
};
|
||||
export interface QuantileScale extends GenericScale<QuantileScale> {
|
||||
quantiles(): any[];
|
||||
copy(): QuantileScale;
|
||||
}
|
||||
|
||||
export interface TimeScale extends Scale {
|
||||
export interface TimeScale extends GenericScale<TimeScale> {
|
||||
(value: Date): number;
|
||||
invert(value: number): Date;
|
||||
domain: {
|
||||
(values: any[]): TimeScale;
|
||||
(): any[];
|
||||
};
|
||||
range: {
|
||||
(values: any[]): TimeScale;
|
||||
(): any[];
|
||||
};
|
||||
rangeRound: (values: any[]) => TimeScale;
|
||||
interpolate: {
|
||||
(): D3.Transition.Interpolate;
|
||||
@@ -2794,7 +2660,6 @@ declare module D3 {
|
||||
(range: D3.Time.Range, count: number): any[];
|
||||
};
|
||||
tickFormat(count: number): (n: number) => string;
|
||||
copy(): TimeScale;
|
||||
nice(count?: number): TimeScale;
|
||||
}
|
||||
}
|
||||
@@ -3488,3 +3353,7 @@ declare module D3 {
|
||||
}
|
||||
|
||||
declare var d3: D3.Base;
|
||||
|
||||
declare module "d3" {
|
||||
export = d3;
|
||||
}
|
||||
|
||||
+165
-153
@@ -1,161 +1,173 @@
|
||||
// Type definitions for express-validator
|
||||
// Project: https://github.com/ctavan/express-validator
|
||||
// Definitions by: Nathan Ridley <https://github.com/axefrog/>
|
||||
// Definitions by: Nathan Ridley <https://github.com/axefrog/>, Jonathan Häberle <http://dreampulse.de>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module ExpressValidator {
|
||||
export interface ValidationError {
|
||||
msg: string;
|
||||
param: string;
|
||||
}
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
export interface RequestValidation {
|
||||
check(field: string, message: string): Validator;
|
||||
assert(field: string, message: string): Validator;
|
||||
sanitize(field: string): Sanitizer;
|
||||
onValidationError(func: (msg: string) => void): void;
|
||||
}
|
||||
|
||||
export interface Validator {
|
||||
/**
|
||||
* Alias for regex()
|
||||
*/
|
||||
is(): Validator;
|
||||
/**
|
||||
* Alias for notRegex()
|
||||
*/
|
||||
not(): Validator;
|
||||
isEmail(): Validator;
|
||||
/**
|
||||
* Accepts http, https, ftp
|
||||
*/
|
||||
isUrl(): Validator;
|
||||
/**
|
||||
* Combines isIPv4 and isIPv6
|
||||
*/
|
||||
isIP(): Validator;
|
||||
isIPv4(): Validator;
|
||||
isIPv6(): Validator;
|
||||
isAlpha(): Validator;
|
||||
isAlphanumeric(): Validator;
|
||||
isNumeric(): Validator;
|
||||
isHexadecimal(): Validator;
|
||||
/**
|
||||
* Accepts valid hexcolors with or without # prefix
|
||||
*/
|
||||
isHexColor(): Validator;
|
||||
/**
|
||||
* isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't
|
||||
*/
|
||||
isInt(): Validator;
|
||||
isLowercase(): Validator;
|
||||
isUppercase(): Validator;
|
||||
isDecimal(): Validator;
|
||||
/**
|
||||
* Alias for isDecimal
|
||||
*/
|
||||
isFloat(): Validator;
|
||||
/**
|
||||
* Check if length is 0
|
||||
*/
|
||||
notNull(): Validator;
|
||||
isNull(): Validator;
|
||||
/**
|
||||
* Not just whitespace (input.trim().length !== 0)
|
||||
*/
|
||||
notEmpty(): Validator;
|
||||
equals(equals: any): Validator;
|
||||
contains(str: string): Validator;
|
||||
notContains(str: string): Validator;
|
||||
/**
|
||||
* Usage: regex(/[a-z]/i) or regex('[a-z]','i')
|
||||
*/
|
||||
regex(pattern: string, modifiers: string): Validator;
|
||||
notRegex(pattern: string, modifiers: string): Validator;
|
||||
/**
|
||||
* max is optional
|
||||
*/
|
||||
len(min: number, max?: number): Validator;
|
||||
/**
|
||||
* Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier
|
||||
*/
|
||||
isUUID(version: number): Validator;
|
||||
/**
|
||||
* Alias for isUUID(3)
|
||||
*/
|
||||
isUUIDv3(): Validator;
|
||||
/**
|
||||
* Alias for isUUID(4)
|
||||
*/
|
||||
isUUIDv4(): Validator;
|
||||
/**
|
||||
* Alias for isUUID(5)
|
||||
*/
|
||||
isUUIDv5(): Validator;
|
||||
/**
|
||||
* Uses Date.parse() - regex is probably a better choice
|
||||
*/
|
||||
isDate(): Validator;
|
||||
/**
|
||||
* Argument is optional and defaults to today. Comparison is non-inclusive
|
||||
*/
|
||||
isAfter(date: Date): Validator;
|
||||
/**
|
||||
* Argument is optional and defaults to today. Comparison is non-inclusive
|
||||
*/
|
||||
isBefore(date: Date): Validator;
|
||||
isIn(options: string): Validator;
|
||||
isIn(options: string[]): Validator;
|
||||
notIn(options: string): Validator;
|
||||
notIn(options: string[]): Validator;
|
||||
max(val: string): Validator;
|
||||
min(val: string): Validator;
|
||||
/**
|
||||
* Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats
|
||||
*/
|
||||
isCreditCard(): Validator;
|
||||
}
|
||||
|
||||
interface Sanitizer {
|
||||
/**
|
||||
* Trim optional `chars`, default is to trim whitespace (\r\n\t )
|
||||
*/
|
||||
trim(...chars: string[]): Sanitizer;
|
||||
ltrim(...chars: string[]): Sanitizer;
|
||||
rtrim(...chars: string[]): Sanitizer;
|
||||
ifNull(replace: any): Sanitizer;
|
||||
toFloat(): Sanitizer;
|
||||
toInt(): Sanitizer;
|
||||
/**
|
||||
* True unless str = '0', 'false', or str.length == 0
|
||||
*/
|
||||
toBoolean(): Sanitizer;
|
||||
/**
|
||||
* False unless str = '1' or 'true'
|
||||
*/
|
||||
toBooleanStrict(): Sanitizer;
|
||||
/**
|
||||
* Decode HTML entities
|
||||
*/
|
||||
entityDecode(): Sanitizer;
|
||||
entityEncode(): Sanitizer;
|
||||
/**
|
||||
* Escape &, <, >, and "
|
||||
*/
|
||||
escape(): Sanitizer;
|
||||
/**
|
||||
* Remove common XSS attack vectors from user-supplied HTML
|
||||
*/
|
||||
xss(): Sanitizer;
|
||||
/**
|
||||
* Remove common XSS attack vectors from images
|
||||
*/
|
||||
xss(fromImages: boolean): Sanitizer;
|
||||
}
|
||||
}
|
||||
|
||||
declare function ExpressValidator(): void;
|
||||
|
||||
declare module "express-validator" {
|
||||
export = ExpressValidator;
|
||||
import express = require('express');
|
||||
|
||||
module ExpressValidator {
|
||||
|
||||
export interface ValidationError {
|
||||
msg: string;
|
||||
param: string;
|
||||
}
|
||||
|
||||
export interface RequestValidation {
|
||||
check(field:string, message:string): Validator;
|
||||
assert(field:string, message:string): Validator;
|
||||
sanitize(field:string): Sanitizer;
|
||||
onValidationError(func:(msg:string) => void): void;
|
||||
validationErrors() : any;
|
||||
}
|
||||
|
||||
export interface Validator {
|
||||
/**
|
||||
* Alias for regex()
|
||||
*/
|
||||
is(): Validator;
|
||||
/**
|
||||
* Alias for notRegex()
|
||||
*/
|
||||
not(): Validator;
|
||||
isEmail(): Validator;
|
||||
/**
|
||||
* Accepts http, https, ftp
|
||||
*/
|
||||
isUrl(): Validator;
|
||||
/**
|
||||
* Combines isIPv4 and isIPv6
|
||||
*/
|
||||
isIP(): Validator;
|
||||
isIPv4(): Validator;
|
||||
isIPv6(): Validator;
|
||||
isAlpha(): Validator;
|
||||
isAlphanumeric(): Validator;
|
||||
isNumeric(): Validator;
|
||||
isHexadecimal(): Validator;
|
||||
/**
|
||||
* Accepts valid hexcolors with or without # prefix
|
||||
*/
|
||||
isHexColor(): Validator;
|
||||
/**
|
||||
* isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't
|
||||
*/
|
||||
isInt(): Validator;
|
||||
isLowercase(): Validator;
|
||||
isUppercase(): Validator;
|
||||
isDecimal(): Validator;
|
||||
/**
|
||||
* Alias for isDecimal
|
||||
*/
|
||||
isFloat(): Validator;
|
||||
/**
|
||||
* Check if length is 0
|
||||
*/
|
||||
notNull(): Validator;
|
||||
isNull(): Validator;
|
||||
/**
|
||||
* Not just whitespace (input.trim().length !== 0)
|
||||
*/
|
||||
notEmpty(): Validator;
|
||||
equals(equals:any): Validator;
|
||||
contains(str:string): Validator;
|
||||
notContains(str:string): Validator;
|
||||
/**
|
||||
* Usage: regex(/[a-z]/i) or regex('[a-z]','i')
|
||||
*/
|
||||
regex(pattern:string, modifiers:string): Validator;
|
||||
notRegex(pattern:string, modifiers:string): Validator;
|
||||
/**
|
||||
* max is optional
|
||||
*/
|
||||
len(min:number, max?:number): Validator;
|
||||
/**
|
||||
* Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier
|
||||
*/
|
||||
isUUID(version:number): Validator;
|
||||
/**
|
||||
* Alias for isUUID(3)
|
||||
*/
|
||||
isUUIDv3(): Validator;
|
||||
/**
|
||||
* Alias for isUUID(4)
|
||||
*/
|
||||
isUUIDv4(): Validator;
|
||||
/**
|
||||
* Alias for isUUID(5)
|
||||
*/
|
||||
isUUIDv5(): Validator;
|
||||
/**
|
||||
* Uses Date.parse() - regex is probably a better choice
|
||||
*/
|
||||
isDate(): Validator;
|
||||
/**
|
||||
* Argument is optional and defaults to today. Comparison is non-inclusive
|
||||
*/
|
||||
isAfter(date:Date): Validator;
|
||||
/**
|
||||
* Argument is optional and defaults to today. Comparison is non-inclusive
|
||||
*/
|
||||
isBefore(date:Date): Validator;
|
||||
isIn(options:string): Validator;
|
||||
isIn(options:string[]): Validator;
|
||||
notIn(options:string): Validator;
|
||||
notIn(options:string[]): Validator;
|
||||
max(val:string): Validator;
|
||||
min(val:string): Validator;
|
||||
/**
|
||||
* Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats
|
||||
*/
|
||||
isCreditCard(): Validator;
|
||||
}
|
||||
|
||||
interface Sanitizer {
|
||||
/**
|
||||
* Trim optional `chars`, default is to trim whitespace (\r\n\t )
|
||||
*/
|
||||
trim(...chars:string[]): Sanitizer;
|
||||
ltrim(...chars:string[]): Sanitizer;
|
||||
rtrim(...chars:string[]): Sanitizer;
|
||||
ifNull(replace:any): Sanitizer;
|
||||
toFloat(): Sanitizer;
|
||||
toInt(): Sanitizer;
|
||||
/**
|
||||
* True unless str = '0', 'false', or str.length == 0
|
||||
*/
|
||||
toBoolean(): Sanitizer;
|
||||
/**
|
||||
* False unless str = '1' or 'true'
|
||||
*/
|
||||
toBooleanStrict(): Sanitizer;
|
||||
/**
|
||||
* Decode HTML entities
|
||||
*/
|
||||
entityDecode(): Sanitizer;
|
||||
entityEncode(): Sanitizer;
|
||||
/**
|
||||
* Escape &, <, >, and "
|
||||
*/
|
||||
escape(): Sanitizer;
|
||||
/**
|
||||
* Remove common XSS attack vectors from user-supplied HTML
|
||||
*/
|
||||
xss(): Sanitizer;
|
||||
/**
|
||||
* Remove common XSS attack vectors from images
|
||||
*/
|
||||
xss(fromImages:boolean): Sanitizer;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @middlewareOptions see: https://github.com/ctavan/express-validator#middleware-options
|
||||
*/
|
||||
function ExpressValidator(middlewareOptions?:any):express.RequestHandler;
|
||||
|
||||
|
||||
export = ExpressValidator;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -335,6 +335,7 @@ declare module fabric {
|
||||
drawBorders(context: CanvasRenderingContext2D): IObject;
|
||||
drawCorners(context: CanvasRenderingContext2D): IObject;
|
||||
get (property: string): any;
|
||||
getBoundingRect(): {left:number; top:number; width:number; height:number};
|
||||
getBoundingRectHeight(): number;
|
||||
getBoundingRectWidth(): number;
|
||||
getSvgStyles(): string;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/// <reference path="htmlparser2.d.ts"/>
|
||||
/**
|
||||
* Created by staticfunction on 8/4/14.
|
||||
*/
|
||||
import htmlparser = require("htmlparser2");
|
||||
|
||||
var parser = new htmlparser.Parser({
|
||||
onopentag: (name:string, attribs:{[s:string]:string}) => {
|
||||
if(name === "script" && attribs['type'] === "text/javascript"){
|
||||
console.log("JS! Hooray!");
|
||||
}
|
||||
},
|
||||
ontext: (text: string) => {
|
||||
console.log("-->", text);
|
||||
},
|
||||
onclosetag: (tagname:string) => {
|
||||
if(tagname === "script"){
|
||||
console.log("That's it?!");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
parser.write("Xyz <script type='text/javascript'>var foo = '<<bar>>';</script>");
|
||||
parser.end();
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
// Type definitions for htmlparser2 v3.7.x
|
||||
// Project: https://github.com/fb55/htmlparser2/
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module "htmlparser2" {
|
||||
|
||||
export interface Handler {
|
||||
onopentag?:(name:string, attribs:{[type:string]: string}) => void;
|
||||
onopentagname?:(name:string) => void;
|
||||
onattribute?:(name:string, value:string) => void;
|
||||
ontext?:(text:string) => void;
|
||||
onclosetag?: (text:string) => void;
|
||||
onprocessinginstruction?:(name:string, data:string) => void;
|
||||
oncomment?:(data:string) => void;
|
||||
oncommentend?:() => void;
|
||||
oncdatastart?:() => void;
|
||||
oncdataend?:() => void;
|
||||
onerror?:(error:Error) => void;
|
||||
onreset?:() => void;
|
||||
onend?:() => void;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
|
||||
/***
|
||||
* Indicates whether special tags (<script> and <style>) should get special treatment
|
||||
* and if "empty" tags (eg. <br>) can have children. If false, the content of special tags
|
||||
* will be text only. For feeds and other XML content (documents that don't consist of HTML),
|
||||
* set this to true. Default: false.
|
||||
*/
|
||||
xmlMode?:boolean;
|
||||
|
||||
/***
|
||||
* If set to true, entities within the document will be decoded. Defaults to false.
|
||||
*/
|
||||
decodeEntities?:boolean;
|
||||
|
||||
/***
|
||||
* If set to true, all tags will be lowercased. If xmlMode is disabled, this defaults to true.
|
||||
*/
|
||||
lowerCaseTags?:boolean;
|
||||
|
||||
/***
|
||||
* If set to true, all attribute names will be lowercased. This has noticeable impact on speed, so it defaults to false.
|
||||
*/
|
||||
lowerCaseAttributeNames?:boolean;
|
||||
|
||||
/***
|
||||
* If set to true, CDATA sections will be recognized as text even if the xmlMode option is not enabled.
|
||||
* NOTE: If xmlMode is set to true then CDATA sections will always be recognized as text.
|
||||
*/
|
||||
recognizeCDATA?:boolean;
|
||||
|
||||
/***
|
||||
* If set to true, self-closing tags will trigger the onclosetag event even if xmlMode is not set to true.
|
||||
* NOTE: If xmlMode is set to true then self-closing tags will always be recognized.
|
||||
*/
|
||||
recognizeSelfClosing?:boolean;
|
||||
}
|
||||
|
||||
export class Parser {
|
||||
constructor(handler: Handler);
|
||||
|
||||
/***
|
||||
* Parses a chunk of data and calls the corresponding callbacks.
|
||||
* @param input
|
||||
*/
|
||||
write(input:string):void;
|
||||
|
||||
/***
|
||||
* Parses the end of the buffer and clears the stack, calls onend.
|
||||
*/
|
||||
end():void;
|
||||
|
||||
|
||||
/***
|
||||
* Resets the parser, parses the data & calls end.
|
||||
* @param input
|
||||
*/
|
||||
parseComplete(input:string):void;
|
||||
|
||||
/***
|
||||
* Resets buffer & stack, calls onreset.
|
||||
*/
|
||||
reset():void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/// <reference path="jasmine-data_driven_tests.d.ts" />
|
||||
/// <reference path="../jasmine/jasmine.d.ts" />
|
||||
|
||||
all("A data driven test is a suite with multiple specs",
|
||||
['a', 'b', 'c'],
|
||||
(value: string) => {
|
||||
expect(value).not.toBe('d');
|
||||
}
|
||||
);
|
||||
|
||||
all("A data driven test can have many arguments",
|
||||
[
|
||||
[1, 2, 3],
|
||||
[2, 4, 6]
|
||||
],
|
||||
(a: number, b: number, c: number) => {
|
||||
expect(c - (a + b)).toBe(0);
|
||||
}
|
||||
);
|
||||
|
||||
all("A data driven test can be asynchronous",
|
||||
[
|
||||
[3, 1],
|
||||
[5, 2]
|
||||
],
|
||||
(a: number, b: number, done: () => void) => {
|
||||
setTimeout(() => {
|
||||
expect(a - b > 0).toBe(true);
|
||||
done();
|
||||
}, 50);
|
||||
}
|
||||
);
|
||||
|
||||
xall("A data driven test can be pending",
|
||||
[1, 2, 3],
|
||||
(value: number) => {
|
||||
expect(value < 4).toBe(true);
|
||||
}
|
||||
);
|
||||
|
||||
describe("A suite", () => {
|
||||
var a: number;
|
||||
|
||||
beforeEach(() => {
|
||||
a = 5;
|
||||
});
|
||||
|
||||
all("can contain data driven tests",
|
||||
[1, 2, 3],
|
||||
(b: number) => {
|
||||
expect(a - b > 0).toBe(true);
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
// Type definitions for Jasmine Data Driven Tests
|
||||
// Project: https://github.com/gburghardt/jasmine-data_driven_tests
|
||||
// Definitions by: Anthony MacKinnon <https://github.com/AnthonyMacKinnon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare function all(description: string, dataset: any[], assertion: (...args: any[]) => void): void;
|
||||
declare function xall(description: string, dataset: any[], assertion: (...args: any[]) => void): void;
|
||||
@@ -0,0 +1,29 @@
|
||||
/// <reference path="morgan.d.ts"/>
|
||||
/**
|
||||
* Created by staticfunction on 8/3/14.
|
||||
*/
|
||||
|
||||
import morgan = require('morgan');
|
||||
|
||||
// a pre-defined name
|
||||
morgan('combined')
|
||||
morgan('common')
|
||||
morgan('short')
|
||||
morgan('tiny')
|
||||
|
||||
// a format string
|
||||
morgan(':remote-addr :method :url')
|
||||
|
||||
// a custom function
|
||||
morgan(function (req, res) {
|
||||
return req.method + ' ' + req.url
|
||||
})
|
||||
|
||||
morgan('combined', {
|
||||
buffer: true,
|
||||
immediate: true,
|
||||
skip: function (req, res) { return res.statusCode < 400 },
|
||||
stream: (str: string) => {
|
||||
console.log(str);
|
||||
}
|
||||
});
|
||||
Vendored
+93
@@ -0,0 +1,93 @@
|
||||
// Type definitions for morgan 1.2.2
|
||||
// Project: https://github.com/expressjs/morgan
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
declare module "morgan" {
|
||||
|
||||
import express = require('express');
|
||||
|
||||
module morgan {
|
||||
|
||||
export function token<T>(name: string, callback: (req: express.Request, res: express.Response) => T): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Morgan accepts these properties in the options object.
|
||||
*/
|
||||
export interface Options {
|
||||
|
||||
/***
|
||||
* Buffer duration before writing logs to the stream, defaults to false. When set to true, defaults to 1000 ms.
|
||||
*/
|
||||
buffer?: boolean;
|
||||
|
||||
/***
|
||||
* Write log line on request instead of response. This means that a requests will be logged even if the server crashes, but data from the response cannot be logged (like the response code).
|
||||
*/
|
||||
immediate?: boolean;
|
||||
|
||||
/***
|
||||
* Function to determine if logging is skipped, defaults to false. This function will be called as skip(req, res).
|
||||
*/
|
||||
skip?: (req: express.Request, res: express.Response) => boolean;
|
||||
|
||||
/***
|
||||
* Output stream for writing log lines, defaults to process.stdout.
|
||||
* @param str
|
||||
*/
|
||||
stream?: (str: string) => void;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name (see below for the names), a string of a format string, or a function that will produce a log entry.
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: string, options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Standard Apache combined log output.
|
||||
* :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'combined', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Standard Apache common log output.
|
||||
* :remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length]
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'common', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Concise output colored by response status for development use. The :status token will be colored red for server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes.
|
||||
* :method :url :status :response-time ms - :res[content-length]
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'dev', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Shorter than default, also including response time.
|
||||
* :remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'short', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* The minimal output.
|
||||
* :method :url :status :res[content-length] - :response-time ms
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
function morgan(format: 'tiny', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
function morgan(custom: (req: express.Request, res: express.Response) => string): express.RequestHandler
|
||||
|
||||
export = morgan;
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
///<reference path="../node/node.d.ts"/>
|
||||
///<reference path="node-webkit.d.ts"/>
|
||||
// Load native UI library
|
||||
var gui: typeof nw.gui;
|
||||
|
||||
|
||||
/* WINDOW */
|
||||
|
||||
// Get the current window
|
||||
var win = gui.Window.get();
|
||||
|
||||
// Listen to the minimize event
|
||||
win.on('minimize', function() {
|
||||
console.log('Window is minimized');
|
||||
});
|
||||
|
||||
// Minimize the window
|
||||
win.minimize();
|
||||
|
||||
// Unlisten the minimize event
|
||||
win.removeAllListeners('minimize');
|
||||
|
||||
// Create a new window and get it
|
||||
var new_win = gui.Window.get(
|
||||
window.open('https://github.com')
|
||||
);
|
||||
|
||||
// And listen to new window's focus event
|
||||
new_win.on('focus', function() {
|
||||
console.log('New window is focused');
|
||||
});
|
||||
|
||||
|
||||
// Get the current window
|
||||
var win = gui.Window.get();
|
||||
|
||||
// Create a new window and get it
|
||||
var new_win = gui.Window.get(
|
||||
window.open('https://github.com')
|
||||
);
|
||||
|
||||
// png as base64string
|
||||
win.capturePage(function(base64string:string){
|
||||
// do something with the base64string
|
||||
}, { format : 'png', datatype : 'raw'} );
|
||||
|
||||
// png as node buffer
|
||||
win.capturePage(function(buffer:Buffer){
|
||||
// do something with the buffer
|
||||
}, { format : 'png', datatype : 'buffer'} );
|
||||
|
||||
|
||||
// Open a new window.
|
||||
var win = gui.Window.get(
|
||||
window.open('popup.html')
|
||||
);
|
||||
|
||||
// Release the 'win' object here after the new window is closed.
|
||||
win.on('closed', function() {
|
||||
win = null;
|
||||
});
|
||||
|
||||
// Listen to main window's close event
|
||||
gui.Window.get().on('close', function() {
|
||||
// Hide the window to give user the feeling of closing immediately
|
||||
this.hide();
|
||||
|
||||
// If the new window is still open then close it.
|
||||
if (win != null)
|
||||
win.close(true);
|
||||
|
||||
// After closing the new window, close the main window.
|
||||
this.close(true);
|
||||
});
|
||||
|
||||
|
||||
/* MENU */
|
||||
|
||||
// Create an empty menu
|
||||
var menu = new gui.Menu();
|
||||
|
||||
// Add some items
|
||||
menu.append(new gui.MenuItem({ label: 'Item A' }));
|
||||
menu.append(new gui.MenuItem({ label: 'Item B' }));
|
||||
menu.append(new gui.MenuItem({ type: 'separator' }));
|
||||
menu.append(new gui.MenuItem({ label: 'Item C' }));
|
||||
|
||||
// Remove one item
|
||||
menu.removeAt(1);
|
||||
|
||||
// Popup as context menu
|
||||
menu.popup(10, 10);
|
||||
|
||||
// Iterate menu's items
|
||||
for (var i = 0; i < menu.items.length; ++i) {
|
||||
console.log(menu.items[i]);
|
||||
}
|
||||
|
||||
|
||||
var win = gui.Window.get();
|
||||
var nativeMenuBar = new gui.Menu({ type: "menubar" });
|
||||
nativeMenuBar.createMacBuiltin("My App");
|
||||
win.menu = nativeMenuBar;
|
||||
|
||||
nativeMenuBar.createMacBuiltin("My App", {
|
||||
hideEdit: true,
|
||||
hideWindow: true
|
||||
});
|
||||
|
||||
/* MENU ITEM */
|
||||
|
||||
var itemc:nw.gui.MenuItem;
|
||||
|
||||
// Create a separator
|
||||
itemc = new gui.MenuItem({ type: 'separator' });
|
||||
|
||||
// Create a normal item with label and icon
|
||||
itemc = new gui.MenuItem({
|
||||
type: "normal",
|
||||
label: "I'm a menu item",
|
||||
icon: "img/icon.png"
|
||||
});
|
||||
|
||||
// Or you can omit the 'type' field for normal items
|
||||
itemc = new gui.MenuItem({ label: 'Simple item' });
|
||||
|
||||
// Bind a callback to item
|
||||
itemc = new gui.MenuItem({
|
||||
label: "Click me",
|
||||
click: function() {
|
||||
console.log("I'm clicked");
|
||||
},
|
||||
key: "s",
|
||||
modifiers: "ctrl-alt",
|
||||
});
|
||||
|
||||
// You can have submenu!
|
||||
var submenu = new gui.Menu();
|
||||
submenu.append(new gui.MenuItem({ label: 'Item 1' }));
|
||||
submenu.append(new gui.MenuItem({ label: 'Item 2' }));
|
||||
submenu.append(new gui.MenuItem({ label: 'Item 3' }));
|
||||
itemc.submenu = submenu;
|
||||
|
||||
// And everything can be changed at runtime
|
||||
itemc.label = 'New label';
|
||||
itemc.click = function() { console.log('New click callback'); };
|
||||
|
||||
|
||||
/* APP */
|
||||
|
||||
// Print arguments
|
||||
console.log(gui.App.argv);
|
||||
|
||||
// Quit current app
|
||||
gui.App.quit();
|
||||
|
||||
// Get the name field in manifest
|
||||
gui.App.manifest.name
|
||||
|
||||
gui.App.addOriginAccessWhitelistEntry('http://github.com/', 'app', 'myapp', true);
|
||||
|
||||
|
||||
/* CLIPBOARD */
|
||||
|
||||
// We can not create a clipboard, we have to receive the system clipboard
|
||||
var clipboard = gui.Clipboard.get();
|
||||
|
||||
// Read from clipboard
|
||||
var text = clipboard.get('text');
|
||||
console.log(text);
|
||||
|
||||
// Or write something
|
||||
clipboard.set('I love node-webkit :)', 'text');
|
||||
|
||||
// And clear it!
|
||||
clipboard.clear();
|
||||
|
||||
|
||||
/* TRAY */
|
||||
|
||||
// Create a tray icon
|
||||
var tray = new gui.Tray({ title: 'Tray', icon: 'img/icon.png' });
|
||||
|
||||
// Give it a menu
|
||||
var menu = new gui.Menu();
|
||||
menu.append(new gui.MenuItem({ type: 'checkbox', label: 'box1' }));
|
||||
tray.menu = menu;
|
||||
|
||||
// Remove the tray
|
||||
tray.remove();
|
||||
tray = null;
|
||||
|
||||
|
||||
/* SHELL */
|
||||
|
||||
// Open URL with default browser.
|
||||
gui.Shell.openExternal('https://github.com/rogerwang/node-webkit');
|
||||
|
||||
// Open a text file with default text editor.
|
||||
gui.Shell.openItem('test.txt');
|
||||
|
||||
// Open a file in file explorer.
|
||||
gui.Shell.showItemInFolder('test.txt');
|
||||
Vendored
+221
@@ -0,0 +1,221 @@
|
||||
// Type definitions for node-webkit
|
||||
// Project: https://github.com/rogerwang/node-webkit
|
||||
// Definitions by: Pedro Casaubon <https://github.com/xperiments>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module nw.gui {
|
||||
|
||||
interface IEventEmitter {
|
||||
addListener(event: string, listener: Function): EventEmitter;
|
||||
on(event: string, listener: Function): EventEmitter;
|
||||
once(event: string, listener: Function): EventEmitter;
|
||||
removeListener(event: string, listener: Function): EventEmitter;
|
||||
removeAllListeners(event?: string): EventEmitter;
|
||||
setMaxListeners(n: number): void;
|
||||
listeners(event: string): Function[];
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
}
|
||||
|
||||
class EventEmitter implements IEventEmitter {
|
||||
addListener(event: string, listener: Function): EventEmitter;
|
||||
on(event: string, listener: Function): EventEmitter;
|
||||
once(event: string, listener: Function): EventEmitter;
|
||||
removeListener(event: string, listener: Function): EventEmitter;
|
||||
removeAllListeners(event?: string): EventEmitter;
|
||||
setMaxListeners(n: number): void;
|
||||
listeners(event: string): Function[];
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
}
|
||||
|
||||
export interface MenuConfig {
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface HideMenusOptions {
|
||||
hideEdit: boolean;
|
||||
hideWindow: boolean;
|
||||
}
|
||||
|
||||
export interface MenuItemConfig {
|
||||
label?: string;
|
||||
click?: Function;
|
||||
type?: string;
|
||||
submenu?: Menu;
|
||||
icon?: string;
|
||||
tooltip?: string;
|
||||
checked?: boolean;
|
||||
enabled?: boolean;
|
||||
key?: string;
|
||||
modifiers?: string;
|
||||
}
|
||||
|
||||
export class MenuItem extends EventEmitter implements MenuItemConfig {
|
||||
constructor(config: MenuItemConfig);
|
||||
label: string;
|
||||
click: Function;
|
||||
type: string;
|
||||
submenu: Menu;
|
||||
icon: string;
|
||||
tooltip: string;
|
||||
checked: boolean;
|
||||
enabled: boolean;
|
||||
key: string;
|
||||
modifiers: string;
|
||||
}
|
||||
|
||||
export class Menu {
|
||||
constructor(config?: MenuConfig);
|
||||
items: MenuItem[];
|
||||
append(item: MenuItem): void;
|
||||
remove(item: MenuItem): void;
|
||||
insert(item: MenuItem, atPosition: number): void;
|
||||
removeAt(index: number): void;
|
||||
popup(x: number, y: number): void;
|
||||
// since v0.10.0-rc1
|
||||
createMacBuiltin(appname: string, options?: HideMenusOptions): void;
|
||||
|
||||
}
|
||||
|
||||
export interface ShortcutOption {
|
||||
key: string;
|
||||
active: Function;
|
||||
failed: Function;
|
||||
}
|
||||
|
||||
export class Shortcut extends EventEmitter {
|
||||
constructor(option: ShortcutOption);
|
||||
key: string;
|
||||
active: Function;
|
||||
failed: Function;
|
||||
}
|
||||
|
||||
export interface WindowManifestOptions {
|
||||
|
||||
title?: string;
|
||||
icon?: string;
|
||||
toolbar?: boolean;
|
||||
frame?: boolean;
|
||||
width?: number;
|
||||
height?: number;
|
||||
position?: string;
|
||||
min_width?: number;
|
||||
min_height?: number;
|
||||
max_width?: number;
|
||||
max_height?: number;
|
||||
}
|
||||
|
||||
export class Window extends EventEmitter {
|
||||
static get(windowObject?: any): Window;
|
||||
static open(url: string, options?: WindowManifestOptions): Window;
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
title: string;
|
||||
menu: Menu;
|
||||
isFullScreen: boolean;
|
||||
isKioskMode: boolean;
|
||||
zoomLevel: number;
|
||||
moveTo(x: number, y: number): void;
|
||||
moveBy(x: number, y: number): void;
|
||||
resizeTo(width: number, height: number): void;
|
||||
resizeBy(width: number, height: number): void;
|
||||
focus(): void;
|
||||
blur(): void;
|
||||
show(): void;
|
||||
hide(): void;
|
||||
close(force?: boolean): void;
|
||||
reload(): void;
|
||||
reloadIgnoringCache(): void;
|
||||
maximize(): void;
|
||||
unmaximize(): void;
|
||||
minimize(): void;
|
||||
restore(): void;
|
||||
enterFullscreen(): void;
|
||||
leaveFullscreen(): void;
|
||||
toggleFullscreen(): void;
|
||||
enterKioskMode(): void;
|
||||
leaveKioskMode(): void;
|
||||
toggleKioskMode(): void;
|
||||
showDevTools(id?: string, headless?: boolean): void;
|
||||
showDevTools(id: HTMLIFrameElement, headless?: boolean): void;
|
||||
closeDevTools(): void;
|
||||
isDevToolsOpen(): boolean;
|
||||
setMaximumSize(width: number, height: number): void;
|
||||
setMinimumSize(width: number, height: number): void;
|
||||
setResizable(resizable: boolean): void;
|
||||
setAlwaysOnTop(top: boolean): void;
|
||||
setPosition(position: string): void;
|
||||
setShowInTaskbar(show: boolean): void;
|
||||
requestAttention(attention: boolean): void;
|
||||
requestAttention(attention: number): void;
|
||||
capturePage(callback: Function, imageformat?: string): void;
|
||||
capturePage(callback: Function, config_object: { format: string; datatype: string }): void;
|
||||
setProgressBar(progress: number): void;
|
||||
setBadgeLabel(label: string): void;
|
||||
eval(frame: HTMLIFrameElement, script: string): void;
|
||||
}
|
||||
|
||||
export interface App {
|
||||
argv: any;
|
||||
fullArgv: any;
|
||||
dataPath: string;
|
||||
manifest: any;
|
||||
clearCache(): void;
|
||||
closeAllWindows(): void;
|
||||
crashBrowser(): void;
|
||||
crashRenderer(): void;
|
||||
getProxyForURL(url: string): void;
|
||||
quit(): void;
|
||||
setCrashDumpDir(dir: string): void;
|
||||
addOriginAccessWhitelistEntry(
|
||||
sourceOrigin: string
|
||||
, destinationProtocol: string
|
||||
, destinationHost: string
|
||||
, allowDestinationSubdomains: boolean
|
||||
): void;
|
||||
removeOriginAccessWhitelistEntry(
|
||||
sourceOrigin: string
|
||||
, destinationProtocol: string
|
||||
, destinationHost: string
|
||||
, allowDestinationSubdomains: boolean
|
||||
): void;
|
||||
registerGlobalHotKey(shortcut: Shortcut): void;
|
||||
unregisterGlobalHotKey(shortcut: Shortcut): void;
|
||||
}
|
||||
|
||||
export class Clipboard {
|
||||
static get(): Clipboard;
|
||||
get(type?: string): string;
|
||||
set(data: string, type?: string): void;
|
||||
clear(): void;
|
||||
}
|
||||
|
||||
export interface TrayOption {
|
||||
title?: string;
|
||||
tooltip?: string;
|
||||
icon?: string;
|
||||
alticon?: string;
|
||||
menu?: Menu;
|
||||
}
|
||||
|
||||
export class Tray implements TrayOption {
|
||||
constructor(option: TrayOption);
|
||||
title: string;
|
||||
tooltip: string;
|
||||
icon: string;
|
||||
alticon: string;
|
||||
menu: Menu;
|
||||
remove(): void;
|
||||
}
|
||||
|
||||
interface Shell {
|
||||
openExternal(uri: string): void;
|
||||
openItem(file_path: string): void;
|
||||
showItemInFolder(file_path: string): void;
|
||||
}
|
||||
|
||||
export var App: App;
|
||||
export var Shell: Shell;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import Q = require('q');
|
||||
import promisePool = require('promise-pool');
|
||||
|
||||
var pool = new promisePool.Pool<number>((taskDataId, index) => {
|
||||
return Q.delay(Math.floor(Math.random() * 5000)).then(function () {
|
||||
taskDataId == 0;
|
||||
index == 0;
|
||||
});
|
||||
}, 20);
|
||||
|
||||
pool
|
||||
.pause()
|
||||
.delay(5000)
|
||||
.then(function () {
|
||||
pool.resume();
|
||||
});
|
||||
|
||||
pool.retries == 0;
|
||||
pool.retryInterval == 0;
|
||||
pool.maxRetryInterval == 0;
|
||||
pool.retryIntervalMultiplier == 0;
|
||||
|
||||
pool.add(0);
|
||||
|
||||
pool
|
||||
.start(onProgress)
|
||||
.then(result => {
|
||||
result.total == 0;
|
||||
return pool.reset();
|
||||
})
|
||||
.then(() => {
|
||||
return pool.start(onProgress);
|
||||
})
|
||||
.then(result => {
|
||||
result.total == 0;
|
||||
return pool.reset();
|
||||
})
|
||||
.then(() => {
|
||||
pool.endless == true;
|
||||
});
|
||||
|
||||
function onProgress(progress: promisePool.IProgress) {
|
||||
progress.success == true;
|
||||
progress.fulfilled == 0;
|
||||
progress.total == 0;
|
||||
progress.index == 0;
|
||||
}
|
||||
Vendored
+124
@@ -0,0 +1,124 @@
|
||||
// Type definitions for promise-pool
|
||||
// Project: https://github.com/vilic/promise-pool
|
||||
// Definitions by: VILIC VANE <https://github.com/vilic>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../q-retry/q-retry.d.ts" />
|
||||
|
||||
declare module "promise-pool" {
|
||||
/**
|
||||
* interface for the final result.
|
||||
*/
|
||||
export interface IResult {
|
||||
fulfilled: number;
|
||||
rejected: number;
|
||||
total: number;
|
||||
}
|
||||
/**
|
||||
* interface for progress data.
|
||||
*/
|
||||
export interface IProgress {
|
||||
index: number;
|
||||
success: boolean;
|
||||
error: any;
|
||||
retries: number;
|
||||
fulfilled: number;
|
||||
rejected: number;
|
||||
pending: number;
|
||||
total: number;
|
||||
}
|
||||
/**
|
||||
* tasks pool that manages concurrency.
|
||||
*/
|
||||
export class Pool<T> {
|
||||
/**
|
||||
* (get/set) the max concurrency of this task pool.
|
||||
*/
|
||||
public concurrency: number;
|
||||
private _tasksData;
|
||||
/**
|
||||
* (get/set) the processor function that handles tasks data.
|
||||
*/
|
||||
public processor: (data: T, index: number) => Q.IPromise<void>;
|
||||
private _deferred;
|
||||
private _pauseDeferred;
|
||||
/**
|
||||
* (get) the number of successful tasks.
|
||||
*/
|
||||
public fulfilled: number;
|
||||
/**
|
||||
* (get) the number of failed tasks.
|
||||
*/
|
||||
public rejected: number;
|
||||
/**
|
||||
* (get) the number of pending tasks.
|
||||
*/
|
||||
public pending: number;
|
||||
/**
|
||||
* (get) the number of completed tasks and pending tasks in total.
|
||||
*/
|
||||
public total: number;
|
||||
/**
|
||||
* (get/set) indicates whether this task pool is endless, if so, tasks can still be added even after all previous tasks have been fulfilled.
|
||||
*/
|
||||
public endless: boolean;
|
||||
/**
|
||||
* (get/set) defaults to 0, the number or retries that this task pool will take for every single task, could be Infinity.
|
||||
*/
|
||||
public retries: number;
|
||||
/**
|
||||
* (get/set) defaults to 0, interval (milliseconds) between each retries.
|
||||
*/
|
||||
public retryInterval: number;
|
||||
/**
|
||||
* (get/set) defaults to Infinity, max retry interval when retry interval multiplier applied.
|
||||
*/
|
||||
public maxRetryInterval: number;
|
||||
/**
|
||||
* (get/set) defaults to 1, the multiplier applies to interval after every retry.
|
||||
*/
|
||||
public retryIntervalMultiplier: number;
|
||||
private _index;
|
||||
private _currentConcurrency;
|
||||
public onProgress: (progress: IProgress) => void;
|
||||
/**
|
||||
* initialize a task pool.
|
||||
* @param processor a function takes the data and index as parameters and returns a promise.
|
||||
* @param concurrency the concurrency of this task pool.
|
||||
* @param endless defaults to false. indicates whether this task pool is endless, if so, tasks can still be added even after all previous tasks have been fulfilled.
|
||||
* @param tasksData an initializing array of task data.
|
||||
*/
|
||||
constructor(processor: (data: T, index: number) => Q.IPromise<void>, concurrency: number, endless?: boolean, tasksData?: T[]);
|
||||
/**
|
||||
* add a data item.
|
||||
* @param taskData task data to add.
|
||||
*/
|
||||
public add(taskData: T): void;
|
||||
/**
|
||||
* add data items.
|
||||
* @param tasskData tasks data to add.
|
||||
*/
|
||||
public add(tasksData: T[]): void;
|
||||
/**
|
||||
* start tasks, return a promise that will be fulfilled after all tasks accomplish if endless is false.
|
||||
* @param onProgress a callback that will be triggered every time when a single task is fulfilled.
|
||||
*/
|
||||
public start(onProgress?: (progress: IProgress) => void): Q.Promise<IResult>;
|
||||
private _start();
|
||||
private _process(data, index);
|
||||
private _notifyProgress(index, success, err, retries);
|
||||
private _next();
|
||||
/**
|
||||
* pause tasks and return a promise that will be fulfilled after the running tasks accomplish. this will wait for running tasks to complete instead of aborting them.
|
||||
*/
|
||||
public pause(): Q.Promise<void>;
|
||||
/**
|
||||
* resume tasks.
|
||||
*/
|
||||
public resume(): void;
|
||||
/**
|
||||
* pause tasks, then clear pending tasks data and reset counters. return a promise that will be fulfilled after resetting accomplish.
|
||||
*/
|
||||
public reset(): Q.Promise<void>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import Q = require('q-retry');
|
||||
|
||||
Q
|
||||
.retry(() => {
|
||||
return '';
|
||||
})
|
||||
.then(str => {
|
||||
str.charAt;
|
||||
return 0;
|
||||
})
|
||||
.retry(num => {
|
||||
num.toFixed;
|
||||
})
|
||||
.retry(() => {
|
||||
|
||||
}, 5)
|
||||
.retry(() => {
|
||||
|
||||
}, (reason, retries) => {
|
||||
retries.toFixed;
|
||||
})
|
||||
.retry(() => {
|
||||
|
||||
}, (reason, retries) => {
|
||||
retries.toFixed;
|
||||
}, 10)
|
||||
.retry(() => {
|
||||
return '';
|
||||
}, (reason, retries) => {
|
||||
|
||||
}, {
|
||||
limit: 10,
|
||||
interval: 1000,
|
||||
maxInterval: 20000,
|
||||
intervalMultiplier: 1.5
|
||||
})
|
||||
.then(str => {
|
||||
str.charAt;
|
||||
});
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for q-retry
|
||||
// Project: https://github.com/vilic/q-retry
|
||||
// Definitions by: VILIC VANE <https://github.com/vilic>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../q/Q.d.ts" />
|
||||
|
||||
declare module Q {
|
||||
export interface IRetryOptions {
|
||||
limit?: number;
|
||||
interval?: number;
|
||||
maxInterval?: number;
|
||||
intervalMultiplier?: number;
|
||||
}
|
||||
|
||||
export function retry<U>(process: () => IPromise<U>, onFail: (reason: any, retries: number) => void, limit: number): Promise<U>;
|
||||
export function retry<U>(process: () => IPromise<U>, onFail: (reason: any, retries: number) => void, options?: IRetryOptions): Promise<U>;
|
||||
export function retry<U>(process: () => IPromise<U>, limit: number): Promise<U>;
|
||||
export function retry<U>(process: () => IPromise<U>, options?: IRetryOptions): Promise<U>;
|
||||
export function retry<U>(process: () => U, onFail: (reason: any, retries: number) => void, limit: number): Promise<U>;
|
||||
export function retry<U>(process: () => U, onFail: (reason: any, retries: number) => void, options?: IRetryOptions): Promise<U>;
|
||||
export function retry<U>(process: () => U, limit: number): Promise<U>;
|
||||
export function retry<U>(process: () => U, options?: IRetryOptions): Promise<U>;
|
||||
|
||||
interface Promise<T> {
|
||||
retry<U>(process: (value: T) => IPromise<U>, onFail: (reason: any, retries: number) => void, limit: number): Promise<U>;
|
||||
retry<U>(process: (value: T) => IPromise<U>, onFail: (reason: any, retries: number) => void, options?: IRetryOptions): Promise<U>;
|
||||
retry<U>(process: (value: T) => IPromise<U>, limit: number): Promise<U>;
|
||||
retry<U>(process: (value: T) => IPromise<U>, options?: IRetryOptions): Promise<U>;
|
||||
retry<U>(process: (value: T) => U, onFail: (reason: any, retries: number) => void, limit: number): Promise<U>;
|
||||
retry<U>(process: (value: T) => U, onFail: (reason: any, retries: number) => void, options?: IRetryOptions): Promise<U>;
|
||||
retry<U>(process: (value: T) => U, limit: number): Promise<U>;
|
||||
retry<U>(process: (value: T) => U, options?: IRetryOptions): Promise<U>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "q-retry" {
|
||||
export = Q;
|
||||
}
|
||||
@@ -294,7 +294,10 @@ declare module Q {
|
||||
* Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed.
|
||||
*/
|
||||
export function delay<T>(value: T, ms: number): Promise<T>;
|
||||
|
||||
/**
|
||||
* Returns a promise that will be fulfilled with undefined after at least ms milliseconds have passed.
|
||||
*/
|
||||
export function delay(ms: number): Promise <void>;
|
||||
/**
|
||||
* Returns whether a given promise is in the fulfilled state. When the static version is used on non-promises, the result is always true.
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -4573,7 +4573,7 @@ declare module SP {
|
||||
get_id(): number;
|
||||
get_information(): SP.TimeZoneInformation;
|
||||
localTimeToUTC(date: Date): SP.DateTimeResult;
|
||||
uTCToLocalTime(date: Date): SP.DateTimeResult;
|
||||
utcToLocalTime(date: Date): SP.DateTimeResult;
|
||||
}
|
||||
export class TimeZoneCollection extends SP.ClientObjectCollection<TimeZone> {
|
||||
itemAt(index: number): SP.TimeZone;
|
||||
|
||||
Reference in New Issue
Block a user