mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
+18
-6
@@ -1,4 +1,4 @@
|
||||
# Contributors
|
||||
# Contributors
|
||||
|
||||
This is a non-exhaustive list of definitions and their creators. If you created a definition but are not listed then feel free to send a pull request on this file with your name and url.
|
||||
|
||||
@@ -17,6 +17,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [angular-spinner](https://github.com/urish/angular-spinner) (by [Marcin Biegała](https://github.com/Biegal))
|
||||
* [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-http-auth](https://github.com/witoldsz/angular-http-auth) (by [vvakame](https://github.com/vvakame))
|
||||
* [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))
|
||||
@@ -47,7 +48,8 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [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))
|
||||
* [bunyan](https://github.com/trentm/node-bunyan) (by [Alex Mikhalev](https://github.com/amikhalev))
|
||||
* [CasperJS](http://casperjs.org) (by [Jed Mao](https://github.com/jedmao))
|
||||
* [CanvasJS](http://canvasjs.com) (by [Mark Overholt](https://github.com/mover5))
|
||||
* [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))
|
||||
@@ -57,7 +59,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [CKEditor](https://github.com/ckeditor/ckeditor-dev) (by [Ondrej Sevcik](https://github.com/ondrejsevcik))
|
||||
* [Clone](https://github.com/pvorb/node-clone) (by [Kieran Simpson](https://github.com/kierans))
|
||||
* [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon))
|
||||
* [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem))
|
||||
* [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem) and [vvakame](https://github.com/vvakame))
|
||||
* [configstore](http://github.com/yeoman/configstore) (by [Bart van der Schoor](https://github.com/Bartvds))
|
||||
* [Cordova](http://cordova.apache.org) (by [Microsoft Open Technologies, Inc.](http://msopentech.com/))
|
||||
* [Cordovarduino](https://github.com/stereolux/cordovarduino) (by [Hendrik Maus](https://github.com/hendrikmaus))
|
||||
@@ -76,7 +78,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [EasyStar](http://easystarjs.com/) (by [Magnus Gustafsson](https://github.com/Borundin))
|
||||
* [Elm](http://elm-lang.org) (by [Dénes Harmath](https://github.com/thSoft))
|
||||
* [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Ember.js](http://emberjs.com/) (by [Jed Mao](https://github.com/jedmao) and [Boris Yankov](https://github.com/borisyankov))
|
||||
* [emissary](https://github.com/atom/emissary) (by [vvakame](https://github.com/vvakame))
|
||||
* [Emscripten](http://kripken.github.io/emscripten-site/) (by [Kensuke MATSUZAKI](https://github.com/zakki))
|
||||
* [EpicEditor](http://epiceditor.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -86,6 +88,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [expectations](https://github.com/spmason/expectations) (by [vvakame](https://github.com/vvakame))
|
||||
* [Express](http://expressjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [express-session](https://www.npmjs.org/package/express-session) (by [Hiroki Horiuchi](https://github.com/horiuchi/))
|
||||
* [express-myconnection](https://www.npmjs.org/package/express-myconnection) (by [Michael Ferris](https://github.com/cellule/)
|
||||
* [Ext JS](http://www.sencha.com/products/extjs/) (by [Brian Kotek](https://github.com/brian428))
|
||||
* [Fabric.js](http://fabricjs.com/) (by [Oliver Klemencic](https://github.com/oklemencic/))
|
||||
* [Fancybox](http://fancybox.net/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -143,7 +146,10 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [i18n-node](https://github.com/mashpie/i18n-node) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz))
|
||||
* [Impress.js](https://github.com/bartaz/impress.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Intercom.js](https://github.com/diy/intercom.js) (by [Spencer Williams](https://github.com/spencerwi))
|
||||
* [Imagemagick](http://github.com/rsms/node-imagemagick) (by [Carlos Ballesteros Velasco](https://github.com/soywiz))
|
||||
* [inflection](https://github.com/dreamerslab/node.inflection) (by [Shogo Iwano](https://github.com/shiwano))
|
||||
* [insight](https://github.com/yeoman/insight) (by [vvakame](https://github.com/vvakame))
|
||||
* [interact.js](http://github.com/taye/interact.js) (by [Douglas Eichelberger](https://github.com/dduugg))
|
||||
* [Ion.RangeSlider](https://github.com/IonDen/ion.rangeSlider) (by [Douglas Eichelberger](https://github.com/dduugg))
|
||||
* [Ionic-Cordova](https://github.com/driftyco/) (by [Hendrik Maus](https://github.com/hendrikmaus))
|
||||
@@ -154,6 +160,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [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))
|
||||
* [Jest](http://facebook.github.io/jest/) (by [Joshua Smith](https://github.com/Josh211ua))
|
||||
* [JointJS](http://www.jointjs.com/) (by [Aidan Reel](http://github.com/areel))
|
||||
* [jQRangeSlider](http://ghusse.github.com/jQRangeSlider) (by [Dániel Tar](https://github.com/qcz))
|
||||
* [jQuery](http://jquery.com/) (from TypeScript samples)
|
||||
@@ -273,10 +280,12 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [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))
|
||||
* [msnodesql](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov) and [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [Mustache.js](https://github.com/janl/mustache.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [mysql](https://github.com/felixge/node-mysql) (by [William Johnston](https://github.com/wjohnsto))
|
||||
* [nconf](https://github.com/flatiron/nconf) (by [Jeff Goddard](https://github.com/jedigo))
|
||||
* [needle](https://github.com/tomas/needle) (by [San Chen](https://github.com/bigsan))
|
||||
* [nexpect](https://github.com/nodejitsu/nexpect) (by [vvakame](https://github.com/vvakame))
|
||||
* [noble](https://github.com/sandeepmistry/noble) (by [Seon-Wook Park](https://github.com/swook))
|
||||
* [nock](https://github.com/pgte/nock) (by [bonnici](https://github.com/bonnici))
|
||||
* [Node.js](http://nodejs.org/) (from TypeScript samples)
|
||||
@@ -285,9 +294,9 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [node-ffi](https://github.com/rbranson/node-ffi) (by [Paul Loyd](https://github.com/loyd))
|
||||
* [node-form](https://github.com/rsamec/form) (by [Roman Samec](https://github.com/rsamec))
|
||||
* [node-git](https://github.com/christkv/node-git) (by [vvakame](https://github.com/vvakame))
|
||||
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov) and [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [nodeunit](https://github.com/caolan/nodeunit) (by [Jeff Goddard](https://github.com/jedigo))
|
||||
* [node_zeromq](https://github.com/JustinTulloss/zeromq.node) (by [Dave McKeown](https://github.com/davemckeown))
|
||||
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [node-tar](https://github.com/npm/node-tar) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [node-uuid](https://github.com/broofa/node-uuid) (by [Jeff May](https://github.com/jeffmay))
|
||||
* [notify.js](https://github.com/alexgibson/notify.js) (by [soundTricker](https://github.com/soundTricker))
|
||||
@@ -310,6 +319,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [PeerJS](http://peerjs.com/) (by [Toshiya Nakakura](https://github.com/nakakura))
|
||||
* [PEG.js](http://pegjs.majda.cz/) (by [vvakame](https://github.com/vvakame))
|
||||
* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto))
|
||||
* [PgwModal](http://pgwjs.com/pgwmodal/) (by [Pine Mizune](https://github.com/pine613))
|
||||
* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
|
||||
* [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Physijs](http://chandlerprall.github.io/Physijs/) (by [gyoh_k](https://github.com/gyohk))
|
||||
@@ -368,6 +378,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Store.js](https://github.com/marcuswestin/store.js/) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [stylus](https://github.com/LearnBoost/stylus) (by [Maxime LUCE](https://github.com/SomaticIT))
|
||||
* [Sugar](http://sugarjs.com/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [swfobject](https://code.google.com/p/swfobject/) (by [rou](https://github.com/rou))
|
||||
* [Swiper](http://www.idangero.us/sliders/swiper) (by [Sebastián Galiano](https://github.com/sgaliano))
|
||||
* [SwipeView](http://cubiq.org/swipeview) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Swiz](https://github.com/racker/node-swiz) (by [Jeff Goddard](https://github.com/jedigo))
|
||||
@@ -377,6 +388,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [text-buffer](https://github.com/atom/text-buffer) (by [vvakame](https://github.com/vvakame))
|
||||
* [text-encoding](https://github.com/inexorabletash/text-encoding) (by [MIZUNE Pine](https://github.com/pine613))
|
||||
* [three.js](http://mrdoob.github.com/three.js/) (by [Kon](http://phyzkit.net/))
|
||||
* [through2](https://github.com/rvagg/through2) (by [Bart van der Schoor](https://github.com/Bartvds) and [jedmao](https://github.com/jedmao))
|
||||
* [TimelineJS](https://github.com/NUKnightLab/TimelineJS) (by [Roland Zwaga](https://github.com/rolandzwaga))
|
||||
* [timezonecomplete](https://github.com/SpiritIT/timezonecomplete) (by [Rogier Schouten](https://github.com/rogierschouten))
|
||||
* [Toastr](https://github.com/CodeSeven/toastr) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -399,7 +411,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [Viewporter](https://github.com/zynga/viewporter) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Vimeo](http://developer.vimeo.com/player/js-api) (by [Daz Wilkin](https://github.com/DazWilkin/))
|
||||
* [vinyl](https://github.com/wearefractal/vinyl) (by [vvakame](https://github.com/vvakame/))
|
||||
* [vinyl-fs](https://github.com/wearefractal/vinyl-fs) (by [vvakame](https://github.com/vvakame/))
|
||||
* [vinyl-fs](https://github.com/wearefractal/vinyl-fs) (by [vvakame](https://github.com/vvakame/) and [jedmao](https://github.com/jedmao))
|
||||
* [WebRTC](http://dev.w3.org/2011/webrtc/editor/webrtc.html) (by [Ken Smith](https://github.com/smithkl42))
|
||||
* [websocket](https://github.com/Worlize/WebSocket-Node) (by [Paul Loyd](https://github.com/loyd))
|
||||
* [WinJS](http://msdn.microsoft.com/en-us/library/windows/apps/br229773.aspx) (from TypeScript samples)
|
||||
|
||||
@@ -1 +1,23 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
function readJSON(target) {
|
||||
return JSON.parse(fs.readFileSync(target, 'utf8'));
|
||||
}
|
||||
|
||||
function getSemFloat(str) {
|
||||
var m = /^[^\d]*(\d+)\.(\d+)/.exec(str);
|
||||
return parseFloat(m[1] + '.' + m[2]);
|
||||
}
|
||||
|
||||
var repo = readJSON(path.resolve(__dirname, '..', 'package.json'));
|
||||
|
||||
var testerPath = path.resolve(__dirname, '..', 'node_modules', 'definition-tester', 'package.json');
|
||||
|
||||
// ultra lame semver major/minor check
|
||||
if (!fs.existsSync(testerPath) || getSemFloat(repo.dependencies['definition-tester']) > getSemFloat(readJSON(testerPath).version)) {
|
||||
console.log('DefinitelyTyped tester needs an update!\n\n please run \'npm install\'\n');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
require('definition-tester');
|
||||
|
||||
+14169
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('./tsc.js')
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,14 @@
|
||||
/// <reference path="./angular-http-auth.d.ts" />
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
angular.module('login', ['http-auth-interceptor'])
|
||||
|
||||
.controller('LoginController', ($scope:any, $http:any, authService:ng.httpAuth.IAuthService) => {
|
||||
$scope.submit = () => {
|
||||
$http.post('auth/login').success(() => {
|
||||
authService.loginConfirmed();
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for angular-http-auth 1.2.1
|
||||
// Project: https://github.com/witoldsz/angular-http-auth
|
||||
// Definitions by: vvakame <https://github.com/vvakame>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ng.httpAuth {
|
||||
interface IAuthService {
|
||||
loginConfirmed(data?:any, configUpdater?:Function):void;
|
||||
loginCancelled(data?:any, reason?:any):void;
|
||||
}
|
||||
|
||||
interface IHttpBuffer {
|
||||
append(config:ng.IRequestConfig, deferred:{resolve(data:any):void; reject(data:any):void;}):void;
|
||||
rejectAll(reason?:any):void;
|
||||
retryAll(updater?:Function):void;
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular Translate v2.3.0 (pascalprecht.translate module)
|
||||
// Type definitions for Angular Translate v2.4.0 (pascalprecht.translate module)
|
||||
// Project: https://github.com/PascalPrecht/angular-translate
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -50,6 +50,8 @@ declare module ng.translate {
|
||||
use(): string;
|
||||
use(key: string): ng.IPromise<string>;
|
||||
useFallbackLanguage(langKey?: string): void;
|
||||
versionInfo(): string;
|
||||
loaderCache(): any;
|
||||
}
|
||||
|
||||
interface ITranslateProvider extends ng.IServiceProvider {
|
||||
@@ -89,5 +91,6 @@ declare module ng.translate {
|
||||
determinePreferredLanguage(fn?: () => void): ITranslateProvider;
|
||||
registerAvailableLanguageKeys(): string[];
|
||||
registerAvailableLanguageKeys(languageKeys: string[], aliases?: ILanguageKeyAlias): ITranslateProvider;
|
||||
useLoaderCache(cache?: any): ITranslateProvider;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+97
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS 1.2+ (ngAnimate module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular.d.ts" />
|
||||
@@ -13,9 +13,104 @@ declare module ng.animate {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AnimateService
|
||||
// see http://docs.angularjs.org/api/ngAnimate.$animate
|
||||
// see http://docs.angularjs.org/api/ngAnimate/service/$animate
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateService extends ng.IAnimateService {
|
||||
/**
|
||||
* Globally enables / disables animations.
|
||||
*
|
||||
* @param value If provided then set the animation on or off.
|
||||
* @param element If provided then the element will be used to represent the enable/disable operation.
|
||||
* @returns current animation state
|
||||
*/
|
||||
enabled(value?: boolean, element?: JQuery): boolean;
|
||||
|
||||
/**
|
||||
* Appends the element to the parentElement element that resides in the document and then runs the enter animation.
|
||||
*
|
||||
* @param element the element that will be the focus of the enter animation
|
||||
* @param parentElement the parent element of the element that will be the focus of the enter animation
|
||||
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Runs the leave animation operation and, upon completion, removes the element from the DOM.
|
||||
*
|
||||
* @param element the element that will be the focus of the leave animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
leave(element: JQuery): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Fires the move DOM operation. Just before the animation starts, the animate service will either append
|
||||
* it into the parentElement container or add the element directly after the afterElement element if present.
|
||||
* Then the move animation will be run.
|
||||
*
|
||||
* @param element the element that will be the focus of the move animation
|
||||
* @param parentElement the parent element of the element that will be the focus of the move animation
|
||||
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Triggers a custom animation event based off the className variable and then attaches the className
|
||||
* value to the element as a CSS class.
|
||||
*
|
||||
* @param element the element that will be animated
|
||||
* @param className the CSS class that will be added to the element and then animated
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
addClass(element: JQuery, className: string): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Triggers a custom animation event based off the className variable and then removes the CSS class
|
||||
* provided by the className value from the element.
|
||||
*
|
||||
* @param element the element that will be animated
|
||||
* @param className the CSS class that will be animated and then removed from the element
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
removeClass(element: JQuery, className: string): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback
|
||||
* will be fired (if provided).
|
||||
*
|
||||
* @param element the element which will have its CSS classes changed removed from it
|
||||
* @param add the CSS classes which will be added to the element
|
||||
* @param remove the CSS class which will be removed from the element CSS classes have been set on the element
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
setClass(element: JQuery, add: string, remove: string): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Cancels the provided animation.
|
||||
*/
|
||||
cancel(animationPromise: ng.IPromise<void>): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularProvider
|
||||
// see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateProvider {
|
||||
/**
|
||||
* Registers a new injectable animation factory function.
|
||||
*
|
||||
* @param name The name of the animation.
|
||||
* @param factory The factory function that will be executed to return the animation object.
|
||||
*/
|
||||
register(name: string, factory: () => ng.IAnimateCallbackObject): void;
|
||||
|
||||
/**
|
||||
* Gets and/or sets the CSS class expression that is checked when performing an animation.
|
||||
*
|
||||
* @param expression The className expression which will be checked against all animations.
|
||||
* @returns The current CSS className expression value. If null then there is no expression value.
|
||||
*/
|
||||
classNameFilter(expression?: RegExp): RegExp;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+55
-2
@@ -237,7 +237,7 @@ declare module ng {
|
||||
major: number;
|
||||
minor: number;
|
||||
dot: number;
|
||||
codename: string;
|
||||
codeName: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -424,6 +424,7 @@ declare module ng {
|
||||
// Documentation states viewValue and modelValue to be a string but other
|
||||
// types do work and it's common to use them.
|
||||
$setViewValue(value: any): void;
|
||||
$setPristine(): void;
|
||||
$validate(): void;
|
||||
$setTouched(): void;
|
||||
$setUntouched(): void;
|
||||
@@ -594,6 +595,35 @@ declare module ng {
|
||||
cancel(promise: IPromise<any>): boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularProvider
|
||||
// see http://docs.angularjs.org/api/ng/provider/$animateProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateProvider {
|
||||
/**
|
||||
* Registers a new injectable animation factory function.
|
||||
*
|
||||
* @param name The name of the animation.
|
||||
* @param factory The factory function that will be executed to return the animation object.
|
||||
*/
|
||||
register(name: string, factory: () => IAnimateCallbackObject): void;
|
||||
|
||||
/**
|
||||
* Gets and/or sets the CSS class expression that is checked when performing an animation.
|
||||
*
|
||||
* @param expression The className expression which will be checked against all animations.
|
||||
* @returns The current CSS className expression value. If null then there is no expression value.
|
||||
*/
|
||||
classNameFilter(expression?: RegExp): RegExp;
|
||||
}
|
||||
|
||||
/**
|
||||
* The animation object which contains callback functions for each event that is expected to be animated.
|
||||
*/
|
||||
interface IAnimateCallbackObject {
|
||||
eventFn(element: Node, doneFn: () => void): Function;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// FilterService
|
||||
// see http://docs.angularjs.org/api/ng.$filter
|
||||
@@ -1286,6 +1316,29 @@ declare module ng {
|
||||
resourceUrlWhitelist(whitelist: any[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* $templateRequest service
|
||||
* see http://docs.angularjs.org/api/ng/service/$templateRequest
|
||||
*/
|
||||
interface ITemplateRequestService {
|
||||
/**
|
||||
* Downloads a template using $http and, upon success, stores the
|
||||
* contents inside of $templateCache.
|
||||
*
|
||||
* If the HTTP request fails or the response data of the HTTP request is
|
||||
* empty then a $compile error will be thrown (unless
|
||||
* {ignoreRequestError} is set to true).
|
||||
*
|
||||
* @param tpl The template URL.
|
||||
* @param ignoreRequestError Whether or not to ignore the exception
|
||||
* when the request fails or the template is
|
||||
* empty.
|
||||
*
|
||||
* @return A promise whose value is the template content.
|
||||
*/
|
||||
(tpl: string, ignoreRequestError?: boolean): IPromise<string>;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Directive
|
||||
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
|
||||
@@ -1360,7 +1413,7 @@ declare module ng {
|
||||
find(selector: string): IAugmentedJQuery;
|
||||
find(element: any): IAugmentedJQuery;
|
||||
find(obj: JQuery): IAugmentedJQuery;
|
||||
|
||||
controller(): any;
|
||||
controller(name: string): any;
|
||||
injector(): any;
|
||||
scope(): IScope;
|
||||
|
||||
Vendored
+19
-1
@@ -31,6 +31,23 @@ interface AsyncQueue<T> {
|
||||
kill(): void;
|
||||
}
|
||||
|
||||
interface AsyncPriorityQueue<T> {
|
||||
length(): number;
|
||||
concurrency: number;
|
||||
started: boolean;
|
||||
paused: boolean;
|
||||
push(task: T, priority: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
push(task: T[], priority: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
saturated: () => any;
|
||||
empty: () => any;
|
||||
drain: () => any;
|
||||
running(): number;
|
||||
idle(): boolean;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
kill(): void;
|
||||
}
|
||||
|
||||
interface Async {
|
||||
|
||||
// Collections
|
||||
@@ -56,7 +73,7 @@ interface Async {
|
||||
some<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
any<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
every<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: (result: boolean) => any): any;
|
||||
all<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: (result: boolean) => any): any;
|
||||
all<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: (result: boolean) => any): any;
|
||||
concat<T, R>(arr: T[], iterator: AsyncIterator<T, R[]>, callback: AsyncMultipleResultsCallback<R>): any;
|
||||
concatSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R[]>, callback: AsyncMultipleResultsCallback<R>): any;
|
||||
|
||||
@@ -72,6 +89,7 @@ interface Async {
|
||||
waterfall<T>(tasks: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
waterfall<T>(tasks: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
queue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncQueue<T>;
|
||||
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
|
||||
// auto(tasks: any[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
auto(tasks: any, callback?: AsyncMultipleResultsCallback<any>): void;
|
||||
iterator(tasks: Function[]): Function;
|
||||
|
||||
Vendored
+4
@@ -48,6 +48,10 @@ declare module "aws-sdk" {
|
||||
public client: s3.Client;
|
||||
}
|
||||
|
||||
export class DynamoDB {
|
||||
constructor(options?: any);
|
||||
}
|
||||
|
||||
export module Sqs {
|
||||
|
||||
export interface Client {
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import browserify = require("browserify");
|
||||
import fs = require("fs");
|
||||
|
||||
var b = browserify();
|
||||
b.add('./browser/main.js');
|
||||
b.transform('deamdify');
|
||||
b.bundle().pipe(fs.createWriteStream('bundle.js'));
|
||||
/// <reference path="browserify.d.ts"/>
|
||||
|
||||
import browserify = require("browserify");
|
||||
import fs = require("fs");
|
||||
|
||||
var b: BrowserifyObject = browserify();
|
||||
b.add('./browser/main.js');
|
||||
b.transform('deamdify');
|
||||
b.bundle().pipe(fs.createWriteStream('bundle.js'));
|
||||
|
||||
var customBrowsify: Browserify = require("browserify");
|
||||
customBrowsify({entries: []});
|
||||
|
||||
Vendored
+41
-38
@@ -1,38 +1,41 @@
|
||||
// Type definitions for Browserify
|
||||
// Project: http://browserify.org/
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
interface BrowserifyObject extends NodeJS.EventEmitter {
|
||||
add(file: string): BrowserifyObject;
|
||||
require(file: string, opts?: {
|
||||
expose: string;
|
||||
}): BrowserifyObject;
|
||||
bundle(opts?: {
|
||||
insertGlobals?: boolean;
|
||||
detectGlobals?: boolean;
|
||||
debug?: boolean;
|
||||
standalone?: string;
|
||||
insertGlobalVars?: any;
|
||||
}, cb?: (err: any, src: any) => void): NodeJS.ReadableStream;
|
||||
|
||||
external(file: string): BrowserifyObject;
|
||||
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" {
|
||||
function browserify(): BrowserifyObject;
|
||||
function browserify(files: string[]): BrowserifyObject;
|
||||
function browserify(opts: {
|
||||
entries?: string[];
|
||||
noParse?: string[];
|
||||
}): BrowserifyObject;
|
||||
|
||||
export = browserify;
|
||||
}
|
||||
// Type definitions for Browserify
|
||||
// Project: http://browserify.org/
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
interface BrowserifyObject extends NodeJS.EventEmitter {
|
||||
add(file:string): BrowserifyObject;
|
||||
require(file:string, opts?:{
|
||||
expose: string;
|
||||
}): BrowserifyObject;
|
||||
bundle(opts?:{
|
||||
insertGlobals?: boolean;
|
||||
detectGlobals?: boolean;
|
||||
debug?: boolean;
|
||||
standalone?: string;
|
||||
insertGlobalVars?: any;
|
||||
}, cb?:(err:any, src:any) => void): NodeJS.ReadableStream;
|
||||
|
||||
external(file:string): BrowserifyObject;
|
||||
ignore(file:string): BrowserifyObject;
|
||||
transform(tr:string): BrowserifyObject;
|
||||
transform(tr:Function): BrowserifyObject;
|
||||
plugin(plugin:string, opts?:any): BrowserifyObject;
|
||||
plugin(plugin:Function, opts?:any): BrowserifyObject;
|
||||
}
|
||||
|
||||
interface Browserify {
|
||||
(): BrowserifyObject;
|
||||
(files:string[]): BrowserifyObject;
|
||||
(opts:{
|
||||
entries?: string[];
|
||||
noParse?: string[];
|
||||
}): BrowserifyObject;
|
||||
}
|
||||
|
||||
declare module "browserify" {
|
||||
var browserify: Browserify;
|
||||
export = browserify;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/// <reference path="bunyan.d.ts" />
|
||||
|
||||
import bunyan = require('bunyan');
|
||||
|
||||
var ringBufferOptions:bunyan.RingBufferOptions = {
|
||||
limit: 100
|
||||
};
|
||||
var ringBuffer:bunyan.RingBuffer = new bunyan.RingBuffer(ringBufferOptions);
|
||||
ringBuffer.write("hello");
|
||||
ringBuffer.end();
|
||||
ringBuffer.destroy();
|
||||
ringBuffer.destroySoon();
|
||||
|
||||
var level:number;
|
||||
level = bunyan.resolveLevel("trace");
|
||||
level = bunyan.resolveLevel("debug");
|
||||
level = bunyan.resolveLevel("info");
|
||||
level = bunyan.resolveLevel("warn");
|
||||
level = bunyan.resolveLevel("error");
|
||||
level = bunyan.resolveLevel("fatal");
|
||||
level = bunyan.resolveLevel(bunyan.TRACE);
|
||||
level = bunyan.resolveLevel(bunyan.DEBUG);
|
||||
level = bunyan.resolveLevel(bunyan.INFO);
|
||||
level = bunyan.resolveLevel(bunyan.WARN);
|
||||
level = bunyan.resolveLevel(bunyan.ERROR);
|
||||
level = bunyan.resolveLevel(bunyan.FATAL);
|
||||
|
||||
var options:bunyan.LoggerOptions = {
|
||||
name: 'test-logger',
|
||||
streams: [{
|
||||
type: 'stream',
|
||||
stream: process.stdout,
|
||||
level: bunyan.TRACE
|
||||
}, {
|
||||
type: 'file',
|
||||
path: '/tmp/test.log',
|
||||
level: bunyan.DEBUG,
|
||||
closeOnExit: true
|
||||
}, {
|
||||
type: 'rotating-file',
|
||||
path: '/tmp/test2.log',
|
||||
level: bunyan.INFO,
|
||||
closeOnExit: false
|
||||
}, {
|
||||
type: 'raw',
|
||||
stream: process.stderr,
|
||||
level: bunyan.WARN
|
||||
}, {
|
||||
type: 'raw',
|
||||
stream: ringBuffer,
|
||||
level: bunyan.ERROR
|
||||
}]
|
||||
};
|
||||
|
||||
var log = bunyan.createLogger(options);
|
||||
|
||||
log.addSerializers(bunyan.stdSerializers);
|
||||
var child = log.child({name: 'child'});
|
||||
child.reopenFileStreams();
|
||||
log.addStream({path: '/dev/null', name: 'stream1'});
|
||||
child.level(bunyan.DEBUG);
|
||||
child.level('debug');
|
||||
child.levels(0, bunyan.ERROR);
|
||||
child.levels(0, 'error');
|
||||
child.levels('stream1', bunyan.FATAL);
|
||||
child.levels('stream1', 'fatal');
|
||||
|
||||
var buffer = new Buffer(0);
|
||||
var error = new Error('');
|
||||
var object = {
|
||||
test: 123
|
||||
};
|
||||
|
||||
log.trace(buffer);
|
||||
log.trace(error);
|
||||
log.trace(object);
|
||||
log.trace('Hello, %s', 'world!');
|
||||
log.debug(buffer);
|
||||
log.debug(error);
|
||||
log.debug(object);
|
||||
log.debug('Hello, %s', 'world!');
|
||||
log.info(buffer);
|
||||
log.info(error);
|
||||
log.info(object);
|
||||
log.info('Hello, %s', 'world!');
|
||||
log.warn(buffer);
|
||||
log.warn(error);
|
||||
log.warn(object);
|
||||
log.warn('Hello, %s', 'world!');
|
||||
log.error(buffer);
|
||||
log.error(error);
|
||||
log.error(object);
|
||||
log.error('Hello, %s', 'world!');
|
||||
log.fatal(buffer);
|
||||
log.fatal(error);
|
||||
log.fatal(object);
|
||||
log.fatal('Hello, %s', 'world!');
|
||||
|
||||
var recursive = {
|
||||
hello: 'world',
|
||||
whats: {
|
||||
huh: recursive
|
||||
}
|
||||
}
|
||||
|
||||
JSON.stringify(recursive, bunyan.safeCycles());
|
||||
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
// Type definitions for node-bunyan
|
||||
// Project: https://github.com/trentm/node-bunyan
|
||||
// Definitions by: Alex Mikhalev <https://github.com/amikhalev>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "bunyan" {
|
||||
import events = require('events');
|
||||
import EventEmitter = events.EventEmitter;
|
||||
import WritableStream = NodeJS.WritableStream;
|
||||
|
||||
class Logger extends EventEmitter {
|
||||
constructor(options:LoggerOptions);
|
||||
addStream(stream:Stream):void;
|
||||
addSerializers(serializers:Serializers):void;
|
||||
child(options:LoggerOptions, simple?:boolean):Logger;
|
||||
reopenFileStreams():void;
|
||||
|
||||
level(value:any /* number | string */):void;
|
||||
levels(name:any /* number | string */, value:any /* number | string */):void;
|
||||
|
||||
trace(error:Error, format?:any, ...params:any[]):void;
|
||||
trace(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
trace(obj:Object, format?:any, ...params:any[]):void;
|
||||
trace(format:string, ...params:any[]):void;
|
||||
debug(error:Error, format?:any, ...params:any[]):void;
|
||||
debug(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
debug(obj:Object, format?:any, ...params:any[]):void;
|
||||
debug(format:string, ...params:any[]):void;
|
||||
info(error:Error, format?:any, ...params:any[]):void;
|
||||
info(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
info(obj:Object, format?:any, ...params:any[]):void;
|
||||
info(format:string, ...params:any[]):void;
|
||||
warn(error:Error, format?:any, ...params:any[]):void;
|
||||
warn(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
warn(obj:Object, format?:any, ...params:any[]):void;
|
||||
warn(format:string, ...params:any[]):void;
|
||||
error(error:Error, format?:any, ...params:any[]):void;
|
||||
error(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
error(obj:Object, format?:any, ...params:any[]):void;
|
||||
error(format:string, ...params:any[]):void;
|
||||
fatal(error:Error, format?:any, ...params:any[]):void;
|
||||
fatal(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
fatal(obj:Object, format?:any, ...params:any[]):void;
|
||||
fatal(format:string, ...params:any[]):void;
|
||||
}
|
||||
|
||||
interface LoggerOptions {
|
||||
name: string;
|
||||
streams?: Stream[];
|
||||
level?: string;
|
||||
stream?: WritableStream;
|
||||
serializers?: Serializers;
|
||||
src?: boolean;
|
||||
}
|
||||
|
||||
interface Serializers {
|
||||
[key:string]: (input:any) => string;
|
||||
}
|
||||
|
||||
interface Stream {
|
||||
type?: string;
|
||||
level?: any; // number | string
|
||||
path?: string;
|
||||
stream?: WritableStream;
|
||||
closeOnExit?: boolean;
|
||||
}
|
||||
|
||||
export var stdSerializers:Serializers;
|
||||
|
||||
export var TRACE:number;
|
||||
export var DEBUG:number;
|
||||
export var INFO:number;
|
||||
export var WARN:number;
|
||||
export var ERROR:number;
|
||||
export var FATAL:number;
|
||||
|
||||
export function resolveLevel(value:any /* number | string */):number;
|
||||
|
||||
export function createLogger(options:LoggerOptions):Logger;
|
||||
|
||||
class RingBuffer extends EventEmitter {
|
||||
constructor(options:RingBufferOptions);
|
||||
|
||||
writable:boolean;
|
||||
records:any[];
|
||||
|
||||
write(record:any):void;
|
||||
end(record?:any):void;
|
||||
destroy():void;
|
||||
destroySoon():void;
|
||||
}
|
||||
|
||||
interface RingBufferOptions {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export function safeCycles():(key:string, value:any) => any;
|
||||
}
|
||||
@@ -31,8 +31,8 @@ caml = new CamlBuilder().Where()
|
||||
)
|
||||
.ToString();
|
||||
|
||||
caml = new CamlBuilder().Where()
|
||||
.LookupIdField("Category").In([2, 3, 10])
|
||||
var caml = new CamlBuilder().Where()
|
||||
.LookupField("Category").Id().In([2, 3, 10])
|
||||
.And()
|
||||
.DateField("ExpirationDate").GreaterThan(CamlBuilder.CamlValues.Now)
|
||||
.OrderBy("ExpirationDate")
|
||||
|
||||
Vendored
+78
-58
@@ -4,48 +4,14 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module Sys {
|
||||
class StringBuilder {
|
||||
/** Appends a string to the string builder */
|
||||
public append(s: string): void;
|
||||
/** Appends a line to the string builder */
|
||||
public appendLine(s: string): void;
|
||||
/** Clears the contents of the string builder */
|
||||
public clear(): void;
|
||||
/** Indicates wherever the string builder is empty */
|
||||
public isEmpty(): boolean;
|
||||
/** Gets the contents of the string builder as a string */
|
||||
public toString(): string;
|
||||
}
|
||||
}
|
||||
declare module SP {
|
||||
/** Defines a writer that provides a set of methods to append text in XML format. Use the static SP.XmlWriter.create(sb) Method to create an SP.XmlWriter object with the Sys.StringBuilder object you pass in. */
|
||||
class XmlWriter {
|
||||
/** Creates a new instance of the XmlWriter class with the specified string builder. */
|
||||
static create(sb: Sys.StringBuilder): XmlWriter;
|
||||
/** Appends a start element tag with the specified name in XML format to the object?s string builder. */
|
||||
public writeStartElement(tagName: string): void;
|
||||
/** Appends an element with the specified tag name and value in XML format to the string builder. */
|
||||
public writeElementString(tagName: string, value: string): void;
|
||||
/** Appends an end element tag in XML format to the object?s string builder. This method appends the end element tag ?/>? if the start element tag is not closed; otherwise, it appends a full end element tag ?</tagName>? to the string builder. */
|
||||
public writeEndElement(): void;
|
||||
/** Appends an attribute with the specified name and value in XML format to the object?s string builder. */
|
||||
public writeAttributeString(localName: string, value: string): void;
|
||||
/** This method only appends the name of the attribute. You can append the value of the attribute by calling the SP.XmlWriter.writeString(value) Method, and close the attribute by calling the SP.XmlWriter.writeEndAttribute() Method. */
|
||||
public writeStartAttribute(localName: string): void;
|
||||
/** Appends an end of an attribute in XML format to the object?s string builder. */
|
||||
public writeEndAttribute(): void;
|
||||
/** Appends the specified value for an element tag or attribute to the object?s string builder. */
|
||||
public writeString(value: string): void;
|
||||
/** Appends the specified text to the object?s string builder. */
|
||||
public writeRaw(xml: string): void;
|
||||
/** This member is reserved for internal use and is not intended to be used directly from your code. */
|
||||
public close(): void;
|
||||
}
|
||||
}
|
||||
declare class CamlBuilder {
|
||||
constructor();
|
||||
/** Generate CAML Query, starting from <Where> tag */
|
||||
public Where(): CamlBuilder.IFieldExpression;
|
||||
/** Generate <View> tag for SP.CamlQuery
|
||||
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
|
||||
Specifying view fields is a good practice, as it decreases traffic between server and client. */
|
||||
public View(viewFields?: string[]): CamlBuilder.IView;
|
||||
/** Use for:
|
||||
1. SPServices CAMLQuery attribute
|
||||
2. Creating partial expressions
|
||||
@@ -54,8 +20,40 @@ declare class CamlBuilder {
|
||||
static Expression(): CamlBuilder.IFieldExpression;
|
||||
}
|
||||
declare module CamlBuilder {
|
||||
interface IView {
|
||||
interface IView extends IJoinable, IFinalizable {
|
||||
Query(): IQuery;
|
||||
RowLimit(limit: number, paged?: boolean): IView;
|
||||
Scope(scope: ViewScope): IView;
|
||||
}
|
||||
interface IJoinable {
|
||||
/** Join the list you're querying with another list.
|
||||
Joins are only allowed through a lookup field relation.
|
||||
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
|
||||
@alias alias for the joined list */
|
||||
InnerJoin(lookupFieldInternalName: string, alias: string): IJoin;
|
||||
/** Join the list you're querying with another list.
|
||||
Joins are only allowed through a lookup field relation.
|
||||
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
|
||||
@alias alias for the joined list */
|
||||
LeftJoin(lookupFieldInternalName: string, alias: string): IJoin;
|
||||
}
|
||||
interface IJoin extends IJoinable {
|
||||
/** Select projected field for using in the main Query body
|
||||
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
|
||||
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
|
||||
}
|
||||
interface IProjectableView extends IView {
|
||||
/** Select projected field for using in the main Query body
|
||||
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
|
||||
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
|
||||
}
|
||||
enum ViewScope {
|
||||
/** */
|
||||
Recursive = 0,
|
||||
/** */
|
||||
RecursiveAll = 1,
|
||||
/** */
|
||||
FilesOnly = 2,
|
||||
}
|
||||
interface IQuery {
|
||||
Where(): IFieldExpression;
|
||||
@@ -63,6 +61,8 @@ declare module CamlBuilder {
|
||||
interface IFinalizable {
|
||||
/** Get the resulting CAML query as string */
|
||||
ToString(): string;
|
||||
/** Get the resulting CAML query as SP.CamlQuery object */
|
||||
ToCamlQuery(): any;
|
||||
}
|
||||
interface ISortable extends IFinalizable {
|
||||
/** Adds OrderBy clause to the query
|
||||
@@ -81,7 +81,7 @@ declare module CamlBuilder {
|
||||
interface IGroupable extends ISortable {
|
||||
/** Adds GroupBy clause to the query.
|
||||
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
|
||||
GroupBy(fieldInternalName): IGroupedQuery;
|
||||
GroupBy(fieldInternalName: any): IGroupedQuery;
|
||||
}
|
||||
interface IExpression extends IGroupable {
|
||||
/** Adds And clause to the query. */
|
||||
@@ -122,12 +122,10 @@ declare module CamlBuilder {
|
||||
UserField(internalName: string): IUserFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Lookup */
|
||||
LookupField(internalName: string): ILookupFieldExpression;
|
||||
/** DEPRECATED. Please use LookupField(...).Id() instead */
|
||||
LookupIdField(internalName: string): INumberFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is LookupMulti */
|
||||
LookupMultiField(internalName: string): ILookupMultiFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is UserMulti */
|
||||
UserMultiField(internalName: string): ILookupMultiFieldExpression;
|
||||
UserMultiField(internalName: string): IUserMultiFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Date */
|
||||
DateField(internalName: string): IDateTimeFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is DateTime */
|
||||
@@ -289,30 +287,52 @@ declare module CamlBuilder {
|
||||
ValueAsBoolean(): IBooleanFieldExpression;
|
||||
}
|
||||
interface ILookupMultiFieldExpression {
|
||||
/** Checks whether the value of the field is equal to the specified value */
|
||||
EqualTo(value: string): IExpression;
|
||||
/** Checks whether the value of the field is not equal to the specified value */
|
||||
NotEqualTo(value: string): IExpression;
|
||||
/** Checks whether the values of the field includes the specified value */
|
||||
Includes(value): IExpression;
|
||||
/** Checks whether the values of the field not includes the specified value */
|
||||
NotIncludes(value): IExpression;
|
||||
/** Checks a condition against every item in the multi lookup value */
|
||||
IncludesSuchItemThat(): ILookupFieldExpression;
|
||||
/** Checks whether the field values collection is empty */
|
||||
IsNull(): IExpression;
|
||||
/** Checks whether the field values collection is not empty */
|
||||
IsNotNull(): IExpression;
|
||||
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().EqualTo(value)" instead. */
|
||||
Includes(value: any): IExpression;
|
||||
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().NotEqualTo(value)" instead. */
|
||||
NotIncludes(value: any): IExpression;
|
||||
/** DEPRECATED: "Eq" operation in CAML works exactly the same as "Includes". To avoid confusion, please use Includes. */
|
||||
EqualTo(value: any): IExpression;
|
||||
/** DEPRECATED: "Neq" operation in CAML works exactly the same as "NotIncludes". To avoid confusion, please use NotIncludes. */
|
||||
NotEqualTo(value: any): IExpression;
|
||||
}
|
||||
interface IUserMultiFieldExpression {
|
||||
/** Checks a condition against every item in the multi lookup value */
|
||||
IncludesSuchItemThat(): IUserFieldExpression;
|
||||
/** Checks whether the field values collection is empty */
|
||||
IsNull(): IExpression;
|
||||
/** Checks whether the field values collection is not empty */
|
||||
IsNotNull(): IExpression;
|
||||
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().EqualTo(value)" instead. */
|
||||
Includes(value: any): IExpression;
|
||||
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().NotEqualTo(value)" instead. */
|
||||
NotIncludes(value: any): IExpression;
|
||||
/** DEPRECATED: "Eq" operation in CAML works exactly the same as "Includes". To avoid confusion, please use Includes. */
|
||||
EqualTo(value: any): IExpression;
|
||||
/** DEPRECATED: "Neq" operation in CAML works exactly the same as "NotIncludes". To avoid confusion, please use NotIncludes. */
|
||||
NotEqualTo(value: any): IExpression;
|
||||
}
|
||||
enum DateRangesOverlapType {
|
||||
/** Returns events for today */
|
||||
Now,
|
||||
Now = 0,
|
||||
/** Returns events for one day, specified by CalendarDate in QueryOptions */
|
||||
Day,
|
||||
Day = 1,
|
||||
/** Returns events for one week, specified by CalendarDate in QueryOptions */
|
||||
Week,
|
||||
Week = 2,
|
||||
/** Returns events for one month, specified by CalendarDate in QueryOptions.
|
||||
Caution: usually also returns few days from previous and next months */
|
||||
Month,
|
||||
Month = 3,
|
||||
/** Returns events for one year, specified by CalendarDate in QueryOptions */
|
||||
Year,
|
||||
Year = 4,
|
||||
}
|
||||
class Internal {
|
||||
static createView(): IView;
|
||||
static createView(viewFields?: string[]): IView;
|
||||
static createWhere(): IFieldExpression;
|
||||
static createExpression(): IFieldExpression;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for CasperJS v1.0.0 API
|
||||
// Project: http://casperjs.org/
|
||||
// Definitions by: Jed Hunsaker <https://github.com/jedhunsaker>
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../phantomjs/phantomjs.d.ts" />
|
||||
|
||||
Vendored
+1
@@ -41,6 +41,7 @@ declare module Chalk {
|
||||
cyan: ChalkChain;
|
||||
white: ChalkChain;
|
||||
gray: ChalkChain;
|
||||
grey: ChalkChain;
|
||||
|
||||
// Background colors
|
||||
bgBlack: ChalkChain;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import runtime = chrome.app.runtime;
|
||||
import cwindow = chrome.app.window;
|
||||
|
||||
var createOptions: cwindow.CreateOptions = {
|
||||
var createOptions: cwindow.CreateWindowOptions = {
|
||||
id: "My Window",
|
||||
bounds: {
|
||||
left: 0,
|
||||
@@ -26,6 +26,35 @@ chrome.app.runtime.onRestarted.addListener(function () { return; });
|
||||
// Get Current Window
|
||||
var currentWindow: cwindow.AppWindow = chrome.app.window.current();
|
||||
|
||||
// FileSystem
|
||||
// https://developer.chrome.com/apps/fileSystem
|
||||
|
||||
function test_fileSystem(): void {
|
||||
var accepts: chrome.fileSystem.AcceptOptions[] = [
|
||||
{mimeTypes: ["text/*"], extensions: ['js', 'css', 'txt', 'html', 'xml', 'tsv', 'csv', 'rtf']}
|
||||
];
|
||||
var chooseOption: chrome.fileSystem.ChooseEntryOptions = {
|
||||
type: "openFile",
|
||||
suggestedName: "foo.txt",
|
||||
accepts: accepts,
|
||||
acceptsAllTypes: false,
|
||||
acceptsMultiple: false
|
||||
};
|
||||
chrome.fileSystem.chooseEntry(chooseOption, (entry: Entry) => {
|
||||
chrome.fileSystem.getDisplayPath(entry, (displayPath: string) => { });
|
||||
|
||||
var retainedId = chrome.fileSystem.retainEntry(entry);
|
||||
chrome.fileSystem.isRestorable(retainedId, (isRestorable: boolean) => {
|
||||
if(isRestorable){
|
||||
chrome.fileSystem.restoreEntry(retainedId, (restoredEntry: Entry) => { });
|
||||
}
|
||||
});
|
||||
|
||||
chrome.fileSystem.getWritableEntry(entry, (writableEntry: Entry) => {});
|
||||
chrome.fileSystem.isWritableEntry(entry, (isWritable: boolean) => {});
|
||||
});
|
||||
}
|
||||
|
||||
// Sockets
|
||||
// https://developer.chrome.com/apps/sockets_tcp
|
||||
function test_socketsTcp(): void {
|
||||
|
||||
Vendored
+111
-22
@@ -1,8 +1,10 @@
|
||||
// Type definitions for Chrome packaged application development
|
||||
// Project: http://developer.chrome.com/apps/
|
||||
// Definitions by: Adam Lay <https://github.com/AdamLay>, MIZUNE Pine <https://github.com/pine613>
|
||||
// Definitions by: Adam Lay <https://github.com/AdamLay>, MIZUNE Pine <https://github.com/pine613>, MIZUSHIMA Junki <https://github.com/mzsm>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path='../filesystem/filesystem.d.ts'/>
|
||||
|
||||
////////////////////
|
||||
// App Runtime
|
||||
////////////////////
|
||||
@@ -21,11 +23,11 @@ declare module chrome.app.runtime {
|
||||
}
|
||||
|
||||
interface LaunchedEvent {
|
||||
addListener(callback: (launchData: LaunchData) => void);
|
||||
addListener(callback: (launchData: LaunchData) => void): void;
|
||||
}
|
||||
|
||||
interface RestartedEvent {
|
||||
addListener(callback: () => void);
|
||||
addListener(callback: () => void): void;
|
||||
}
|
||||
|
||||
var onLaunched: LaunchedEvent;
|
||||
@@ -36,13 +38,65 @@ declare module chrome.app.runtime {
|
||||
// App Window
|
||||
////////////////////
|
||||
declare module chrome.app.window {
|
||||
interface Bounds {
|
||||
interface ContentBounds {
|
||||
left?: number;
|
||||
top?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
|
||||
interface BoundsSpecification {
|
||||
left?: number;
|
||||
top?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
}
|
||||
|
||||
interface Bounds {
|
||||
left: number;
|
||||
top: number;
|
||||
width: number;
|
||||
height: number;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
setPosition(left: number, top: number): void;
|
||||
setSize(width: number, height: number): void;
|
||||
setMinimumSize(minWidth: number, minHeight: number): void;
|
||||
setMaximumSize(maxWidth: number, maxHeight: number): void;
|
||||
}
|
||||
interface FrameOptions {
|
||||
type?: string;
|
||||
color?: string;
|
||||
activeColor?: string;
|
||||
inactiveColor?: string;
|
||||
}
|
||||
|
||||
interface CreateWindowOptions {
|
||||
id?: string;
|
||||
innerBounds?: BoundsSpecification;
|
||||
outerBounds?: BoundsSpecification;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
frame?: any; // string ("none", "chrome") or FrameOptions
|
||||
bounds?: ContentBounds;
|
||||
alphaEnabled?: boolean;
|
||||
state?: string; // "normal", "fullscreen", "maximized", "minimized"
|
||||
hidden?: boolean;
|
||||
resizable?: boolean;
|
||||
singleton?: boolean;
|
||||
alwaysOnTop?: boolean;
|
||||
focused?: boolean;
|
||||
visibleOnAllWorkspaces?: boolean;
|
||||
}
|
||||
|
||||
interface AppWindow {
|
||||
focus: () => void;
|
||||
fullscreen: () => void;
|
||||
@@ -59,27 +113,18 @@ declare module chrome.app.window {
|
||||
close: () => void;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
getBounds: () => Bounds;
|
||||
setBounds: (bounds: Bounds) => void;
|
||||
getBounds: () => ContentBounds;
|
||||
setBounds: (bounds: ContentBounds) => void;
|
||||
isAlwaysOnTop: () => boolean;
|
||||
setAlwaysOnTop: (alwaysOnTop: boolean) => void;
|
||||
setVisibleOnAllWorkspaces: (alwaysVisible: boolean) => void;
|
||||
contentWindow: Window;
|
||||
id: string;
|
||||
innerBounds: Bounds;
|
||||
outerBounds: Bounds;
|
||||
}
|
||||
|
||||
interface CreateOptions {
|
||||
id?: string;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
frame?: string; // "none", "chrome"
|
||||
bounds?: Bounds;
|
||||
transparentBackground?: boolean;
|
||||
state?: string; // "normal", "fullscreen", "maximized", "minimized"
|
||||
hidden?: boolean;
|
||||
resizable?: boolean;
|
||||
singleton?: boolean;
|
||||
}
|
||||
|
||||
export function create(url: string, options?: CreateOptions, callback?: (created_window: AppWindow) => void): void;
|
||||
export function create(url: string, options?: CreateWindowOptions, callback?: (created_window: AppWindow) => void): void;
|
||||
export function current(): AppWindow;
|
||||
|
||||
interface WindowEvent {
|
||||
@@ -94,6 +139,50 @@ declare module chrome.app.window {
|
||||
var onRestored: WindowEvent;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// fileSystem
|
||||
////////////////////
|
||||
declare module chrome.fileSystem {
|
||||
|
||||
interface ChildChangeInfo {
|
||||
entry: Entry;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface EntryChangedEvent {
|
||||
target: Entry;
|
||||
childChanges?: ChildChangeInfo[];
|
||||
}
|
||||
|
||||
interface EntryRemovedEvent {
|
||||
target: Entry;
|
||||
}
|
||||
|
||||
interface AcceptOptions {
|
||||
description?: string;
|
||||
mimeTypes?: string[];
|
||||
extensions?: string[];
|
||||
}
|
||||
|
||||
interface ChooseEntryOptions {
|
||||
type?: string;
|
||||
suggestedName?: string;
|
||||
accepts?: AcceptOptions[];
|
||||
acceptsAllTypes?: boolean;
|
||||
acceptsMultiple?: boolean;
|
||||
}
|
||||
|
||||
export function getDisplayPath(entry: Entry, callback: (displayPath: string) => void): void;
|
||||
export function getWritableEntry(entry: Entry, callback: (entry: Entry) => void): void;
|
||||
export function isWritableEntry(entry: Entry, callback: (isWritable: boolean) => void): void;
|
||||
export function chooseEntry(callback: (entry: Entry) => void): void;
|
||||
export function chooseEntry(callback: (fileEntries: FileEntry[]) => void): void;
|
||||
export function chooseEntry(options: ChooseEntryOptions, callback: (entry: Entry) => void): void;
|
||||
export function chooseEntry(options: ChooseEntryOptions, callback: (fileEntries: FileEntry[]) => void): void;
|
||||
export function restoreEntry(id: string, callback: (entry: Entry) => void): void;
|
||||
export function isRestorable(id: string, callback: (isRestorable: boolean) => void): void;
|
||||
export function retainEntry(entry: Entry): string;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Sockets
|
||||
|
||||
+22
-1
@@ -152,4 +152,25 @@ function printPage() {
|
||||
var action_url = "javascript:window.print();";
|
||||
chrome.tabs.update(tab.id, { url: action_url });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// https://developer.chrome.com/extensions/examples/extensions/catblock/background.js
|
||||
function catBlock () {
|
||||
var loldogs: string[];
|
||||
chrome.webRequest.onBeforeRequest.addListener(
|
||||
function(info) {
|
||||
console.log("Cat intercepted: " + info.url);
|
||||
// Redirect the lolcal request to a random loldog URL.
|
||||
var i = Math.round(Math.random() * loldogs.length);
|
||||
return {redirectUrl: loldogs[i]};
|
||||
},
|
||||
// filters
|
||||
{
|
||||
urls: [
|
||||
"https://i.chzbgr.com/*"
|
||||
],
|
||||
types: ["image"]
|
||||
},
|
||||
// extraInfoSpec
|
||||
["blocking"]);
|
||||
}
|
||||
|
||||
Vendored
+12
-11
@@ -1053,6 +1053,7 @@ declare module chrome.identity {
|
||||
declare module chrome.i18n {
|
||||
export function getMessage(messageName: string, substitutions?: any): string;
|
||||
export function getAcceptLanguages(callback: (languages: string[]) => void): void;
|
||||
export function getUILanguage(): string;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
@@ -1616,8 +1617,8 @@ declare module chrome.runtime {
|
||||
var onStartup: RuntimeStartupEvent;
|
||||
var onInstalled: RuntimeInstalledEvent;
|
||||
var onSuspendCanceled: RuntimeSuspendCanceledEvent;
|
||||
var onMessage: RuntimeMessageEvent;
|
||||
var onMessageExternal: RuntimeMessageEvent;
|
||||
var onMessage: ExtensionMessageEvent;
|
||||
var onMessageExternal: ExtensionMessageExternalEvent;
|
||||
var onRestartRequired: RuntimeRestartRequiredEvent;
|
||||
var onUpdateAvailable: RuntimeUpdateAvailableEvent;
|
||||
|
||||
@@ -2247,7 +2248,7 @@ declare module chrome.webRequest {
|
||||
|
||||
interface RequestFilter {
|
||||
tabId?: number;
|
||||
types?: string;
|
||||
types?: string[];
|
||||
urls: string[];
|
||||
windowId?: number;
|
||||
}
|
||||
@@ -2395,15 +2396,15 @@ declare module chrome.webRequest {
|
||||
}
|
||||
|
||||
interface WebRequestCompletedEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnCompletedDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnCompletedDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
}
|
||||
|
||||
interface WebRequestHeadersReceivedEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnHeadersReceivedDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnHeadersReceivedDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
}
|
||||
|
||||
interface WebRequestBeforeRedirectEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnBeforeRedirectDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnBeforeRedirectDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
}
|
||||
|
||||
interface WebRequestAuthRequiredEvent extends chrome.events.Event {
|
||||
@@ -2411,23 +2412,23 @@ declare module chrome.webRequest {
|
||||
}
|
||||
|
||||
interface WebRequestBeforeSendHeadersEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnBeforeSendHeadersDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnBeforeSendHeadersDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
}
|
||||
|
||||
interface WebRequestErrorOccurredEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnErrorOccurredDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnErrorOccurredDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
}
|
||||
|
||||
interface WebRequestResponseStartedEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnResponseStartedDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnResponseStartedDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
}
|
||||
|
||||
interface WebRequestSendHeadersEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnSendHeadersDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnSendHeadersDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
}
|
||||
|
||||
interface WebRequestBeforeRequestEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnBeforeRequestDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnBeforeRequestDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
}
|
||||
|
||||
var MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES: number;
|
||||
|
||||
Vendored
+17
-5
@@ -9,6 +9,7 @@ declare module CKEDITOR {
|
||||
|
||||
// Config options
|
||||
var disableAutoInline: boolean;
|
||||
var disableObjectResizing: boolean;
|
||||
var replaceClass: string;
|
||||
var skinName: string;
|
||||
|
||||
@@ -551,9 +552,20 @@ declare module CKEDITOR {
|
||||
|
||||
|
||||
interface config {
|
||||
startupMode: string;
|
||||
removeButtons: string;
|
||||
startupMode?: string;
|
||||
removeButtons?: string;
|
||||
toolbar?: any;
|
||||
skin?: string;
|
||||
language?: string;
|
||||
plugins?: string;
|
||||
font_names?: string;
|
||||
font_defaultLabel?: string;
|
||||
fontSize_sizes?: string;
|
||||
fontSize_defaultLabel?: string;
|
||||
colorButton_enableMore?: boolean;
|
||||
colorButton_colors?: string;
|
||||
startupFocus?: boolean;
|
||||
on?: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -666,7 +678,7 @@ declare module CKEDITOR {
|
||||
getClipboardData(options: Object, callback: Function): void;
|
||||
getColorFromDialog(callback: Function, scope?: Object): void;
|
||||
getCommand(commandName: string): command;
|
||||
getData(noEvents: Object): string;
|
||||
getData(noEvents?: Object): string;
|
||||
getMenuItem(name: string): Object;
|
||||
getResizable(forContents: boolean): dom.element;
|
||||
getSelection(forceRealSelection?: boolean): dom.selection;
|
||||
@@ -695,7 +707,7 @@ declare module CKEDITOR {
|
||||
selectionChange(checkNow?: boolean): void;
|
||||
setActiveEnterMode(enterMode: number, shiftEnterMode: number): void;
|
||||
setActiveFilter(filter: filter): void;
|
||||
setData(data: string, callback: Function, internal: boolean): void;
|
||||
setData(data: string, options?: { internal?: boolean; callback?: Function; noSnapshot?: boolean; }): void;
|
||||
setKeystroke(keystroke: number, behavior?: string): void;
|
||||
setKeystroke(keystroke: any[], behavior?: string): void;
|
||||
setKeystroke(keystroke: number, behavior?: boolean): void;
|
||||
@@ -951,4 +963,4 @@ declare module CKEDITOR {
|
||||
addFocusable(element: CKEDITOR.dom.element, index: number): void;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+110
@@ -806,4 +806,114 @@ declare module CodeMirror {
|
||||
By default, a marker appears only in its target document. */
|
||||
shared?: boolean;
|
||||
}
|
||||
|
||||
interface StringStream {
|
||||
lastColumnPos: number;
|
||||
lastColumnValue: number;
|
||||
lineStart: number;
|
||||
|
||||
/**
|
||||
* Current position in the string.
|
||||
*/
|
||||
pos: number;
|
||||
|
||||
/**
|
||||
* Where the stream's position was when it was first passed to the token function.
|
||||
*/
|
||||
start: number;
|
||||
|
||||
/**
|
||||
* The current line's content.
|
||||
*/
|
||||
string: string;
|
||||
|
||||
/**
|
||||
* Number of spaces per tab character.
|
||||
*/
|
||||
tabSize: number;
|
||||
|
||||
/**
|
||||
* Returns true only if the stream is at the end of the line.
|
||||
*/
|
||||
eol(): boolean;
|
||||
|
||||
/**
|
||||
* Returns true only if the stream is at the start of the line.
|
||||
*/
|
||||
sol(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the next character in the stream without advancing it. Will return an null at the end of the line.
|
||||
*/
|
||||
peek(): string;
|
||||
|
||||
/**
|
||||
* Returns the next character in the stream and advances it. Also returns null when no more characters are available.
|
||||
*/
|
||||
next(): string;
|
||||
|
||||
/**
|
||||
* match can be a character, a regular expression, or a function that takes a character and returns a boolean.
|
||||
* If the next character in the stream 'matches' the given argument, it is consumed and returned.
|
||||
* Otherwise, undefined is returned.
|
||||
*/
|
||||
eat(match: string): string;
|
||||
eat(match: RegExp): string;
|
||||
eat(match: (char: string) => boolean): string;
|
||||
|
||||
/**
|
||||
* Repeatedly calls eat with the given argument, until it fails. Returns true if any characters were eaten.
|
||||
*/
|
||||
eatWhile(match: string): boolean;
|
||||
eatWhile(match: RegExp): boolean;
|
||||
eatWhile(match: (char: string) => boolean): boolean;
|
||||
|
||||
/**
|
||||
* Shortcut for eatWhile when matching white-space.
|
||||
*/
|
||||
eatSpace(): boolean;
|
||||
|
||||
/**
|
||||
* Moves the position to the end of the line.
|
||||
*/
|
||||
skipToEnd(): void;
|
||||
|
||||
/**
|
||||
* Skips to the next occurrence of the given character, if found on the current line (doesn't advance the stream if
|
||||
* the character does not occur on the line).
|
||||
*
|
||||
* Returns true if the character was found.
|
||||
*/
|
||||
skipTo(ch: string): boolean;
|
||||
|
||||
/**
|
||||
* Act like a multi-character eat - if consume is true or not given - or a look-ahead that doesn't update the stream
|
||||
* position - if it is false. pattern can be either a string or a regular expression starting with ^. When it is a
|
||||
* string, caseFold can be set to true to make the match case-insensitive. When successfully matching a regular
|
||||
* expression, the returned value will be the array returned by match, in case you need to extract matched groups.
|
||||
*/
|
||||
match(pattern: string, consume?: boolean, caseFold?: boolean): boolean;
|
||||
match(pattern: RegExp, consume?: boolean): string[];
|
||||
|
||||
/**
|
||||
* Backs up the stream n characters. Backing it up further than the start of the current token will cause things to
|
||||
* break, so be careful.
|
||||
*/
|
||||
backUp(n: number): void;
|
||||
|
||||
/**
|
||||
* Returns the column (taking into account tabs) at which the current token starts.
|
||||
*/
|
||||
column(): number;
|
||||
|
||||
/**
|
||||
* Tells you how far the current line has been indented, in spaces. Corrects for tab characters.
|
||||
*/
|
||||
indentation(): number;
|
||||
|
||||
/**
|
||||
* Get the string between the start of the current token and the current stream position.
|
||||
*/
|
||||
current(): string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +1,100 @@
|
||||
///<reference path="commander.d.ts"/>
|
||||
|
||||
//
|
||||
// TODO: improve tests
|
||||
// [the code below was extracted from the documentation and examples, but does not seem to cover all cases]
|
||||
//
|
||||
// NOTE: import statement can not use in TypeScript 1.0.1
|
||||
var program:commander.IExportedCommand = require('commander');
|
||||
|
||||
import program = require("commander");
|
||||
declare module commander {
|
||||
interface IExportedCommand {
|
||||
peppers:boolean;
|
||||
pineapple:boolean;
|
||||
bbq:boolean;
|
||||
cheese:string;
|
||||
}
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-C, --chdir <path>', 'change the working directory')
|
||||
.option('-c, --config <path>', 'set config path [./deploy.conf]')
|
||||
.option('-T, --no-tests', 'ignore test hook')
|
||||
.version('0.0.1')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineapple');
|
||||
if (program.bbq) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
|
||||
function range(val:string) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val:string) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
function collect(val:string, memo:string[]) {
|
||||
memo.push(val);
|
||||
return memo;
|
||||
}
|
||||
|
||||
function increaseVerbosity(v:any, total:number) {
|
||||
return total + 1;
|
||||
}
|
||||
|
||||
declare module commander {
|
||||
interface IExportedCommand {
|
||||
integer:number;
|
||||
float:number;
|
||||
optional:string;
|
||||
range:number[];
|
||||
list:string[];
|
||||
collect:string[];
|
||||
verbose:number;
|
||||
}
|
||||
}
|
||||
|
||||
// $ deploy setup stage
|
||||
// $ deploy setup
|
||||
program
|
||||
.command('setup [env]')
|
||||
.description('run setup commands for all envs')
|
||||
.action(function (env?) {
|
||||
env = env || 'all';
|
||||
console.log('setup for %s env(s)', env);
|
||||
});
|
||||
.version('0.0.1')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' collect: %j', program.collect);
|
||||
console.log(' verbosity: %j', program.verbose);
|
||||
console.log(' args: %j', program.args);
|
||||
|
||||
|
||||
// $ deploy stage
|
||||
// $ deploy production
|
||||
program
|
||||
.command('*')
|
||||
.action(function (env?) {
|
||||
console.log('deploying "%s"', env);
|
||||
});
|
||||
.version('0.0.1')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
program.option('-p, --pepper', 'add pepper');
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.option('-C, --chdir <path>', 'change the working directory');
|
||||
|
||||
program.prompt('Username: ', function (name) {
|
||||
console.log('hi %s', name);
|
||||
program.on('--help', () => {
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.prompt('Description:', function (desc) {
|
||||
console.log('description was "%s"', desc.trim());
|
||||
});
|
||||
program.parse(process.argv);
|
||||
|
||||
program.promptForNumber("Enter a number:", (n) => { });
|
||||
|
||||
program.confirm("Confirm? ", (f) => { });
|
||||
|
||||
program.choose(["a", "b", "c"], (i) => { });
|
||||
console.log('stuff');
|
||||
|
||||
Vendored
+383
-209
@@ -1,228 +1,402 @@
|
||||
// Type definitions for commanderjs 1.1.1
|
||||
// Type definitions for commanderjs 2.3.0
|
||||
// Project: https://github.com/visionmedia/commander.js
|
||||
// Definitions by: Marcelo Dezem <http://github.com/mdezem>
|
||||
// Definitions by: Marcelo Dezem <http://github.com/mdezem>, vvakame <http://github.com/vvakame>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "commander" {
|
||||
export interface Command {
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module commander {
|
||||
interface ICommandStatic {
|
||||
/**
|
||||
* The command name.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
//
|
||||
//
|
||||
// NOTE: the methods below are COPIED to the module
|
||||
// as functions exports. If changes need to be made here,
|
||||
// remember to re-paste the definitions in the module.
|
||||
// Read below to know why such ugly thing is required.
|
||||
//
|
||||
//
|
||||
|
||||
/**
|
||||
* Register callback fn for the command.
|
||||
*/
|
||||
action(fn: (...args: any[]) => any): Command;
|
||||
|
||||
/**
|
||||
* Define option with flags, description and optional coercion function and default value.
|
||||
* The flags string should contain both the short and long flags
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when --help is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* @param flags the option flags.
|
||||
* @param description the option description. The description is printed when "--help" is used.
|
||||
* @param coerceFn (optional) specifies a callback function to coerce the option arg.
|
||||
* @param defaultValue (optional) specifies a default value.
|
||||
*/
|
||||
option(flags: string, description: string, coerceFn?: (value: string) => any, defaultValue?: any): Command;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the command version
|
||||
*/
|
||||
version(version: string): Command;
|
||||
|
||||
/**
|
||||
* Parse the arguments array and invokes the commands passing the parsed options.
|
||||
* @param argv the arguments array.
|
||||
*/
|
||||
parse(argv: string[]): Command;
|
||||
|
||||
/**
|
||||
* Gets or sets the command description.
|
||||
* @param description the new description for the command. When ommited this returns the current description, otherwise returns the current Command.
|
||||
*/
|
||||
description(description: string): Command;
|
||||
description(): string;
|
||||
|
||||
/**
|
||||
* Gets or sets the usage help string.
|
||||
*/
|
||||
usage(usage: string): Command;
|
||||
usage(): string;
|
||||
|
||||
/*
|
||||
* Prompt the user for a value, calling the callback function.
|
||||
*
|
||||
* Supports single-line and multi-line prompts.
|
||||
* To issue a single-line prompt simply add a whitespace
|
||||
* to the end of label, something like "name: ", whereas
|
||||
* for a multi-line prompt omit this "description:".
|
||||
* @param label the label string to be printed in console.
|
||||
* @param callback a callback function to handle the inputed string.
|
||||
*/
|
||||
prompt(label: string, callback: (value: string) => any): void;
|
||||
|
||||
promptForNumber(label: string, callback: (value: number) => any): void;
|
||||
promptForDate(label: string, callback: (value: Date) => any): void;
|
||||
promptSingleLine(label: string, callback: (value: string) => any): void;
|
||||
promptMultiLine(label: string, callback: (value: string) => any): void;
|
||||
|
||||
/**
|
||||
* Prompt for password with a label, a optional mask char and callback function.
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
password(label: string, mask: string, callback: (value: string) => any): void;
|
||||
password(label: string, callback: (value: string) => any): void;
|
||||
|
||||
/**
|
||||
* Prompts the user for a confirmation.
|
||||
*/
|
||||
confirm(label: string, callback: (flag: boolean) => any): void;
|
||||
|
||||
/**
|
||||
* Prompt for password with str, mask char and callback fn(val).
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
choose(options: string[], callback: (idx: number) => any): void;
|
||||
choose(options: any[], callback: (idx: number) => any): void;
|
||||
|
||||
/**
|
||||
* Add command with the specified name. Returns a new instance of Command.
|
||||
*
|
||||
* The .action() callback is invoked when the
|
||||
* command name is specified via ARGV,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
|
||||
* When the name is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of ARGV remaining.
|
||||
*
|
||||
* @param name the name of the command. Pass "*" to trap un-matched commands.
|
||||
*/
|
||||
command(name: string): Command;
|
||||
* Initialize a new `Command`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api public
|
||||
*/
|
||||
new (name?:string):ICommand;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// since TypeScript (and ECMA6) does not supports module.exports,
|
||||
// there is no way to set the default Command instance as the module itself.
|
||||
// It's ugly but the only way is to copy all the methods from Command
|
||||
// and paste it in the module as functions exports.
|
||||
//
|
||||
//
|
||||
interface ICommand extends NodeJS.EventEmitter {
|
||||
args: string[];
|
||||
_args: { required:boolean; name: string; }[];
|
||||
|
||||
/**
|
||||
* Register callback fn for the command.
|
||||
*/
|
||||
export function action(fn: (...args: any[]) => any): Command;
|
||||
/**
|
||||
* Add command `name`.
|
||||
*
|
||||
* The `.action()` callback is invoked when the
|
||||
* command `name` is specified via __ARGV__,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
*
|
||||
* When the `name` is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of __ARGV__ remaining.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .version('0.0.1')
|
||||
* .option('-C, --chdir <path>', 'change the working directory')
|
||||
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
* .option('-T, --no-tests', 'ignore test hook')
|
||||
*
|
||||
* program
|
||||
* .command('setup')
|
||||
* .description('run remote setup commands')
|
||||
* .action(function(){
|
||||
* console.log('setup');
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('exec <cmd>')
|
||||
* .description('run the given remote command')
|
||||
* .action(function(cmd){
|
||||
* console.log('exec "%s"', cmd);
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('*')
|
||||
* .description('deploy the given env')
|
||||
* .action(function(env){
|
||||
* console.log('deploying "%s"', env);
|
||||
* });
|
||||
*
|
||||
* program.parse(process.argv);
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} [desc]
|
||||
* @return {Command} the new command
|
||||
* @api public
|
||||
*/
|
||||
command(name:string, desc?:string):ICommand;
|
||||
|
||||
/**
|
||||
* Define option with flags, description and optional coercion function and default value.
|
||||
* The flags string should contain both the short and long flags
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when --help is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* @param flags the option flags.
|
||||
* @param description the option description. The description is printed when "--help" is used.
|
||||
* @param coerceFn (optional) specifies a callback function to coerce the option arg.
|
||||
* @param defaultValue (optional) specifies a default value.
|
||||
*/
|
||||
export function option(flags: string, description: string, coerceFn?: (value: string) => any, defaultValue?: any): Command;
|
||||
/**
|
||||
* Add an implicit `help [cmd]` subcommand
|
||||
* which invokes `--help` for the given command.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
addImplicitHelpCommand():void;
|
||||
|
||||
/**
|
||||
* Parse expected `args`.
|
||||
*
|
||||
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
parseExpectedArgs(args:string[]):ICommand;
|
||||
|
||||
/**
|
||||
* Sets the command version
|
||||
*/
|
||||
export function version(version: string): Command;
|
||||
/**
|
||||
* Register callback `fn` for the command.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .command('help')
|
||||
* .description('display verbose help')
|
||||
* .action(function(){
|
||||
* // output help here
|
||||
* });
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
action(fn:(...args:any[])=>void):ICommand;
|
||||
|
||||
/**
|
||||
* Parse the arguments array and invokes the commands passing the parsed options.
|
||||
* @param argv the arguments array.
|
||||
*/
|
||||
export function parse(argv: string[]): Command;
|
||||
/**
|
||||
* Define option with `flags`, `description` and optional
|
||||
* coercion `fn`.
|
||||
*
|
||||
* The `flags` string should contain both the short and long flags,
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when `--help` is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // simple boolean defaulting to false
|
||||
* program.option('-p, --pepper', 'add pepper');
|
||||
*
|
||||
* --pepper
|
||||
* program.pepper
|
||||
* // => Boolean
|
||||
*
|
||||
* // simple boolean defaulting to true
|
||||
* program.option('-C, --no-cheese', 'remove cheese');
|
||||
*
|
||||
* program.cheese
|
||||
* // => true
|
||||
*
|
||||
* --no-cheese
|
||||
* program.cheese
|
||||
* // => false
|
||||
*
|
||||
* // required argument
|
||||
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||
*
|
||||
* --chdir /tmp
|
||||
* program.chdir
|
||||
* // => "/tmp"
|
||||
*
|
||||
* // optional argument
|
||||
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @param {Function|Mixed} fn or default
|
||||
* @param {Mixed} defaultValue
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
option(flags:string, description?:string, fn?:(arg1:any, arg2:any)=>void, defaultValue?:any):ICommand;
|
||||
option(flags:string, description?:string, defaultValue?:any):ICommand;
|
||||
|
||||
/**
|
||||
* Gets or sets the command description.
|
||||
* @param description the new description for the command. When ommited this returns the current description, otherwise returns the current Command.
|
||||
*/
|
||||
export function description(description: string): Command;
|
||||
export function description(): string;
|
||||
/**
|
||||
* Parse `argv`, settings options and invoking commands when defined.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
parse(argv:string[]):ICommand;
|
||||
|
||||
/**
|
||||
* Gets or sets the usage help string.
|
||||
*/
|
||||
export function usage(usage: string): Command;
|
||||
export function usage(): string;
|
||||
/**
|
||||
* Execute a sub-command executable.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @param {Array} args
|
||||
* @param {Array} unknown
|
||||
* @api private
|
||||
*/
|
||||
executeSubCommand(argv:string[], args:string[], unknown:string[]):any; /* child_process.ChildProcess */
|
||||
|
||||
/*
|
||||
* Prompt the user for a value, calling the callback function.
|
||||
*
|
||||
* Supports single-line and multi-line prompts.
|
||||
* To issue a single-line prompt simply add a whitespace
|
||||
* to the end of label, something like "name: ", whereas
|
||||
* for a multi-line prompt omit this "description:".
|
||||
* @param label the label string to be printed in console.
|
||||
* @param callback a callback function to handle the inputed string.
|
||||
*/
|
||||
export function prompt(label: string, callback: (value: string) => any): void;
|
||||
/**
|
||||
* Normalize `args`, splitting joined short flags. For example
|
||||
* the arg "-abc" is equivalent to "-a -b -c".
|
||||
* This also normalizes equal sign and splits "--abc=def" into "--abc def".
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
normalize(args:string[]):string[];
|
||||
|
||||
export function promptForNumber(label: string, callback: (value: number) => any): void;
|
||||
export function promptForDate(label: string, callback: (value: Date) => any): void;
|
||||
export function promptSingleLine(label: string, callback: (value: string) => any): void;
|
||||
export function promptMultiLine(label: string, callback: (value: string) => any): void;
|
||||
/**
|
||||
* Prompt for password with a label, a optional mask char and callback function.
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
export function password(label: string, mask: string, callback: (value: string) => any): void;
|
||||
export function password(label: string, callback: (value: string) => any): void;
|
||||
/**
|
||||
* Parse command `args`.
|
||||
*
|
||||
* When listener(s) are available those
|
||||
* callbacks are invoked, otherwise the "*"
|
||||
* event is emitted and those actions are invoked.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api private
|
||||
*/
|
||||
parseArgs(args:string[], unknown:string[]):ICommand;
|
||||
|
||||
/**
|
||||
* Prompts the user for a confirmation.
|
||||
*/
|
||||
export function confirm(label: string, callback: (flag: boolean) => any): void;
|
||||
/**
|
||||
* Return an option matching `arg` if any.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Option}
|
||||
* @api private
|
||||
*/
|
||||
optionFor(arg:string):IOption;
|
||||
|
||||
/**
|
||||
* Prompt for password with str, mask char and callback fn(val).
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
export function choose(options: string[], callback: (idx: number) => any): void;
|
||||
export function choose(options: any[], callback: (idx: number) => any): void;
|
||||
/**
|
||||
* Parse options from `argv` returning `argv`
|
||||
* void of these options.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
parseOptions(argv:string[]): {args:string[]; unknown:string[];};
|
||||
|
||||
/**
|
||||
* Add command with the specified name. Returns a new instance of Command.
|
||||
*
|
||||
* The .action() callback is invoked when the
|
||||
* command name is specified via ARGV,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
/**
|
||||
* Return an object containing options as key-value pairs
|
||||
*
|
||||
* @return {Object}
|
||||
* @api public
|
||||
*/
|
||||
opts():any;
|
||||
|
||||
* When the name is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of ARGV remaining.
|
||||
*
|
||||
* @param name the name of the command. Pass "*" to trap un-matched commands.
|
||||
*/
|
||||
export function command(name: string): Command;
|
||||
}
|
||||
/**
|
||||
* Argument `name` is missing.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api private
|
||||
*/
|
||||
missingArgument(name:string):void;
|
||||
|
||||
/**
|
||||
* `Option` is missing an argument, but received `flag` or nothing.
|
||||
*
|
||||
* @param {String} option
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
optionMissingArgument(option:{flags:string;}, flag?:string):void;
|
||||
|
||||
/**
|
||||
* Unknown option `flag`.
|
||||
*
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
unknownOption(flag:string):void;
|
||||
|
||||
/**
|
||||
* Set the program version to `str`.
|
||||
*
|
||||
* This method auto-registers the "-V, --version" flag
|
||||
* which will print the version number when passed.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {String} flags
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
version(str:string, flags?:string):ICommand;
|
||||
|
||||
/**
|
||||
* Set the description to `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
description(str:string):ICommand;
|
||||
description():string;
|
||||
|
||||
/**
|
||||
* Set an alias for the command
|
||||
*
|
||||
* @param {String} alias
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
alias(alias:string):ICommand;
|
||||
alias():string;
|
||||
|
||||
/**
|
||||
* Set / get the command usage `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
usage(str:string):ICommand;
|
||||
usage():string;
|
||||
|
||||
/**
|
||||
* Get the name of the command
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
name():string;
|
||||
|
||||
/**
|
||||
* Return the largest option length.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
largestOptionLength():number;
|
||||
|
||||
/**
|
||||
* Return help for options.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
optionHelp():string;
|
||||
|
||||
/**
|
||||
* Return command help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
commandHelp():string;
|
||||
|
||||
/**
|
||||
* Return program help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
helpInformation():string;
|
||||
|
||||
/**
|
||||
* Output help information for this command
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
outputHelp():void;
|
||||
|
||||
/**
|
||||
* Output help information and exit.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
help():void;
|
||||
}
|
||||
|
||||
interface IOptionStatic {
|
||||
/**
|
||||
* Initialize a new `Option` with the given `flags` and `description`.
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @api public
|
||||
*/
|
||||
new (flags:string, description?:string):IOption;
|
||||
}
|
||||
|
||||
interface IOption {
|
||||
flags:string;
|
||||
required:boolean;
|
||||
optional:boolean;
|
||||
bool:boolean;
|
||||
short?:string;
|
||||
long:string;
|
||||
description:string;
|
||||
|
||||
/**
|
||||
* Return option name.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
name():string;
|
||||
|
||||
/**
|
||||
* Check if `arg` matches the short or long flag.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
is(arg:string):boolean;
|
||||
}
|
||||
|
||||
interface IExportedCommand extends ICommand {
|
||||
Command: commander.ICommandStatic;
|
||||
Option: commander.IOptionStatic;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "commander" {
|
||||
var _tmp:commander.IExportedCommand;
|
||||
export = _tmp;
|
||||
}
|
||||
|
||||
Vendored
+11
-5
@@ -719,6 +719,7 @@ declare module D3 {
|
||||
(name: string): string;
|
||||
(name: string, value: any): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any): Selection;
|
||||
(classValueMap: Object): Selection;
|
||||
};
|
||||
|
||||
style: {
|
||||
@@ -841,6 +842,11 @@ declare module D3 {
|
||||
entries(values: any[]): NestKeyValue[];
|
||||
}
|
||||
|
||||
export interface MapKeyValue<T> {
|
||||
key: string;
|
||||
value: T;
|
||||
}
|
||||
|
||||
export interface Map<T> {
|
||||
has(key: string): boolean;
|
||||
get(key: string): T;
|
||||
@@ -848,7 +854,7 @@ declare module D3 {
|
||||
remove(key: string): boolean;
|
||||
keys(): string[];
|
||||
values(): T[];
|
||||
entries(): any[][]; // Actually of form [key: string, val: T][], but this is inexpressible in Typescript
|
||||
entries(): MapKeyValue<T>[];
|
||||
forEach(func: (key: string, value: T) => void ): void;
|
||||
empty(): boolean;
|
||||
size(): number;
|
||||
@@ -1902,13 +1908,13 @@ declare module D3 {
|
||||
/**
|
||||
* Get the accessor function that controls where the line is defined.
|
||||
*/
|
||||
(): (data: any, index ?: number) => boolean;
|
||||
(): (data: any, index?: number) => boolean;
|
||||
/**
|
||||
* Set the accessor function that controls where the area is defined.
|
||||
*
|
||||
* @param defined The new accessor function
|
||||
*/
|
||||
(defined: (data: any) => boolean): Line;
|
||||
(defined: (data: any, index?: number) => boolean): Line;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2198,13 +2204,13 @@ declare module D3 {
|
||||
/**
|
||||
* Get the accessor function that controls where the area is defined.
|
||||
*/
|
||||
(): (data: any) => any;
|
||||
(): (data: any, index?: number) => any;
|
||||
/**
|
||||
* Set the accessor function that controls where the area is defined.
|
||||
*
|
||||
* @param defined The new accessor function
|
||||
*/
|
||||
(defined: (data: any) => any): Area;
|
||||
(defined: (data: any, index?: number) => any): Area;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vendored
-1
@@ -4,7 +4,6 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module DevExpress {
|
||||
export function abstract(): void;
|
||||
export var rtlEnabled: boolean;
|
||||
|
||||
Vendored
+4
-3
@@ -751,8 +751,8 @@ export interface ILayoutController {
|
||||
static create(container: JQuery, options: TransitionExecutorOptions): TransitionExecutor;
|
||||
}
|
||||
export interface ViewEngineOptions {
|
||||
$root?: JQuery;
|
||||
device?: IDevice;
|
||||
$root: JQuery;
|
||||
device: IDevice;
|
||||
commandManager?: CommandManager;
|
||||
templateEngine?: ITemplateEngine;
|
||||
dataOptionsAttributeName?: string;
|
||||
@@ -906,9 +906,10 @@ export interface dxAutocompleteOptions extends dxDropDownEditorOptions {
|
||||
}
|
||||
export interface dxButtonOptions extends WidgetOptions {
|
||||
type?: string;
|
||||
text?: string;
|
||||
text?: string;
|
||||
icon?: string;
|
||||
iconSrc?: string;
|
||||
clickAction?: any;
|
||||
}
|
||||
export class dxButton extends Widget {
|
||||
constructor(element: Element, options?: dxButtonOptions);
|
||||
|
||||
Vendored
+50
-3
@@ -751,8 +751,8 @@ export interface ILayoutController {
|
||||
static create(container: JQuery, options: TransitionExecutorOptions): TransitionExecutor;
|
||||
}
|
||||
export interface ViewEngineOptions {
|
||||
$root?: JQuery;
|
||||
device?: IDevice;
|
||||
$root: JQuery;
|
||||
device: IDevice;
|
||||
commandManager?: CommandManager;
|
||||
templateEngine?: ITemplateEngine;
|
||||
dataOptionsAttributeName?: string;
|
||||
@@ -906,9 +906,10 @@ export interface dxAutocompleteOptions extends dxDropDownEditorOptions {
|
||||
}
|
||||
export interface dxButtonOptions extends WidgetOptions {
|
||||
type?: string;
|
||||
text?: string;
|
||||
text?: string;
|
||||
icon?: string;
|
||||
iconSrc?: string;
|
||||
clickAction?: any;
|
||||
}
|
||||
export class dxButton extends Widget {
|
||||
constructor(element: Element, options?: dxButtonOptions);
|
||||
@@ -1536,6 +1537,7 @@ export interface dxDataGridFilterDescriptions {
|
||||
getSelectedRowKeys: () => Array<any>;
|
||||
getSelectedRowsData: () => Array<any>;
|
||||
selectRows: (keys: Array<any>) => void;
|
||||
selectRowsByIndexes: (indexes: Array<any>) => void;
|
||||
searchByText: (text: string) => void;
|
||||
insertRow: () => void;
|
||||
editRow: (rowIndex: number) => void;
|
||||
@@ -1560,6 +1562,48 @@ export interface dxDataGridFilterDescriptions {
|
||||
isScrollbarVisible: () => boolean;
|
||||
getTopVisibleRowData: () => {};
|
||||
}
|
||||
export interface dxMenuOptions extends CollectionContainerWidgetOptions {
|
||||
orientation?: string;
|
||||
submenuDirection?: string;
|
||||
showFirstSubmenuMode?: string;
|
||||
enableHotTrack?: boolean;
|
||||
allowSelection?: boolean;
|
||||
allowSelectOnClick?: boolean;
|
||||
selectedItem?: any;
|
||||
itemSelectAction?: any;
|
||||
cssClass?: string;
|
||||
}
|
||||
export interface dxContextMenuOptions extends CollectionContainerWidgetOptions {
|
||||
showSubmenuMode?: string;
|
||||
invokeOnlyFromCode?: boolean;
|
||||
cssClass?: string;
|
||||
enableHotTrack?: boolean;
|
||||
allowSelection?: boolean;
|
||||
allowSelectOnClick?: boolean;
|
||||
selectedItem?: any;
|
||||
itemSelectAction?: any;
|
||||
animation?: any;
|
||||
position?: any;
|
||||
showingAction?: any;
|
||||
submenuDirection?: string;
|
||||
}
|
||||
export class dxMenu extends CollectionContainerWidget {
|
||||
constructor(element: Element, options?: dxMenuOptions);
|
||||
constructor(element: JQuery, options?: dxMenuOptions);
|
||||
}
|
||||
export class dxContextMenu extends CollectionContainerWidget {
|
||||
constructor(element: Element, options?: dxContextMenuOptions);
|
||||
constructor(element: JQuery, options?: dxContextMenuOptions);
|
||||
}
|
||||
export interface dxColorPickerOptions extends dxDropDownEditorOptions {
|
||||
editAlphaChannel?: boolean;
|
||||
applyButtonText?: string;
|
||||
cancelButtonText?: string;
|
||||
}
|
||||
export class dxColorPicker extends dxDropDownEditor {
|
||||
constructor(element: Element, options?: dxColorPickerOptions);
|
||||
constructor(element: JQuery, options?: dxColorPickerOptions);
|
||||
}
|
||||
}
|
||||
interface JQuery {
|
||||
dxAutocomplete(options?: DevExpress.ui.dxAutocompleteOptions): JQuery;
|
||||
@@ -1594,4 +1638,7 @@ dxLoadIndicator(options?: DevExpress.ui.dxLoadIndicatorOptions): JQuery;
|
||||
dxMultiView(options?: DevExpress.ui.dxMultiViewOptions): JQuery;
|
||||
dxGallery(options?: DevExpress.ui.dxGalleryOptions): JQuery;
|
||||
dxDataGrid(options?: DevExpress.ui.dxDataGridOptions): JQuery;
|
||||
dxMenu(options?: DevExpress.ui.dxMenuOptions): JQuery;
|
||||
dxContextMenu(options?: DevExpress.ui.dxContextMenuOptions): JQuery;
|
||||
dxColorPicker(options?: DevExpress.ui.dxColorPickerOptions): JQuery;
|
||||
}
|
||||
Vendored
+3
-3
@@ -101908,7 +101908,7 @@ declare module dijit {
|
||||
* @param callback
|
||||
* @param onError
|
||||
*/
|
||||
getChildren(parentItem: dojo.data.api.Item, callback: {(items:any[])}, onError: Function): void;
|
||||
getChildren(parentItem: dojo.data.api.Item, callback: {(items:any[]):any;}, onError: Function): void;
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
@@ -102160,7 +102160,7 @@ declare module dijit {
|
||||
* @param onComplete
|
||||
* @param onError
|
||||
*/
|
||||
getChildren(parentItem: Object, onComplete: {(items:any[])}, onError: Function): void;
|
||||
getChildren(parentItem: Object, onComplete: {(items:any[]):any;}, onError: Function): void;
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
@@ -102331,7 +102331,7 @@ declare module dijit {
|
||||
* @param onComplete
|
||||
* @param onError
|
||||
*/
|
||||
getChildren(parentItem: dojo.data.api.Item, onComplete: {(items:any[])}, onError: Function): void;
|
||||
getChildren(parentItem: dojo.data.api.Item, onComplete: {(items:any[]):any;}, onError: Function): void;
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
|
||||
Vendored
+1
-2
@@ -4,7 +4,6 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="dojo.d.ts" />
|
||||
/// <reference path="dojox.geo.d.ts" />
|
||||
declare module dojox {
|
||||
|
||||
/**
|
||||
@@ -5277,7 +5276,7 @@ declare module dojox {
|
||||
* @param c an x component of a central point, or a central point
|
||||
* @param d a y component of a central point
|
||||
*/
|
||||
scaleAt(a: number, b: number, c: dojox.geo.openlayers.Point, d: number): dojox.gfx.matrix.Matrix2D;
|
||||
scaleAt(a: number, b: number, c: dojox.gfx.Point, d: number): dojox.gfx.matrix.Matrix2D;
|
||||
/**
|
||||
* forms an x skewing matrix
|
||||
* The resulting matrix is used to skew points in the x dimension
|
||||
|
||||
Vendored
+4
-4
@@ -7381,7 +7381,7 @@ declare module dojox {
|
||||
* @param onError
|
||||
* @param queryObj
|
||||
*/
|
||||
getChildren(parentItem: dojo.data.api.Item, onComplete: {(items:Object[], size?:number)}, onError: Function, queryObj?: Object): void;
|
||||
getChildren(parentItem: dojo.data.api.Item, onComplete: {(items:Object[], size?:number): any;}, onError: Function, queryObj?: Object): void;
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
@@ -21624,19 +21624,19 @@ declare module dojox {
|
||||
* @param searchArgs
|
||||
* @param onSearched
|
||||
*/
|
||||
searchRow(searchArgs: Object, onSearched: {(index:number,item:Object)}): void;
|
||||
searchRow(searchArgs: Object, onSearched: {(index:number,item:Object): any;}): void;
|
||||
/**
|
||||
*
|
||||
* @param searchArgs
|
||||
* @param onSearched
|
||||
*/
|
||||
searchRow(searchArgs: RegExp, onSearched: {(index:number,item:Object)}): void;
|
||||
searchRow(searchArgs: RegExp, onSearched: {(index:number,item:Object): any;}): void;
|
||||
/**
|
||||
*
|
||||
* @param searchArgs
|
||||
* @param onSearched
|
||||
*/
|
||||
searchRow(searchArgs: String, onSearched: {(index:number,item:Object)}): void;
|
||||
searchRow(searchArgs: String, onSearched: {(index:number,item:Object): any;}): void;
|
||||
/**
|
||||
* Subscribes to the specified topic and calls the specified method
|
||||
* of this object.
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Ember.js 1.0.0
|
||||
// Project: http://emberjs.com/
|
||||
// Definitions by: Jed Hunsaker <https://github.com/jedhunsaker/>
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path="./express-myconnection.d.ts" />
|
||||
|
||||
import express = require('express');
|
||||
import mysql = require('mysql');
|
||||
import connection = require('express-myconnection');
|
||||
|
||||
var app = express();
|
||||
|
||||
app.use(
|
||||
connection(
|
||||
mysql,
|
||||
{
|
||||
host: 'localhost',
|
||||
user: 'dbuser',
|
||||
password: 'password',
|
||||
port: 3306,
|
||||
database: 'mydb'
|
||||
},
|
||||
'single'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
app.use(function list(req: express.Request, res: express.Response, next: Function){
|
||||
|
||||
req.getConnection(function(err: mysql.IError, connection: mysql.IConnection) {
|
||||
if (err) return next(err);
|
||||
|
||||
connection.query('SELECT 1 AS RESULT', [], function(err: mysql.IError, results: any) {
|
||||
if (err) return next(err);
|
||||
|
||||
results[0].RESULT;
|
||||
// -> 1
|
||||
|
||||
res.send(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for express-myconnection v1.0.4
|
||||
// Project: https://www.npmjs.org/package/express-myconnection
|
||||
// Definitions by: Michael Ferris <https://github.com/Cellule/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
/// <reference path="../mysql/mysql.d.ts" />
|
||||
|
||||
declare module mysql{
|
||||
export interface IConnection {}
|
||||
export interface IError {}
|
||||
}
|
||||
|
||||
declare module Express {
|
||||
|
||||
export interface Request {
|
||||
getConnection?: (callback: (err: mysql.IError, connection: mysql.IConnection) => void) => void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "express-myconnection" {
|
||||
import express = require('express');
|
||||
import mysql = require('mysql');
|
||||
|
||||
function connection(mysql: mysql.IMySql, dbConfig: mysql.IConnectionConfig, strategy: string): express.RequestHandler;
|
||||
|
||||
export = connection;
|
||||
}
|
||||
|
||||
@@ -145,9 +145,9 @@ fs.readdir(path, (err: Error, files: string[]) => {
|
||||
strArr = fs.readdirSync(path);
|
||||
fs.close(fd, errorCallback);
|
||||
fs.closeSync(fd);
|
||||
fs.open(path, flags, modeStr, (err: Error, fd: number) => [
|
||||
|
||||
]);
|
||||
fs.open(path, flags, modeStr, (err: Error, fd: number) => {
|
||||
|
||||
});
|
||||
num = fs.openSync(path, flags, modeStr);
|
||||
fs.utimes(path, atime, mtime, errorCallback);
|
||||
fs.utimesSync(path, atime, mtime);
|
||||
|
||||
@@ -2,24 +2,44 @@
|
||||
/// <reference path="../jasmine/jasmine.d.ts" />
|
||||
|
||||
describe("tester Google Analytics Tracker _gat object", () => {
|
||||
|
||||
it("can set ga script element", () => {
|
||||
ga = <HTMLScriptElement>document.createElement("script");
|
||||
gaClassic = <HTMLScriptElement>document.createElement("script");
|
||||
});
|
||||
|
||||
it("can set aync to true", () => {
|
||||
ga.async = true;
|
||||
});
|
||||
|
||||
gaClassic.async = true;
|
||||
});
|
||||
it("can set src to string url", () => {
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';;
|
||||
gaClassic.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
});
|
||||
|
||||
it("can set type", () => {
|
||||
ga.type = 'text/javascript';
|
||||
gaClassic.type = 'text/javascript';
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('UniversalAnalytics', () => {
|
||||
it('should exercise all ga APIs', () => {
|
||||
ga('create', 'UA-65432-1', 'auto');
|
||||
ga('create', 'UA-65432-1', {some: 'config'});
|
||||
ga('create', 'UA-65432-1', 'auto', {some: 'config'});
|
||||
ga('send', 'pageview');
|
||||
ga('send', 'pageview', {some: 'details'});
|
||||
ga.create('UA-65432-1', 'auto');
|
||||
ga.create('UA-65432-1', {some: 'config'});
|
||||
ga.create('UA-65432-1', 'auto', {some: 'config'});
|
||||
ga.getAll();
|
||||
ga.getByName('aNamedTracker');
|
||||
});
|
||||
it('should excercise Tracker APIs', () => {
|
||||
var tracker: UniversalAnalytics.Tracker = ga('create', 'UA-65432-1', 'auto');
|
||||
var aString: string = tracker.get<string>('aString');
|
||||
var aNumber: number = tracker.get<number>('aNumber');
|
||||
var anObject: {} = tracker.get<{}>('anObject');
|
||||
tracker.send('pageview');
|
||||
tracker.send('pageview', {some: 'details'});
|
||||
tracker.set('aString', aString);
|
||||
tracker.set('aNumber', aNumber);
|
||||
tracker.set('anObject', anObject);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tester Google Analytics Tracker _gat object", () => {
|
||||
@@ -27,7 +47,7 @@ describe("tester Google Analytics Tracker _gat object", () => {
|
||||
_gat._createTracker('UA-65432-1');
|
||||
_gat._createTracker('UA-65432-2', 't2');
|
||||
});
|
||||
|
||||
|
||||
it("can create _getTrackerByName", () => {
|
||||
_gat._getTrackerByName();
|
||||
_gat._getTrackerByName('t2');
|
||||
@@ -36,7 +56,7 @@ describe("tester Google Analytics Tracker _gat object", () => {
|
||||
it("can create _anonymizeIp", () => {
|
||||
_gat._anonymizeIp();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe("tester Google Analytics Code _gaq object", () => {
|
||||
@@ -50,12 +70,12 @@ describe("tester Google Analytics Code _gaq object", () => {
|
||||
tracker._trackPageview();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("tester Google Analytics Code Tracker object", () => {
|
||||
it("can create Tracker object and call methods", () => {
|
||||
it("can create Tracker object and call methods", () => {
|
||||
var tracker = _gat._getTrackerByName('UA-65432-1');
|
||||
tracker._trackPageview();
|
||||
tracker._getName();
|
||||
@@ -71,6 +91,3 @@ describe("tester Google Analytics Code Tracker object", () => {
|
||||
tracker._trackPageLoadTime();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+28
-4
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Google Analytics
|
||||
// Project: https://developers.google.com/analytics/devguides/collection/gajs/
|
||||
// Definitions by: Ronnie Haakon Hegelund <http://ronniehegelund.blogspot.dk>
|
||||
// Type definitions for Google Analytics (Classic and Universal)
|
||||
// Project: https://developers.google.com/analytics/devguides/collection/gajs/, https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference
|
||||
// Definitions by: Ronnie Haakon Hegelund <http://ronniehegelund.blogspot.dk>, Pat Kujawa <http://patkujawa.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare class Tracker {
|
||||
@@ -36,6 +36,30 @@ interface GoogleAnalytics {
|
||||
async: boolean;
|
||||
}
|
||||
|
||||
declare var ga: GoogleAnalytics;
|
||||
declare module UniversalAnalytics {
|
||||
// https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference
|
||||
|
||||
interface ga {
|
||||
(command: string, poly: string, opt_poly?: {}): UniversalAnalytics.Tracker;
|
||||
(command: string, trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker;
|
||||
(command: string, hitDetails: {}): void;
|
||||
create(trackingId: string, opt_configObject?: {}): UniversalAnalytics.Tracker;
|
||||
create(trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker;
|
||||
getAll(): UniversalAnalytics.Tracker[];
|
||||
getByName(name: string): UniversalAnalytics.Tracker;
|
||||
}
|
||||
|
||||
interface Tracker {
|
||||
get<T>(fieldName: string): T;
|
||||
send(hitType: string, opt_fieldObject?: {}): void;
|
||||
set(fieldName: string, value: string): void;
|
||||
set(fieldName: string, value: {}): void;
|
||||
set(fieldName: string, value: number): void;
|
||||
set(fieldName: string, value: boolean): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare var gaClassic: GoogleAnalytics;
|
||||
declare var ga: UniversalAnalytics.ga;
|
||||
declare var _gaq: GoogleAnalyticsCode;
|
||||
declare var _gat: GoogleAnalyticsTracker;
|
||||
|
||||
Vendored
+7
-6
@@ -97,9 +97,9 @@ declare class TweenMax extends TweenLite {
|
||||
repeatDelay(value:number):any;
|
||||
static resumeAll(tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void;
|
||||
static set(target:Object, vars:Object):TweenMax;
|
||||
static staggerFrom(targets:Object[], duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[];
|
||||
static staggerFromTo(targets:Object[], duration:number, fromVars:Object, toVars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[];
|
||||
static staggerTo(targets:Object[], duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[];
|
||||
static staggerFrom(targets:any, duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[];
|
||||
static staggerFromTo(targets:any, duration:number, fromVars:Object, toVars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[];
|
||||
static staggerTo(targets:any, duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[];
|
||||
time(value:number, suppressEvents?:boolean):any;
|
||||
static to(target:Object, duration:number, vars:Object):TweenMax;
|
||||
totalDuration(value:number):any;
|
||||
@@ -120,6 +120,7 @@ declare class TimelineLite extends SimpleTimeline {
|
||||
clear(labels?:boolean):any;
|
||||
duration(value:number):any;
|
||||
exportRoot(vars?:Object, omitDelayedCalls?:boolean):TimelineLite;
|
||||
from(target:Object, duration:number, vars:Object, position?:any):any;
|
||||
fromTo(target:Object, duration:number, fromVars:Object, toVars:Object, position?:any):any;
|
||||
getChildren(nested?:boolean, tweens?:boolean, timelines?:boolean, ignoreBeforeTime?:number):any[];
|
||||
getLabelTime(label:string):number;
|
||||
@@ -133,9 +134,9 @@ declare class TimelineLite extends SimpleTimeline {
|
||||
set(target: Object, vars: Object, position?:any):any;
|
||||
seek(position:any, suppressEvents?:boolean):any;
|
||||
shiftChildren(amount:number, adjustLabels?:boolean, ignoreBeforeTime?:number):any;
|
||||
staggerFrom(targets:any[], duration:number, vars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteScope?:any):any;
|
||||
staggerFromTo(targets:any[], duration:number, fromVars:Object, toVars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any;
|
||||
staggerTo(targets:any[], duration:number, vars:Object, stagger:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any;
|
||||
staggerFrom(targets:any, duration:number, vars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteScope?:any):any;
|
||||
staggerFromTo(targets:any, duration:number, fromVars:Object, toVars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any;
|
||||
staggerTo(targets:any, duration:number, vars:Object, stagger:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any;
|
||||
stop():any;
|
||||
to(target:Object, duration:number, vars:Object, position?:any):any;
|
||||
usesFrames():Boolean;
|
||||
|
||||
@@ -0,0 +1,597 @@
|
||||
/// <reference path="../mocha/mocha.d.ts" />
|
||||
/// <reference path="../should/should.d.ts" />
|
||||
/// <reference path='../gulp/gulp.d.ts' />
|
||||
/// <reference path='../through2/through2.d.ts' />
|
||||
/// <reference path='gulp-util.d.ts' />
|
||||
|
||||
import gulp = require('gulp');
|
||||
import util = require('gulp-util');
|
||||
import path = require('path');
|
||||
import should = require('should');
|
||||
import Stream = require('stream');
|
||||
import through = require('through2');
|
||||
var es = require('event-stream');
|
||||
|
||||
// ReSharper disable WrongExpressionStatement
|
||||
describe('File()', () => {
|
||||
it('should return a valid file', done => {
|
||||
var fname = path.join(__dirname, './fixtures/test.coffee');
|
||||
var base = path.join(__dirname, './fixtures/');
|
||||
var file = new util.File({
|
||||
base: base,
|
||||
cwd: __dirname,
|
||||
path: fname
|
||||
});
|
||||
should.exist(file, 'root');
|
||||
should.exist(file.relative, 'relative');
|
||||
should.exist(file.path, 'path');
|
||||
should.exist(file.cwd, 'cwd');
|
||||
should.exist(file.base, 'base');
|
||||
file.path.should.equal(fname);
|
||||
file.cwd.should.equal(__dirname);
|
||||
file.base.should.equal(base);
|
||||
file.relative.should.equal('test.coffee');
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return a valid file 2', done => {
|
||||
var fname = path.join(__dirname, './fixtures/test.coffee');
|
||||
var base = __dirname;
|
||||
var file = new util.File({
|
||||
base: base,
|
||||
cwd: __dirname,
|
||||
path: fname
|
||||
});
|
||||
should.exist(file, 'root');
|
||||
should.exist(file.relative, 'relative');
|
||||
should.exist(file.path, 'path');
|
||||
should.exist(file.cwd, 'cwd');
|
||||
should.exist(file.base, 'base');
|
||||
file.path.should.equal(fname);
|
||||
file.cwd.should.equal(__dirname);
|
||||
file.base.should.equal(base);
|
||||
file.relative.should.equal(path.normalize('fixtures/test.coffee'));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('replaceExtension()', () => {
|
||||
it('should return a valid replaced extension on nested', done => {
|
||||
var fname = path.join(__dirname, './fixtures/test.coffee');
|
||||
var expected = path.join(__dirname, './fixtures/test.js');
|
||||
var nu = util.replaceExtension(fname, '.js');
|
||||
should.exist(nu);
|
||||
nu.should.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return a valid replaced extension on flat', done => {
|
||||
var fname = 'test.coffee';
|
||||
var expected = 'test.js';
|
||||
var nu = util.replaceExtension(fname, '.js');
|
||||
should.exist(nu);
|
||||
nu.should.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should not return a valid replaced extension on empty string', done => {
|
||||
var fname = '';
|
||||
var expected = '';
|
||||
var nu = util.replaceExtension(fname, '.js');
|
||||
should.exist(nu);
|
||||
nu.should.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('colors', () => {
|
||||
it('should be a chalk instance', done => {
|
||||
util.colors.should.equal(require('chalk'));
|
||||
done();
|
||||
});
|
||||
});
|
||||
util.log('stuff happened', 'Really it did', util.colors.cyan('123'));
|
||||
|
||||
describe('date', () => {
|
||||
it('should be a date format instance', done => {
|
||||
util.date.should.equal(require('dateformat'));
|
||||
done();
|
||||
});
|
||||
it('should return today\'s date', done => {
|
||||
var time = new Date();
|
||||
var dateutil = util.date('HH:MM:ss');
|
||||
dateutil.should.equal(('0' + time.getHours()).slice(-2) + ':' + ('0' + time.getMinutes()).slice(-2) + ':' + ('0' + time.getSeconds()).slice(-2));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
var now = new Date();
|
||||
|
||||
// Basic usage
|
||||
util.date(now, 'dddd, mmmm dS, yyyy, h:MM:ss TT');
|
||||
// Saturday, June 9th, 2007, 5:46:21 PM
|
||||
|
||||
// You can use one of several named masks
|
||||
util.date(now, 'isoDateTime');
|
||||
// 2007-06-09T17:46:21
|
||||
|
||||
// ...Or add your own
|
||||
util.date.masks.hammerTime = 'HH:MM! "Can\'t touch this!"';
|
||||
util.date(now, 'hammerTime');
|
||||
// 17:46! Can't touch this!
|
||||
|
||||
// When using the standalone dateFormat function,
|
||||
// you can also provide the date as a string
|
||||
util.date('Jun 9 2007', 'fullDate');
|
||||
// Saturday, June 9, 2007
|
||||
|
||||
// Note that if you don't include the mask argument,
|
||||
// dateFormat.masks.default is used
|
||||
util.date(now);
|
||||
// Sat Jun 09 2007 17:46:21
|
||||
|
||||
// And if you don't include the date argument,
|
||||
// the current date and time is used
|
||||
util.date();
|
||||
// Sat Jun 09 2007 17:46:22
|
||||
|
||||
// You can also skip the date argument (as long as your mask doesn't
|
||||
// contain any numbers), in which case the current date/time is used
|
||||
util.date('longTime');
|
||||
// 5:46:22 PM EST
|
||||
|
||||
// And finally, you can convert local time to UTC time. Simply pass in
|
||||
// true as an additional argument (no argument skipping allowed in this case):
|
||||
util.date(now, 'longTime', true);
|
||||
// 10:46:21 PM UTC
|
||||
|
||||
// ...Or add the prefix 'UTC:' or 'GMT:' to your mask.
|
||||
util.date(now, 'UTC:h:MM:ss TT Z');
|
||||
// 10:46:21 PM UTC
|
||||
|
||||
// You can also get the ISO 8601 week of the year:
|
||||
util.date(now, 'W');
|
||||
// 42
|
||||
|
||||
// and also get the ISO 8601 numeric representation of the day of the week:
|
||||
util.date(now, 'N');
|
||||
// 6
|
||||
|
||||
describe('log()', () => {
|
||||
it('should work i guess', done => {
|
||||
var writtenValue = '';
|
||||
|
||||
util.log(1, 2, 3, 4, 'five');
|
||||
var time = util.date(new Date(), 'HH:MM:ss');
|
||||
writtenValue.should.eql('[' + util.colors.gray(time) + '] 1 2 3 4 five\n');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('template()', () => {
|
||||
it('should work with just a template', done => {
|
||||
var opt = {
|
||||
name: 'todd',
|
||||
file: {
|
||||
path: 'hi.js'
|
||||
}
|
||||
};
|
||||
var expected = 'test todd hi.js';
|
||||
|
||||
var tmpl = util.template('test <%= name %> <%= file.path %>');
|
||||
should.exist(tmpl);
|
||||
'function'.should.equal(typeof (tmpl));
|
||||
|
||||
// eval it now
|
||||
var etmpl = tmpl(opt);
|
||||
'string'.should.equal(typeof (etmpl));
|
||||
etmpl.should.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should work with a template and data', done => {
|
||||
var opt = {
|
||||
name: 'todd',
|
||||
file: {
|
||||
path: 'hi.js'
|
||||
}
|
||||
};
|
||||
var expected = 'test todd hi.js';
|
||||
var tmpl = util.template('test <%= name %> <%= file.path %>', opt);
|
||||
should.exist(tmpl);
|
||||
'string'.should.equal(typeof (tmpl));
|
||||
tmpl.should.equal(expected);
|
||||
done();
|
||||
});
|
||||
|
||||
//it('should throw an error when no file object is passed', done => {
|
||||
// var opt = {
|
||||
// name: 'todd'
|
||||
// };
|
||||
// try {
|
||||
// var tmpl = util.template('test <%= name %> <%= file.path %>', opt);
|
||||
// } catch (err) {
|
||||
// should.exist(err);
|
||||
// done();
|
||||
// }
|
||||
//});
|
||||
|
||||
it('should ignore modified templateSettings', done => {
|
||||
var templateSettings = require('lodash.templatesettings');
|
||||
templateSettings.interpolate = /\{\{([\s\S]+?)\}\}/g;
|
||||
|
||||
var opt = {
|
||||
name: 'todd',
|
||||
file: {
|
||||
path: 'hi.js'
|
||||
}
|
||||
};
|
||||
var expected = 'test {{name}} hi.js';
|
||||
|
||||
var tmpl = util.template('test {{name}} <%= file.path %>');
|
||||
should.exist(tmpl);
|
||||
'function'.should.equal(typeof (tmpl));
|
||||
|
||||
// eval it now
|
||||
var etmpl = tmpl(opt);
|
||||
'string'.should.equal(typeof (etmpl));
|
||||
etmpl.should.equal(expected);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should allow ES6 delimiters', done => {
|
||||
var opt = {
|
||||
name: 'todd',
|
||||
file: {
|
||||
path: 'hi.js'
|
||||
}
|
||||
};
|
||||
var expected = 'test todd hi.js';
|
||||
|
||||
var tmpl = util.template('test ${name} ${file.path}');
|
||||
should.exist(tmpl);
|
||||
'function'.should.equal(typeof (tmpl));
|
||||
|
||||
// eval it now
|
||||
var etmpl = tmpl(opt);
|
||||
'string'.should.equal(typeof (etmpl));
|
||||
etmpl.should.equal(expected);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('env', () => {
|
||||
it('should exist', done => {
|
||||
should.exist(util.env);
|
||||
should.exist(util.env._);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('noop()', () => {
|
||||
it('should return a stream', done => {
|
||||
util.isStream(util.noop()).should.equal(true);
|
||||
done();
|
||||
});
|
||||
it('should return a stream that passes through all data', done => {
|
||||
var inp = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
var stream = util.noop();
|
||||
es.readArray(inp)
|
||||
.pipe(stream)
|
||||
.pipe(es.writeArray((err: Error, arr: any[]) => {
|
||||
should.not.exist(err);
|
||||
should.exist(arr);
|
||||
arr.should.eql(inp);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
describe('beep()', () => {
|
||||
it('should send the right code to stdout', done => {
|
||||
var writtenValue = '';
|
||||
|
||||
util.beep();
|
||||
writtenValue.should.equal('\x07');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isStream()', () => {
|
||||
it('should work on a stream', done => {
|
||||
util.isStream(through()).should.equal(true);
|
||||
done();
|
||||
});
|
||||
it('should not work on a buffer', done => {
|
||||
util.isStream(new Buffer('huh')).should.equal(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isBuffer()', () => {
|
||||
it('should work on a buffer', done => {
|
||||
util.isBuffer(new Buffer('huh')).should.equal(true);
|
||||
done();
|
||||
});
|
||||
it('should not work on a stream', done => {
|
||||
util.isBuffer(through()).should.equal(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isNull()', () => {
|
||||
it('should work on a null', done => {
|
||||
util.isNull(null).should.equal(true);
|
||||
done();
|
||||
});
|
||||
it('should not work on a stream', done => {
|
||||
util.isNull(through()).should.equal(false);
|
||||
done();
|
||||
});
|
||||
it('should not work on undefined', done => {
|
||||
util.isNull(undefined).should.equal(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
// linefeed
|
||||
declare var lines: string[];
|
||||
lines.join(util.linefeed);
|
||||
|
||||
describe('combine()', () => {
|
||||
it('should return a function', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
var factory = util.combine(inp);
|
||||
factory.should.be.type('function');
|
||||
done();
|
||||
});
|
||||
it('should return a function that returns a stream combination', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
var inp2 = es.writeArray((err: Error, data: any[]) => {
|
||||
should.not.exist(err);
|
||||
data.should.eql(src);
|
||||
done();
|
||||
});
|
||||
var factory = util.combine(inp, inp2);
|
||||
factory().should.be.instanceof(Stream.Readable);
|
||||
});
|
||||
it('should return a function that returns a stream combination when given an array', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
var inp2 = es.writeArray((err: Error, data: any[]) => {
|
||||
should.not.exist(err);
|
||||
data.should.eql(src);
|
||||
done();
|
||||
});
|
||||
var factory = util.combine([inp, inp2]);
|
||||
factory().should.be.instanceof(Stream.Readable);
|
||||
});
|
||||
});
|
||||
|
||||
describe('buffer()', () => {
|
||||
it('should buffer stuff and return an array into the callback', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
inp.pipe(util.buffer((err: Error, data: any[]) => {
|
||||
should.not.exist(err);
|
||||
should.exist(data);
|
||||
data.should.eql(src);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
it('should buffer stuff and emit it as a data event', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
inp.pipe(util.buffer()).on('data', (data: any[]) => {
|
||||
should.exist(data);
|
||||
data.should.eql(src);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should buffer stuff and return a stream with the buffered data', done => {
|
||||
var src = [1, 2, 3];
|
||||
var inp = es.readArray(src);
|
||||
inp.pipe(util.buffer()).pipe(es.through((data: any[]) => {
|
||||
should.exist(data);
|
||||
data.should.eql(src);
|
||||
done();
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
||||
describe('PluginError()', () => {
|
||||
it('should default name to Error', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
err.name.should.equal('Error');
|
||||
});
|
||||
|
||||
it('should default name to Error, even when wrapped error has no name', () => {
|
||||
var realErr = { message: 'something broke' };
|
||||
var err = new util.PluginError('test', realErr);
|
||||
err.name.should.equal('Error');
|
||||
});
|
||||
|
||||
it('should print the plugin name in toString', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
err.toString().indexOf('test').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should not include the stack by default in toString', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
// just check that there are no 'at' lines
|
||||
err.toString().indexOf('at').should.equal(-1);
|
||||
});
|
||||
|
||||
it('should include the stack when specified in toString', () => {
|
||||
var err = new util.PluginError('test', 'something broke', { stack: "at huh", showStack: true });
|
||||
// just check that there are 'at' lines
|
||||
err.toString().indexOf('at').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should take arguments as one object', () => {
|
||||
var err = new util.PluginError({
|
||||
plugin: 'test',
|
||||
message: 'something broke'
|
||||
});
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
});
|
||||
|
||||
it('should take arguments as plugin name and one object', () => {
|
||||
var err = new util.PluginError('test', {
|
||||
message: 'something broke'
|
||||
});
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
});
|
||||
|
||||
it('should take arguments as plugin name and message', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
});
|
||||
|
||||
it('should take arguments as plugin name, message, and one object', () => {
|
||||
var err = new util.PluginError('test', 'something broke', { showStack: true });
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
err.showStack.should.equal(true);
|
||||
});
|
||||
|
||||
it('should take arguments as plugin name, error, and one object', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
var err = new util.PluginError('test', realErr, { showStack: true, fileName: 'override.js' });
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
err.fileName.should.equal('override.js');
|
||||
err.showStack.should.equal(true);
|
||||
});
|
||||
|
||||
it('should take properties from error', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).abstractProperty = 'abstract';
|
||||
var err = new util.PluginError('test', realErr);
|
||||
err.plugin.should.equal('test');
|
||||
err.message.should.equal('something broke');
|
||||
(<any>err).abstractProperty.should.equal('abstract');
|
||||
});
|
||||
|
||||
it('should be configured to show properties by default', () => {
|
||||
var err = new util.PluginError('test', 'something broke');
|
||||
err.showProperties.should.be.true;
|
||||
});
|
||||
|
||||
it('should not be configured to take option to show properties', () => {
|
||||
var err = new util.PluginError('test', 'something broke', { showProperties: false });
|
||||
err.showProperties.should.be.false;
|
||||
});
|
||||
|
||||
it('should show properties', () => {
|
||||
var err = new util.PluginError('test', 'it broke', { showProperties: true });
|
||||
err.fileName = 'original.js';
|
||||
err.lineNumber = 35;
|
||||
err.toString().indexOf('it broke').should.not.equal(-1);
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should show properties', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).lineNumber = 35;
|
||||
var err = new util.PluginError('test', realErr, { showProperties: true });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should not show properties', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).lineNumber = 35;
|
||||
var err = new util.PluginError('test', realErr, { showProperties: false });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.equal(-1);
|
||||
});
|
||||
|
||||
it('should not show properties, but should show stack', () => {
|
||||
var err = new util.PluginError('test', 'it broke', { stack: 'test stack', showStack: true, showProperties: false });
|
||||
err.fileName = 'original.js';
|
||||
err.lineNumber = 35;
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.equal(-1);
|
||||
err.toString().indexOf('test stack').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should not show properties, but should show stack for real error', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).lineNumber = 35;
|
||||
(<any>realErr).stack = 'test stack';
|
||||
var err = new util.PluginError('test', realErr, { showStack: true, showProperties: false });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.equal(-1);
|
||||
err.toString().indexOf('test stack').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should not show properties, but should show stack for _stack', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).lineNumber = 35;
|
||||
(<any>realErr)._stack = 'test stack';
|
||||
var err = new util.PluginError('test', realErr, { showStack: true, showProperties: false });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.equal(-1);
|
||||
err.toString().indexOf('test stack').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should show properties and stack', () => {
|
||||
var realErr = new Error('something broke');
|
||||
(<any>realErr).fileName = 'original.js';
|
||||
(<any>realErr).stack = 'test stack';
|
||||
var err = new util.PluginError('test', realErr, { showStack: true });
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.not.equal(-1);
|
||||
err.toString().indexOf('test stack').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should show properties added after the error is created', () => {
|
||||
var realErr = new Error('something broke');
|
||||
var err = new util.PluginError('test', realErr);
|
||||
err.fileName = 'original.js';
|
||||
err.toString().indexOf('message:').should.equal(-1);
|
||||
err.toString().indexOf('fileName:').should.not.equal(-1);
|
||||
});
|
||||
|
||||
it('should toString quickly', function(done) {
|
||||
this.timeout(100);
|
||||
|
||||
var err = new util.PluginError('test', 'it broke', { showStack: true });
|
||||
var str = err.toString();
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should toString quickly with original error', function(done) {
|
||||
this.timeout(100);
|
||||
|
||||
var realErr = new Error('it broke');
|
||||
var err = new util.PluginError('test', realErr, { showStack: true });
|
||||
var str = err.toString();
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should not show "Details:" if there are no properties to show', () => {
|
||||
var err = new util.PluginError('plugin', 'message');
|
||||
err.toString().indexOf('Details:').should.equal(-1);
|
||||
});
|
||||
});
|
||||
Vendored
+138
@@ -0,0 +1,138 @@
|
||||
// Type definitions for gulp-util v3.0.x
|
||||
// Project: https://github.com/gulpjs/gulp-util
|
||||
// Definitions by: jedmao <https://github.com/jedmao>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../vinyl/vinyl.d.ts" />
|
||||
/// <reference path="../chalk/chalk.d.ts" />
|
||||
/// <reference path="../through2/through2.d.ts" />
|
||||
|
||||
declare module 'gulp-util' {
|
||||
|
||||
import vinyl = require('vinyl');
|
||||
import chalk = require('chalk');
|
||||
import through2 = require('through2');
|
||||
|
||||
export class File extends vinyl { }
|
||||
|
||||
/**
|
||||
* Replaces a file extension in a path. Returns the new path.
|
||||
*/
|
||||
export function replaceExtension(npath: string, ext: string): string;
|
||||
|
||||
export var colors: typeof chalk;
|
||||
|
||||
export var date: {
|
||||
(now?: Date, mask?: string, convertLocalTimeToUTC?: boolean): any;
|
||||
(date?: string, mask?: string, convertLocalTimeToUTC?: boolean): any;
|
||||
masks: any;
|
||||
};
|
||||
|
||||
/**
|
||||
* Logs stuff. Already prefixed with [gulp] and all that. Use the right colors
|
||||
* for values. If you pass in multiple arguments it will join them by a space.
|
||||
*/
|
||||
export function log(message?: any, ...optionalParams: any[]): void;
|
||||
|
||||
/**
|
||||
* This is a lodash.template function wrapper. You must pass in a valid gulp
|
||||
* file object so it is available to the user or it will error. You can not
|
||||
* configure any of the delimiters. Look at the lodash docs for more info.
|
||||
*/
|
||||
export function template(tmpl: string): (opt: { file: { path: string } }) => string;
|
||||
export function template(tmpl: string, opt: { file: { path: string } }): string;
|
||||
|
||||
export var env: any;
|
||||
|
||||
export function beep(): void;
|
||||
|
||||
/**
|
||||
* Returns a stream that does nothing but pass data straight through.
|
||||
*/
|
||||
export var noop: typeof through2;
|
||||
|
||||
export function isStream(obj: any): boolean;
|
||||
|
||||
export function isBuffer(obj: any): boolean;
|
||||
|
||||
export function isNull(obj: any): boolean;
|
||||
|
||||
export var linefeed: string;
|
||||
|
||||
export function combine(streams: NodeJS.ReadWriteStream[]): () => NodeJS.ReadWriteStream;
|
||||
export function combine(...streams: NodeJS.ReadWriteStream[]): () => NodeJS.ReadWriteStream;
|
||||
|
||||
/**
|
||||
* This is similar to es.wait but instead of buffering text into one string
|
||||
* it buffers anything into an array (so very useful for file objects).
|
||||
*/
|
||||
export function buffer(cb?: (err: Error, data: any[]) => void): NodeJS.ReadWriteStream;
|
||||
|
||||
export class PluginError implements Error, PluginErrorOptions {
|
||||
constructor(options?: PluginErrorOptions);
|
||||
constructor(pluginName: string, options?: PluginErrorOptions);
|
||||
constructor(pluginName: string, message: string, options?: PluginErrorOptions);
|
||||
constructor(pluginName: string, message: Error, options?: PluginErrorOptions);
|
||||
/**
|
||||
* The module name of your plugin.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Can be a string or an existing error.
|
||||
*/
|
||||
message: any;
|
||||
fileName: string;
|
||||
lineNumber: number;
|
||||
/**
|
||||
* You need to include the message along with this stack. If you pass an
|
||||
* error in as the message the stack will be pulled from that, otherwise one
|
||||
* will be created.
|
||||
*/
|
||||
stack: string;
|
||||
/**
|
||||
* By default the stack will not be shown. Set this to true if you think the
|
||||
* stack is important for your error.
|
||||
*/
|
||||
showStack: boolean;
|
||||
/**
|
||||
* Error properties will be included in err.toString(). Can be omitted by
|
||||
* setting this to false.
|
||||
*/
|
||||
showProperties: boolean;
|
||||
plugin: string;
|
||||
error: Error;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface PluginErrorOptions {
|
||||
/**
|
||||
* The module name of your plugin.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* Can be a string or an existing error.
|
||||
*/
|
||||
message?: any;
|
||||
fileName?: string;
|
||||
lineNumber?: number;
|
||||
/**
|
||||
* You need to include the message along with this stack. If you pass an
|
||||
* error in as the message the stack will be pulled from that, otherwise one
|
||||
* will be created.
|
||||
*/
|
||||
stack?: string;
|
||||
/**
|
||||
* By default the stack will not be shown. Set this to true if you think the
|
||||
* stack is important for your error.
|
||||
*/
|
||||
showStack?: boolean;
|
||||
/**
|
||||
* Error properties will be included in err.toString(). Can be omitted by
|
||||
* setting this to false.
|
||||
*/
|
||||
showProperties?: boolean;
|
||||
plugin?: string;
|
||||
error?: Error;
|
||||
}
|
||||
Vendored
+116
-5
@@ -26,14 +26,14 @@ interface HandlebarsCommon {
|
||||
createFrame(object: any): any;
|
||||
|
||||
Exception(message: string): void;
|
||||
SafeString: typeof SafeString;
|
||||
SafeString: typeof hbs.SafeString;
|
||||
|
||||
logger: Logger;
|
||||
log(level: number, obj: any): void;
|
||||
}
|
||||
|
||||
interface HandlebarsStatic extends HandlebarsCommon {
|
||||
parse(input: string): boolean;
|
||||
parse(input: string): hbs.AST.ProgramNode;
|
||||
compile(input: any, options?: any): HandlebarsTemplateDelegate;
|
||||
}
|
||||
|
||||
@@ -46,9 +46,11 @@ interface HandlebarsRuntimeStatic extends HandlebarsCommon {
|
||||
templates: HandlebarsTemplates;
|
||||
}
|
||||
|
||||
declare class SafeString {
|
||||
constructor(str: string);
|
||||
static toString(): string;
|
||||
declare module hbs {
|
||||
class SafeString {
|
||||
constructor(str: string);
|
||||
static toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
interface Logger {
|
||||
@@ -63,6 +65,115 @@ interface Logger {
|
||||
log(level: number, obj: string): void;
|
||||
}
|
||||
|
||||
declare module hbs {
|
||||
module AST {
|
||||
interface IStripInfo {
|
||||
left?: boolean;
|
||||
right?: boolean;
|
||||
inlineStandalone?: boolean;
|
||||
}
|
||||
|
||||
class NodeBase {
|
||||
firstColumn: number;
|
||||
firstLine: number;
|
||||
lastColumn: number;
|
||||
lastLine: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
class ProgramNode extends NodeBase {
|
||||
statements: NodeBase[];
|
||||
}
|
||||
|
||||
class IdNode extends NodeBase {
|
||||
original: string;
|
||||
parts: string[];
|
||||
string: string;
|
||||
depth: number;
|
||||
idName: string;
|
||||
isSimple: boolean;
|
||||
stringModeValue: string;
|
||||
}
|
||||
|
||||
class HashNode extends NodeBase {
|
||||
pairs: {0: string;
|
||||
1: NodeBase}[];
|
||||
}
|
||||
|
||||
class SexprNode extends NodeBase {
|
||||
hash: HashNode;
|
||||
id: NodeBase;
|
||||
params: NodeBase[];
|
||||
isHelper: boolean;
|
||||
eligibleHelper: boolean;
|
||||
}
|
||||
|
||||
class MustacheNode extends NodeBase {
|
||||
strip: IStripInfo;
|
||||
escaped: boolean;
|
||||
sexpr: SexprNode;
|
||||
|
||||
}
|
||||
|
||||
class BlockNode extends NodeBase {
|
||||
mustache: MustacheNode;
|
||||
program: ProgramNode;
|
||||
inverse: ProgramNode;
|
||||
strip: IStripInfo;
|
||||
isInverse: boolean;
|
||||
}
|
||||
|
||||
class PartialNameNode extends NodeBase {
|
||||
name: string;
|
||||
}
|
||||
|
||||
class PartialNode extends NodeBase {
|
||||
partialName: PartialNameNode;
|
||||
context: NodeBase;
|
||||
hash: HashNode;
|
||||
strip: IStripInfo;
|
||||
}
|
||||
|
||||
class RawBlockNode extends NodeBase {
|
||||
mustache: MustacheNode;
|
||||
program: ProgramNode;
|
||||
}
|
||||
|
||||
class ContentNode extends NodeBase {
|
||||
original: string;
|
||||
string: string;
|
||||
}
|
||||
|
||||
class DataNode extends NodeBase {
|
||||
id: IdNode;
|
||||
stringModeValue: string;
|
||||
idName: string;
|
||||
}
|
||||
|
||||
class StringNode extends NodeBase {
|
||||
original: string;
|
||||
string: string;
|
||||
stringModeValue: string;
|
||||
}
|
||||
|
||||
class NumberNode extends NodeBase {
|
||||
original: string;
|
||||
number: string;
|
||||
stringModeValue: number;
|
||||
}
|
||||
|
||||
class BooleanNode extends NodeBase {
|
||||
bool: string;
|
||||
stringModeValue: boolean;
|
||||
}
|
||||
|
||||
class CommentNode extends NodeBase {
|
||||
comment: string;
|
||||
strip: IStripInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "handlebars" {
|
||||
export = Handlebars;
|
||||
}
|
||||
|
||||
@@ -38,5 +38,5 @@ function test_statusLine(): void {
|
||||
|
||||
function test_headers(): void {
|
||||
var result: { [key: string]: string } =
|
||||
parser.parseHeaders("Content-Type: text/html; charset=utf-8\r\nContent-Length: 256\r\n");
|
||||
parser.parseHeaders(["Content-Type: text/html; charset=utf-8", "Content-Length: 256"]);
|
||||
}
|
||||
+1
-1
@@ -34,5 +34,5 @@ declare module "http-string-parser" {
|
||||
export function parseResponse(responseString: string): ParseResponseResult;
|
||||
export function parseRequestLine(requestLineString: string): ParseRequestLineResult;
|
||||
export function parseStatusLine(statusLine: string): ParseStatusLineResult;
|
||||
export function parseHeaders(headerLines: string): { [key: string]: string };
|
||||
export function parseHeaders(headerLines: string[]): { [key: string]: string };
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -126,4 +126,4 @@ interface JQuery {
|
||||
i18n: (options?: I18nextOptions) => void;
|
||||
}
|
||||
|
||||
declare var i18next: I18nextStatic;
|
||||
declare var i18n: I18nextStatic;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/// <reference path="inflection.d.ts" />
|
||||
|
||||
import inflection = require("inflection");
|
||||
|
||||
inflection.indexOf(["hi", "there"], "guys");
|
||||
|
||||
inflection.pluralize("person");
|
||||
inflection.pluralize("person", "guys");
|
||||
|
||||
inflection.singularize("Hats");
|
||||
inflection.singularize("guys", "person");
|
||||
|
||||
inflection.inflect("Hats", 1);
|
||||
inflection.inflect("guys", 1, "person");
|
||||
|
||||
inflection.camelize("message_properties");
|
||||
inflection.camelize("message_properties", true);
|
||||
|
||||
inflection.underscore("MP");
|
||||
inflection.underscore("MP", true);
|
||||
|
||||
inflection.humanize("message_properties");
|
||||
inflection.humanize("message_properties", true);
|
||||
|
||||
inflection.capitalize("message_properties");
|
||||
|
||||
inflection.dasherize("message_properties");
|
||||
|
||||
inflection.titleize("message_properties");
|
||||
|
||||
inflection.demodulize("Message::Bus::Properties");
|
||||
|
||||
inflection.tableize("MessageBusProperty");
|
||||
|
||||
inflection.classify("message_bus_properties");
|
||||
|
||||
inflection.foreign_key("MessageBusProperty");
|
||||
inflection.foreign_key("MessageBusProperty", true);
|
||||
|
||||
inflection.ordinalize("the 1 pitch");
|
||||
|
||||
inflection.transform("all job", [ "pluralize", "capitalize", "dasherize" ]);
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for inflection 1.5.0
|
||||
// Project: https://github.com/dreamerslab/node.inflection
|
||||
// Definitions by: Shogo Iwano <https://github.com/shiwano>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Inflection {
|
||||
indexOf<T, T2>(arr: T[], item: T2, from_index?: number, compare_func?: (arr_item: T, item: T2) => boolean): number;
|
||||
pluralize(str: string, plural?: string): string;
|
||||
singularize(str: string, singular?: string): string;
|
||||
inflect(str: string, count: number, singular?: string, plural?: string): string;
|
||||
camelize(str: string, low_first_letter?: boolean): string;
|
||||
underscore(str: string, all_upper_case?: boolean): string;
|
||||
humanize(str: string, low_first_letter?: boolean): string;
|
||||
capitalize(str: string): string;
|
||||
dasherize(str: string): string;
|
||||
titleize(str: string): string;
|
||||
demodulize(str: string): string;
|
||||
tableize(str: string): string;
|
||||
classify(str: string): string;
|
||||
foreign_key(str: string, drop_id_ubar?: boolean): string;
|
||||
ordinalize(str: string): string;
|
||||
transform(str: string, arr: string[]): string;
|
||||
}
|
||||
|
||||
declare module "inflection" {
|
||||
var inflection: Inflection;
|
||||
export = inflection;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="./insight.d.ts" />
|
||||
|
||||
declare var require:any;
|
||||
|
||||
import Insight = require('insight');
|
||||
var pkg:any = require('./package.json');
|
||||
|
||||
var insight = new Insight({
|
||||
// Google Analytics tracking code
|
||||
trackingCode: 'UA-XXXXXXXX-X',
|
||||
packageName: pkg.name,
|
||||
packageVersion: pkg.version
|
||||
});
|
||||
|
||||
(()=> {
|
||||
// ask for permission the first time
|
||||
if (insight.optOut === undefined) {
|
||||
return insight.askPermission();
|
||||
}
|
||||
|
||||
insight.track('foo', 'bar');
|
||||
// recorded in Analytics as `/foo/bar`
|
||||
})();
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
// Type definitions for insight 0.4.3
|
||||
// Project: https://github.com/yeoman/insight
|
||||
// Definitions by: vvakame <http://github.com/vvakame>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module insight {
|
||||
interface IOptions {
|
||||
trackingCode:string;
|
||||
trackingProvider?:string;
|
||||
packageName:string;
|
||||
packageVersion?:string;
|
||||
config?:IConfigstore;
|
||||
}
|
||||
|
||||
interface IConfigstore {
|
||||
path:string;
|
||||
all:any;
|
||||
get(key:string):any;
|
||||
set(key:string, val:any):void;
|
||||
del(key:string):void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "insight" {
|
||||
import IOptions = insight.IOptions;
|
||||
import IConfigstore = insight.IConfigstore;
|
||||
|
||||
class Insight {
|
||||
trackingCode:string;
|
||||
trackingProvider:string;
|
||||
packageName:string;
|
||||
packageVersion:string;
|
||||
os:string;
|
||||
nodeVersion:string;
|
||||
appVersion:string;
|
||||
config:IConfigstore;
|
||||
|
||||
optOut:boolean;
|
||||
clientId:string;
|
||||
|
||||
constructor(options:IOptions);
|
||||
|
||||
track(...args:string[]):void;
|
||||
|
||||
askPermission(msg?:string, cb?:Function):void;
|
||||
}
|
||||
|
||||
export = Insight;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="intercom.d.ts" />
|
||||
|
||||
function test_intercom_static() {
|
||||
var instance: intercom.Intercom = Intercom.getInstance();
|
||||
|
||||
var capturedMessage: any;
|
||||
var detect: Function = (msg: any) => capturedMessage = msg;
|
||||
instance.on("test", detect);
|
||||
|
||||
var msgToSend: any = {one: 1, two: "2"};
|
||||
instance.emit("test", msgToSend);
|
||||
console.log(capturedMessage === msgToSend);
|
||||
|
||||
var onceListenerInvokedTimes = 0;
|
||||
instance.once("testOnce", ()=>onceListenerInvokedTimes+=1, 300);
|
||||
instance.once("testOnce", ()=>onceListenerInvokedTimes+=1, 300);
|
||||
console.log(onceListenerInvokedTimes === 1);
|
||||
|
||||
instance.emit("eventWithoutAMessage");
|
||||
}
|
||||
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
// Type definitions for intercom.js
|
||||
// Project: https://github.com/diy/intercom.js
|
||||
// Definitions by: spencerwi <http://github.com/spencerwi>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module intercom {
|
||||
interface Intercom {
|
||||
/**
|
||||
* Broadcasts a message to all open windows (including the current window).
|
||||
* @param name The string event name
|
||||
* @param message The event data/message
|
||||
*/
|
||||
emit(name: string, message?: any): void;
|
||||
/**
|
||||
* Sets up a listener to be invoked when a message with the given name is received.
|
||||
* @param name The string event name to listen for.
|
||||
* @param fn The listener method to invoke.
|
||||
*/
|
||||
on(name: string, fn: Function): void;
|
||||
/**
|
||||
* Given a unique key to represent the function, fn will be invoked in only one window. The ttl argument represents the number of seconds before the function can be called again.
|
||||
* @param key The unique function identifier key
|
||||
* @param fn The function to be called once
|
||||
* @param ttl The amount of time in seconds to wait before allowing the function to be invoked again.
|
||||
*/
|
||||
once(key: string, fn: Function, ttl?: number): void;
|
||||
/**
|
||||
* Bind to a socket.io socket and forward all received messages to all windows and/or back to the socket.
|
||||
* @param socket A socket.io socket to bind to.
|
||||
* @param options Object with "send" and "receive" keys having values of Boolean or Boolean-producing function to determine whether message(s) should be forwarded to/from the socket.
|
||||
*/
|
||||
bind(socket: any, options?: intercom.SocketBindingOptions): void;
|
||||
}
|
||||
interface SocketBindingOptions {
|
||||
send?: any; /* boolean | (name: string, message: any)=>any */
|
||||
receive?: any; /* boolean | (name: string, message: any)=>any */
|
||||
}
|
||||
}
|
||||
|
||||
interface IntercomStatic {
|
||||
/**
|
||||
* Returns an instance of Intercom. If one doesn't exist, it will be instantiated.
|
||||
* @return an instance of Intercom.
|
||||
*/
|
||||
getInstance(): intercom.Intercom;
|
||||
/**
|
||||
* Removes all data associated with intercom from localStorage.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
declare var Intercom: IntercomStatic
|
||||
@@ -0,0 +1,123 @@
|
||||
/// <reference path="jest.d.ts" />
|
||||
|
||||
// Tests based on the Jest website
|
||||
jest.dontMock('../sum');
|
||||
|
||||
describe('sum', function() {
|
||||
it('adds 1 + 2 to equal 3', function() {
|
||||
var sum: (a: number, b: number) => number = require('../sum');
|
||||
expect(sum(1, 2)).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetchCurrentUser', function() {
|
||||
it('calls the callback when $.ajax requests are finished', function() {
|
||||
var $ = require('jquery');
|
||||
var fetchCurrentUser = require('../fetchCurrentUser');
|
||||
|
||||
// Create a mock function for our callback
|
||||
var callback = jest.genMockFunction();
|
||||
fetchCurrentUser(callback);
|
||||
|
||||
// Now we emulate the process by which `$.ajax` would execute its own
|
||||
// callback
|
||||
$.ajax.mock.calls[0 /*first call*/][0 /*first argument*/].success({
|
||||
firstName: 'Bobby',
|
||||
lastName: '");DROP TABLE Users;--'
|
||||
});
|
||||
|
||||
// And finally we assert that this emulated call by `$.ajax` incurred a
|
||||
// call back into the mock function we provided as a callback
|
||||
expect(callback.mock.calls[0/*first call*/][0/*first arg*/]).toEqual({
|
||||
loggedIn: true,
|
||||
fullName: 'Bobby ");DROP TABLE Users;--'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
jest.dontMock('../displayUser.js')
|
||||
jest.dontMock('jquery');
|
||||
|
||||
describe('displayUser', function() {
|
||||
it('displays a user after a click', function() {
|
||||
// Set up our document body
|
||||
document.body.innerHTML =
|
||||
'<div>' +
|
||||
' <span id="username" />' +
|
||||
' <button id="button" />' +
|
||||
'</div>';
|
||||
|
||||
var displayUser = require('../displayUser');
|
||||
var $ = require('jquery');
|
||||
var fetchCurrentUser = require('../fetchCurrentUser');
|
||||
|
||||
// Tell the fetchCurrentUser mock function to automatically invoke
|
||||
// its callback with some data
|
||||
fetchCurrentUser.mockImplementation(function(cb: Function) {
|
||||
cb({
|
||||
loggedIn: true,
|
||||
fullName: 'Johnny Cash'
|
||||
});
|
||||
});
|
||||
|
||||
// Use jquery to emulate a click on our button
|
||||
$('#button').click();
|
||||
|
||||
// Assert that the fetchCurrentUser function was called, and that the
|
||||
// #username span's innter text was updated as we'd it expect.
|
||||
expect(fetchCurrentUser).toBeCalled();
|
||||
expect($('#username').text()).toEqual('Johnny Cash - Logged In');
|
||||
});
|
||||
});
|
||||
|
||||
jest.dontMock('../CheckboxWithLabel.js');
|
||||
describe('CheckboxWithLabel', function() {
|
||||
it('changes the text after click', function() {
|
||||
var React = require('react/addons');
|
||||
var CheckboxWithLabel = require('../CheckboxWithLabel.js');
|
||||
var TestUtils = React.addons.TestUtils;
|
||||
|
||||
// Render a checkbox with label in the document
|
||||
var checkbox = TestUtils.renderIntoDocument(
|
||||
CheckboxWithLabel({
|
||||
labelOn: "On",
|
||||
labelOff: "Off"
|
||||
})
|
||||
);
|
||||
|
||||
// Verify that it's Off by default
|
||||
var label = TestUtils.findRenderedDOMComponentWithTag(
|
||||
checkbox, 'label');
|
||||
expect(label.getDOMNode().textContent).toEqual('Off');
|
||||
|
||||
// Simulate a click and verify that it is now On
|
||||
var input = TestUtils.findRenderedDOMComponentWithTag(
|
||||
checkbox, 'input');
|
||||
TestUtils.Simulate.change(input);
|
||||
expect(label.getDOMNode().textContent).toEqual('On');
|
||||
});
|
||||
});
|
||||
|
||||
function testInstances() {
|
||||
var mockFn = jest.genMockFunction<Function>();
|
||||
var a = new mockFn();
|
||||
var b = new mockFn();
|
||||
|
||||
mockFn.mock.instances[0] === a; // true
|
||||
mockFn.mock.instances[1] === b; // true
|
||||
}
|
||||
|
||||
function testMockImplementation() {
|
||||
var mockFn = jest.genMockFunction<Function>().mockImplementation(function (scalar:number):number {
|
||||
return 42 + scalar;
|
||||
});
|
||||
|
||||
var a = mockFn(0);
|
||||
var b = mockFn(1);
|
||||
|
||||
a === 42; // true
|
||||
b === 43; // true
|
||||
|
||||
mockFn.mock.calls[0][0] === 0; // true
|
||||
mockFn.mock.calls[1][0] === 1; // true
|
||||
}
|
||||
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
// Type definitions for Jest 0.1.18
|
||||
// Project: http://facebook.github.io/jest/
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare function afterEach(fn: jest.EmptyFunction): void;
|
||||
declare function beforeEach(fn: jest.EmptyFunction): void;
|
||||
declare function describe(name: string, fn: jest.EmptyFunction): void;
|
||||
declare var it: jest.It;
|
||||
declare function pit(name: string, fn: jest.EmptyFunction): void;
|
||||
declare var require: jest.Require;
|
||||
declare function xdescribe(name: string, fn: jest.EmptyFunction): void;
|
||||
declare function xit(name: string, fn: jest.EmptyFunction): void;
|
||||
|
||||
declare function expect(actual: any): jest.Matchers;
|
||||
|
||||
declare module jest {
|
||||
function autoMockOff(): void;
|
||||
function autoMockOn(): void;
|
||||
function clearAllTimers(): void;
|
||||
function dontMock(moduleName: string): void;
|
||||
function genMockFromModule<T>(moduleName: string): Mock<T>;
|
||||
function genMockFunction<T>(): Mock<T>;
|
||||
function genMockFn<T>(): Mock<T>;
|
||||
function mock(moduleName: string): void;
|
||||
function runAllTicks(): void;
|
||||
function runAllTimers(): void;
|
||||
function runOnlyPendingTimers(): void;
|
||||
function setMock<T>(moduleName: string, moduleExports: T): void;
|
||||
|
||||
interface EmptyFunction {
|
||||
(): void;
|
||||
}
|
||||
|
||||
interface Matchers {
|
||||
not: Matchers;
|
||||
toThrow(expected?: any): boolean;
|
||||
toBe(expected: any): boolean;
|
||||
toEqual(expected: any): boolean;
|
||||
toBeFalsy(): boolean;
|
||||
toBeTruthy(): boolean;
|
||||
toBeNull(): boolean;
|
||||
toBeUndefined(): boolean;
|
||||
toMatch(expected: RegExp): boolean;
|
||||
toContain(expected: string): boolean;
|
||||
toBeCloseTo(expected: number, delta: number): boolean;
|
||||
toBeGreaterThen(expected: number): boolean;
|
||||
toBeLessThen(expected: number): boolean;
|
||||
toBeCalled(): boolean;
|
||||
toBeCalledWith(...args: any[]): boolean;
|
||||
lastCalledWith(...args: any[]): boolean;
|
||||
}
|
||||
|
||||
interface It {
|
||||
(name: string, fn: EmptyFunction): void;
|
||||
only(name: string, fn: EmptyFunction): void;
|
||||
}
|
||||
|
||||
interface Require {
|
||||
(moduleName: string): any;
|
||||
requireActual(moduleName: string): any;
|
||||
}
|
||||
|
||||
interface Mock<T> {
|
||||
new(): T;
|
||||
(...args:any[]): any; // TODO please fix this line! added for TypeScript 1.1.0-1 https://github.com/borisyankov/DefinitelyTyped/pull/2932
|
||||
mock: MockContext<T>;
|
||||
mockClear(): void;
|
||||
mockImplementation(fn: Function): Mock<T>;
|
||||
mockImpl(fn: Function): Mock<T>;
|
||||
mockReturnThis(): Mock<T>;
|
||||
mockReturnValue(value: any): Mock<T>;
|
||||
mockReturnValueOnce(value: any): Mock<T>;
|
||||
}
|
||||
|
||||
interface MockContext<T> {
|
||||
calls: any[][];
|
||||
instances: T[];
|
||||
}
|
||||
}
|
||||
Vendored
+2
-2
@@ -459,10 +459,10 @@ declare module 'joi' {
|
||||
/**
|
||||
* Validates a value using the given schema and options.
|
||||
*/
|
||||
export function validate<T>(value: T, schema: Schema, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void;
|
||||
export function validate<T>(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void;
|
||||
export function validate<T>(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void;
|
||||
export function validate<T>(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void;
|
||||
export function validate<T>(value: T, schema: Schema, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void;
|
||||
export function validate<T>(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void;
|
||||
|
||||
/**
|
||||
* Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object).
|
||||
|
||||
Vendored
+24
-13
@@ -7,19 +7,29 @@
|
||||
/// <reference path='../jquery/jquery.d.ts'/>
|
||||
|
||||
interface NotyOptions {
|
||||
layout?: string;
|
||||
theme?: string;
|
||||
type?: string;
|
||||
text?: string;
|
||||
dismissQueue?: boolean;
|
||||
template?: string;
|
||||
animation?: NotyAnimationOptions;
|
||||
timeout?: number;
|
||||
force?: boolean;
|
||||
modal?: boolean;
|
||||
closeWith?: any[];
|
||||
callback?: NotyCallbackOptions;
|
||||
buttons?: any;
|
||||
layout?: string;
|
||||
theme?: string;
|
||||
type?: string;
|
||||
/** Text to show. Can be html or string. */
|
||||
text?: string;
|
||||
/** If you want to use queue feature set this true. */
|
||||
dismissQueue?: boolean;
|
||||
/** The note`s optional template like '<div class="noty_message"><span class="noty_text"></span><div class="noty_close"></div></div>' */
|
||||
template?: string;
|
||||
animation?: NotyAnimationOptions;
|
||||
/** Delay for closing event. Set false for sticky notifications */
|
||||
timeout?: any;
|
||||
/** Adds notification to the beginning of queue when set to true */
|
||||
force?: boolean;
|
||||
modal?: boolean;
|
||||
/** You can set max visible notification for dismissQueue true option */
|
||||
maxVisible?: number;
|
||||
/** To close all notifications before show */
|
||||
killer?: boolean;
|
||||
closeWith?: any[];
|
||||
callback?: NotyCallbackOptions;
|
||||
/** An array of buttons or false to hide them */
|
||||
buttons?: any;
|
||||
}
|
||||
|
||||
interface NotyAnimationOptions {
|
||||
@@ -39,6 +49,7 @@ interface NotyCallbackOptions {
|
||||
interface NotyStatic {
|
||||
|
||||
(notyOptions: NotyOptions);
|
||||
defaults: NotyOptions;
|
||||
|
||||
get(id: any);
|
||||
close(id: any);
|
||||
|
||||
+28
-1
@@ -2461,7 +2461,7 @@ function test_isNumeric() {
|
||||
$.isNumeric("8e5");
|
||||
$.isNumeric(3.1415);
|
||||
$.isNumeric(+10);
|
||||
$.isNumeric(0144);
|
||||
$.isNumeric(144);
|
||||
$.isNumeric("");
|
||||
$.isNumeric({});
|
||||
$.isNumeric(NaN);
|
||||
@@ -3344,3 +3344,30 @@ function test_deferred_promise() {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function test_promise_then_change_type() {
|
||||
function request() {
|
||||
var def = $.Deferred<any>();
|
||||
var promise = def.promise(null);
|
||||
|
||||
def.rejectWith(this, new Error());
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
function count() {
|
||||
var def = request();
|
||||
return def.then<number>(data => {
|
||||
try {
|
||||
var count: number = parseInt(data.count, 10);
|
||||
} catch (err) {
|
||||
return $.Deferred<number>().reject(err).promise();
|
||||
}
|
||||
return $.Deferred<number>().resolve(count).promise();
|
||||
});
|
||||
}
|
||||
|
||||
count().done(data => {
|
||||
}).fail((exception: Error) => {
|
||||
});
|
||||
}
|
||||
Vendored
+13
-31
@@ -307,6 +307,11 @@ interface JQueryPromiseCallback<T> {
|
||||
(value?: T, ...args: any[]): void;
|
||||
}
|
||||
|
||||
interface JQueryPromiseOperator<T, R> {
|
||||
(callback: JQueryPromiseCallback<T>, ...callbacks: JQueryPromiseCallback<T>[]): JQueryPromise<R>;
|
||||
(callback: JQueryPromiseCallback<T>[], ...callbacks: JQueryPromiseCallback<T>[]): JQueryPromise<R>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for the JQuery promise, part of callbacks
|
||||
*/
|
||||
@@ -317,52 +322,28 @@ interface JQueryPromise<T> {
|
||||
* @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected.
|
||||
* @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
|
||||
*/
|
||||
always(alwaysCallbacks1?: JQueryPromiseCallback<T>, ...alwaysCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
always: JQueryPromiseOperator<any, T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is resolved.
|
||||
*
|
||||
* @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved.
|
||||
* @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
|
||||
*/
|
||||
done(doneCallbacks1?: JQueryPromiseCallback<T>, ...doneCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
done: JQueryPromiseOperator<T, T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is rejected.
|
||||
*
|
||||
* @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected.
|
||||
* @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
|
||||
*/
|
||||
fail(failCallbacks1?: JQueryPromiseCallback<T>, ...failCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
fail: JQueryPromiseOperator<any, T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object generates progress notifications.
|
||||
*
|
||||
* @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications.
|
||||
*/
|
||||
progress(...progressCallbacks: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is either resolved or rejected.
|
||||
*
|
||||
* @param alwaysCallbacks A function, or array of functions, that is called when the Deferred is resolved or rejected.
|
||||
*/
|
||||
always(...alwaysCallbacks: any[]): JQueryPromise<T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is resolved.
|
||||
*
|
||||
* @param doneCallbacks A function, or array of functions, that are called when the Deferred is resolved.
|
||||
*/
|
||||
done(...doneCallbacks: any[]): JQueryPromise<T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is rejected.
|
||||
*
|
||||
* @param failCallbacks A function, or array of functions, that are called when the Deferred is rejected.
|
||||
*/
|
||||
fail(...failCallbacks: any[]): JQueryPromise<T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object generates progress notifications.
|
||||
*
|
||||
* @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications.
|
||||
*/
|
||||
progress(...progressCallbacks: any[]): JQueryPromise<T>;
|
||||
progress(progressCallback: JQueryPromiseCallback<T>): JQueryPromise<T>;
|
||||
progress(progressCallbacks: JQueryPromiseCallback<T>[]): JQueryPromise<T>;
|
||||
|
||||
/**
|
||||
* Determine the current state of a Deferred object.
|
||||
@@ -479,8 +460,9 @@ interface JQueryDeferred<T> extends JQueryPromise<T> {
|
||||
*
|
||||
* @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications.
|
||||
*/
|
||||
progress(...progressCallbacks: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
|
||||
progress(progressCallback: JQueryPromiseCallback<T>): JQueryDeferred<T>;
|
||||
progress(progressCallbacks: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Call the progressCallbacks on a Deferred object with the given args.
|
||||
*
|
||||
|
||||
@@ -75,6 +75,8 @@ a.search('test', false, true);
|
||||
//test redraw node
|
||||
a.redraw_node($('#node1'), false, false, false);
|
||||
|
||||
//test clear buffer
|
||||
a.clear_buffer();
|
||||
|
||||
//tree with new unique plugin parameters
|
||||
var treeWithUnique = $('#treeWithUnique').jstree({
|
||||
|
||||
Vendored
+16
@@ -1059,6 +1059,13 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
paste: (obj: any, pos: any) => void;
|
||||
|
||||
/**
|
||||
* clear the buffer of previously copied or cut nodes
|
||||
* @name clear_buffer()
|
||||
* @trigger clear_buffer.jstree
|
||||
*/
|
||||
clear_buffer: () => void;
|
||||
|
||||
/**
|
||||
* put a node in edit mode (input field to rename the node)
|
||||
* @name edit(obj [, default_text])
|
||||
@@ -1223,7 +1230,16 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
is_undetermined: (obj: any) => boolean;
|
||||
|
||||
/**
|
||||
* called when a node is selected by the user. Used internally.
|
||||
* @private
|
||||
* @name activate_node(obj, e)
|
||||
* @param {mixed} obj the node
|
||||
* @param {Object} e the related event
|
||||
* @trigger activate_node.jstree, changed.jstree
|
||||
*/
|
||||
activate_node: (obj: any, e: any) => any;
|
||||
|
||||
/**
|
||||
* check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally)
|
||||
* @name check_node(obj)
|
||||
|
||||
Vendored
+2
-2
@@ -65,7 +65,6 @@ interface KnockoutComputedStatic {
|
||||
<T>(): KnockoutComputed<T>;
|
||||
<T>(func: () => T, context?: any, options?: any): KnockoutComputed<T>;
|
||||
<T>(def: KnockoutComputedDefine<T>, context?: any): KnockoutComputed<T>;
|
||||
(options?: any, context?: any): KnockoutComputed<any>;
|
||||
}
|
||||
|
||||
interface KnockoutComputed<T> extends KnockoutObservable<T>, KnockoutComputedFunctions<T> {
|
||||
@@ -135,6 +134,7 @@ interface KnockoutBindingHandler {
|
||||
init? (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext): void;
|
||||
update? (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext): void;
|
||||
options?: any;
|
||||
preprocess?: (value: string, name: string, addBindingCallback?: (name: string, value: string) => void) => string;
|
||||
}
|
||||
|
||||
interface KnockoutBindingHandlers {
|
||||
@@ -418,7 +418,7 @@ interface KnockoutStatic {
|
||||
applyBindingAccessorsToNode(node: Node, bindings: {}, bindingContext: KnockoutBindingContext): void;
|
||||
applyBindingAccessorsToNode(node: Node, bindings: (bindingContext: KnockoutBindingContext, node: Node) => {}, viewModel: any): void;
|
||||
applyBindingAccessorsToNode(node: Node, bindings: {}, viewModel: any): void;
|
||||
applyBindingsToNode(node: Element, options: any, viewModel: any): void;
|
||||
applyBindingsToNode(node: Node, bindings: any, viewModelOrBindingContext?: any): any;
|
||||
|
||||
subscribable: KnockoutSubscribableStatic;
|
||||
observable: KnockoutObservableStatic;
|
||||
|
||||
@@ -72,7 +72,7 @@ function test_computed() {
|
||||
this.acceptedNumericValue = ko.observable(123);
|
||||
this.lastInputWasValid = ko.observable(true);
|
||||
|
||||
this.attemptedValue = ko.computed({
|
||||
this.attemptedValue = ko.computed<number>({
|
||||
read: this.acceptedNumericValue,
|
||||
write: function (value) {
|
||||
if (isNaN(value))
|
||||
@@ -284,7 +284,7 @@ function test_more() {
|
||||
};
|
||||
|
||||
ko.extenders.numeric = function (target, precision) {
|
||||
var result = ko.computed({
|
||||
var result = ko.computed<any>({
|
||||
read: target,
|
||||
write: function (newValue) {
|
||||
var current = target(),
|
||||
|
||||
@@ -21,7 +21,7 @@ var sample = new Sample();
|
||||
var unwrappedProperties = ko.utils.unwrapProperties(sample);
|
||||
|
||||
var kts: KnockoutTemplateSources;
|
||||
var stringTemplate = kts.stringTemplate('string-template');
|
||||
var stringTemplate = new kts.stringTemplate('string-template');
|
||||
var stname = stringTemplate.templateName;
|
||||
|
||||
ko.stringTemplateEngine.instance.allowTemplateRewriting = true;
|
||||
|
||||
Vendored
+11
-9
@@ -418,7 +418,8 @@ declare module L {
|
||||
on(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
|
||||
once(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
|
||||
off(type: string, fn?: (e: LeafletEvent) => void, context?: any): Layers;
|
||||
fire(type: string, data?: any): Layers; addEventListener(eventMap: any, context?: any): Layers;
|
||||
fire(type: string, data?: any): Layers;
|
||||
addEventListener(eventMap: any, context?: any): Layers;
|
||||
removeEventListener(eventMap?: any, context?: any): Layers;
|
||||
clearAllEventListeners(): Layers;
|
||||
on(eventMap: any, context?: any): Layers;
|
||||
@@ -909,6 +910,11 @@ declare module L {
|
||||
* Changes styles of GeoJSON vector layers with the given style function.
|
||||
*/
|
||||
setStyle(style: (featureData: any) => any): GeoJSON;
|
||||
|
||||
/**
|
||||
* Changes styles of GeoJSON vector layers with the given style options.
|
||||
*/
|
||||
setStyle(style: PathOptions): GeoJSON;
|
||||
|
||||
/**
|
||||
* Resets the the given vector layer's style to the original GeoJSON style,
|
||||
@@ -2418,9 +2424,7 @@ declare module L {
|
||||
*
|
||||
* Default value: true.
|
||||
*/
|
||||
scrollWheelZoom?: any;
|
||||
//scrollWheelZoom?: boolean;
|
||||
//scrollWheelZoom?: string;
|
||||
scrollWheelZoom?: boolean;
|
||||
|
||||
/**
|
||||
* Whether the map can be zoomed in by double clicking on it and zoomed out
|
||||
@@ -2430,9 +2434,7 @@ declare module L {
|
||||
*
|
||||
* Default value: true.
|
||||
*/
|
||||
doubleClickZoom?: string;
|
||||
//doubleClickZoom?: boolean;
|
||||
//doubleClickZoom?: string;
|
||||
doubleClickZoom?: boolean;
|
||||
|
||||
/**
|
||||
* Whether the map can be zoomed to a rectangular area specified by dragging
|
||||
@@ -3759,7 +3761,7 @@ declare module L {
|
||||
|
||||
module TileLayer {
|
||||
|
||||
export class WMS {
|
||||
export class WMS extends TileLayer {
|
||||
|
||||
/**
|
||||
* Instantiates a WMS tile layer object given a base URL of the WMS service and
|
||||
@@ -4056,7 +4058,7 @@ declare module L {
|
||||
/**
|
||||
* Trims the whitespace from both ends of the string and returns the result.
|
||||
*/
|
||||
static trim(str: string): boolean;
|
||||
static trim(str: string): string;
|
||||
|
||||
/**
|
||||
* Data URI string containing a base64-encoded empty GIF image. Used as a hack
|
||||
|
||||
+25
-6
@@ -326,6 +326,8 @@ result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4, 5]).xor([5, 2, 10], [4, 5,
|
||||
|
||||
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
result = <any[][]>_.unzip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
result = <any[][]>_(['moe', 'larry']).zip([30, 40], [true, false]).value();
|
||||
result = <any[][]>_(['moe', 'larry']).unzip([30, 40], [true, false]).value();
|
||||
|
||||
// /* *************
|
||||
// * Collections *
|
||||
@@ -381,6 +383,11 @@ result = <number>_.find([1, 2, 3, 4], function (num) {
|
||||
});
|
||||
result = <IFoodCombined>_.find(foodsCombined, { 'type': 'vegetable' });
|
||||
result = <IFoodCombined>_.find(foodsCombined, 'organic');
|
||||
result = <number>_([1, 2, 3, 4]).find(function (num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
result = <IFoodCombined>_(foodsCombined).find({ 'type': 'vegetable' });
|
||||
result = <IFoodCombined>_(foodsCombined).find('organic');
|
||||
|
||||
result = <number>_.detect([1, 2, 3, 4], function (num) {
|
||||
return num % 2 == 0;
|
||||
@@ -400,6 +407,12 @@ result = <number>_.findLast([1, 2, 3, 4], function (num) {
|
||||
result = <IFoodCombined>_.findLast(foodsCombined, { 'type': 'vegetable' });
|
||||
result = <IFoodCombined>_.findLast(foodsCombined, 'organic');
|
||||
|
||||
result = <number>_([1, 2, 3, 4]).findLast(function (num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
result = <IFoodCombined>_(foodsCombined).findLast({ 'type': 'vegetable' });
|
||||
result = <IFoodCombined>_(foodsCombined).findLast('organic');
|
||||
|
||||
result = <number[]>_.forEach([1, 2, 3], function (num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); });
|
||||
result = <IFoodType>_.forEach<IFoodType, string>({ name: 'apple', type: 'fruit' }, function (value, key) { console.log(value, key) });
|
||||
@@ -468,10 +481,16 @@ result = <IStoogesAge[]>_(stoogesAges).collect('name').value();
|
||||
result = <number>_.max([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.max(stoogesAges, function (stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.max(stoogesAges, 'age');
|
||||
result = <_.LoDashWrapper<number>>_([4, 2, 8, 6]).max();
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).max(function (stooge) { return stooge.age; });
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).max('age');
|
||||
|
||||
result = <number>_.min([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.min(stoogesAges, function (stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.min(stoogesAges, 'age');
|
||||
result = <_.LoDashWrapper<number>>_([4, 2, 8, 6]).min();
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).min(function (stooge) { return stooge.age; });
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).min('age');
|
||||
|
||||
result = <string[]>_.pluck(stoogesAges, 'name');
|
||||
result = <string[]>_(stoogesAges).pluck('name').value();
|
||||
@@ -667,7 +686,7 @@ result = <Function>_.curry(function (a: any, b: any, c: any) {
|
||||
console.log(a + b + c);
|
||||
});
|
||||
|
||||
result = <_.LoDashObjectWrapper<Function>>_(function (a, b, c) {
|
||||
result = <_.LoDashObjectWrapper<Function>>_(function (a: any, b: any, c: any) {
|
||||
console.log(a + b + c);
|
||||
}).curry();
|
||||
|
||||
@@ -694,7 +713,7 @@ source.addEventListener('message', <_.LoDashObjectWrapper<Function>>_(function (
|
||||
'maxWait': 1000
|
||||
}), false);
|
||||
|
||||
var returnedDebounce = _.throttle(function (a) { return a * 5; }, 5);
|
||||
var returnedDebounce = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedThrottled(4);
|
||||
|
||||
result = <number>_.defer(function () { console.log('deferred'); });
|
||||
@@ -704,7 +723,7 @@ var log = _.bind(console.log, console);
|
||||
result = <number>_.delay(log, 1000, 'logged later');
|
||||
result = <_.LoDashWrapper<number>>_(log).delay(1000, 'logged later');
|
||||
|
||||
var fibonacci = <Function>_.memoize(function (n) {
|
||||
var fibonacci = <Function>_.memoize(function (n: any) {
|
||||
return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
|
||||
});
|
||||
|
||||
@@ -716,13 +735,13 @@ var data: { [index: string]: { name: string; age: number; } } = {
|
||||
var stooge = _.memoize(function (name: string) { return data[name]; }, _.identity);
|
||||
stooge('curly');
|
||||
|
||||
var returnedMemoize = _.throttle(function (a) { return a * 5; }, 5);
|
||||
var returnedMemoize = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedMemoize(4);
|
||||
|
||||
var initialize = _.once(function () { });
|
||||
initialize();
|
||||
initialize();''
|
||||
var returnedOnce = _.throttle(function (a) { return a * 5; }, 5);
|
||||
var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedOnce(4);
|
||||
|
||||
var greetPartial = function (greeting: string, name: string) { return greeting + ' ' + name; };
|
||||
@@ -745,7 +764,7 @@ jQuery('.interactive').on('click', _.throttle(function () { }, 300000, {
|
||||
'trailing': false
|
||||
}));
|
||||
|
||||
var returnedThrottled = _.throttle(function (a) { return a * 5; }, 5);
|
||||
var returnedThrottled = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedThrottled(4);
|
||||
|
||||
var helloWrap = function (name: string) { return 'hello ' + name; };
|
||||
|
||||
Vendored
+102
@@ -2027,6 +2027,18 @@ declare module _ {
|
||||
unzip(...arrays: any[]): any[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.zip
|
||||
**/
|
||||
zip(...arrays: any[][]): _.LoDashArrayWrapper<any[][]>;
|
||||
|
||||
/**
|
||||
* @see _.zip
|
||||
**/
|
||||
unzip(...arrays: any[]): _.LoDashArrayWrapper<any[][]>;
|
||||
}
|
||||
|
||||
//_.zipObject
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -2860,6 +2872,28 @@ declare module _ {
|
||||
pluckValue: string): T;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.find
|
||||
*/
|
||||
find(
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T;
|
||||
/**
|
||||
* @see _.find
|
||||
* @param _.where style callback
|
||||
*/
|
||||
find<W>(
|
||||
whereValue: W): T;
|
||||
|
||||
/**
|
||||
* @see _.find
|
||||
* @param _.where style callback
|
||||
*/
|
||||
find(
|
||||
pluckValue: string): T;
|
||||
}
|
||||
|
||||
//_.findLast
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -2940,6 +2974,28 @@ declare module _ {
|
||||
pluckValue: string): T;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.findLast
|
||||
*/
|
||||
findLast(
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T;
|
||||
/**
|
||||
* @see _.findLast
|
||||
* @param _.where style callback
|
||||
*/
|
||||
findLast<W>(
|
||||
whereValue: W): T;
|
||||
|
||||
/**
|
||||
* @see _.findLast
|
||||
* @param _.where style callback
|
||||
*/
|
||||
findLast(
|
||||
pluckValue: string): T;
|
||||
}
|
||||
|
||||
//_.forEach
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -3620,6 +3676,29 @@ declare module _ {
|
||||
whereValue: W): T;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.max
|
||||
**/
|
||||
max(
|
||||
callback?: ListIterator<T, any>,
|
||||
thisArg?: any): LoDashWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
max(
|
||||
pluckValue: string): LoDashWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
max<W>(
|
||||
whereValue: W): LoDashWrapper<T>;
|
||||
}
|
||||
|
||||
//_.min
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -3708,6 +3787,29 @@ declare module _ {
|
||||
whereValue: W): T;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.min
|
||||
**/
|
||||
min(
|
||||
callback?: ListIterator<T, any>,
|
||||
thisArg?: any): LoDashWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.min
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
min(
|
||||
pluckValue: string): LoDashWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.min
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
min<W>(
|
||||
whereValue: W): LoDashWrapper<T>;
|
||||
}
|
||||
|
||||
//_.pluck
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Vendored
+1
-1
@@ -246,7 +246,7 @@ interface Array<T> {
|
||||
/**
|
||||
* Inserts a value at the specified location in an Array object.
|
||||
*/
|
||||
insert(array: any[], index: number, item: any);
|
||||
insert(array: any[], index: number, item: any): any;
|
||||
/**
|
||||
* Creates an Array object from a string representation.
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@ var todo = {
|
||||
|
||||
this.add = function() {
|
||||
if (this.description()) {
|
||||
this.list.push(new todo.Todo({description: this.description()}));
|
||||
this.list.push(new (<any>todo.Todo)({description: this.description()}));
|
||||
this.description("");
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
""
|
||||
Vendored
+4
@@ -258,6 +258,10 @@ interface Moment {
|
||||
lang(reset: boolean): Moment;
|
||||
lang(): MomentLanguage;
|
||||
|
||||
locale(language: string): Moment;
|
||||
locale(reset: boolean): Moment;
|
||||
locale(): string;
|
||||
|
||||
localeData(language: string): Moment;
|
||||
localeData(reset: boolean): Moment;
|
||||
localeData(): MomentLanguage;
|
||||
|
||||
Vendored
+1
-1
@@ -255,7 +255,7 @@ declare module "mongodb" {
|
||||
|
||||
// Documentation : http://mongodb.github.io/node-mongodb-native/api-generated/collection.html
|
||||
export interface Collection {
|
||||
new (db: Db, collectionName: string, pkFactory?: Object, options?: CollectionCreateOptions);
|
||||
new (db: Db, collectionName: string, pkFactory?: Object, options?: CollectionCreateOptions): Collection; // is this right?
|
||||
|
||||
insert(query: any, callback: (err: Error, result: any) => void): void;
|
||||
insert(query: any, options: { safe?: any; continueOnError?: boolean; keepGoing?: boolean; serializeFunctions?: boolean; }, callback: (err: Error, result: any) => void): void;
|
||||
|
||||
@@ -14,6 +14,22 @@ function test_streaming() {
|
||||
stmt.on('error', function (err) { console.log("We had an error :-( " + err); });
|
||||
}
|
||||
|
||||
function test_callback() {
|
||||
var conn_str = "Driver={SQL Server Native Client 11.0};Server={(local)\\SQLEXPRESS};Database={DBName};Trusted_Connection={Yes};";
|
||||
|
||||
sql.query(conn_str, "SELECT * FROM TestTable", (err, results) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
else if (results.length) {
|
||||
console.log(results);
|
||||
}
|
||||
else {
|
||||
console.log("No results");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function test_explicit() {
|
||||
var conn_str = "Driver={SQL Server Native Client 11.0};Server={(localdb)\\v11.0};Database={DBName};Trusted_Connection={Yes};";
|
||||
|
||||
|
||||
Vendored
+26
-12
@@ -1,6 +1,6 @@
|
||||
// Type definitions for msnodesql 0.2
|
||||
// Type definitions for msnodesql 0.2.1
|
||||
// Project: https://github.com/WindowsAzure/node-sqlserver
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Maxime LUCE <https://github.com/SomaticIT>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -11,18 +11,25 @@ declare module "msnodesql" {
|
||||
|
||||
export function open(connectionString: string, callback?: OpenCallback): Connection;
|
||||
|
||||
export function query(connectionString: string, query: string, callback?: QueryCallback): StreamEvents;
|
||||
export function query(connectionString: string, query: string, params: any[], callback?: QueryCallback): StreamEvents;
|
||||
export function query(connectionString: string, query: string): StreamEvents;
|
||||
export function query(connectionString: string, query: string, callback: QueryCallback<any>): StreamEvents;
|
||||
export function query(connectionString: string, query: string, params: any[]): StreamEvents;
|
||||
export function query(connectionString: string, query: string, params: any[], callback: QueryCallback<any>): StreamEvents;
|
||||
|
||||
export function queryRaw(connectionString: string, query: string, callback?: QueryRawCallback): StreamEvents;
|
||||
export function queryRaw(connectionString: string, query: string, params: any[], callback?: QueryRawCallback): StreamEvents;
|
||||
export function query<T>(connectionString: string, query: string, callback: QueryCallback<T>): StreamEvents;
|
||||
export function query<T>(connectionString: string, query: string, params: any[], callback: QueryCallback<T>): StreamEvents;
|
||||
|
||||
export function queryRaw(connectionString: string, query: string): StreamEvents;
|
||||
export function queryRaw(connectionString: string, query: string, callback: QueryRawCallback): StreamEvents;
|
||||
export function queryRaw(connectionString: string, query: string, params: any[]): StreamEvents;
|
||||
export function queryRaw(connectionString: string, query: string, params: any[], callback: QueryRawCallback): StreamEvents;
|
||||
|
||||
interface OpenCallback {
|
||||
(err?: Error, connection?: Connection): void;
|
||||
}
|
||||
|
||||
interface QueryCallback {
|
||||
(err?: Error, results?: QueryRawResult, more?: boolean): void;
|
||||
interface QueryCallback<T> {
|
||||
(err?: Error, results?: T[], more?: boolean): void;
|
||||
}
|
||||
|
||||
interface QueryRawCallback {
|
||||
@@ -43,11 +50,18 @@ declare module "msnodesql" {
|
||||
}
|
||||
|
||||
interface Connection {
|
||||
queryRaw(query: string, callback?: QueryCallback): StreamEvents;
|
||||
queryRaw(query: string, params: any[], callback?: QueryCallback): StreamEvents;
|
||||
query(query: string): StreamEvents;
|
||||
query(query: string, callback: QueryCallback<any>): StreamEvents;
|
||||
query(query: string, params: any[]): StreamEvents;
|
||||
query(query: string, params: any[], callback: QueryCallback<any>): StreamEvents;
|
||||
|
||||
query(query: string, callback?: QueryRawCallback): StreamEvents;
|
||||
query(query: string, params: any[], callback?: QueryRawCallback): StreamEvents;
|
||||
query<T>(query: string, callback: QueryCallback<T>): StreamEvents;
|
||||
query<T>(query: string, params: any[], callback: QueryCallback<T>): StreamEvents;
|
||||
|
||||
queryRaw(query: string): StreamEvents;
|
||||
queryRaw(query: string, callback: QueryRawCallback): StreamEvents;
|
||||
queryRaw(query: string, params: any[]): StreamEvents;
|
||||
queryRaw(query: string, params: any[], callback: QueryRawCallback): StreamEvents;
|
||||
|
||||
beginTransaction(callback?: ErrorCallback);
|
||||
commit(callback?: ErrorCallback);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference path="./nexpect.d.ts" />
|
||||
|
||||
import nexpect = require('nexpect');
|
||||
|
||||
nexpect.spawn("echo", ["hello"])
|
||||
.expect("hello")
|
||||
.run((err, stdout, exitcode) => {
|
||||
if (!err) {
|
||||
console.log("hello was echoed");
|
||||
}
|
||||
});
|
||||
|
||||
nexpect.spawn("ls -la /tmp/undefined", {stream: 'stderr'})
|
||||
.expect("No such file or directory")
|
||||
.run((err) => {
|
||||
if (!err) {
|
||||
console.log("checked that file doesn't exists");
|
||||
}
|
||||
});
|
||||
|
||||
nexpect.spawn("node --interactive")
|
||||
.expect(">")
|
||||
.sendline("console.log('testing')")
|
||||
.expect("testing")
|
||||
.sendline("process.exit()")
|
||||
.run((err) => {
|
||||
if (!err) {
|
||||
console.log("node process started, console logged, process exited");
|
||||
}
|
||||
else {
|
||||
console.log(err)
|
||||
}
|
||||
});
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Type definitions for nexpect 0.4.2
|
||||
// Project: https://github.com/nodejitsu/nexpect
|
||||
// Definitions by: vvakame <http://github.com/vvakame>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "nexpect" {
|
||||
import child_process = require("child_process");
|
||||
|
||||
function spawn(command:string[], options?:ISpawnOptions):IChain;
|
||||
|
||||
function spawn(command:string, params?:any[], options?:ISpawnOptions):IChain;
|
||||
|
||||
function spawn(command:string, options?:ISpawnOptions):IChain;
|
||||
|
||||
interface IChain {
|
||||
expect(expectation:string):IChain;
|
||||
expect(expectation:RegExp):IChain;
|
||||
wait(expectation:string):IChain;
|
||||
wait(expectation:RegExp):IChain;
|
||||
sendline(line:string):IChain;
|
||||
sendEof():IChain;
|
||||
run(callback:(err:Error, output:string[], exit:any /* string | number */)=>void):child_process.ChildProcess;
|
||||
}
|
||||
|
||||
interface ISpawnOptions {
|
||||
cwd?:string;
|
||||
env?:any;
|
||||
ignoreCase?:any;
|
||||
stripColors?:any;
|
||||
stream?:any;
|
||||
verbose?:any;
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -24,6 +24,7 @@ declare module "noble" {
|
||||
advertisement: Advertisement;
|
||||
rssi: number;
|
||||
services: string[];
|
||||
state: string;
|
||||
|
||||
connect(callback?: (error: string) => void): void;
|
||||
disconnect(callback?: () => void): void;
|
||||
|
||||
Vendored
+10
-5
@@ -844,7 +844,7 @@ declare module "azure" {
|
||||
container: string;
|
||||
|
||||
etag: string;
|
||||
lastModified: Date;
|
||||
lastModified: string;
|
||||
contentType: string;
|
||||
contentEncoding: string;
|
||||
contentLanguage: string;
|
||||
@@ -894,7 +894,7 @@ declare module "azure" {
|
||||
publicAccessLevel: string;
|
||||
|
||||
etag: string;
|
||||
lastModified: Date;
|
||||
lastModified: string;
|
||||
leaseStatus: string;
|
||||
leaseDuration: string;
|
||||
leaseState: string;
|
||||
@@ -916,15 +916,15 @@ declare module "azure" {
|
||||
container: string;
|
||||
blob: string;
|
||||
id: string;
|
||||
time: Date;
|
||||
time: string;
|
||||
etag: string;
|
||||
lastModified: Date;
|
||||
lastModified: string;
|
||||
|
||||
constructor();
|
||||
constructor(container: string);
|
||||
constructor(container: string, blob: string);
|
||||
constructor(container: string, blob: string, id: string);
|
||||
constructor(container: string, blob: string, id: string, time: Date);
|
||||
constructor(container: string, blob: string, id: string, time: string);
|
||||
|
||||
getPropertiesFromHeaders(header: any): void;
|
||||
}
|
||||
@@ -945,6 +945,11 @@ declare module "azure" {
|
||||
|
||||
export class QueueMessageResult {
|
||||
queue: string;
|
||||
insertiontime: string;
|
||||
expirationtime: string;
|
||||
timenextvisible: string;
|
||||
messagetext: string;
|
||||
dequeuecount: string;
|
||||
messageid: string;
|
||||
popreceipt: string;
|
||||
metadata: StorageMetadata;
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
/// <reference path="node.d.ts" />
|
||||
|
||||
import assert = require("assert");
|
||||
import fs = require("fs");
|
||||
import events = require("events");
|
||||
import zlib = require("zlib");
|
||||
import url = require('url');
|
||||
import util = require("util");
|
||||
import crypto = require("crypto");
|
||||
import http = require("http");
|
||||
import net = require("net");
|
||||
import dgram = require("dgram");
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP");
|
||||
|
||||
assert.equal(3, "3", "uses == comparator");
|
||||
|
||||
assert.notStrictEqual(2, "2", "uses === comparator");
|
||||
|
||||
assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT");
|
||||
|
||||
assert.doesNotThrow(() => {
|
||||
if (false) { throw "a hammer at your face"; }
|
||||
}, undefined, "What the...*crunch*");
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// File system tests : http://nodejs.org/api/fs.html
|
||||
////////////////////////////////////////////////////
|
||||
fs.writeFile("thebible.txt",
|
||||
"Do unto others as you would have them do unto you.",
|
||||
assert.ifError);
|
||||
|
||||
fs.writeFile("Harry Potter",
|
||||
"\"You be wizzing, Harry,\" jived Dumbledore.",
|
||||
{
|
||||
encoding: "ascii"
|
||||
},
|
||||
assert.ifError);
|
||||
|
||||
var content: string,
|
||||
buffer: Buffer;
|
||||
|
||||
content = fs.readFileSync('testfile', 'utf8');
|
||||
content = fs.readFileSync('testfile', {encoding : 'utf8'});
|
||||
buffer = fs.readFileSync('testfile');
|
||||
buffer = fs.readFileSync('testfile', {flag : 'r'});
|
||||
fs.readFile('testfile', 'utf8', (err, data) => content = data);
|
||||
fs.readFile('testfile', {encoding : 'utf8'}, (err, data) => content = data);
|
||||
fs.readFile('testfile', (err, data) => buffer = data);
|
||||
fs.readFile('testfile', {flag : 'r'}, (err, data) => buffer = data);
|
||||
|
||||
class Networker extends events.EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.emit("mingling");
|
||||
}
|
||||
}
|
||||
|
||||
url.format(url.parse('http://www.example.com/xyz'));
|
||||
|
||||
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
|
||||
url.format({
|
||||
protocol: 'https',
|
||||
host: "google.com",
|
||||
pathname: 'search',
|
||||
query: { q: "you're a lizard, gary" }
|
||||
});
|
||||
|
||||
// Old and new util.inspect APIs
|
||||
util.inspect(["This is nice"], false, 5);
|
||||
util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false });
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Stream tests : http://nodejs.org/api/stream.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options
|
||||
function stream_readable_pipe_test() {
|
||||
var r = fs.createReadStream('file.txt');
|
||||
var z = zlib.createGzip();
|
||||
var w = fs.createWriteStream('file.txt.gz');
|
||||
r.pipe(z).pipe(w);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Crypto tests : http://nodejs.org/api/crypto.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex');
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// Make sure .listen() and .close() retuern a Server instance
|
||||
http.createServer().listen(0).close().address();
|
||||
net.createServer().listen(0).close().address();
|
||||
|
||||
var request = http.request('http://0.0.0.0');
|
||||
request.once('error', function () {});
|
||||
request.setNoDelay(true);
|
||||
request.abort();
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Http tests : http://nodejs.org/api/http.html
|
||||
////////////////////////////////////////////////////
|
||||
module http_tests {
|
||||
// Status codes
|
||||
var code = 100;
|
||||
var codeMessage = http.STATUS_CODES['400'];
|
||||
var codeMessage = http.STATUS_CODES[400];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Dgram tests : http://nodejs.org/api/dgram.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
var ds: dgram.Socket = dgram.createSocket("udp4", (msg: Buffer, rinfo: dgram.RemoteInfo): void => {
|
||||
});
|
||||
var ai: dgram.AddressInfo = ds.address();
|
||||
ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => {
|
||||
});
|
||||
|
||||
|
||||
Vendored
+1334
File diff suppressed because it is too large
Load Diff
@@ -99,6 +99,40 @@ function stream_readable_pipe_test() {
|
||||
|
||||
var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex');
|
||||
|
||||
function crypto_cipher_decipher_string_test() {
|
||||
var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]);
|
||||
var clearText:string = "This is the clear text.";
|
||||
var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key);
|
||||
var cipherText:string = cipher.update(clearText, "utf8", "hex");
|
||||
cipherText += cipher.final("hex");
|
||||
|
||||
var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key);
|
||||
var clearText2:string = decipher.update(cipherText, "hex", "utf8");
|
||||
clearText2 += decipher.final("utf8");
|
||||
|
||||
assert.equal(clearText2, clearText);
|
||||
}
|
||||
|
||||
function crypto_cipher_decipher_buffer_test() {
|
||||
var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]);
|
||||
var clearText:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4]);
|
||||
var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key);
|
||||
var cipherBuffers:Buffer[] = [];
|
||||
cipherBuffers.push(cipher.update(clearText));
|
||||
cipherBuffers.push(cipher.final());
|
||||
|
||||
var cipherText:Buffer = Buffer.concat(cipherBuffers);
|
||||
|
||||
var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key);
|
||||
var decipherBuffers:Buffer[] = [];
|
||||
decipherBuffers.push(decipher.update(cipherText));
|
||||
decipherBuffers.push(decipher.final());
|
||||
|
||||
var clearText2:Buffer = Buffer.concat(decipherBuffers);
|
||||
|
||||
assert.deepEqual(clearText2, clearText);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// Make sure .listen() and .close() retuern a Server instance
|
||||
|
||||
Vendored
+11
-4
@@ -720,6 +720,9 @@ declare module "net" {
|
||||
setNoDelay(noDelay?: boolean): void;
|
||||
setKeepAlive(enable?: boolean, initialDelay?: number): void;
|
||||
address(): { port: number; family: string; address: string; };
|
||||
unref(): void;
|
||||
ref(): void;
|
||||
|
||||
remoteAddress: string;
|
||||
remotePort: number;
|
||||
bytesRead: number;
|
||||
@@ -1076,15 +1079,19 @@ declare module "crypto" {
|
||||
export function createCipher(algorithm: string, password: any): Cipher;
|
||||
export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;
|
||||
interface Cipher {
|
||||
update(data: any, input_encoding?: string, output_encoding?: string): string;
|
||||
final(output_encoding?: string): string;
|
||||
update(data: Buffer): Buffer;
|
||||
update(data: string, input_encoding?: string, output_encoding?: string): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding: boolean): void;
|
||||
}
|
||||
export function createDecipher(algorithm: string, password: any): Decipher;
|
||||
export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
|
||||
interface Decipher {
|
||||
update(data: any, input_encoding?: string, output_encoding?: string): void;
|
||||
final(output_encoding?: string): string;
|
||||
update(data: Buffer): Buffer;
|
||||
update(data: string, input_encoding?: string, output_encoding?: string): string;
|
||||
final(): Buffer;
|
||||
final(output_encoding: string): string;
|
||||
setAutoPadding(auto_padding: boolean): void;
|
||||
}
|
||||
export function createSign(algorithm: string): Signer;
|
||||
|
||||
+11
-7
@@ -20,16 +20,20 @@
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node ./_infrastructure/runner.js --test-changes",
|
||||
"changes": "node ./_infrastructure/runner.js --test-changes",
|
||||
"lint": "node ./_infrastructure/runner.js --lint-changes",
|
||||
"all": "node ./_infrastructure/runner.js",
|
||||
"dry": "node ./_infrastructure/runner.js --skip-tests --test-changes",
|
||||
"list": "node ./_infrastructure/runner.js --skip-tests --print-files --print-refmap",
|
||||
"test": "node ./_infrastructure/runner.js --changes",
|
||||
"changes": "node ./_infrastructure/runner.js --changes",
|
||||
"lint": "node ./_infrastructure/runner.js --lint",
|
||||
"tscparams": "node ./_infrastructure/runner.js --tscparams --no-tests --no-headers",
|
||||
"all": "node ./_infrastructure/runner.js ",
|
||||
"dry": "node ./_infrastructure/runner.js --dry --changes",
|
||||
"list": "node ./_infrastructure/runner.js --dry --print-files --print-refmap",
|
||||
"last": "node ./_infrastructure/runner.js --dry --print-files --print-refmap --changes",
|
||||
"files": "node ./_infrastructure/runner.js --dry --print-files",
|
||||
"refmap": "node ./_infrastructure/runner.js --dry --print-refmap",
|
||||
"help": "node ./_infrastructure/runner.js -h"
|
||||
},
|
||||
"dependencies": {
|
||||
"definition-tester": "~0.0.4"
|
||||
"definition-tester": "~0.1.4"
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/// <reference path="pgwmodal.d.ts" />
|
||||
|
||||
var $j: JQueryStatic;
|
||||
var $z: ZeptoStatic;
|
||||
|
||||
function test_open(): void {
|
||||
var r: boolean = $j.pgwModal({
|
||||
content: 'Modal Example 1'
|
||||
});
|
||||
|
||||
$j.pgwModal({
|
||||
target: '#modalContent',
|
||||
title: 'Modal title 2',
|
||||
maxWidth: 800
|
||||
});
|
||||
|
||||
$j.pgwModal({
|
||||
url: 'modal-test.php',
|
||||
loadingContent: '<span style="text-align:center">Loading in progress</span>',
|
||||
closable: false,
|
||||
titleBar: false
|
||||
});
|
||||
}
|
||||
|
||||
function test_action(): void {
|
||||
var r1: boolean = $j.pgwModal('close');
|
||||
var r2: boolean = $j.pgwModal('reposition');
|
||||
var r3: boolean = $j.pgwModal('isOpen');
|
||||
var r4: any = $j.pgwModal('getData');
|
||||
}
|
||||
|
||||
function test_equal(): void {
|
||||
$j.pgwModal == $z.pgwModal;
|
||||
}
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
// Type definitions for PgwModal 2.0
|
||||
// Project: http://pgwjs.com/pgwmodal/
|
||||
// Definitions by: Pine Mizune <https://github.com/pine613>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface PgwModalOption {
|
||||
content?: string;
|
||||
target?: string;
|
||||
url?: string;
|
||||
title?: string;
|
||||
titleBar?: boolean;
|
||||
mainClassName?: string;
|
||||
backdropClassName?: string;
|
||||
maxWidth?: number;
|
||||
angular?: boolean;
|
||||
modalData?: any;
|
||||
ajaxOptions?: any;
|
||||
closable?: boolean;
|
||||
closeContent?: string;
|
||||
closeOnEscape?: boolean;
|
||||
closeOnBackgroundClick?: boolean;
|
||||
loadingContent?: string;
|
||||
errorContent?: string;
|
||||
pushContent?: string;
|
||||
}
|
||||
|
||||
interface PgwModalMethod {
|
||||
(option: PgwModalOption): boolean;
|
||||
(action: string): any;
|
||||
(action: "close"): boolean;
|
||||
(action: "reposition"): boolean;
|
||||
(action: "getData"): any;
|
||||
(action: "isOpen"): boolean;
|
||||
}
|
||||
|
||||
interface ZeptoStatic {
|
||||
pgwModal: PgwModalMethod;
|
||||
}
|
||||
|
||||
|
||||
interface JQueryStatic {
|
||||
pgwModal: PgwModalMethod;
|
||||
}
|
||||
@@ -1,2 +1 @@
|
||||
""
|
||||
|
||||
|
||||
|
||||
@@ -150,10 +150,13 @@ datePickerInput.pickadate({
|
||||
}
|
||||
});
|
||||
|
||||
var datePickerApi = <Pickadate.Api> datePickerInput.pickadate('picker');
|
||||
var datePickerApi = datePickerInput.pickadate('picker');
|
||||
|
||||
datePickerInput.pickadate('open');
|
||||
datePickerInput.pickadate('get', 'value');
|
||||
datePickerInput.pickadate('$node').show();
|
||||
datePickerInput.pickadate('$root').show();
|
||||
datePickerInput.pickadate('_hidden').show();
|
||||
|
||||
testApiMethods(datePickerApi);
|
||||
|
||||
@@ -234,10 +237,13 @@ timePickerInput.pickatime({
|
||||
}
|
||||
});
|
||||
|
||||
var timePickerApi = <Pickadate.Api> timePickerInput.pickatime('picker');
|
||||
var timePickerApi = timePickerInput.pickatime('picker');
|
||||
|
||||
timePickerInput.pickatime('open');
|
||||
timePickerInput.pickatime('get', 'value');
|
||||
timePickerInput.pickatime('$node').show();
|
||||
timePickerInput.pickatime('$root').show();
|
||||
timePickerInput.pickatime('_hidden').show();
|
||||
|
||||
testApiMethods(timePickerApi);
|
||||
|
||||
|
||||
Vendored
+36
-22
@@ -141,8 +141,8 @@ declare module Pickadate {
|
||||
// Disable dates (elements can be Dates, [YEAR, MONTH, DATE] arrays, or integers of the week)
|
||||
disable?: any[];
|
||||
|
||||
// Root container selector
|
||||
container?: string
|
||||
// Root container selector (string) or element (JQuery)
|
||||
container?: any;
|
||||
|
||||
// Events
|
||||
onStart?: () => void;
|
||||
@@ -238,8 +238,8 @@ declare module Pickadate {
|
||||
// Disable dates (elements can be Dates, [YEAR, MONTH, DATE] arrays, or integers of the week)
|
||||
disable?: any[];
|
||||
|
||||
// Root container selector
|
||||
container?: string
|
||||
// Root container selector (string) or element (JQuery)
|
||||
container?: any;
|
||||
|
||||
// Events
|
||||
onStart?: () => void;
|
||||
@@ -289,29 +289,43 @@ declare module Pickadate {
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Initialize a date picker.
|
||||
*/
|
||||
pickadate(options?: Pickadate.DateOptions): any;
|
||||
* Access the API object after initialization.
|
||||
*/
|
||||
pickadate(keyword: "picker"): Pickadate.Api;
|
||||
pickadate(objectName: "$node"): JQuery;
|
||||
pickadate(objectName: "$root"): JQuery;
|
||||
pickadate(objectName: "_hidden"): JQuery;
|
||||
|
||||
/**
|
||||
* Access objects attached to the picker or invoke API methods after initialization.
|
||||
* If keyword is "picker", this returns a PickadateApi.
|
||||
* @param keyword "picker", an object name, or method name
|
||||
* @param arguments any arguments to pass to the method
|
||||
*/
|
||||
pickadate(keyword: string, ...arguments: any[]): any;
|
||||
* Invoke API methods after picker initialization.
|
||||
* @param methodName
|
||||
* @param arguments any arguments to pass to the method
|
||||
*/
|
||||
pickadate(methodName: string, ...arguments: any[]): any;
|
||||
|
||||
/**
|
||||
* Initialize a time picker.
|
||||
*/
|
||||
pickatime(options?: Pickadate.TimeOptions): any;
|
||||
* Initialize a date picker.
|
||||
* @returns the original JQuery selection
|
||||
*/
|
||||
pickadate(options?: Pickadate.DateOptions): JQuery;
|
||||
|
||||
|
||||
pickatime(keyword: "picker"): Pickadate.Api;
|
||||
pickatime(objectName: "$node"): JQuery;
|
||||
pickatime(objectName: "$root"): JQuery;
|
||||
pickatime(objectName: "_hidden"): JQuery;
|
||||
|
||||
/**
|
||||
* Access objects attached to the picker or invoke API methods after initialization.
|
||||
* If keyword is "picker", this returns a PickadateApi.
|
||||
* @param keyword "picker", an object name, or method name
|
||||
* @param arguments any arguments to pass to the method
|
||||
*/
|
||||
pickatime(keyword: string, ...arguments: any[]): any;
|
||||
* Invoke API methods after picker initialization.
|
||||
* @param methodName
|
||||
* @param arguments any arguments to pass to the method
|
||||
*/
|
||||
pickatime(methodName: string, ...arguments: any[]): any;
|
||||
|
||||
/**
|
||||
* Initialize a time picker.
|
||||
* @returns the original JQuery selection
|
||||
*/
|
||||
pickatime(options?: Pickadate.TimeOptions): JQuery;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/// <reference path="react-addons-0.11.d.ts" />
|
||||
import React = require("react/addons-0.11");
|
||||
|
||||
var PropTypesSpecification: React.Specification<any, any> = {
|
||||
propTypes: {
|
||||
// You can declare that a prop is a specific JS primitive. By default, these
|
||||
// are all optional.
|
||||
optionalArray: React.PropTypes.array,
|
||||
optionalBool: React.PropTypes.bool,
|
||||
optionalFunc: React.PropTypes.func,
|
||||
optionalNumber: React.PropTypes.number,
|
||||
optionalObject: React.PropTypes.object,
|
||||
optionalString: React.PropTypes.string,
|
||||
|
||||
// Anything that can be rendered: numbers, strings, components or an array
|
||||
// containing these types.
|
||||
optionalRenderable: React.PropTypes.renderable,
|
||||
|
||||
// A React component.
|
||||
optionalComponent: React.PropTypes.component,
|
||||
|
||||
// You can also declare that a prop is an instance of a class. This uses
|
||||
// JS's instanceof operator.
|
||||
optionalMessage: React.PropTypes.instanceOf(Date),
|
||||
|
||||
// You can ensure that your prop is limited to specific values by treating
|
||||
// it as an enum.
|
||||
optionalEnum: React.PropTypes.oneOf(['News', 'Photos']),
|
||||
|
||||
// An object that could be one of many types
|
||||
optionalUnion: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.number,
|
||||
React.PropTypes.instanceOf(Date)
|
||||
]),
|
||||
|
||||
// An array of a certain type
|
||||
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
|
||||
|
||||
// An object with property values of a certain type
|
||||
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
|
||||
|
||||
// An object taking on a particular shape
|
||||
optionalObjectWithShape: React.PropTypes.shape({
|
||||
color: React.PropTypes.string,
|
||||
fontSize: React.PropTypes.number
|
||||
}),
|
||||
|
||||
// You can chain any of the above with `isRequired` to make sure a warning
|
||||
// is shown if the prop isn't provided.
|
||||
requiredFunc: React.PropTypes.func.isRequired,
|
||||
|
||||
// A value of any data type
|
||||
requiredAny: React.PropTypes.any.isRequired,
|
||||
|
||||
// You can also specify a custom validator. It should return an Error
|
||||
// object if the validation fails. Don't `console.warn` or throw, as this
|
||||
// won't work inside `oneOfType`.
|
||||
customProp: function(props, propName, componentName) {
|
||||
if (!/matchme/.test(props[propName])) {
|
||||
return new Error('Validation failed!');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
render: (): React.Descriptor<any> => {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
React.createClass(PropTypesSpecification);
|
||||
|
||||
var mountNode: Element;
|
||||
|
||||
var HelloMessage = React.createClass({displayName: 'HelloMessage',
|
||||
render: function() {
|
||||
return React.DOM.div(null, "Hello ", (<React.Component<{name: string}, any>>this).props.name);
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(HelloMessage({name: "John"}), mountNode);
|
||||
|
||||
var Timer = React.createClass({displayName: 'Timer',
|
||||
getInitialState: function() {
|
||||
return {secondsElapsed: 0};
|
||||
},
|
||||
tick: function() {
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).setState({
|
||||
secondsElapsed: (<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed + 1
|
||||
});
|
||||
},
|
||||
componentDidMount: function() {
|
||||
this.interval = setInterval(this.tick, 1000);
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
clearInterval(this.interval);
|
||||
},
|
||||
render: function() {
|
||||
return React.DOM.div(
|
||||
null,
|
||||
"Seconds Elapsed: ",
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(Timer(null), mountNode);
|
||||
|
||||
// TestUtils
|
||||
var that: React.Component<any, any>;
|
||||
var node = that.refs['input'].getDOMNode();
|
||||
React.addons.TestUtils.Simulate.click(node);
|
||||
React.addons.TestUtils.Simulate.change(node);
|
||||
React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"});
|
||||
|
||||
var GoodbyeMessage = React.createClass({displayName: 'GoodbyeMessage',
|
||||
render: function() {
|
||||
return React.DOM.div(null, "Goodbye ", (<React.Component<{name: string}, any>>this).props.name);
|
||||
}
|
||||
});
|
||||
React.addons.TestUtils.renderIntoDocument(GoodbyeMessage({name: "John"}));
|
||||
|
||||
var isImportant: boolean;
|
||||
var isRead: boolean;
|
||||
var cx = React.addons.classSet;
|
||||
var classes = cx({
|
||||
'message': true,
|
||||
'message-important': isImportant,
|
||||
'message-read': isRead
|
||||
});
|
||||
|
||||
|
||||
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
// Type definitions for React with Addons 0.11.2
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../../react/legacy/react-0.11.d.ts" />
|
||||
|
||||
declare module "react/addons-0.11" {
|
||||
export = React;
|
||||
}
|
||||
|
||||
declare module React {
|
||||
export var addons: {
|
||||
classSet: (classes: {[key: string]: boolean}) => string;
|
||||
cloneWithProps: CloneWithProps<any>;
|
||||
CSSTransitionGroup: Factory<CSSTransitionGroupProps>;
|
||||
LinkedStateMixin: LinkedStateMixin<any, any>;
|
||||
Perf: Perf;
|
||||
PureRenderMixin: Mixin<any, any>;
|
||||
TestUtils: TestUtils;
|
||||
TransitionGroup: Factory<any>;
|
||||
update(object: Object, changes: Object): Object;
|
||||
};
|
||||
|
||||
export interface CloneWithProps<P> {
|
||||
(instance: Descriptor<P>, extraProps?: P): Descriptor<P>;
|
||||
}
|
||||
|
||||
export interface ReactLink<T> {
|
||||
value: T;
|
||||
requestChange(newValue: T): void;
|
||||
}
|
||||
|
||||
export interface LinkedStateMixin<P, S> extends Mixin<P, S> {
|
||||
linkState<T>(key: string): ReactLink<T>;
|
||||
}
|
||||
|
||||
export interface ComponentPerfContext {
|
||||
current: string;
|
||||
owner: string;
|
||||
}
|
||||
|
||||
export interface CSSTransitionGroupProps {
|
||||
transitionName: string;
|
||||
}
|
||||
|
||||
export interface TransitionsSpecification<P, S> extends Specification<P, S> {
|
||||
componentWillEnter?(callback: () => void): void;
|
||||
componentDidEnter?(): void;
|
||||
componentWillLeave?(callback: () => void): void;
|
||||
componentDidLeave?(): void;
|
||||
}
|
||||
|
||||
export interface NumericPerfContext {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
export interface Measurements {
|
||||
exclusive: NumericPerfContext;
|
||||
inclusive: NumericPerfContext;
|
||||
render: NumericPerfContext;
|
||||
counts: NumericPerfContext;
|
||||
writes: NumericPerfContext;
|
||||
displayNames: {
|
||||
[key: string]: ComponentPerfContext;
|
||||
};
|
||||
totalTime: number;
|
||||
}
|
||||
|
||||
export interface Perf {
|
||||
start(): void;
|
||||
stop(): void;
|
||||
printInclusive(measurements: Measurements[]): void;
|
||||
printExclusive(measurements: Measurements[]): void;
|
||||
printWasted(measurements: Measurements[]): void;
|
||||
printDOM(measurements: Measurements[]): void;
|
||||
getLastMeasurements(): Measurements[];
|
||||
}
|
||||
|
||||
export interface TestUtils {
|
||||
Simulate: Simulate;
|
||||
renderIntoDocument(instance: Descriptor<any>): Descriptor<any>;
|
||||
mockComponent(componentClass: Factory<any>, mockTagName?: string): TestUtils;
|
||||
isDescriptorOfType(descriptor: Descriptor<any>, componentClass: Factory<any>): boolean;
|
||||
isDOMComponent(instance: Descriptor<any>): boolean;
|
||||
isCompositeComponent(instance: Descriptor<any>): boolean;
|
||||
isCompositeComponentWithType(instance: Descriptor<any>, componentClass: Function): boolean;
|
||||
isTextComponent(instance: Descriptor<any>): boolean;
|
||||
findAllInRenderedTree(tree: Descriptor<any>, test: Function): Descriptor<any>[];
|
||||
scryRenderedDOMComponentsWithClass(tree: Descriptor<any>, className: string): Descriptor<any>[];
|
||||
findRenderedDOMComponentWithClass(tree: Descriptor<any>, className: string): Descriptor<any>;
|
||||
scryRenderedDOMComponentsWithTag(tree: Descriptor<any>, className: string): Descriptor<any>[];
|
||||
findRenderedDOMComponentWithTag(tree: Descriptor<any>, tagName: string): Descriptor<any>;
|
||||
scryFindRenderedComponentsWithTag(tree: Descriptor<any>, componentClass: Function): Descriptor<any>[];
|
||||
findRenderedComponentWithType(tree: Descriptor<any>, componentClass: Function): Descriptor<any>;
|
||||
}
|
||||
|
||||
export interface SyntheticEventData {
|
||||
altKey?: boolean;
|
||||
button?: number;
|
||||
buttons?: number;
|
||||
clientX?: number;
|
||||
clientY?: number;
|
||||
changedTouches?: TouchList;
|
||||
charCode?: boolean;
|
||||
clipboardData?: DataTransfer;
|
||||
ctrlKey?: boolean;
|
||||
deltaMode?: number;
|
||||
deltaX?: number;
|
||||
deltaY?: number;
|
||||
deltaZ?: number;
|
||||
detail?: number;
|
||||
getModifierState?(key: string): boolean;
|
||||
key?: string;
|
||||
keyCode?: number;
|
||||
locale?: string;
|
||||
location?: number;
|
||||
metaKey?: boolean;
|
||||
pageX?: number;
|
||||
pageY?: number;
|
||||
relatedTarget?: EventTarget;
|
||||
repeat?: boolean;
|
||||
screenX?: number;
|
||||
screenY?: number;
|
||||
shiftKey?: boolean;
|
||||
targetTouches?: TouchList;
|
||||
touches?: TouchList;
|
||||
view?: AbstractView;
|
||||
which?: number;
|
||||
}
|
||||
|
||||
export interface EventSimulator {
|
||||
(element: Element, eventData?: SyntheticEventData): void;
|
||||
(descriptor: Descriptor<any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
export interface Simulate {
|
||||
blur: EventSimulator;
|
||||
change: EventSimulator;
|
||||
click: EventSimulator;
|
||||
cut: EventSimulator;
|
||||
doubleClick: EventSimulator;
|
||||
drag: EventSimulator;
|
||||
dragEnd: EventSimulator;
|
||||
dragEnter: EventSimulator;
|
||||
dragExit: EventSimulator;
|
||||
dragLeave: EventSimulator;
|
||||
dragOver: EventSimulator;
|
||||
dragStart: EventSimulator;
|
||||
drop: EventSimulator;
|
||||
focus: EventSimulator;
|
||||
input: EventSimulator;
|
||||
keyDown: EventSimulator;
|
||||
keyPress: EventSimulator;
|
||||
keyUp: EventSimulator;
|
||||
mouseDown: EventSimulator;
|
||||
mouseEnter: EventSimulator;
|
||||
mouseLeave: EventSimulator;
|
||||
mouseMove: EventSimulator;
|
||||
mouseOut: EventSimulator;
|
||||
mouseOver: EventSimulator;
|
||||
mouseUp: EventSimulator;
|
||||
paste: EventSimulator;
|
||||
scroll: EventSimulator;
|
||||
submit: EventSimulator;
|
||||
touchCancel: EventSimulator;
|
||||
touchEnd: EventSimulator;
|
||||
touchMove: EventSimulator;
|
||||
touchStart: EventSimulator;
|
||||
wheel: EventSimulator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/// <reference path="react-addons.d.ts" />
|
||||
import React = require("react/addons");
|
||||
|
||||
var PropTypesSpecification: React.Specification<any, any> = {
|
||||
propTypes: {
|
||||
// You can declare that a prop is a specific JS primitive. By default, these
|
||||
// are all optional.
|
||||
optionalArray: React.PropTypes.array,
|
||||
optionalBool: React.PropTypes.bool,
|
||||
optionalFunc: React.PropTypes.func,
|
||||
optionalNumber: React.PropTypes.number,
|
||||
optionalObject: React.PropTypes.object,
|
||||
optionalString: React.PropTypes.string,
|
||||
|
||||
// Anything that can be rendered: numbers, strings, components or an array
|
||||
// containing these types.
|
||||
optionalRenderable: React.PropTypes.node,
|
||||
|
||||
// A React component.
|
||||
optionalComponent: React.PropTypes.component,
|
||||
|
||||
// You can also declare that a prop is an instance of a class. This uses
|
||||
// JS's instanceof operator.
|
||||
optionalMessage: React.PropTypes.instanceOf(Date),
|
||||
|
||||
// You can ensure that your prop is limited to specific values by treating
|
||||
// it as an enum.
|
||||
optionalEnum: React.PropTypes.oneOf(['News', 'Photos']),
|
||||
|
||||
// An object that could be one of many types
|
||||
optionalUnion: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.number,
|
||||
React.PropTypes.instanceOf(Date)
|
||||
]),
|
||||
|
||||
// An array of a certain type
|
||||
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
|
||||
|
||||
// An object with property values of a certain type
|
||||
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
|
||||
|
||||
// An object taking on a particular shape
|
||||
optionalObjectWithShape: React.PropTypes.shape({
|
||||
color: React.PropTypes.string,
|
||||
fontSize: React.PropTypes.number
|
||||
}),
|
||||
|
||||
// You can chain any of the above with `isRequired` to make sure a warning
|
||||
// is shown if the prop isn't provided.
|
||||
requiredFunc: React.PropTypes.func.isRequired,
|
||||
|
||||
// A value of any data type
|
||||
requiredAny: React.PropTypes.any.isRequired,
|
||||
|
||||
// You can also specify a custom validator. It should return an Error
|
||||
// object if the validation fails. Don't `console.warn` or throw, as this
|
||||
// won't work inside `oneOfType`.
|
||||
customProp: function(props, propName, componentName) {
|
||||
if (!/matchme/.test(props[propName])) {
|
||||
return new Error('Validation failed!');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
render: (): React.ReactHTMLElement => {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
React.createClass(PropTypesSpecification);
|
||||
|
||||
var mountNode: Element;
|
||||
|
||||
var HelloMessage = React.createClass({displayName: 'HelloMessage',
|
||||
render: function() {
|
||||
return React.DOM.div(null, "Hello ", (<React.Component<{name: string}, any>>this).props.name);
|
||||
}
|
||||
});
|
||||
|
||||
React.render(HelloMessage({name: "John"}), mountNode);
|
||||
|
||||
var Timer = React.createClass({displayName: 'Timer',
|
||||
getInitialState: function() {
|
||||
return {secondsElapsed: 0};
|
||||
},
|
||||
tick: function() {
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).setState({
|
||||
secondsElapsed: (<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed + 1
|
||||
});
|
||||
},
|
||||
componentDidMount: function() {
|
||||
this.interval = setInterval(this.tick, 1000);
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
clearInterval(this.interval);
|
||||
},
|
||||
render: function() {
|
||||
return React.DOM.div(
|
||||
null,
|
||||
"Seconds Elapsed: ",
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
React.render(Timer(null), mountNode);
|
||||
|
||||
// TestUtils
|
||||
var that: React.Component<any, any>;
|
||||
var node = that.refs['input'].getDOMNode();
|
||||
React.addons.TestUtils.Simulate.click(node);
|
||||
React.addons.TestUtils.Simulate.change(node);
|
||||
React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"});
|
||||
|
||||
var GoodbyeMessage = React.createClass({displayName: 'GoodbyeMessage',
|
||||
render: function() {
|
||||
return React.DOM.div(null, "Goodbye ", (<React.Component<{name: string}, any>>this).props.name);
|
||||
}
|
||||
});
|
||||
React.addons.TestUtils.renderIntoDocument(GoodbyeMessage({name: "John"}));
|
||||
|
||||
var isImportant: boolean;
|
||||
var isRead: boolean;
|
||||
var cx = React.addons.classSet;
|
||||
var classes = cx({
|
||||
'message': true,
|
||||
'message-important': isImportant,
|
||||
'message-read': isRead
|
||||
});
|
||||
|
||||
|
||||
|
||||
Vendored
+174
@@ -0,0 +1,174 @@
|
||||
// Type definitions for React with Addons 0.12.RC
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
declare module "react/addons" {
|
||||
export = React;
|
||||
}
|
||||
|
||||
declare module React {
|
||||
export var addons: {
|
||||
classSet: (classes: {[key: string]: boolean}) => string;
|
||||
cloneWithProps: CloneWithProps<any>;
|
||||
CSSTransitionGroup: ReactComponentFactory<CSSTransitionGroupProps>;
|
||||
LinkedStateMixin: LinkedStateMixin<any, any>;
|
||||
Perf: Perf;
|
||||
PureRenderMixin: Mixin<any, any>;
|
||||
TestUtils: TestUtils;
|
||||
TransitionGroup: ReactComponentFactory<any>;
|
||||
update(object: Object, changes: Object): Object;
|
||||
};
|
||||
|
||||
export interface CloneWithProps<P> {
|
||||
(instance: ReactComponentElement<P>, extraProps?: P): ReactComponentElement<P>;
|
||||
}
|
||||
|
||||
export interface ReactLink<T> {
|
||||
value: T;
|
||||
requestChange(newValue: T): void;
|
||||
}
|
||||
|
||||
export interface LinkedStateMixin<P, S> extends Mixin<P, S> {
|
||||
linkState<T>(key: string): ReactLink<T>;
|
||||
}
|
||||
|
||||
export interface ComponentPerfContext {
|
||||
current: string;
|
||||
owner: string;
|
||||
}
|
||||
|
||||
export interface CSSTransitionGroupProps {
|
||||
transitionName: string;
|
||||
}
|
||||
|
||||
export interface TransitionsSpecification<P, S> extends Specification<P, S> {
|
||||
componentWillEnter?(callback: () => void): void;
|
||||
componentDidEnter?(): void;
|
||||
componentWillLeave?(callback: () => void): void;
|
||||
componentDidLeave?(): void;
|
||||
}
|
||||
|
||||
export interface NumericPerfContext {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
export interface Measurements {
|
||||
exclusive: NumericPerfContext;
|
||||
inclusive: NumericPerfContext;
|
||||
render: NumericPerfContext;
|
||||
counts: NumericPerfContext;
|
||||
writes: NumericPerfContext;
|
||||
displayNames: {
|
||||
[key: string]: ComponentPerfContext;
|
||||
};
|
||||
totalTime: number;
|
||||
}
|
||||
|
||||
export interface Perf {
|
||||
start(): void;
|
||||
stop(): void;
|
||||
printInclusive(measurements: Measurements[]): void;
|
||||
printExclusive(measurements: Measurements[]): void;
|
||||
printWasted(measurements: Measurements[]): void;
|
||||
printDOM(measurements: Measurements[]): void;
|
||||
getLastMeasurements(): Measurements[];
|
||||
}
|
||||
|
||||
export interface TestUtils {
|
||||
Simulate: Simulate;
|
||||
renderIntoDocument<P>(instance: ReactComponentElement<P>): ReactComponentElement<P>;
|
||||
renderIntoDocument(instnace: ReactHTMLElement): ReactHTMLElement;
|
||||
renderIntoDocument(instnace: ReactSVGElement): ReactSVGElement;
|
||||
mockComponent(componentClass: ReactComponentFactory<any>, mockTagName?: string): TestUtils;
|
||||
isDescriptorOfType(descriptor: ReactElement<any, any>, componentClass: ReactComponentFactory<any>): boolean;
|
||||
isDOMComponent(instance: ReactElement<any, any>): boolean;
|
||||
isCompositeComponent(instance: ReactElement<any, any>): boolean;
|
||||
isCompositeComponentWithType(instance: ReactElement<any, any>, componentClass: ReactComponentFactory<any>): boolean;
|
||||
isTextComponent(instance: ReactElement<any, any>): boolean;
|
||||
findAllInRenderedTree(tree: ReactElement<any, any>, test: (component: ReactElement<any, any>) => boolean): ReactElement<any, any>[];
|
||||
scryRenderedDOMComponentsWithClass(tree: ReactElement<any, any>, className: string): ReactElement<any, any>[];
|
||||
findRenderedDOMComponentWithClass(tree: ReactElement<any, any>, className: string): ReactElement<any, any>;
|
||||
scryRenderedDOMComponentsWithTag(tree: ReactElement<any, any>, className: string): ReactElement<any, any>[];
|
||||
findRenderedDOMComponentWithTag(tree: ReactElement<any, any>, tagName: string): ReactElement<any, any>;
|
||||
scryFindRenderedComponentsWithTag(tree: ReactElement<any, any>, componentClass: Function): ReactElement<any, any>[];
|
||||
findRenderedComponentWithType(tree: ReactElement<any, any>, componentClass: Function): ReactElement<any, any>;
|
||||
}
|
||||
|
||||
export interface SyntheticEventData {
|
||||
altKey?: boolean;
|
||||
button?: number;
|
||||
buttons?: number;
|
||||
clientX?: number;
|
||||
clientY?: number;
|
||||
changedTouches?: TouchList;
|
||||
charCode?: boolean;
|
||||
clipboardData?: DataTransfer;
|
||||
ctrlKey?: boolean;
|
||||
deltaMode?: number;
|
||||
deltaX?: number;
|
||||
deltaY?: number;
|
||||
deltaZ?: number;
|
||||
detail?: number;
|
||||
getModifierState?(key: string): boolean;
|
||||
key?: string;
|
||||
keyCode?: number;
|
||||
locale?: string;
|
||||
location?: number;
|
||||
metaKey?: boolean;
|
||||
pageX?: number;
|
||||
pageY?: number;
|
||||
relatedTarget?: EventTarget;
|
||||
repeat?: boolean;
|
||||
screenX?: number;
|
||||
screenY?: number;
|
||||
shiftKey?: boolean;
|
||||
targetTouches?: TouchList;
|
||||
touches?: TouchList;
|
||||
view?: AbstractView;
|
||||
which?: number;
|
||||
}
|
||||
|
||||
export interface EventSimulator {
|
||||
(element: Element, eventData?: SyntheticEventData): void;
|
||||
(descriptor: ReactElement<any, any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
export interface Simulate {
|
||||
blur: EventSimulator;
|
||||
change: EventSimulator;
|
||||
click: EventSimulator;
|
||||
cut: EventSimulator;
|
||||
doubleClick: EventSimulator;
|
||||
drag: EventSimulator;
|
||||
dragEnd: EventSimulator;
|
||||
dragEnter: EventSimulator;
|
||||
dragExit: EventSimulator;
|
||||
dragLeave: EventSimulator;
|
||||
dragOver: EventSimulator;
|
||||
dragStart: EventSimulator;
|
||||
drop: EventSimulator;
|
||||
focus: EventSimulator;
|
||||
input: EventSimulator;
|
||||
keyDown: EventSimulator;
|
||||
keyPress: EventSimulator;
|
||||
keyUp: EventSimulator;
|
||||
mouseDown: EventSimulator;
|
||||
mouseEnter: EventSimulator;
|
||||
mouseLeave: EventSimulator;
|
||||
mouseMove: EventSimulator;
|
||||
mouseOut: EventSimulator;
|
||||
mouseOver: EventSimulator;
|
||||
mouseUp: EventSimulator;
|
||||
paste: EventSimulator;
|
||||
scroll: EventSimulator;
|
||||
submit: EventSimulator;
|
||||
touchCancel: EventSimulator;
|
||||
touchEnd: EventSimulator;
|
||||
touchMove: EventSimulator;
|
||||
touchStart: EventSimulator;
|
||||
wheel: EventSimulator;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/// <reference path="react-0.11.d.ts" />
|
||||
import React = require("react-0.11");
|
||||
|
||||
var PropTypesSpecification: React.Specification<any, any> = {
|
||||
propTypes: {
|
||||
// You can declare that a prop is a specific JS primitive. By default, these
|
||||
// are all optional.
|
||||
optionalArray: React.PropTypes.array,
|
||||
optionalBool: React.PropTypes.bool,
|
||||
optionalFunc: React.PropTypes.func,
|
||||
optionalNumber: React.PropTypes.number,
|
||||
optionalObject: React.PropTypes.object,
|
||||
optionalString: React.PropTypes.string,
|
||||
|
||||
// Anything that can be rendered: numbers, strings, components or an array
|
||||
// containing these types.
|
||||
optionalRenderable: React.PropTypes.renderable,
|
||||
|
||||
// A React component.
|
||||
optionalComponent: React.PropTypes.component,
|
||||
|
||||
// You can also declare that a prop is an instance of a class. This uses
|
||||
// JS's instanceof operator.
|
||||
optionalMessage: React.PropTypes.instanceOf(Date),
|
||||
|
||||
// You can ensure that your prop is limited to specific values by treating
|
||||
// it as an enum.
|
||||
optionalEnum: React.PropTypes.oneOf(['News', 'Photos']),
|
||||
|
||||
// An object that could be one of many types
|
||||
optionalUnion: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.number,
|
||||
React.PropTypes.instanceOf(Date)
|
||||
]),
|
||||
|
||||
// An array of a certain type
|
||||
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
|
||||
|
||||
// An object with property values of a certain type
|
||||
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
|
||||
|
||||
// An object taking on a particular shape
|
||||
optionalObjectWithShape: React.PropTypes.shape({
|
||||
color: React.PropTypes.string,
|
||||
fontSize: React.PropTypes.number
|
||||
}),
|
||||
|
||||
// You can chain any of the above with `isRequired` to make sure a warning
|
||||
// is shown if the prop isn't provided.
|
||||
requiredFunc: React.PropTypes.func.isRequired,
|
||||
|
||||
// A value of any data type
|
||||
requiredAny: React.PropTypes.any.isRequired,
|
||||
|
||||
// You can also specify a custom validator. It should return an Error
|
||||
// object if the validation fails. Don't `console.warn` or throw, as this
|
||||
// won't work inside `oneOfType`.
|
||||
customProp: function(props, propName, componentName) {
|
||||
if (!/matchme/.test(props[propName])) {
|
||||
return new Error('Validation failed!');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
render: (): React.Descriptor<any> => {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
React.createClass(PropTypesSpecification);
|
||||
|
||||
var mountNode: Element;
|
||||
|
||||
var HelloMessage = React.createClass({displayName: 'HelloMessage',
|
||||
render: function() {
|
||||
return React.DOM.div(null, "Hello ", (<React.Component<{name: string}, any>>this).props.name);
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(HelloMessage({name: "John"}), mountNode);
|
||||
|
||||
var Timer = React.createClass({displayName: 'Timer',
|
||||
getInitialState: function() {
|
||||
return {secondsElapsed: 0};
|
||||
},
|
||||
tick: function() {
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).setState({
|
||||
secondsElapsed: (<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed + 1
|
||||
});
|
||||
},
|
||||
componentDidMount: function() {
|
||||
this.interval = setInterval(this.tick, 1000);
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
clearInterval(this.interval);
|
||||
},
|
||||
render: function() {
|
||||
return React.DOM.div(
|
||||
null,
|
||||
"Seconds Elapsed: ",
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(Timer(null), mountNode);
|
||||
Vendored
+553
@@ -0,0 +1,553 @@
|
||||
// Type definitions for React 0.11.2
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "react-0.11" {
|
||||
export = React;
|
||||
}
|
||||
|
||||
declare module React {
|
||||
export function createClass<P, S>(specification: Specification<P, S>): Factory<P>;
|
||||
|
||||
export function renderComponent<P>(component: Descriptor<P>, container: Element, callback?: () => void): Descriptor<P>;
|
||||
|
||||
export function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
export function renderComponentToString(component: Descriptor<any>): string;
|
||||
|
||||
export function renderComponentToStaticMarkup(component: Descriptor<any>): string;
|
||||
|
||||
export function isValidClass(factory: Factory<any>): boolean;
|
||||
|
||||
export function isValidComponent(component: Descriptor<any>): boolean;
|
||||
|
||||
export function initializeTouchEvents(shouldUseTouch: boolean): void;
|
||||
|
||||
export interface Descriptor<P> {
|
||||
props: P;
|
||||
}
|
||||
|
||||
export interface Factory<P> {
|
||||
(properties?: P, ...children: any[]): Descriptor<P>;
|
||||
}
|
||||
|
||||
export interface Mixin<P, S> {
|
||||
componentWillMount?(): void;
|
||||
componentDidMount?(): void;
|
||||
componentWillReceiveProps?(nextProps: P): void;
|
||||
shouldComponentUpdate?(nextProps: P, nextState: S): boolean;
|
||||
componentWillUpdate?(nextProps: P, nextState: S): void;
|
||||
componentDidUpdate?(prevProps: P, prevState: S): void;
|
||||
componentWillUnmount?(): void;
|
||||
}
|
||||
|
||||
export interface Specification<P, S> extends Mixin<P, S> {
|
||||
displayName?: string;
|
||||
mixins?: Mixin<P, S>[];
|
||||
statics?: {
|
||||
[key: string]: Function;
|
||||
};
|
||||
propTypes?: ValidationMap<P>;
|
||||
getDefaultProps?(): P;
|
||||
getInitialState?(): S;
|
||||
render(): Descriptor<any>;
|
||||
}
|
||||
|
||||
export interface DomReferencer {
|
||||
getDOMNode(): Element;
|
||||
}
|
||||
|
||||
export interface Component<P, S> extends DomReferencer {
|
||||
refs: {
|
||||
[key: string]: DomReferencer
|
||||
};
|
||||
props: P;
|
||||
state: S;
|
||||
setState(nextState: S, callback?: () => void): void;
|
||||
replaceState(nextState: S, callback?: () => void): void;
|
||||
forceUpdate(callback?: () => void): void;
|
||||
isMounted(): boolean;
|
||||
transferPropsTo(target: Factory<P>): Descriptor<P>;
|
||||
setProps(nextProps: P, callback?: () => void): void;
|
||||
replaceProps(nextProps: P, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface Constructable {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
export interface Validator<P> {
|
||||
(props: P, propName: string, componentName: string): Error;
|
||||
}
|
||||
|
||||
export interface Requireable<P> extends Validator<P> {
|
||||
isRequired: Validator<P>;
|
||||
}
|
||||
|
||||
export interface ValidationMap<P> {
|
||||
[key: string]: Validator<P>;
|
||||
}
|
||||
|
||||
export var PropTypes: {
|
||||
any: Requireable<any>;
|
||||
array: Requireable<any>;
|
||||
bool: Requireable<any>;
|
||||
func: Requireable<any>;
|
||||
number: Requireable<any>;
|
||||
object: Requireable<any>;
|
||||
string: Requireable<any>;
|
||||
renderable: Requireable<any>;
|
||||
component: Requireable<any>;
|
||||
instanceOf: (clazz: Constructable) => Requireable<any>;
|
||||
oneOf: (types: any[]) => Requireable<any>
|
||||
oneOfType: (types: Validator<any>[]) => Requireable<any>;
|
||||
arrayOf: (type: Validator<any>) => Requireable<any>;
|
||||
objectOf: (type: Validator<any>) => Requireable<any>;
|
||||
shape: (type: ValidationMap<any>) => Requireable<any>;
|
||||
};
|
||||
|
||||
export var Children: {
|
||||
map(children: any[], fn: (child: any) => any): any[];
|
||||
forEach(children: any[], fn: (child: any) => any): void;
|
||||
count(children: any[]): number;
|
||||
only(children: any[]): any;
|
||||
};
|
||||
|
||||
// Browser Interfaces
|
||||
// Taken from https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
|
||||
export interface AbstractView {
|
||||
styleMedia: StyleMedia;
|
||||
document: Document;
|
||||
}
|
||||
|
||||
export interface Touch {
|
||||
identifier: number;
|
||||
target: EventTarget;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
|
||||
export interface TouchList {
|
||||
[index: number]: Touch;
|
||||
length: number;
|
||||
item(index: number): Touch;
|
||||
identifiedTouch(identifier: number): Touch;
|
||||
}
|
||||
|
||||
// Events
|
||||
export interface SyntheticEvent {
|
||||
bubbles: boolean;
|
||||
cancelable: boolean;
|
||||
currentTarget: EventTarget;
|
||||
defaultPrevented: boolean;
|
||||
eventPhase: number;
|
||||
nativeEvent: Event;
|
||||
preventDefault(): void;
|
||||
stopPropagation(): void;
|
||||
target: EventTarget;
|
||||
timeStamp: Date;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface ClipboardEvent extends SyntheticEvent {
|
||||
clipboardData: DataTransfer;
|
||||
}
|
||||
|
||||
export interface KeyboardEvent extends SyntheticEvent {
|
||||
altKey: boolean;
|
||||
charCode: number;
|
||||
ctrlKey: boolean;
|
||||
getModifierState(key: string): boolean;
|
||||
key: string;
|
||||
keyCode: number;
|
||||
locale: string;
|
||||
location: number;
|
||||
metaKey: boolean;
|
||||
repeat: boolean;
|
||||
shiftKey: boolean;
|
||||
which: number;
|
||||
}
|
||||
|
||||
export interface FocusEvent extends SyntheticEvent {
|
||||
relatedTarget: EventTarget;
|
||||
}
|
||||
|
||||
export interface MouseEvent extends SyntheticEvent {
|
||||
altKey: boolean;
|
||||
button: number;
|
||||
buttons: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
ctrlKey: boolean;
|
||||
getModifierState(key: string): boolean;
|
||||
metaKey: boolean;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
relatedTarget: EventTarget;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
|
||||
export interface TouchEvent extends SyntheticEvent {
|
||||
altKey: boolean;
|
||||
changedTouches: TouchList;
|
||||
ctrlKey: boolean;
|
||||
getModifierState(key: string): boolean;
|
||||
metaKey: boolean;
|
||||
shiftKey: boolean;
|
||||
targetTouches: TouchList;
|
||||
touches: TouchList;
|
||||
}
|
||||
|
||||
export interface UiEvent extends SyntheticEvent {
|
||||
detail: number;
|
||||
view: AbstractView;
|
||||
}
|
||||
|
||||
export interface WheelEvent extends SyntheticEvent {
|
||||
deltaMode: number;
|
||||
deltaX: number;
|
||||
deltaY: number;
|
||||
deltaZ: number;
|
||||
}
|
||||
|
||||
// Attributes
|
||||
export interface EventAttributes {
|
||||
onCopy?: (event: ClipboardEvent) => void;
|
||||
onCut?: (event: ClipboardEvent) => void;
|
||||
onPaste?: (event: ClipboardEvent) => void;
|
||||
onKeyDown?: (event: KeyboardEvent) => void;
|
||||
onKeyPress?: (event: KeyboardEvent) => void;
|
||||
onKeyUp?: (event: KeyboardEvent) => void;
|
||||
onFocus?: (event: FocusEvent) => void;
|
||||
onBlur?: (event: FocusEvent) => void;
|
||||
onChange?: (event: SyntheticEvent) => void;
|
||||
onInput?: (event: SyntheticEvent) => void;
|
||||
onSubmit?: (event: SyntheticEvent) => void;
|
||||
onClick?: (event: MouseEvent) => void;
|
||||
onDoubleClick?: (event: MouseEvent) => void;
|
||||
onDrag?: (event: MouseEvent) => void;
|
||||
onDragEnd?: (event: MouseEvent) => void;
|
||||
onDragEnter?: (event: MouseEvent) => void;
|
||||
onDragExit?: (event: MouseEvent) => void;
|
||||
onDragLeave?: (event: MouseEvent) => void;
|
||||
onDragOver?: (event: MouseEvent) => void;
|
||||
onDragStart?: (event: MouseEvent) => void;
|
||||
onDrop?: (event: MouseEvent) => void;
|
||||
onMouseDown?: (event: MouseEvent) => void;
|
||||
onMouseEnter?: (event: MouseEvent) => void;
|
||||
onMouseLeave?: (event: MouseEvent) => void;
|
||||
onMouseMove?: (event: MouseEvent) => void;
|
||||
onMouseOut?: (event: MouseEvent) => void;
|
||||
onMouseOver?: (event: MouseEvent) => void;
|
||||
onMouseUp?: (event: MouseEvent) => void;
|
||||
onTouchCancel?: (event: TouchEvent) => void;
|
||||
onTouchEnd?: (event: TouchEvent) => void;
|
||||
onTouchMove?: (event: TouchEvent) => void;
|
||||
onTouchStart?: (event: TouchEvent) => void;
|
||||
onScroll?: (event: UiEvent) => void;
|
||||
onWheel?: (event: WheelEvent) => void;
|
||||
}
|
||||
|
||||
export interface ReactAttributes {
|
||||
dangerouslySetInnerHTML?: {
|
||||
__html: string;
|
||||
};
|
||||
children?: any[];
|
||||
key?: string;
|
||||
ref?: string;
|
||||
}
|
||||
|
||||
export interface DomAttributes extends EventAttributes, ReactAttributes {
|
||||
// HTML Attributes
|
||||
accept?: any;
|
||||
accessKey?: any;
|
||||
action?: any;
|
||||
allowFullScreen?: any;
|
||||
allowTransparency?: any;
|
||||
alt?: any;
|
||||
async?: any;
|
||||
autoCapitalize?: any;
|
||||
autoComplete?: any;
|
||||
autoCorrect?: any;
|
||||
autoFocus?: any;
|
||||
autoPlay?: any;
|
||||
cellPadding?: any;
|
||||
cellSpacing?: any;
|
||||
charSet?: any;
|
||||
checked?: any;
|
||||
className?: any;
|
||||
cols?: any;
|
||||
colSpan?: any;
|
||||
content?: any;
|
||||
contentEditable?: any;
|
||||
contextMenu?: any;
|
||||
controls?: any;
|
||||
coords?: any;
|
||||
crossOrigin?: any;
|
||||
data?: any;
|
||||
dateTime?: any;
|
||||
defer?: any;
|
||||
dir?: any;
|
||||
disabled?: any;
|
||||
download?: any;
|
||||
draggable?: any;
|
||||
encType?: any;
|
||||
form?: any;
|
||||
formNoValidate?: any;
|
||||
frameBorder?: any;
|
||||
height?: any;
|
||||
hidden?: any;
|
||||
href?: any;
|
||||
hrefLang?: any;
|
||||
htmlFor?: any;
|
||||
httpEquiv?: any;
|
||||
icon?: any;
|
||||
id?: any;
|
||||
itemProp?: any;
|
||||
itemScope?: any;
|
||||
itemType?: any;
|
||||
label?: any;
|
||||
lang?: any;
|
||||
list?: any;
|
||||
loop?: any;
|
||||
max?: any;
|
||||
maxLength?: any;
|
||||
mediaGroup?: any;
|
||||
method?: any;
|
||||
min?: any;
|
||||
multiple?: any;
|
||||
muted?: any;
|
||||
name?: any;
|
||||
noValidate?: any;
|
||||
open?: any;
|
||||
pattern?: any;
|
||||
placeholder?: any;
|
||||
poster?: any;
|
||||
preload?: any;
|
||||
property?: any;
|
||||
radioGroup?: any;
|
||||
readOnly?: any;
|
||||
rel?: any;
|
||||
required?: any;
|
||||
role?: any;
|
||||
rows?: any;
|
||||
rowSpan?: any;
|
||||
sandbox?: any;
|
||||
scope?: any;
|
||||
scrollLeft?: any;
|
||||
scrolling?: any;
|
||||
scrollTop?: any;
|
||||
seamless?: any;
|
||||
selected?: any;
|
||||
shape?: any;
|
||||
size?: any;
|
||||
span?: any;
|
||||
spellCheck?: any;
|
||||
src?: any;
|
||||
srcDoc?: any;
|
||||
srcSet?: any;
|
||||
start?: any;
|
||||
step?: any;
|
||||
style?: any;
|
||||
tabIndex?: any;
|
||||
target?: any;
|
||||
title?: any;
|
||||
type?: any;
|
||||
useMap?: any;
|
||||
value?: any;
|
||||
width?: any;
|
||||
wmode?: any;
|
||||
}
|
||||
|
||||
export interface SvgAttributes extends EventAttributes, ReactAttributes {
|
||||
cx?: any;
|
||||
cy?: any;
|
||||
d?: any;
|
||||
dx?: any;
|
||||
dy?: any;
|
||||
fill?: any;
|
||||
fillOpacity?: any;
|
||||
fontFamily?: any;
|
||||
fontSize?: any;
|
||||
fx?: any;
|
||||
fy?: any;
|
||||
gradientTransform?: any;
|
||||
gradientUnits?: any;
|
||||
markerEnd?: any;
|
||||
markerMid?: any;
|
||||
markerStart?: any;
|
||||
offset?: any;
|
||||
opacity?: any;
|
||||
patternContentUnits?: any;
|
||||
patternUnits?: any;
|
||||
points?: any;
|
||||
preserveAspectRatio?: any;
|
||||
r?: any;
|
||||
rx?: any;
|
||||
ry?: any;
|
||||
spreadMethod?: any;
|
||||
stopColor?: any;
|
||||
stopOpacity?: any;
|
||||
stroke?: any;
|
||||
strokeDasharray?: any;
|
||||
strokeLinecap?: any;
|
||||
strokeOpacity?: any;
|
||||
strokeWidth?: any;
|
||||
textAnchor?: any;
|
||||
transform?: any;
|
||||
version?: any;
|
||||
viewBox?: any;
|
||||
x1?: any;
|
||||
x2?: any;
|
||||
x?: any;
|
||||
y1?: any;
|
||||
y2?: any;
|
||||
y?: any;
|
||||
}
|
||||
|
||||
export interface DomElement extends Factory<DomAttributes> {
|
||||
}
|
||||
|
||||
export interface SvgElement extends Factory<SvgAttributes> {
|
||||
}
|
||||
|
||||
export var DOM: {
|
||||
// HTML
|
||||
a: DomElement;
|
||||
abbr: DomElement;
|
||||
address: DomElement;
|
||||
area: DomElement;
|
||||
article: DomElement;
|
||||
aside: DomElement;
|
||||
audio: DomElement;
|
||||
b: DomElement;
|
||||
base: DomElement;
|
||||
bdi: DomElement;
|
||||
bdo: DomElement;
|
||||
big: DomElement;
|
||||
blockquote: DomElement;
|
||||
body: DomElement;
|
||||
br: DomElement;
|
||||
button: DomElement;
|
||||
canvas: DomElement;
|
||||
caption: DomElement;
|
||||
cite: DomElement;
|
||||
code: DomElement;
|
||||
col: DomElement;
|
||||
colgroup: DomElement;
|
||||
data: DomElement;
|
||||
datalist: DomElement;
|
||||
dd: DomElement;
|
||||
del: DomElement;
|
||||
details: DomElement;
|
||||
dfn: DomElement;
|
||||
dialog: DomElement;
|
||||
div: DomElement;
|
||||
dl: DomElement;
|
||||
dt: DomElement;
|
||||
em: DomElement;
|
||||
embed: DomElement;
|
||||
fieldset: DomElement;
|
||||
figcaption: DomElement;
|
||||
figure: DomElement;
|
||||
footer: DomElement;
|
||||
form: DomElement;
|
||||
h1: DomElement;
|
||||
h2: DomElement;
|
||||
h3: DomElement;
|
||||
h4: DomElement;
|
||||
h5: DomElement;
|
||||
h6: DomElement;
|
||||
head: DomElement;
|
||||
header: DomElement;
|
||||
hr: DomElement;
|
||||
html: DomElement;
|
||||
i: DomElement;
|
||||
iframe: DomElement;
|
||||
img: DomElement;
|
||||
input: DomElement;
|
||||
ins: DomElement;
|
||||
kbd: DomElement;
|
||||
keygen: DomElement;
|
||||
label: DomElement;
|
||||
legend: DomElement;
|
||||
li: DomElement;
|
||||
link: DomElement;
|
||||
main: DomElement;
|
||||
map: DomElement;
|
||||
mark: DomElement;
|
||||
menu: DomElement;
|
||||
menuitem: DomElement;
|
||||
meta: DomElement;
|
||||
meter: DomElement;
|
||||
nav: DomElement;
|
||||
noscript: DomElement;
|
||||
object: DomElement;
|
||||
ol: DomElement;
|
||||
optgroup: DomElement;
|
||||
option: DomElement;
|
||||
output: DomElement;
|
||||
p: DomElement;
|
||||
param: DomElement;
|
||||
pre: DomElement;
|
||||
progress: DomElement;
|
||||
q: DomElement;
|
||||
rp: DomElement;
|
||||
rt: DomElement;
|
||||
ruby: DomElement;
|
||||
s: DomElement;
|
||||
samp: DomElement;
|
||||
script: DomElement;
|
||||
section: DomElement;
|
||||
select: DomElement;
|
||||
small: DomElement;
|
||||
source: DomElement;
|
||||
span: DomElement;
|
||||
strong: DomElement;
|
||||
style: DomElement;
|
||||
sub: DomElement;
|
||||
summary: DomElement;
|
||||
sup: DomElement;
|
||||
table: DomElement;
|
||||
tbody: DomElement;
|
||||
td: DomElement;
|
||||
textarea: DomElement;
|
||||
tfoot: DomElement;
|
||||
th: DomElement;
|
||||
thead: DomElement;
|
||||
time: DomElement;
|
||||
title: DomElement;
|
||||
tr: DomElement;
|
||||
track: DomElement;
|
||||
u: DomElement;
|
||||
ul: DomElement;
|
||||
"var": DomElement;
|
||||
video: DomElement;
|
||||
wbr: DomElement;
|
||||
// SVG
|
||||
circle: SvgElement;
|
||||
defs: SvgElement;
|
||||
ellipse: SvgElement;
|
||||
g: SvgElement;
|
||||
line: SvgElement;
|
||||
linearGradient: SvgElement;
|
||||
mask: SvgElement;
|
||||
path: SvgElement;
|
||||
pattern: SvgElement;
|
||||
polygon: SvgElement;
|
||||
polyline: SvgElement;
|
||||
radialGradient: SvgElement;
|
||||
rect: SvgElement;
|
||||
stop: SvgElement;
|
||||
svg: SvgElement;
|
||||
text: SvgElement;
|
||||
tspan: SvgElement;
|
||||
};
|
||||
}
|
||||
@@ -14,7 +14,7 @@ var PropTypesSpecification: React.Specification<any, any> = {
|
||||
|
||||
// Anything that can be rendered: numbers, strings, components or an array
|
||||
// containing these types.
|
||||
optionalRenderable: React.PropTypes.renderable,
|
||||
optionalRenderable: React.PropTypes.node,
|
||||
|
||||
// A React component.
|
||||
optionalComponent: React.PropTypes.component,
|
||||
@@ -63,7 +63,7 @@ var PropTypesSpecification: React.Specification<any, any> = {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
render: (): React.Descriptor<any> => {
|
||||
render: (): React.ReactHTMLElement => {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
@@ -78,7 +78,7 @@ var HelloMessage = React.createClass({displayName: 'HelloMessage',
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(HelloMessage({name: "John"}), mountNode);
|
||||
React.render(HelloMessage({name: "John"}), mountNode);
|
||||
|
||||
var Timer = React.createClass({displayName: 'Timer',
|
||||
getInitialState: function() {
|
||||
@@ -104,4 +104,4 @@ var Timer = React.createClass({displayName: 'Timer',
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(Timer(null), mountNode);
|
||||
React.render(Timer(null), mountNode);
|
||||
Vendored
+98
-31
@@ -1,31 +1,90 @@
|
||||
// Type definitions for React 0.11.2
|
||||
// Type definitions for React 0.12.RC
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "react" {
|
||||
export function createClass<P, S>(specification: Specification<P, S>): Factory<P>;
|
||||
export = React;
|
||||
}
|
||||
|
||||
export function renderComponent(component: Descriptor<any>, container: Element, callback?: () => void): void;
|
||||
declare module React {
|
||||
export function createClass<P, S>(specification: Specification<P, S>): ReactComponentFactory<P>;
|
||||
|
||||
export function createFactory<P>(clazz: ReactComponentFactory<P>): ReactComponentFactory<P>;
|
||||
|
||||
export function render<P>(component: ReactComponentElement<P>, container: Element, callback?: () => void): ReactComponentElement<P>;
|
||||
|
||||
export function render(component: ReactHTMLElement, container: Element, callback?: () => void): ReactHTMLElement;
|
||||
|
||||
export function render(component: ReactSVGElement, container: Element, callback?: () => void): ReactSVGElement;
|
||||
|
||||
export function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
export function renderComponentToString(component: Descriptor<any>): string;
|
||||
export function renderToString<P>(component: ReactComponentElement<P>): string;
|
||||
|
||||
export function renderComponentToStaticMarkup(component: Descriptor<any>): string;
|
||||
export function renderToString(component: ReactHTMLElement): string;
|
||||
|
||||
export function isValidClass(factory: Factory<any>): boolean;
|
||||
export function renderToString(component: ReactSVGElement): string;
|
||||
|
||||
export function isValidComponent(component: Descriptor<any>): boolean;
|
||||
export function renderToStaticMarkup<P>(component: ReactComponentElement<P>): string;
|
||||
|
||||
export function renderToStaticMarkup(component: ReactHTMLElement): string;
|
||||
|
||||
export function renderToStaticMarkup(component: ReactSVGElement): string;
|
||||
|
||||
export function isValidClass(factory: ReactComponentFactory<any>): boolean;
|
||||
|
||||
export function isValidElement(component: ReactComponentElement<any>): boolean;
|
||||
|
||||
export function isValidElement(component: ReactHTMLElement): boolean;
|
||||
|
||||
export function isValidElement(component: ReactSVGElement): boolean;
|
||||
|
||||
export function initializeTouchEvents(shouldUseTouch: boolean): void;
|
||||
|
||||
export interface Descriptor<P> {
|
||||
|
||||
export interface ReactComponentFactory<P> {
|
||||
(properties: P, ...children: any[]): ReactComponentElement<P>;
|
||||
}
|
||||
|
||||
export interface ReactElementFactory<P> {
|
||||
(properties: P, ...children: any[]): ReactDOMElement<P>;
|
||||
}
|
||||
|
||||
export interface DomElement extends ReactElementFactory<DomAttributes> {
|
||||
}
|
||||
|
||||
export interface SvgElement extends ReactElementFactory<SvgAttributes> {
|
||||
}
|
||||
|
||||
export interface ReactClass<P> {
|
||||
(props: P): ReactComponent<P>;
|
||||
}
|
||||
|
||||
export interface ReactComponent<P> {
|
||||
props: P;
|
||||
render(): ReactElement<any, any>;
|
||||
}
|
||||
|
||||
export interface ReactElement<T, P> {
|
||||
type: T;
|
||||
props: P;
|
||||
key: string;
|
||||
ref: string;
|
||||
}
|
||||
|
||||
export interface ReactDOMElement<P> extends ReactElement<string, P> {
|
||||
props: P;
|
||||
}
|
||||
|
||||
export interface Factory<P> {
|
||||
(properties?: P, ...children: any[]): Descriptor<P>;
|
||||
export interface ReactHTMLElement extends ReactDOMElement<DomAttributes> {
|
||||
}
|
||||
|
||||
export interface ReactSVGElement extends ReactDOMElement<SvgAttributes> {
|
||||
}
|
||||
|
||||
export interface ReactComponentElement<P> extends ReactElement<ReactClass<P>, P> {
|
||||
props: P;
|
||||
}
|
||||
|
||||
export interface Mixin<P, S> {
|
||||
@@ -47,11 +106,11 @@ declare module "react" {
|
||||
propTypes?: ValidationMap<P>;
|
||||
getDefaultProps?(): P;
|
||||
getInitialState?(): S;
|
||||
render(): Descriptor<any>;
|
||||
render(): ReactElement<any, any>;
|
||||
}
|
||||
|
||||
interface DomReferencer {
|
||||
getDomNode(): Element;
|
||||
export interface DomReferencer {
|
||||
getDOMNode(): Element;
|
||||
}
|
||||
|
||||
export interface Component<P, S> extends DomReferencer {
|
||||
@@ -64,24 +123,23 @@ declare module "react" {
|
||||
replaceState(nextState: S, callback?: () => void): void;
|
||||
forceUpdate(callback?: () => void): void;
|
||||
isMounted(): boolean;
|
||||
transferPropsTo(target: Factory<P>): Descriptor<P>;
|
||||
setProps(nextProps: P, callback?: () => void): void;
|
||||
replaceProps(nextProps: P, callback?: () => void): void;
|
||||
}
|
||||
|
||||
interface Constructable {
|
||||
export interface Constructable {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
interface Validator<P> {
|
||||
export interface Validator<P> {
|
||||
(props: P, propName: string, componentName: string): Error;
|
||||
}
|
||||
|
||||
interface Requireable<P> extends Validator<P> {
|
||||
export interface Requireable<P> extends Validator<P> {
|
||||
isRequired: Validator<P>;
|
||||
}
|
||||
|
||||
interface ValidationMap<P> {
|
||||
export interface ValidationMap<P> {
|
||||
[key: string]: Validator<P>;
|
||||
}
|
||||
|
||||
@@ -93,7 +151,7 @@ declare module "react" {
|
||||
number: Requireable<any>;
|
||||
object: Requireable<any>;
|
||||
string: Requireable<any>;
|
||||
renderable: Requireable<any>;
|
||||
node: Requireable<any>;
|
||||
component: Requireable<any>;
|
||||
instanceOf: (clazz: Constructable) => Requireable<any>;
|
||||
oneOf: (types: any[]) => Requireable<any>
|
||||
@@ -112,12 +170,12 @@ declare module "react" {
|
||||
|
||||
// Browser Interfaces
|
||||
// Taken from https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
|
||||
interface AbstractView {
|
||||
export interface AbstractView {
|
||||
styleMedia: StyleMedia;
|
||||
document: Document;
|
||||
}
|
||||
|
||||
interface Touch {
|
||||
export interface Touch {
|
||||
identifier: number;
|
||||
target: EventTarget;
|
||||
screenX: number;
|
||||
@@ -128,7 +186,7 @@ declare module "react" {
|
||||
pageY: number;
|
||||
}
|
||||
|
||||
interface TouchList {
|
||||
export interface TouchList {
|
||||
[index: number]: Touch;
|
||||
length: number;
|
||||
item(index: number): Touch;
|
||||
@@ -214,7 +272,7 @@ declare module "react" {
|
||||
}
|
||||
|
||||
// Attributes
|
||||
interface EventAttributes {
|
||||
export interface EventAttributes {
|
||||
onCopy?: (event: ClipboardEvent) => void;
|
||||
onCut?: (event: ClipboardEvent) => void;
|
||||
onPaste?: (event: ClipboardEvent) => void;
|
||||
@@ -251,7 +309,16 @@ declare module "react" {
|
||||
onWheel?: (event: WheelEvent) => void;
|
||||
}
|
||||
|
||||
interface DomAttributes extends EventAttributes {
|
||||
export interface ReactAttributes {
|
||||
dangerouslySetInnerHTML?: {
|
||||
__html: string;
|
||||
};
|
||||
children?: any[];
|
||||
key?: string;
|
||||
ref?: string;
|
||||
}
|
||||
|
||||
export interface DomAttributes extends EventAttributes, ReactAttributes {
|
||||
// HTML Attributes
|
||||
accept?: any;
|
||||
accessKey?: any;
|
||||
@@ -260,7 +327,9 @@ declare module "react" {
|
||||
allowTransparency?: any;
|
||||
alt?: any;
|
||||
async?: any;
|
||||
autoCapitalize?: any;
|
||||
autoComplete?: any;
|
||||
autoCorrect?: any;
|
||||
autoFocus?: any;
|
||||
autoPlay?: any;
|
||||
cellPadding?: any;
|
||||
@@ -295,6 +364,9 @@ declare module "react" {
|
||||
httpEquiv?: any;
|
||||
icon?: any;
|
||||
id?: any;
|
||||
itemProp?: any;
|
||||
itemScope?: any;
|
||||
itemType?: any;
|
||||
label?: any;
|
||||
lang?: any;
|
||||
list?: any;
|
||||
@@ -313,6 +385,7 @@ declare module "react" {
|
||||
placeholder?: any;
|
||||
poster?: any;
|
||||
preload?: any;
|
||||
property?: any;
|
||||
radioGroup?: any;
|
||||
readOnly?: any;
|
||||
rel?: any;
|
||||
@@ -347,7 +420,7 @@ declare module "react" {
|
||||
wmode?: any;
|
||||
}
|
||||
|
||||
interface SvgAttributes extends EventAttributes {
|
||||
export interface SvgAttributes extends EventAttributes, ReactAttributes {
|
||||
cx?: any;
|
||||
cy?: any;
|
||||
d?: any;
|
||||
@@ -393,12 +466,6 @@ declare module "react" {
|
||||
y?: any;
|
||||
}
|
||||
|
||||
interface DomElement extends Factory<DomAttributes> {
|
||||
}
|
||||
|
||||
interface SvgElement extends Factory<SvgAttributes> {
|
||||
}
|
||||
|
||||
export var DOM: {
|
||||
// HTML
|
||||
a: DomElement;
|
||||
|
||||
Vendored
+48
-2
@@ -49,6 +49,8 @@ declare module Rx {
|
||||
|
||||
export module helpers {
|
||||
function noop(): void;
|
||||
function notDefined(value: any): boolean;
|
||||
function isScheduler(value: any): boolean;
|
||||
function identity<T>(value: T): T;
|
||||
function defaultNow(): number;
|
||||
function defaultComparer(left: any, right: any): boolean;
|
||||
@@ -314,7 +316,7 @@ declare module Rx {
|
||||
* @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
||||
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
||||
*/
|
||||
selectSwitch<TResult>(selector: (value: T, index: number, source: Observable<T>) => TResult, thisArg?: any): Observable<TResult>;
|
||||
selectSwitch<TResult>(selector: (value: T, index: number, source: Observable<T>) => Observable<TResult>, thisArg?: any): Observable<TResult>;
|
||||
/**
|
||||
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
||||
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
||||
@@ -323,7 +325,7 @@ declare module Rx {
|
||||
* @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
||||
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
||||
*/
|
||||
flatMapLatest<TResult>(selector: (value: T, index: number, source: Observable<T>) => TResult, thisArg?: any): Observable<TResult>; // alias for selectSwitch
|
||||
flatMapLatest<TResult>(selector: (value: T, index: number, source: Observable<T>) => Observable<TResult>, thisArg?: any): Observable<TResult>; // alias for selectSwitch
|
||||
/**
|
||||
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
||||
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
||||
@@ -394,6 +396,50 @@ declare module Rx {
|
||||
defer<T>(observableFactory: () => Observable<T>): Observable<T>;
|
||||
defer<T>(observableFactory: () => IPromise<T>): Observable<T>;
|
||||
empty<T>(scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param mapFn Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T, TResult>(array: T[], mapFn: (value: T, index: number) => TResult, thisArg?: any, scheduler?: IScheduler): Observable<TResult>;
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param [mapFn] Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T>(array: T[], mapFn?: (value: T, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array-like object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param mapFn Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T, TResult>(array: { length: number;[index: number]: T; }, mapFn: (value: T, index: number) => TResult, thisArg?: any, scheduler?: IScheduler): Observable<TResult>;
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array-like object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param [mapFn] Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T>(array: { length: number;[index: number]: T; }, mapFn?: (value: T, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
/**
|
||||
* This method creates a new Observable sequence from an array-like or iterable object.
|
||||
* @param array An array-like or iterable object to convert to an Observable sequence.
|
||||
* @param [mapFn] Map function to call on every element of the array.
|
||||
* @param [thisArg] The context to use calling the mapFn if provided.
|
||||
* @param [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
||||
*/
|
||||
from<T>(iterable: any, mapFn?: (value: any, index: number) => T, thisArg?: any, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
fromArray<T>(array: T[], scheduler?: IScheduler): Observable<T>;
|
||||
fromArray<T>(array: { length: number;[index: number]: T; }, scheduler?: IScheduler): Observable<T>;
|
||||
|
||||
|
||||
Vendored
+28
-28
@@ -16,46 +16,46 @@ declare module Rx {
|
||||
|
||||
fromCallback: {
|
||||
// with single result callback without selector
|
||||
<TResult>(func: (callback: (result: TResult) => any) => any, scheduler?: IScheduler, context?: any): () => Observable<TResult>;
|
||||
<T1, TResult>(func: (arg1: T1, callback: (result: TResult) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TResult>(func: (arg1: T1, arg2: T2, callback: (result: TResult) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (result: TResult) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
<TResult>(func: (callback: (result: TResult) => any) => any, context?: any): () => Observable<TResult>;
|
||||
<T1, TResult>(func: (arg1: T1, callback: (result: TResult) => any) => any, context?: any): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TResult>(func: (arg1: T1, arg2: T2, callback: (result: TResult) => any) => any, context?: any): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (result: TResult) => any) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
// with any callback with selector
|
||||
<TCallbackResult, TResult>(func: (callback: Function) => any, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): () => Observable<TResult>;
|
||||
<T1, TCallbackResult, TResult>(func: (arg1: T1, callback: Function) => any, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TCallbackResult, TResult>(func: (arg1: T1, arg2: T2, callback: Function) => any, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TCallbackResult, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
<TCallbackResult, TResult>(func: (callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): () => Observable<TResult>;
|
||||
<T1, TCallbackResult, TResult>(func: (arg1: T1, callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TCallbackResult, TResult>(func: (arg1: T1, arg2: T2, callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TCallbackResult, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context: any, selector: (args: TCallbackResult[]) => TResult): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
// with any callback without selector
|
||||
<TResult>(func: (callback: Function) => any, scheduler?: IScheduler, context?: any): () => Observable<TResult>;
|
||||
<T1, TResult>(func: (arg1: T1, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TResult>(func: (arg1: T1, arg2: T2, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
<TResult>(func: (callback: Function) => any, context?: any): () => Observable<TResult>;
|
||||
<T1, TResult>(func: (arg1: T1, callback: Function) => any, context?: any): (arg1: T1) => Observable<TResult>;
|
||||
<T1, T2, TResult>(func: (arg1: T1, arg2: T2, callback: Function) => any, context?: any): (arg1: T1, arg2: T2) => Observable<TResult>;
|
||||
<T1, T2, T3, TResult>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TResult>;
|
||||
// with any function with selector
|
||||
<TCallbackResult, TResult>(func: Function, scheduler: IScheduler, context: any, selector: (args: TCallbackResult[]) => TResult): (...args: any[]) => Observable<TResult>;
|
||||
<TCallbackResult, TResult>(func: Function, context: any, selector: (args: TCallbackResult[]) => TResult): (...args: any[]) => Observable<TResult>;
|
||||
// with any function without selector
|
||||
<TResult>(func: Function, scheduler?: IScheduler, context?: any): (...args: any[]) => Observable<TResult>;
|
||||
<TResult>(func: Function, context?: any): (...args: any[]) => Observable<TResult>;
|
||||
};
|
||||
|
||||
fromNodeCallback: {
|
||||
// with single result callback without selector
|
||||
<T>(func: (callback: (err: any, result: T) => any) => any, scheduler?: IScheduler, context?: any): () => Observable<T>;
|
||||
<T1, T>(func: (arg1: T1, callback: (err: any, result: T) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1) => Observable<T>;
|
||||
<T1, T2, T>(func: (arg1: T1, arg2: T2, callback: (err: any, result: T) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2) => Observable<T>;
|
||||
<T1, T2, T3, T>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: T) => any) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<T>;
|
||||
<T>(func: (callback: (err: any, result: T) => any) => any, context?: any): () => Observable<T>;
|
||||
<T1, T>(func: (arg1: T1, callback: (err: any, result: T) => any) => any, context?: any): (arg1: T1) => Observable<T>;
|
||||
<T1, T2, T>(func: (arg1: T1, arg2: T2, callback: (err: any, result: T) => any) => any, context?: any): (arg1: T1, arg2: T2) => Observable<T>;
|
||||
<T1, T2, T3, T>(func: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: T) => any) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<T>;
|
||||
// with any callback with selector
|
||||
<TC, TR>(func: (callback: Function) => any, scheduler: IScheduler, context: any, selector: (results: TC[]) => TR): () => Observable<TR>;
|
||||
<T1, TC, TR>(func: (arg1: T1, callback: Function) => any, scheduler: IScheduler, context: any, selector: (results: TC[]) => TR): (arg1: T1) => Observable<TR>;
|
||||
<T1, T2, TC, TR>(func: (arg1: T1, arg2: T2, callback: Function) => any, scheduler: IScheduler, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2) => Observable<TR>;
|
||||
<T1, T2, T3, TC, TR>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, scheduler: IScheduler, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2, arg3: T3) => Observable<TR>;
|
||||
<TC, TR>(func: (callback: Function) => any, context: any, selector: (results: TC[]) => TR): () => Observable<TR>;
|
||||
<T1, TC, TR>(func: (arg1: T1, callback: Function) => any, context: any, selector: (results: TC[]) => TR): (arg1: T1) => Observable<TR>;
|
||||
<T1, T2, TC, TR>(func: (arg1: T1, arg2: T2, callback: Function) => any, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2) => Observable<TR>;
|
||||
<T1, T2, T3, TC, TR>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context: any, selector: (results: TC[]) => TR): (arg1: T1, arg2: T2, arg3: T3) => Observable<TR>;
|
||||
// with any callback without selector
|
||||
<TR>(func: (callback: Function) => any, scheduler?: IScheduler, context?: any): () => Observable<TR>;
|
||||
<T1, TR>(func: (arg1: T1, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1) => Observable<TR>;
|
||||
<T1, T2, TR>(func: (arg1: T1, arg2: T2, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2) => Observable<TR>;
|
||||
<T1, T2, T3, TR>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, scheduler?: IScheduler, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TR>;
|
||||
<TR>(func: (callback: Function) => any, context?: any): () => Observable<TR>;
|
||||
<T1, TR>(func: (arg1: T1, callback: Function) => any, context?: any): (arg1: T1) => Observable<TR>;
|
||||
<T1, T2, TR>(func: (arg1: T1, arg2: T2, callback: Function) => any, context?: any): (arg1: T1, arg2: T2) => Observable<TR>;
|
||||
<T1, T2, T3, TR>(func: (arg1: T1, arg2: T2, arg3: T3, callback: Function) => any, context?: any): (arg1: T1, arg2: T2, arg3: T3) => Observable<TR>;
|
||||
// with any function with selector
|
||||
<TC, T>(func: Function, scheduler: IScheduler, context: any, selector: (results: TC[]) => T): (...args: any[]) => Observable<T>;
|
||||
<TC, T>(func: Function, context: any, selector: (results: TC[]) => T): (...args: any[]) => Observable<T>;
|
||||
// with any function without selector
|
||||
<T>(func: Function, scheduler?: IScheduler, context?: any): (...args: any[]) => Observable<T>;
|
||||
<T>(func: Function, context?: any): (...args: any[]) => Observable<T>;
|
||||
};
|
||||
|
||||
fromEvent<T>(element: NodeList, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
|
||||
|
||||
+13
-17
@@ -10,8 +10,8 @@ module Rx.Tests.Async {
|
||||
var sch: Rx.IScheduler;
|
||||
|
||||
function start() {
|
||||
obsNum = Rx.Observable.start(()=> 10, sch, obsStr);
|
||||
obsNum = Rx.Observable.start(()=> 10, sch);
|
||||
obsNum = Rx.Observable.start(()=> 10, obsStr, sch);
|
||||
obsNum = Rx.Observable.start(() => 10, obsStr);
|
||||
obsNum = Rx.Observable.start(()=> 10);
|
||||
}
|
||||
|
||||
@@ -27,38 +27,34 @@ module Rx.Tests.Async {
|
||||
// 0 arguments
|
||||
var func0: (cb: (result: number)=> void)=> void;
|
||||
obsNum = Rx.Observable.fromCallback(func0)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, sch)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, sch, obsStr)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, sch, obsStr, (results: number[]) => results[0])();
|
||||
obsNum = Rx.Observable.fromCallback(func0, obsStr)();
|
||||
obsNum = Rx.Observable.fromCallback(func0, obsStr, (results: number[]) => results[0])();
|
||||
|
||||
// 1 argument
|
||||
var func1: (a: string, cb: (result: number)=> void)=> number;
|
||||
obsNum = Rx.Observable.fromCallback(func1)("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, sch)("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, sch, {})("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, sch, {}, (results: number[]) => results[0])("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, {})("");
|
||||
obsNum = Rx.Observable.fromCallback(func1, {}, (results: number[]) => results[0])("");
|
||||
|
||||
// 2 arguments
|
||||
var func2: (a: number, b: string, cb: (result: string) => number) => Date;
|
||||
obsStr = Rx.Observable.fromCallback(func2)(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, sch)(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, sch, {})(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, sch, {}, (results: string[]) => results[0])(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, {})(1, "");
|
||||
obsStr = Rx.Observable.fromCallback(func2, {}, (results: string[]) => results[0])(1, "");
|
||||
|
||||
// 3 arguments
|
||||
var func3: (a: number, b: string, c: boolean, cb: (result: string) => number) => Date;
|
||||
obsStr = Rx.Observable.fromCallback(func3)(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, sch)(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, sch, {})(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, sch, {}, (results: string[]) => results[0])(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, {})(1, "", true);
|
||||
obsStr = Rx.Observable.fromCallback(func3, {}, (results: string[]) => results[0])(1, "", true);
|
||||
|
||||
// multiple results
|
||||
var func0m: (cb: (result1: number, result2: number, result3: number) => void) => void;
|
||||
obsNum = Rx.Observable.fromCallback(func0m, sch, obsStr, (results: number[]) => results[0])();
|
||||
obsNum = Rx.Observable.fromCallback(func0m, obsStr, (results: number[]) => results[0])();
|
||||
var func1m: (a: string, cb: (result1: number, result2: number, result3: number) => void) => void;
|
||||
obsNum = Rx.Observable.fromCallback(func1m, sch, obsStr, (results: number[]) => results[0])("");
|
||||
obsNum = Rx.Observable.fromCallback(func1m, obsStr, (results: number[]) => results[0])("");
|
||||
var func2m: (a: string, b: number, cb: (result1: string, result2: string, result3: string) => void) => void;
|
||||
obsStr = Rx.Observable.fromCallback(func2m, sch, obsStr, (results: string[]) => results[0])("", 10);
|
||||
obsStr = Rx.Observable.fromCallback(func2m, obsStr, (results: string[]) => results[0])("", 10);
|
||||
}
|
||||
|
||||
function toPromise() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user