mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-28 12:43:06 +08:00
Merge origin/master into react-simplification
This commit is contained in:
+12
-3
@@ -92,6 +92,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](chrome/chrome.d.ts) [Chrome extension development](http://developer.chrome.com/extensions) by [Matthew Kimber](https://github.com/matthewkimber), [otiai10](https://github.com/otiai10)
|
||||
* [:link:](chrome/chrome-app.d.ts) [Chrome packaged application development](http://developer.chrome.com/apps) by [Adam Lay](https://github.com/AdamLay), [MIZUNE Pine](https://github.com/pine613), [MIZUSHIMA Junki](https://github.com/mzsm)
|
||||
* [:link:](ckeditor/ckeditor.d.ts) [CKEditor](http://ckeditor.com) by [Ondrej Sevcik](https://github.com/ondrejsevcik)
|
||||
* [:link:](cli-color/cli-color.d.ts) [cli-color](https://github.com/medikoo/cli-color) by [Joel Spadin](https://github.com/ChaosinaCan)
|
||||
* [:link:](clone/clone.d.ts) [clone](https://github.com/pvorb/node-clone) by [Kieran Simpson](https://github.com/kierans/DefinitelyTyped)
|
||||
* [:link:](codemirror/codemirror.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [mihailik](https://github.com/mihailik)
|
||||
* [:link:](colors/colors.d.ts) [Colors.js 0.6.0-1](https://github.com/Marak/colors.js) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
@@ -172,7 +173,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](findup-sync/findup-sync.d.ts) [findup-sync](https://github.com/cowboy/node-findup-sync) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](fingerprintjs/fingerprint.d.ts) [fingerprintjs](https://github.com/Valve/fingerprintjs) by [Shunsuke Ohtani](https://github.com/zaneli)
|
||||
* [:link:](state-machine/state-machine.d.ts) [Finite State Machine](https://github.com/jakesgordon/javascript-state-machine) by [Boris Yankov](https://github.com/borisyankov), [Maarten Docter](https://github.com/mdocter), [William Sears](https://github.com/MrBigDog2U)
|
||||
* [:link:](firebase/firebase.d.ts) [Firebase API](https://www.firebase.com/docs/javascript/firebase) by [Vincent Botone](https://github.com/vbortone)
|
||||
* [:link:](firebase/firebase.d.ts) [Firebase API](https://www.firebase.com/docs/javascript/firebase) by [Vincent Botone](https://github.com/vbortone), [Shin1 Kashimura](https://github.com/in-async)
|
||||
* [:link:](firebase/firebase-simplelogin.d.ts) [Firebase Simple Login](https://www.firebase.com/docs/security/simple-login-overview.html) by [Wilker Lucio](http://github.com/wilkerlucio)
|
||||
* [:link:](flexSlider/flexSlider.d.ts) [FlexSlider 2 jquery plugin](https://github.com/woothemes/FlexSlider) by [Diullei Gomes](https://github.com/diullei)
|
||||
* [:link:](flight/flight.d.ts) [Flight](http://flightjs.github.com/flight) by [Jonathan Hedrén](https://github.com/jonathanhedren)
|
||||
@@ -197,6 +198,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](glob/glob.d.ts) [Glob](https://github.com/isaacs/node-glob) by [vvakame](https://github.com/vvakame)
|
||||
* [:link:](glob-stream/glob-stream.d.ts) [glob-stream](http://github.com/wearefractal/glob-stream) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](globalize/globalize.d.ts) [Globalize](https://github.com/jquery/globalize) by [Boris Yankov](https://github.com/borisyankov)
|
||||
* [:link:](gm/gm.d.ts) [gm](https://github.com/aheckmann/gm) by [Joel Spadin](https://github.com/ChaosinaCan)
|
||||
* [:link:](goJS/goJS.d.ts) [GoJS](http://gojs.net) by [Barbara Duckworth](https://github.com/barbara42)
|
||||
* [:link:](google.analytics/ga.d.ts) [Google Analytics (Classic and Universal)](https://developers.google.com/analytics/devguides/collection/gajs) by [Ronnie Haakon Hegelund](http://ronniehegelund.blogspot.dk), [Pat Kujawa](http://patkujawa.com)
|
||||
* [:link:](gapi/gapi.d.ts) [Google API Client](https://code.google.com/p/google-api-javascript-client) by [Frank M](https://github.com/sgtfrankieboy)
|
||||
@@ -216,7 +218,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](gruntjs/gruntjs.d.ts) [Grunt 0.4.x](http://gruntjs.com) by [Jeff May](https://github.com/jeffmay), [Basarat Ali Syed](https://github.com/basarat)
|
||||
* [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com)
|
||||
* [:link:](gulp-util/gulp-util.d.ts) [gulp-util v3.0.x](https://github.com/gulpjs/gulp-util) by [jedmao](https://github.com/jedmao)
|
||||
* [:link:](hammerjs/hammerjs.d.ts) [Hammer.js](http://eightmedia.github.com/hammer.js) by [Boris Yankov](https://github.com/borisyankov), [Drew Noakes](https://drewnoakes.com)
|
||||
* [:link:](hammerjs/hammerjs.d.ts) [Hammer.js](http://hammerjs.github.io) by [Philip Bulley](https://github.com/milkisevil)
|
||||
* [:link:](handlebars/handlebars.d.ts) [Handlebars](http://handlebarsjs.com) by [Boris Yankov](https://github.com/borisyankov)
|
||||
* [:link:](hapi/hapi.d.ts) [hapi](http://github.com/spumko/hapi) by [Hakubo](http://github.com/hakubo)
|
||||
* [:link:](hashmap/hashmap.d.ts) [HashMap](https://github.com/flesler/hashmap) by [Rafał Wrzeszcz](http://wrzasq.pl)
|
||||
@@ -228,6 +230,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](highlightjs/highlightjs.d.ts) [highlight.js](https://github.com/isagalaev/highlight.js) by [Niklas Mollenhauer](https://github.com/nikeee), [Jeremy Hull](https://github.com/sourrust)
|
||||
* [:link:](history/history.d.ts) [History.js](https://github.com/browserstate/history.js) by [Boris Yankov](https://github.com/borisyankov), [Gidon Junge](https://github.com/gjunge)
|
||||
* [:link:](howlerjs/howler.d.ts) [howler.js](https://github.com/goldfire/howler.js) by [Pedro Casaubon](https://github.com/xperiments)
|
||||
* [:link:](touch-events/touch-events.d.ts) [HTML Touch Events](http://www.w3.org/TR/touch-events) by [Kevin Barabash](https://github.com/kevinb7)
|
||||
* [:link:](html2canvas/html2canvas.d.ts) [html2canvas.js](https://github.com/niklasvh/html2canvas) by [Richard Hepburn](https://github.com/rwhepburn)
|
||||
* [:link:](htmlparser2/htmlparser2.d.ts) [htmlparser2 v3.7.x](https://github.com/fb55/htmlparser2) by [James Roland Cabresos](https://github.com/staticfunction)
|
||||
* [:link:](http-string-parser/http-string-parser.d.ts) [http-string-parser](https://github.com/apiaryio/http-string-parser) by [MIZUNE Pine](https://github.com/pine613)
|
||||
@@ -373,10 +376,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](libxmljs/libxmljs.d.ts) [Libxmljs](https://github.com/polotek/libxmljs) by [François de Campredon](https://github.com/fdecampredon)
|
||||
* [:link:](dustjs-linkedin/dustjs-linkedin.d.ts) [linkedin dustjs](https://github.com/linkedin/dustjs) by [Marcelo Dezem](http://github.com/mdezem)
|
||||
* [:link:](linq/linq.jquery.d.ts) [linq.jquery (from linq.js)](http://linqjs.codeplex.com) by [neuecc](http://www.codeplex.com/site/users/view/neuecc)
|
||||
* [:link:](linq/linq.d.ts) [linq.js](http://linqjs.codeplex.com) by [Marcin Najder](https://github.com/marcinnajder)
|
||||
* [:link:](linq/linq.d.ts) [linq.js](http://linqjs.codeplex.com) by [Marcin Najder](https://github.com/marcinnajder), [Sebastiaan Dammann](https://github.com/Sebazzz)
|
||||
* [:link:](jquery.livestampjs/jquery.livestampjs.d.ts) [Livestamp.js](http://mattbradley.github.com/livestampjs) by [Vincent Bortone](https://github.com/vbortone)
|
||||
* [:link:](lodash/lodash.d.ts) [Lo-Dash](http://lodash.com) by [Brian Zengel](https://github.com/bczengel)
|
||||
* [:link:](lockfile/lockfile.d.ts) [lockfile](https://github.com/isaacs/lockfile) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](log4javascript/log4javascript.d.ts) [log4javascript](http://log4javascript.org) by [Markus Wagner](https://github.com/Ritzlgrmft)
|
||||
* [:link:](logg/logg.d.ts) [logg](https://github.com/dpup/node-logg) by [Bret Little](https://github.com/blittle)
|
||||
* [:link:](long/long.d.ts) [Long.js](https://github.com/dcodeIO/Long.js) by [Toshihide Hara](https://github.com/kerug)
|
||||
* [:link:](lru-cache/lru-cache.d.ts) [lru-cache](https://github.com/isaacs/node-lru-cache) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
@@ -428,6 +432,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](ngprogress-lite/ngprogress-lite.d.ts) [ngprogress-lite](https://github.com/voronianski/ngprogress-lite) by [Luke Forder](https://github.com/LukeForder)
|
||||
* [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook)
|
||||
* [:link:](nock/nock.d.ts) [nock](https://github.com/pgte/nock) by [bonnici](https://github.com/bonnici)
|
||||
* [:link:](node-imap/imap.d.ts) [node imap](https://github.com/mscdex/node-imap) by [Steve Fenton](https://github.com/Steve-Fenton)
|
||||
* [:link:](bunyan/bunyan.d.ts) [node-bunyan](https://github.com/trentm/node-bunyan) by [Alex Mikhalev](https://github.com/amikhalev)
|
||||
* [:link:](bunyan-logentries/bunyan-logentries.d.ts) [node-bunyan-logentries](https://github.com/nemtsov/node-bunyan-logentries) by [Aymeric Beaumet](http://aymericbeaumet.me)
|
||||
* [:link:](node-ffi/node-ffi.d.ts) [node-ffi](https://github.com/rbranson/node-ffi) by [Paul Loyd](https://github.com/loyd)
|
||||
@@ -481,6 +486,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](pickadate/pickadate.d.ts) [pickadate.js](https://github.com/amsul/pickadate.js) by [Adi Dahiya](https://github.com/adidahiya)
|
||||
* [:link:](pixi/pixi.d.ts) [PIXI](https://github.com/GoodBoyDigital/pixi.js) by [xperiments](http://github.com/xperiments)
|
||||
* [:link:](platform/platform.d.ts) [Platform](https://github.com/bestiejs/platform.js) by [Jake Hickman](https://github.com/JakeH)
|
||||
* [:link:](playerframework/playerFramework.d.ts) [Player Framework (MMPPF)](https://playerframework.codeplex.com) by [Ricardo Sabino](https://github.com/ricardosabino)
|
||||
* [:link:](podcast/podcast.d.ts) [podcast](http://github.com/maxnowack/node-podcast) by [Niklas Mollenhauer](https://github.com/nikeee)
|
||||
* [:link:](popcorn/popcorn.d.ts) [Popcorn](https://github.com/mozilla/popcorn-js) by [grapswiz](https://github.com/grapswiz)
|
||||
* [:link:](pouchDB/pouch.d.ts) [Pouch](http://pouchdb.com) by [Bill Sears](https://github.com/MrBigDog2U)
|
||||
@@ -520,6 +526,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](rtree/rtree.d.ts) [rtree](https://github.com/leaflet-extras/RTree) by [Omede Firouz](https://github.com/oefirouz)
|
||||
* [:link:](rx/rx.d.ts) [RxJS](http://rx.codeplex.com) by [gsino](http://www.codeplex.com/site/users/view/gsino), [Igor Oleinikov](https://github.com/Igorbek)
|
||||
* [:link:](rx/rx.aggregates.d.ts) [RxJS-Aggregates](http://rx.codeplex.com) by [Carl de Billy](http://carl.debilly.net), [Igor Oleinikov](https://github.com/Igorbek)
|
||||
* [:link:](rx/rx.all.d.ts) [RxJS-All](http://rx.codeplex.com) by [Carl de Billy](http://carl.debilly.net), [Igor Oleinikov](https://github.com/Igorbek)
|
||||
* [:link:](rx/rx.async.d.ts) [RxJS-Async](http://rx.codeplex.com) by [zoetrope](https://github.com/zoetrope), [Igor Oleinikov](https://github.com/Igorbek)
|
||||
* [:link:](rx/rx.backpressure.d.ts) [RxJS-BackPressure](http://rx.codeplex.com) by [Igor Oleinikov](https://github.com/Igorbek)
|
||||
* [:link:](rx/rx.binding.d.ts) [RxJS-Binding](http://rx.codeplex.com) by [Carl de Billy](http://carl.debilly.net), [Igor Oleinikov](https://github.com/Igorbek)
|
||||
@@ -552,6 +559,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](slickgrid/slick.headerbuttons.d.ts) [SlickGrid HeaderButtons Plugin](https://github.com/mleibman/SlickGrid) by [Derek Cicerone](https://github.com/derekcicerone)
|
||||
* [:link:](slickgrid/slick.rowselectionmodel.d.ts) [SlickGrid RowSelectionModel Plugin](https://github.com/mleibman/SlickGrid) by [Derek Cicerone](https://github.com/derekcicerone)
|
||||
* [:link:](smoothie/smoothie.d.ts) [Smoothie Charts](https://github.com/joewalnes/smoothie) by [Drew Noakes](https://drewnoakes.com), [Mike H. Hawley](https://github.com/mikehhawley)
|
||||
* [:link:](snapsvg/snapsvg.d.ts) [Snap-SVG](https://github.com/adobe-webplatform/Snap.svg) by [Lars Klein](https://github.com/lhk)
|
||||
* [:link:](socket.io/socket.io.d.ts) [socket.io](http://socket.io) by [PROGRE](https://github.com/progre)
|
||||
* [:link:](socket.io-client/socket.io-client.d.ts) [socket.io-client](http://socket.io) by [PROGRE](https://github.com/progre)
|
||||
* [:link:](sockjs/sockjs.d.ts) [SockJS 0.3.x](https://github.com/sockjs/sockjs-client) by [Emil Ivanov](https://github.com/vladev)
|
||||
@@ -642,6 +650,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](jquery.watermark/jquery.watermark.d.ts) [Watermark plugin for jQuery](http://jquery-watermark.googlecode.com) by [Anwar Javed](https://github.com/anwarjaved)
|
||||
* [:link:](webaudioapi/waa.d.ts) [Web Audio API](http://www.w3.org/TR/webaudio) by [Baruch Berger](https://github.com/bbss), [Kon](http://phyzkit.net)
|
||||
* [:link:](webaudioapi/waa-nightly.d.ts) [Web Audio API (nightly)](http://www.w3.org/TR/2012/WD-webaudio-20120802) by [Baruch Berger](https://github.com/bbss)
|
||||
* [:link:](webmidi/webmidi.d.ts) [Web MIDI API](http://www.w3.org/TR/webmidi) by [Toshiya Nakakura](https://github.com/nakakura)
|
||||
* [:link:](devextreme/dx.webappjs.d.ts) [WebAppJS](http://js.devexpress.com/WebDevelopment) by [DevExpress Inc.](http://devexpress.com)
|
||||
* [:link:](webcrypto/WebCrypto.d.ts) [WebCrypto](http://www.w3.org/TR/WebCryptoAPI) by [Lucas Dixon](https://github.com/iislucas)
|
||||
* [:link:](webrtc/MediaStream.d.ts) [WebRTC](http://dev.w3.org/2011/webrtc) by [Ken Smith](https://github.com/smithkl42)
|
||||
|
||||
@@ -17,7 +17,7 @@ myApp.config((
|
||||
var concat: ng.ui.IUrlMatcher = matcher.concat('/test');
|
||||
var str: string = matcher.format({ id:'bob', q:'yes' });
|
||||
var arr: string[] = matcher.parameters();
|
||||
|
||||
|
||||
$urlRouterProvider
|
||||
.when('/test', '/list')
|
||||
.when('/test', '/list')
|
||||
@@ -34,7 +34,11 @@ myApp.config((
|
||||
$stateProvider
|
||||
.state('state1', {
|
||||
url: "/state1",
|
||||
templateUrl: "partials/state1.html"
|
||||
templateUrl: "partials/state1.html",
|
||||
params: {
|
||||
param1: "defaultValue",
|
||||
param2: undefined
|
||||
}
|
||||
})
|
||||
.state('state1.list', {
|
||||
url: "/list",
|
||||
@@ -135,7 +139,7 @@ myApp.service("urlLocatorTest", UrlLocatorTestService);
|
||||
|
||||
module UiViewScrollProviderTests {
|
||||
var app = angular.module("uiViewScrollProviderTests", ["ui.router"]);
|
||||
|
||||
|
||||
app.config(['$uiViewScrollProvider', function($uiViewScrollProvider: ng.ui.IUiViewScrollProvider) {
|
||||
// This prevents unwanted scrolling to the active nested state view.
|
||||
// Use this when you have nested states, but you don't want the browser to scroll down the page
|
||||
|
||||
Vendored
+3
-3
@@ -17,7 +17,7 @@ declare module ng.ui {
|
||||
controllerProvider?: any;
|
||||
resolve?: {};
|
||||
url?: string;
|
||||
params?: any[];
|
||||
params?: any;
|
||||
views?: {};
|
||||
abstract?: boolean;
|
||||
onEnter?: any;
|
||||
@@ -108,10 +108,10 @@ declare module ng.ui {
|
||||
*/
|
||||
sync(): void;
|
||||
}
|
||||
|
||||
|
||||
interface IUiViewScrollProvider {
|
||||
/*
|
||||
* Reverts back to using the core $anchorScroll service for scrolling
|
||||
* Reverts back to using the core $anchorScroll service for scrolling
|
||||
* based on the url anchor.
|
||||
*/
|
||||
useAnchorScroll(): void;
|
||||
|
||||
Vendored
+2
-2
@@ -20,8 +20,8 @@ interface AngularFire {
|
||||
$remove(key?: string): ng.IPromise<Firebase>;
|
||||
$update(key: string, data: Object): ng.IPromise<Firebase>;
|
||||
$update(data: any): ng.IPromise<Firebase>;
|
||||
$transaction(updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<IFirebaseDataSnapshot>;
|
||||
$transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<IFirebaseDataSnapshot>;
|
||||
$transaction(updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<FirebaseDataSnapshot>;
|
||||
$transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<FirebaseDataSnapshot>;
|
||||
}
|
||||
|
||||
interface AngularFireObject extends AngularFireSimpleObject {
|
||||
|
||||
Vendored
+49
-46
@@ -3,12 +3,14 @@
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface AsyncMultipleResultsCallback<T> { (err: Error, results: T[]): any; }
|
||||
interface AsyncSingleResultCallback<T> { (err: Error, result: T): void; }
|
||||
interface AsyncTimesCallback<T> { (n: number, callback: AsyncMultipleResultsCallback<T>): void; }
|
||||
interface ErrorCallback { (err?: Error): void; }
|
||||
interface AsyncResultsCallback<T> { (err: Error, results: T[]): void; }
|
||||
interface AsyncResultCallback<T> { (err: Error, result: T): void; }
|
||||
interface AsyncTimesCallback<T> { (n: number, callback: AsyncResultsCallback<T>): void; }
|
||||
|
||||
interface AsyncIterator<T, R> { (item: T, callback: AsyncSingleResultCallback<R>): void; }
|
||||
interface AsyncMemoIterator<T, R> { (memo: R, item: T, callback: AsyncSingleResultCallback<R>): void; }
|
||||
interface AsyncIterator<T> { (item: T, callback: ErrorCallback): void; }
|
||||
interface AsyncResultIterator<T, R> { (item: T, callback: AsyncResultCallback<R>): void; }
|
||||
interface AsyncMemoIterator<T, R> { (memo: R, item: T, callback: AsyncResultCallback<R>): void; }
|
||||
|
||||
interface AsyncWorker<T> { (task: T, callback: Function): void; }
|
||||
|
||||
@@ -17,10 +19,10 @@ interface AsyncQueue<T> {
|
||||
concurrency: number;
|
||||
started: boolean;
|
||||
paused: boolean;
|
||||
push(task: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
push(task: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
unshift(task: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
unshift(task: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
push(task: T, callback?: AsyncResultsCallback<T>): void;
|
||||
push(task: T[], callback?: AsyncResultsCallback<T>): void;
|
||||
unshift(task: T, callback?: AsyncResultsCallback<T>): void;
|
||||
unshift(task: T[], callback?: AsyncResultsCallback<T>): void;
|
||||
saturated: () => any;
|
||||
empty: () => any;
|
||||
drain: () => any;
|
||||
@@ -36,8 +38,8 @@ interface AsyncPriorityQueue<T> {
|
||||
concurrency: number;
|
||||
started: boolean;
|
||||
paused: boolean;
|
||||
push(task: T, priority: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
push(task: T[], priority: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
push(task: T, priority: number, callback?: AsyncResultsCallback<T>): void;
|
||||
push(task: T[], priority: number, callback?: AsyncResultsCallback<T>): void;
|
||||
saturated: () => any;
|
||||
empty: () => any;
|
||||
drain: () => any;
|
||||
@@ -51,47 +53,48 @@ interface AsyncPriorityQueue<T> {
|
||||
interface Async {
|
||||
|
||||
// Collections
|
||||
each<T,R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
eachSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
eachLimit<T, R>(arr: T[], limit: number, iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): void;
|
||||
map<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): any;
|
||||
mapSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R>, callback: AsyncMultipleResultsCallback<R>): any;
|
||||
filter<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
select<T, R>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
filterSeries<T, R>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
selectSeries<T, R>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
reject<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
rejectSeries<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
reduce<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>): any;
|
||||
inject<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>): any;
|
||||
foldl<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>): any;
|
||||
reduceRight<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>): any;
|
||||
foldr<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncSingleResultCallback<R>): any;
|
||||
detect<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
detectSeries<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
sortBy<T, V>(arr: T[], iterator: AsyncIterator<T, V>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
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;
|
||||
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;
|
||||
each<T>(arr: T[], iterator: AsyncIterator<T>, callback: ErrorCallback): void;
|
||||
eachSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback: ErrorCallback): void;
|
||||
eachLimit<T>(arr: T[], limit: number, iterator: AsyncIterator<T>, callback: ErrorCallback): void;
|
||||
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback: AsyncResultsCallback<R>): any;
|
||||
mapSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback: AsyncResultsCallback<R>): any;
|
||||
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback: AsyncResultsCallback<R>): any;
|
||||
filter<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: (results: T[]) => any): any;
|
||||
select<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: (results: T[]) => any): any;
|
||||
filterSeries<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: (results: T[]) => any): any;
|
||||
selectSeries<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: (results: T[]) => any): any;
|
||||
reject<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: (results: T[]) => any): any;
|
||||
rejectSeries<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: (results: T[]) => any): any;
|
||||
reduce<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
|
||||
inject<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
|
||||
foldl<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
|
||||
reduceRight<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
|
||||
foldr<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
|
||||
detect<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: AsyncResultsCallback<T>): any;
|
||||
detectSeries<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: AsyncResultsCallback<T>): any;
|
||||
sortBy<T, V>(arr: T[], iterator: AsyncResultIterator<T, V>, callback: AsyncResultsCallback<T>): any;
|
||||
some<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: AsyncResultsCallback<T>): any;
|
||||
any<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: AsyncResultsCallback<T>): any;
|
||||
every<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: (result: boolean) => any): any;
|
||||
all<T>(arr: T[], iterator: AsyncResultIterator<T, boolean>, callback: (result: boolean) => any): any;
|
||||
concat<T, R>(arr: T[], iterator: AsyncResultIterator<T, R[]>, callback: AsyncResultsCallback<R>): any;
|
||||
concatSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R[]>, callback: AsyncResultsCallback<R>): any;
|
||||
|
||||
// Control Flow
|
||||
series<T>(tasks: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
series<T>(tasks: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
parallel<T>(tasks: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
parallel<T>(tasks: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
parallelLimit<T>(tasks: T[], limit: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
parallelLimit<T>(tasks: T, limit: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
series<T>(tasks: T[], callback?: AsyncResultsCallback<T>): void;
|
||||
series<T>(tasks: T, callback?: AsyncResultsCallback<T>): void;
|
||||
parallel<T>(tasks: T[], callback?: AsyncResultsCallback<T>): void;
|
||||
parallel<T>(tasks: T, callback?: AsyncResultsCallback<T>): void;
|
||||
parallelLimit<T>(tasks: T[], limit: number, callback?: AsyncResultsCallback<T>): void;
|
||||
parallelLimit<T>(tasks: T, limit: number, callback?: AsyncResultsCallback<T>): void;
|
||||
whilst(test: Function, fn: Function, callback: Function): void;
|
||||
until(test: Function, fn: Function, callback: Function): void;
|
||||
waterfall<T>(tasks: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
waterfall<T>(tasks: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
waterfall<T>(tasks: T[], callback?: AsyncResultsCallback<T>): void;
|
||||
waterfall<T>(tasks: T, callback?: AsyncResultsCallback<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;
|
||||
// auto(tasks: any[], callback?: AsyncResultsCallback<T>): void;
|
||||
auto(tasks: any, callback?: AsyncResultsCallback<any>): void;
|
||||
iterator(tasks: Function[]): Function;
|
||||
apply(fn: Function, ...arguments: any[]): void;
|
||||
nextTick<T>(callback: Function): void;
|
||||
|
||||
Vendored
+75
-1
@@ -18,7 +18,81 @@ declare module "aws-sdk" {
|
||||
accessKeyId: string;
|
||||
}
|
||||
|
||||
export interface ClientConfig {
|
||||
export interface Logger {
|
||||
write?: (chunk: any, encoding?: string, callback?: () => void) => void;
|
||||
log?: (...messages: any[]) => void;
|
||||
}
|
||||
|
||||
export interface HttpOptions {
|
||||
proxy?: string;
|
||||
agent?: any;
|
||||
timeout?: number;
|
||||
xhrAsync?: boolean;
|
||||
xhrWithCredentials?: boolean;
|
||||
}
|
||||
|
||||
export interface Services {
|
||||
autoscaling?: any;
|
||||
cloudformation?: any;
|
||||
cloudfront?: any;
|
||||
cloudsearch?: any;
|
||||
cloudsearchdomain?: any;
|
||||
cloudtrail?: any;
|
||||
cloudwatch?: any;
|
||||
cloudwatchlogs?: any;
|
||||
cognitoidentity?: any;
|
||||
cognitosync?: any;
|
||||
datapipeline?: any;
|
||||
directconnect?: any;
|
||||
dynamodb?: any;
|
||||
ec2?: any;
|
||||
elasticache?: any;
|
||||
elasticbeanstalk?: any;
|
||||
elastictranscoder?: any;
|
||||
elb?: any;
|
||||
emr?: any;
|
||||
glacier?: any;
|
||||
httpOptions?: HttpOptions;
|
||||
iam?: any;
|
||||
importexport?: any;
|
||||
kinesis?: any;
|
||||
opsworks?: any;
|
||||
rds?: any;
|
||||
redshift?: any;
|
||||
route53?: any;
|
||||
route53domains?: any;
|
||||
s3?: any;
|
||||
ses?: any;
|
||||
simpledb?: any;
|
||||
sns?: any;
|
||||
sqs?: any;
|
||||
storagegateway?: any;
|
||||
sts?: any;
|
||||
support?: any;
|
||||
swf?: any;
|
||||
}
|
||||
|
||||
export interface ClientConfigPartial extends Services {
|
||||
credentials?: Credentials;
|
||||
region?: string;
|
||||
computeChecksums?: boolean;
|
||||
convertResponseTypes?: boolean;
|
||||
logger?: Logger;
|
||||
maxRedirects?: number;
|
||||
maxRetries?: number;
|
||||
paramValidation?: boolean;
|
||||
s3ForcePathStyle?: boolean;
|
||||
apiVersion?: any;
|
||||
apiVersions?: Services;
|
||||
signatureVersion?: string;
|
||||
sslEnabled?: boolean;
|
||||
systemClockOffset?: number;
|
||||
}
|
||||
|
||||
export interface ClientConfig extends ClientConfigPartial {
|
||||
update?: (options: ClientConfigPartial, allUnknownKeys?: boolean) => void;
|
||||
getCredentials?: (callback: (err?: any) => void) => void ;
|
||||
loadFromPath?: (path: string) => void;
|
||||
credentials: Credentials;
|
||||
region: string;
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -241,7 +241,7 @@ declare module Backbone {
|
||||
last(): TModel;
|
||||
last(n: number): TModel[];
|
||||
lastIndexOf(element: TModel, fromIndex?: number): number;
|
||||
map(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): any[];
|
||||
map(iterator: (element: TModel, index: number, context?: any) => any, context?: any): any[];
|
||||
max(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
|
||||
min(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
|
||||
reduce(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
|
||||
@@ -279,6 +279,7 @@ declare module Backbone {
|
||||
constructor(options?: RouterOptions);
|
||||
initialize(options?: RouterOptions): void;
|
||||
route(route: string, name: string, callback?: Function): Router;
|
||||
route(route: RegExp, name: string, callback?: Function): Router;
|
||||
navigate(fragment: string, options?: NavigateOptions): Router;
|
||||
navigate(fragment: string, trigger?: boolean): Router;
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/// <reference path="cli-color.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import clc = require('cli-color');
|
||||
import ansiTrim = require('cli-color/trim');
|
||||
import setupThrobber = require('cli-color/throbber');
|
||||
|
||||
var text: string;
|
||||
var color: number;
|
||||
var x: number;
|
||||
var y: number;
|
||||
var n: number;
|
||||
var period: number;
|
||||
|
||||
// Test cli-color
|
||||
text = clc('foo');
|
||||
text = clc('foo', 42, { toString: () => 'bar' });
|
||||
|
||||
text = clc.bold.italic.underline.blink.inverse.strike(text);
|
||||
text = clc.black.red.green.yellow.blue.magenta.cyan.white(text);
|
||||
text = clc.bgBlack.bgRed.bgGreen.bgYellow.bgBlack.bgMagenta.bgCyan.bgWhite(text);
|
||||
text = clc.blackBright.redBright.greenBright.yellowBright.blueBright.magentaBright.cyanBright.whiteBright(text);
|
||||
text = clc.bgBlackBright.bgRedBright.bgGreenBright.bgYellowBright.bgBlueBright.bgMagentaBright.bgCyanBright.bgWhiteBright(text);
|
||||
text = clc.xterm(color).bgXterm(color)(text);
|
||||
|
||||
text = clc.bold.red.bgGreen.yellowBright.bgBlueBright.xterm(color)(text, text, text);
|
||||
|
||||
text = clc.move(x, y);
|
||||
text = clc.moveTo(x, y);
|
||||
text = clc.bol();
|
||||
text = clc.bol(n);
|
||||
text = clc.bol(n, true);
|
||||
text = clc.up(n);
|
||||
text = clc.down(n);
|
||||
text = clc.left(n);
|
||||
text = clc.right(n);
|
||||
text = clc.beep;
|
||||
text = clc.reset;
|
||||
|
||||
var width: number = clc.width;
|
||||
var height: number = clc.height;
|
||||
var support: boolean = clc.xtermSupported;
|
||||
|
||||
// Test cli-color/trim
|
||||
text = ansiTrim(clc.red(text));
|
||||
|
||||
// Test cli-color/throbber
|
||||
var throbber: setupThrobber.Throbber;
|
||||
|
||||
throbber = setupThrobber(process.stdout.write.bind(process.stdout), period);
|
||||
throbber = setupThrobber(process.stdout.write.bind(process.stdout), period, clc.red);
|
||||
|
||||
throbber.start();
|
||||
throbber.stop();
|
||||
throbber.restart();
|
||||
Vendored
+96
@@ -0,0 +1,96 @@
|
||||
// Type definitions for cli-color 0.3.2
|
||||
// Project: https://github.com/medikoo/cli-color
|
||||
// Definitions by: Joel Spadin <https://github.com/ChaosinaCan>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "cli-color" {
|
||||
module m {
|
||||
export interface Format {
|
||||
(...text: any[]): string;
|
||||
|
||||
bold: Format;
|
||||
italic: Format;
|
||||
underline: Format;
|
||||
blink: Format;
|
||||
inverse: Format;
|
||||
strike: Format;
|
||||
|
||||
black: Format;
|
||||
red: Format;
|
||||
green: Format;
|
||||
yellow: Format;
|
||||
blue: Format;
|
||||
magenta: Format;
|
||||
cyan: Format;
|
||||
white: Format;
|
||||
|
||||
bgBlack: Format;
|
||||
bgRed: Format;
|
||||
bgGreen: Format;
|
||||
bgYellow: Format;
|
||||
bgBlue: Format;
|
||||
bgMagenta: Format;
|
||||
bgCyan: Format;
|
||||
bgWhite: Format;
|
||||
|
||||
blackBright: Format;
|
||||
redBright: Format;
|
||||
greenBright: Format;
|
||||
yellowBright: Format;
|
||||
blueBright: Format;
|
||||
magentaBright: Format;
|
||||
cyanBright: Format;
|
||||
whiteBright: Format;
|
||||
|
||||
bgBlackBright: Format;
|
||||
bgRedBright: Format;
|
||||
bgGreenBright: Format;
|
||||
bgYellowBright: Format;
|
||||
bgBlueBright: Format;
|
||||
bgMagentaBright: Format;
|
||||
bgCyanBright: Format;
|
||||
bgWhiteBright: Format;
|
||||
|
||||
xterm(color: number): Format;
|
||||
bgXterm(color: number): Format;
|
||||
|
||||
move(x: number, y: number): string;
|
||||
moveTo(x: number, y: number): string;
|
||||
bol(n?: number, erase?: boolean): string;
|
||||
up(n: number): string;
|
||||
down(n: number): string;
|
||||
left(n: number): string;
|
||||
right(n: number): string;
|
||||
|
||||
beep: string;
|
||||
reset: string;
|
||||
|
||||
width: number;
|
||||
height: number;
|
||||
xtermSupported: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
var m: m.Format;
|
||||
export = m;
|
||||
}
|
||||
|
||||
declare module "cli-color/trim" {
|
||||
function ansiTrim(str: string): string;
|
||||
export = ansiTrim;
|
||||
}
|
||||
|
||||
declare module "cli-color/throbber" {
|
||||
import clc = require('cli-color');
|
||||
|
||||
module setupThrobber {
|
||||
export interface Throbber {
|
||||
start(): void;
|
||||
stop(): void;
|
||||
restart(): void;
|
||||
}
|
||||
}
|
||||
|
||||
function setupThrobber(write: (str: string) => any, period: number, format?: clc.Format): setupThrobber.Throbber;
|
||||
export = setupThrobber;
|
||||
}
|
||||
@@ -1,5 +1,18 @@
|
||||
|
||||
///<reference path="colors.d.ts" />
|
||||
|
||||
import colors = require("colors");
|
||||
|
||||
var test:string = 'test';
|
||||
var arr:string[] = ['color', 'odd'.italic.zebra, 'radical'.bold.rainbow, test.underline + 'super'.green];
|
||||
|
||||
colors.black("abc").trim();
|
||||
colors.red("abc").trim();
|
||||
colors.green("abc").trim();
|
||||
colors.yellow("abc").trim();
|
||||
colors.blue("abc").trim();
|
||||
colors.magenta("abc").trim();
|
||||
colors.cyan("abc").trim();
|
||||
colors.white("abc").trim();
|
||||
colors.gray("abc").trim();
|
||||
colors.grey("abc").trim();
|
||||
|
||||
Vendored
+11
@@ -5,6 +5,17 @@
|
||||
|
||||
declare module "colors" {
|
||||
export function setTheme(theme:any):any;
|
||||
|
||||
export function black(text: string): string;
|
||||
export function red(text: string): string;
|
||||
export function green(text: string): string;
|
||||
export function yellow(text: string): string;
|
||||
export function blue(text: string): string;
|
||||
export function magenta(text: string): string;
|
||||
export function cyan(text: string): string;
|
||||
export function white(text: string): string;
|
||||
export function gray(text: string): string;
|
||||
export function grey(text: string): string;
|
||||
}
|
||||
|
||||
interface String {
|
||||
|
||||
Vendored
+4
-4
@@ -1162,7 +1162,7 @@ declare module D3 {
|
||||
/**
|
||||
* If separation is specified, uses the specified function to compute separation between neighboring nodes. If separation is not specified, returns the current separation function
|
||||
*/
|
||||
seperation: {
|
||||
separation: {
|
||||
/**
|
||||
* Gets the current separation function
|
||||
*/
|
||||
@@ -1170,7 +1170,7 @@ declare module D3 {
|
||||
/**
|
||||
* Sets the specified function to compute separation between neighboring nodes
|
||||
*/
|
||||
(seperation: (a: GraphNode, b: GraphNode) => number): TreeLayout;
|
||||
(separation: (a: GraphNode, b: GraphNode) => number): TreeLayout;
|
||||
};
|
||||
/**
|
||||
* Gets or sets the available layout size
|
||||
@@ -1382,9 +1382,9 @@ declare module D3 {
|
||||
}
|
||||
nodes(root: GraphNode): GraphNode[];
|
||||
links(nodes: GraphNode[]): GraphLink[];
|
||||
seperation: {
|
||||
separation: {
|
||||
(): (a: GraphNode, b: GraphNode) => number;
|
||||
(seperation: (a: GraphNode, b: GraphNode) => number): ClusterLayout;
|
||||
(separation: (a: GraphNode, b: GraphNode) => number): ClusterLayout;
|
||||
}
|
||||
size: {
|
||||
(): number[];
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@ interface IDateJSLiteral {
|
||||
}
|
||||
|
||||
/** DateJS Public Static Methods */
|
||||
interface IDateJSStatic extends Date {
|
||||
interface IDateJSStatic extends IDateJS {
|
||||
/** Gets a date that is set to the current date. The time is set to the start of the day (00:00 or 12:00 AM) */
|
||||
today(): IDateJS;
|
||||
/** Compares the first date to the second date and returns an number indication of their relative values. -1 = this is lessthan date. 0 = values are equal. 1 = this is greaterthan date. */
|
||||
|
||||
@@ -71,4 +71,18 @@ function test_canvas_tick() {
|
||||
var canvas = <HTMLCanvasElement>document.getElementById('canvas');
|
||||
var stage = new createjs.Stage(canvas);
|
||||
var stage = createjs.Ticker.addEventListener("tick", stage);
|
||||
}
|
||||
|
||||
function matrixDecompose() {
|
||||
var matrix = new createjs.Matrix2D();
|
||||
var shape = new createjs.Shape();
|
||||
var transform = matrix.decompose(shape);
|
||||
var transformData = matrix.decompose();
|
||||
shape.x = transformData.x;
|
||||
shape.y = transformData.y;
|
||||
shape.scaleX = transformData.scaleX;
|
||||
shape.scaleY = transformData.scaleY;
|
||||
shape.skewX = transformData.skewX;
|
||||
shape.skewY = transformData.skewY;
|
||||
shape.rotation = transformData.rotation;
|
||||
}
|
||||
Vendored
+1
@@ -383,6 +383,7 @@ declare module createjs {
|
||||
appendTransform(x: number, y: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number, regX?: number, regY?: number): Matrix2D;
|
||||
clone(): Matrix2D;
|
||||
copy(matrix: Matrix2D): Matrix2D;
|
||||
decompose(): {x: number; y: number; scaleX: number; scaleY: number; rotation: number; skewX: number; skewY: number};
|
||||
decompose(target: Object): Matrix2D;
|
||||
identity(): Matrix2D;
|
||||
initialize(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number): Matrix2D;
|
||||
|
||||
Vendored
+3
@@ -681,6 +681,9 @@ declare module "express" {
|
||||
header(field: any): Response;
|
||||
header(field: string, value?: string): Response;
|
||||
|
||||
// Property indicating if HTTP headers has been sent for the response.
|
||||
headersSent: boolean;
|
||||
|
||||
/**
|
||||
* Get value for header `field`.
|
||||
*
|
||||
|
||||
+805
-10
@@ -11,6 +11,152 @@ dataRef.auth(AUTH_TOKEN, function(error, result) {
|
||||
}
|
||||
});
|
||||
|
||||
var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com/');
|
||||
/*
|
||||
* Firebase.authWithCustomToken()
|
||||
*/
|
||||
() => {
|
||||
var dataRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
// Log me in
|
||||
dataRef.authWithCustomToken(AUTH_TOKEN, function (error, authData) {
|
||||
if (error) {
|
||||
console.log('Login Failed!', error);
|
||||
} else {
|
||||
console.log('Authenticated successfully with payload:', authData);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.authAnonymously()
|
||||
*/
|
||||
() => {
|
||||
var dataRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
// Log me in
|
||||
dataRef.authAnonymously(function (error, authData) {
|
||||
if (error) {
|
||||
console.log('Login Failed!', error);
|
||||
} else {
|
||||
console.log('Authenticated successfully with payload:', authData);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.authWithPassword()
|
||||
*/
|
||||
() => {
|
||||
var dataRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
// Log me in
|
||||
dataRef.authWithPassword({
|
||||
"email": "bobtony@firebase.com",
|
||||
"password": "correcthorsebatterystaple"
|
||||
}, function (error, authData) {
|
||||
if (error) {
|
||||
console.log('Login Failed!', error);
|
||||
} else {
|
||||
console.log('Authenticated successfully with payload:', authData);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.authWithOAuthPopup()
|
||||
*/
|
||||
() => {
|
||||
var dataRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
// Log me in
|
||||
dataRef.authWithOAuthPopup("twitter", function (error, authData) {
|
||||
if (error) {
|
||||
console.log('Login Failed!', error);
|
||||
} else {
|
||||
console.log('Authenticated successfully with payload:', authData);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.authWithOAuthRedirect
|
||||
*/
|
||||
() => {
|
||||
var dataRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
// Log me in
|
||||
dataRef.authWithOAuthRedirect("twitter", function (error) {
|
||||
if (error) {
|
||||
console.log('Login Failed!', error);
|
||||
} else {
|
||||
// We'll never get here, as the page will redirect on success.
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.authWithOAuthToken()
|
||||
*/
|
||||
() => {
|
||||
var dataRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
// Authenticate with Facebook using an existing OAuth 2.0 access token
|
||||
dataRef.authWithOAuthToken("facebook", "<ACCESS-TOKEN>", function (error, authData) {
|
||||
if (error) {
|
||||
console.log('Login Failed!', error);
|
||||
} else {
|
||||
console.log('Authenticated successfully with payload:', authData);
|
||||
}
|
||||
});
|
||||
}
|
||||
() => {
|
||||
var dataRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
// Authenticate with Twitter using an existing OAuth 1.0a credential set
|
||||
dataRef.authWithOAuthToken("twitter", {
|
||||
"user_id": "<USER-ID>",
|
||||
"oauth_token": "<ACCESS-TOKEN>",
|
||||
"oauth_token_secret": "<ACCESS-TOKEN-SECRET>",
|
||||
}, function (error, authData) {
|
||||
if (error) {
|
||||
console.log('Login Failed!', error);
|
||||
} else {
|
||||
console.log('Authenticated successfully with payload:', authData);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.getAuth()
|
||||
*/
|
||||
() => {
|
||||
var dataRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
var authData = dataRef.getAuth();
|
||||
|
||||
if (authData) {
|
||||
console.log('Authenticated user with uid:', authData.uid);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.onAuth()
|
||||
*/
|
||||
() => {
|
||||
var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
firebaseRef.onAuth(function (authData) {
|
||||
if (authData) {
|
||||
console.log('Client is authenticated with uid ' + authData.uid);
|
||||
} else {
|
||||
// Client is unauthenticated
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.offAuth
|
||||
*/
|
||||
() => {
|
||||
var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
var onAuthChange = function (authData: FirebaseAuthData) { /*...*/ };
|
||||
firebaseRef.onAuth(onAuthChange);
|
||||
// Sometime later...
|
||||
firebaseRef.offAuth(onAuthChange);
|
||||
}
|
||||
|
||||
//Time to log out!
|
||||
dataRef.unauth();
|
||||
|
||||
@@ -36,6 +182,146 @@ var fredRef3:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/use
|
||||
var x4:string = fredRef3.name();
|
||||
// x is now 'fred'.
|
||||
|
||||
/*
|
||||
* Firebase.key()
|
||||
*/
|
||||
() => {
|
||||
var fredRef = new Firebase("https://samplechat.firebaseio-demo.com/users/fred");
|
||||
var key = fredRef.key(); // key === "fred"
|
||||
key = fredRef.child("name/last").key(); // key === "last"
|
||||
}
|
||||
() => {
|
||||
// Calling key() on the root of a Firebase will return null:
|
||||
var rootRef = new Firebase("https://samplechat.firebaseio-demo.com");
|
||||
var key = rootRef.key(); // key === null
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.set()
|
||||
*/
|
||||
() => {
|
||||
var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name');
|
||||
fredNameRef.child('first').set('Fred');
|
||||
fredNameRef.child('last').set('Flintstone');
|
||||
// We've written 'Fred' to the Firebase location storing fred's first name,
|
||||
// and 'Flintstone' to the location storing his last name
|
||||
}
|
||||
() => {
|
||||
var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name');
|
||||
fredNameRef.set({ first: 'Fred', last: 'Flintstone' });
|
||||
// Exact same effect as the previous example, except we've written
|
||||
// fred's first and last name simultaneously
|
||||
}
|
||||
() => {
|
||||
var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name');
|
||||
var onComplete = function (error: any) {
|
||||
if (error) {
|
||||
console.log('Synchronization failed');
|
||||
} else {
|
||||
console.log('Synchronization succeeded');
|
||||
}
|
||||
};
|
||||
fredNameRef.set({ first: 'Fred', last: 'Flintstone' }, onComplete);
|
||||
// Same as the previous example, except we will also log a message
|
||||
// when the data has finished synchronizing
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.update()
|
||||
*/
|
||||
() => {
|
||||
var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name');
|
||||
// Modify the 'first' and 'last' children, but leave other data at fredNameRef unchanged
|
||||
fredNameRef.update({ first: 'Fred', last: 'Flintstone' });
|
||||
}
|
||||
() => {
|
||||
var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name');
|
||||
// Same as the previous example, except we will also display an alert
|
||||
// message when the data has finished synchronizing.
|
||||
var onComplete = function (error:any) {
|
||||
if (error) {
|
||||
console.log('Synchronization failed');
|
||||
} else {
|
||||
console.log('Synchronization succeeded');
|
||||
}
|
||||
};
|
||||
fredNameRef.update({ first: 'Wilma', last: 'Flintstone' }, onComplete);
|
||||
}
|
||||
() => {
|
||||
var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred');
|
||||
//The following 2 function calls are equivalent
|
||||
fredRef.update({ name: { first: 'Fred', last: 'Flintstone' }});
|
||||
fredRef.child('name').set({ first: 'Fred', last: 'Flintstone' });
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.remove()
|
||||
*/
|
||||
() => {
|
||||
var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred');
|
||||
fredRef.remove();
|
||||
// All data at the Firebase location for user 'fred' has been deleted
|
||||
// (including any child data)
|
||||
}
|
||||
() => {
|
||||
var onComplete = function (error: any) {
|
||||
if (error) {
|
||||
console.log('Synchronization failed');
|
||||
} else {
|
||||
console.log('Synchronization succeeded');
|
||||
}
|
||||
};
|
||||
fredRef.remove(onComplete);
|
||||
// Same as the previous example, except we will also log
|
||||
// a message when the delete has finished synchronizing
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.push()
|
||||
*/
|
||||
() => {
|
||||
var messageListRef = new Firebase('https://samplechat.firebaseio-demo.com/message_list');
|
||||
var newMessageRef = messageListRef.push();
|
||||
newMessageRef.set({ 'user_id': 'fred', 'text': 'Yabba Dabba Doo!' });
|
||||
// We've appended a new message to the message_list location.
|
||||
var path = newMessageRef.toString();
|
||||
// path will be something like
|
||||
// 'https://samplechat.firebaseio-demo.com/message_list/-IKo28nwJLH0Nc5XeFmj'
|
||||
}
|
||||
() => {
|
||||
var messageListRef = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list');
|
||||
messageListRef.push({ 'user_id': 'fred', 'text': 'Yabba Dabba Doo!' });
|
||||
// Same effect as the previous example, but we've combined the push() and the set().
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.setWithPriority()
|
||||
*/
|
||||
() => {
|
||||
var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred');
|
||||
|
||||
var user = {
|
||||
name: {
|
||||
first: 'Fred',
|
||||
last: 'Flintstone'
|
||||
},
|
||||
rank: 1000
|
||||
};
|
||||
|
||||
fredRef.setWithPriority(user, 1000);
|
||||
// We've written Fred's name and rank to firebase, and used his rank (1000) as the
|
||||
// priority of the data so he'll be ordered relative to other users by his rank
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.setPriority()
|
||||
*/
|
||||
() => {
|
||||
var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred');
|
||||
fredRef.setPriority(1000);
|
||||
// We have changed the priority of fred's user data to 1000
|
||||
}
|
||||
|
||||
// Increment Fred's rank by 1.
|
||||
var fredRankRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred/rank');
|
||||
fredRankRef.transaction(function(currentRank: number) {
|
||||
@@ -51,7 +337,7 @@ wilmaRef.transaction(function(currentData) {
|
||||
console.log('User wilma already exists.');
|
||||
return; // Abort the transaction.
|
||||
}
|
||||
}, function(error: any, committed: boolean, snapshot: IFirebaseDataSnapshot) {
|
||||
}, function(error: any, committed: boolean, snapshot: FirebaseDataSnapshot) {
|
||||
if (error)
|
||||
console.log('Transaction failed abnormally!', error);
|
||||
else if (!committed)
|
||||
@@ -61,14 +347,523 @@ wilmaRef.transaction(function(currentData) {
|
||||
console.log('Wilma\'s data: ', snapshot.val());
|
||||
});
|
||||
|
||||
var messageListRef: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list');
|
||||
var lastMessagesQuery:IFirebaseQuery = messageListRef.endAt().limit(500);
|
||||
lastMessagesQuery.on('child_added', function(childSnapshot: IFirebaseDataSnapshot) { /* handle child add */ });
|
||||
/*
|
||||
* Firebase.createUser()
|
||||
*/
|
||||
() => {
|
||||
var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
firebaseRef.createUser({
|
||||
email: "bobtony@firebase.com",
|
||||
password: "correcthorsebatterystaple"
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
switch (err.code) {
|
||||
case 'EMAIL_TAKEN':
|
||||
// The new user account cannot be created because the email is already in use.
|
||||
case 'INVALID_EMAIL':
|
||||
// The specified email is not a valid email.
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
// User account created successfully!
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var messageListRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list');
|
||||
var firstMessagesQuery:IFirebaseQuery = messageListRef2.startAt().limit(500);
|
||||
firstMessagesQuery.on('child_added', function(childSnapshot: IFirebaseDataSnapshot) { /* handle child add */ });
|
||||
/*
|
||||
* Firebase.changePassword()
|
||||
*/
|
||||
() => {
|
||||
var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
firebaseRef.changePassword({
|
||||
email: "bobtony@firebase.com",
|
||||
oldPassword: "correcthorsebatterystaple",
|
||||
newPassword: "shinynewpassword"
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
switch (err.code) {
|
||||
case 'INVALID_PASSWORD':
|
||||
// The specified user account password is incorrect.
|
||||
case 'INVALID_USER':
|
||||
// The specified user account does not exist.
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
// User password changed successfully!
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var usersRef3: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users');
|
||||
var usersQuery: IFirebaseQuery = usersRef3.startAt(1000).limit(50);
|
||||
usersQuery.on('child_added', function(userSnapshot: IFirebaseDataSnapshot) { /* handle user */ });
|
||||
/*
|
||||
* Firebase.removeUser()
|
||||
*/
|
||||
() => {
|
||||
var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
firebaseRef.removeUser({
|
||||
email: "bobtony@firebase.com",
|
||||
password: "correcthorsebatterystaple"
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
switch (err.code) {
|
||||
case 'INVALID_USER':
|
||||
// The specified user account does not exist.
|
||||
case 'INVALID_PASSWORD':
|
||||
// The specified user account password is incorrect.
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
// User account deleted successfully!
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.resetPassword()
|
||||
*/
|
||||
() => {
|
||||
var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com');
|
||||
firebaseRef.resetPassword({
|
||||
email: "bobtony@firebase.com"
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
switch (err.code) {
|
||||
case 'INVALID_USER':
|
||||
// The specified user account does not exist.
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
// Password reset email sent successfully!
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//var messageListRef: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list');
|
||||
//var lastMessagesQuery:FirebaseQuery = messageListRef.endAt().limit(500);
|
||||
//lastMessagesQuery.on('child_added', function(childSnapshot: FirebaseDataSnapshot) { /* handle child add */ });
|
||||
|
||||
//var messageListRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list');
|
||||
//var firstMessagesQuery:FirebaseQuery = messageListRef2.startAt().limit(500);
|
||||
//firstMessagesQuery.on('child_added', function(childSnapshot: FirebaseDataSnapshot) { /* handle child add */ });
|
||||
|
||||
//var usersRef3: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users');
|
||||
//var usersQuery: FirebaseQuery = usersRef3.startAt(1000).limit(50);
|
||||
//usersQuery.on('child_added', function(userSnapshot: FirebaseDataSnapshot) { /* handle user */ });
|
||||
|
||||
/*
|
||||
* Firebase.goOffline()
|
||||
* Firebase.goOnline()
|
||||
*/
|
||||
() => {
|
||||
var usersRef = new Firebase('https://samplechat.firebaseio-demo.com/users');
|
||||
Firebase.goOffline(); // All Firebase instances are disconnected
|
||||
Firebase.goOnline(); // All Firebase instances automatically reconnect
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.on()
|
||||
*/
|
||||
() => {
|
||||
firebaseRef.on('value', function (dataSnapshot) {
|
||||
// code to handle new value.
|
||||
});
|
||||
|
||||
firebaseRef.on('child_added', function (childSnapshot, prevChildName) {
|
||||
// code to handle new child.
|
||||
});
|
||||
|
||||
firebaseRef.on('child_removed', function (oldChildSnapshot) {
|
||||
// code to handle child removal.
|
||||
});
|
||||
|
||||
firebaseRef.on('child_changed', function (childSnapshot, prevChildName) {
|
||||
// code to handle child data changes.
|
||||
});
|
||||
|
||||
firebaseRef.on('child_changed', function (childSnapshot, prevChildName) {
|
||||
// code to handle child data changes.
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.off()
|
||||
*/
|
||||
() => {
|
||||
var onValueChange = function (dataSnapshot: FirebaseDataSnapshot) { /* handle... */ };
|
||||
firebaseRef.on('value', onValueChange);
|
||||
// Sometime later...
|
||||
firebaseRef.off('value', onValueChange);
|
||||
}
|
||||
() => {
|
||||
// Or you can save a line of code by using an inline function
|
||||
// and on()'s return value.
|
||||
var onValueChange = firebaseRef.on('value', function (dataSnapshot) { /* handle... */ });
|
||||
// Sometime later...
|
||||
firebaseRef.off('value', onValueChange);
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.once()
|
||||
*/
|
||||
() => {
|
||||
// Basic usage of .once() to read the data located at firebaseRef.
|
||||
firebaseRef.once('value', function (dataSnapshot) {
|
||||
// handle read data.
|
||||
});
|
||||
}
|
||||
() => {
|
||||
// Provide a failureCallback to be notified when this
|
||||
// callback is revoked due to security violations.
|
||||
firebaseRef.once('value', function (dataSnapshot) {
|
||||
// code to handle new value
|
||||
}, function (err: any) {
|
||||
// code to handle read error
|
||||
});
|
||||
}
|
||||
() => {
|
||||
// Provide a context to override "this" when callbacks are triggered.
|
||||
firebaseRef.once('value', function (dataSnapshot) {
|
||||
// this.x is 1
|
||||
}, { x: 1 });
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.orderByChild()
|
||||
*/
|
||||
() => {
|
||||
// For example, using our sample Firebase of dinosaur facts,
|
||||
// we can read all dinosaurs ordered by height using the following query:
|
||||
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/");
|
||||
ref.orderByChild("height").on("child_added", function (snapshot) {
|
||||
console.log(snapshot.key() + " was " + snapshot.val().height + " meters tall");
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.orderByKey()
|
||||
*/
|
||||
() => {
|
||||
// For example, using our sample Firebase of dinosaur facts,
|
||||
// we can read all dinosaurs in alphabetical order, ignoring their priority,
|
||||
// using the following query:
|
||||
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/");
|
||||
ref.orderByKey().on("child_added", function (snapshot) {
|
||||
console.log(snapshot.key());
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.orderByPriority()
|
||||
*/
|
||||
() => {
|
||||
// For example, using our sample Firebase of dinosaur facts,
|
||||
// we can read all dinosaurs in priority order using the following query:
|
||||
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/");
|
||||
ref.orderByPriority().on("child_added", function (snapshot) {
|
||||
console.log(snapshot.key());
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.startAt()
|
||||
*/
|
||||
() => {
|
||||
// For example, using our sample Firebase of dinosaur facts,
|
||||
// we can find all dinosaurs that are at least three meters tall
|
||||
// by combining orderByChild() and startAt():
|
||||
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/");
|
||||
ref.orderByChild("height").startAt(3).on("child_added", function (snapshot) {
|
||||
console.log(snapshot.key())
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.endAt()
|
||||
*/
|
||||
() => {
|
||||
// For example, using our sample Firebase of dinosaur facts,
|
||||
// we can find all dinosaurs whose names come before Pterodactyl lexicographically
|
||||
// by combining orderByKey() and endAt():
|
||||
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/");
|
||||
ref.orderByKey().endAt("pterodactyl").on("child_added", function (snapshot) {
|
||||
console.log(snapshot.key());
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.equalTo()
|
||||
*/
|
||||
() => {
|
||||
// For example, using our sample Firebase of dinosaur facts,
|
||||
// we can find all dinosaurs whose height is exactly 25 meters
|
||||
// by combining orderByChild() and equalTo():
|
||||
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/");
|
||||
ref.orderByChild("height").equalTo(25).on("child_added", function (snapshot) {
|
||||
console.log(snapshot.key());
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.limitToFirst
|
||||
*/
|
||||
() => {
|
||||
// Using our sample Firebase of dinosaur facts,
|
||||
// we can find the two shortest dinosaurs with this query:
|
||||
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/");
|
||||
ref.orderByChild("height").limitToFirst(2).on("child_added", function (snapshot) {
|
||||
console.log(snapshot.key());
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.limitToLast
|
||||
*/
|
||||
() => {
|
||||
// Using our sample Firebase of dinosaur facts,
|
||||
// we can find the two heaviest dinosaurs with this query:
|
||||
var ref = new Firebase("https://dinosaur-facts.firebaseio.com/");
|
||||
ref.orderByChild("weight").limitToLast(2).on("child_added", function (snapshot) {
|
||||
console.log(snapshot.key());
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* FirebaseQuery.ref()
|
||||
*/
|
||||
() => {
|
||||
// The Firebase reference returned by ref() is equivalent to the Firebase reference used to create the Query.
|
||||
var ref = new Firebase("https://samplechat.firebaseio-demo.com/users");
|
||||
var query = ref.limitToFirst(5);
|
||||
var refToSameLocation = query.ref(); // ref === refToSameLocation
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.onDisconnect().set()
|
||||
*/
|
||||
() => {
|
||||
var disconnectRef = new Firebase('https://samplechat.firebaseio-demo.com/disconnectmessage');
|
||||
disconnectRef.onDisconnect().set('I disconnected!');
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.onDisconnect().update()
|
||||
*/
|
||||
() => {
|
||||
var disconnectRef = new Firebase('https://samplechat.firebaseio-demo.com/disconnectmessage');
|
||||
disconnectRef.onDisconnect().update({ message: 'I disconnected!' });
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.onDisconnect().remove()
|
||||
*/
|
||||
() => {
|
||||
var disconnectRef = new Firebase('https://samplechat.firebaseio-demo.com/disconnectdata');
|
||||
disconnectRef.onDisconnect().remove();
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.onDisconnect().setWithPriority()
|
||||
*/
|
||||
() => {
|
||||
var disconnectRef = new Firebase('https://samplechat.firebaseio-demo.com/disconnectMessage');
|
||||
disconnectRef.onDisconnect().setWithPriority('I disconnected', 10);
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.onDisconnect().cancel()
|
||||
*/
|
||||
() => {
|
||||
var fredOnlineRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/online');
|
||||
fredOnlineRef.onDisconnect().set(false);
|
||||
|
||||
// cancel the previously set onDisconnect().set() event
|
||||
fredOnlineRef.onDisconnect().cancel();
|
||||
}
|
||||
|
||||
/*
|
||||
* Firebase.ServerValue.TIMESTAMP
|
||||
*/
|
||||
() => {
|
||||
// Record the current time immediately, and queue an event to
|
||||
// record the time at which the user disconnects.
|
||||
var sessionsRef = new Firebase('https://samplechat.firebaseio-demo.com/sessions/');
|
||||
var mySessionRef = sessionsRef.push();
|
||||
mySessionRef.onDisconnect().update({ endedAt: Firebase.ServerValue.TIMESTAMP });
|
||||
mySessionRef.update({ startedAt: Firebase.ServerValue.TIMESTAMP });
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.val()
|
||||
*/
|
||||
() => {
|
||||
// Demonstrate writing data and then reading it back as a Javascript object.
|
||||
var fredNameRef = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred');
|
||||
fredNameRef.set({ first: 'Fred', last: 'Flintstone' });
|
||||
|
||||
fredNameRef.once('value', function (nameSnapshot) {
|
||||
var val = nameSnapshot.val();
|
||||
// val now contains the object { first: 'Fred', last: 'Flintstone' }.
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.child()
|
||||
*/
|
||||
(dataSnapshot:FirebaseDataSnapshot) => {
|
||||
// Given a DataSnapshot containing a child 'name' that has children 'first'
|
||||
// (set to 'Fred') and 'last' (set to 'Flintstone'):
|
||||
var nameSnapshot = dataSnapshot.child('name');
|
||||
var name = nameSnapshot.val();
|
||||
// name now contains { first: 'Fred', last: 'Flintstone'}.
|
||||
|
||||
var firstNameSnapshot = dataSnapshot.child('name/first');
|
||||
var firstName = firstNameSnapshot.val();
|
||||
// firstName now contains 'Fred'.
|
||||
|
||||
var favoriteColorSnapshot = dataSnapshot.child('favorite_color');
|
||||
var favoriteColor = favoriteColorSnapshot.val();
|
||||
// favoriteColor will be null, because there is no 'favorite_color' child in dataSnapshot.
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.forEach()
|
||||
*/
|
||||
(dataSnapshot:FirebaseDataSnapshot) => {
|
||||
// Given a DataSnapshot containing a child "fred" and a child "wilma", this callback
|
||||
// function will be called twice
|
||||
dataSnapshot.forEach(function (childSnapshot) {
|
||||
// key will be "fred" the first time and "wilma" the second time
|
||||
var key = childSnapshot.key();
|
||||
|
||||
// childData will be the actual contents of the child
|
||||
var childData = childSnapshot.val();
|
||||
});
|
||||
}
|
||||
(dataSnapshot:FirebaseDataSnapshot) => {
|
||||
// Given a DataSnapshot containing a child "fred" and a child "wilma", this callback
|
||||
// funciton will only be called once (since we return true)
|
||||
dataSnapshot.forEach(function (childSnapshot) {
|
||||
var key = childSnapshot.key(); // key will be "fred"
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.hasChild()
|
||||
*/
|
||||
(dataSnapshot: FirebaseDataSnapshot) => {
|
||||
// Given a DataSnapshot with child 'fred' and no other children:
|
||||
var x = dataSnapshot.hasChild('fred');
|
||||
var y = dataSnapshot.hasChild('whales');
|
||||
// x is true and y is false.
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.hasChildren()
|
||||
*/
|
||||
(dataSnapshot: FirebaseDataSnapshot) => {
|
||||
// Given a DataSnapshot containing a child 'name' with children 'first'
|
||||
// (set to 'Fred') and 'last' (set to 'Flintstone'):
|
||||
var x = dataSnapshot.hasChildren();
|
||||
// x is true.
|
||||
var y = dataSnapshot.child('name').hasChildren();
|
||||
// y is true.
|
||||
var z = dataSnapshot.child('name/first').hasChildren();
|
||||
// z is false since 'Fred' is a string and therefore has no children.
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.key()
|
||||
*/
|
||||
() => {
|
||||
// Calling key() on any DataSnapshot (except for one which represents the root of a Firebase)
|
||||
// will return the key name of the location that generated it:
|
||||
var fredRef = new Firebase("https://samplechat.firebaseio-demo.com/users/fred");
|
||||
fredRef.on("value", function (fredSnapshot) {
|
||||
var key = fredSnapshot.key(); // key === "fred"
|
||||
key = fredSnapshot.child("name/last").key(); // key === "last"
|
||||
});
|
||||
}
|
||||
() => {
|
||||
// Calling key() on a DataSnapshot generated from a reference to the root of a Firebase return null:
|
||||
var rootRef = new Firebase("https://samplechat.firebaseio-demo.com");
|
||||
rootRef.on("value", function (rootSnapshot) {
|
||||
var key = rootSnapshot.key(); // key === null
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.name()
|
||||
*/
|
||||
() => {
|
||||
var fredRef = new Firebase("https://samplechat.firebaseio-demo.com/users/fred");
|
||||
fredRef.on("value", function (fredSnapshot) {
|
||||
var key = fredSnapshot.name(); // key === "fred"
|
||||
key = fredSnapshot.child("name/last").name(); // key === "last"
|
||||
});
|
||||
}
|
||||
() => {
|
||||
var rootRef = new Firebase("https://samplechat.firebaseio-demo.com");
|
||||
rootRef.on("value", function (rootSnapshot) {
|
||||
var key = rootSnapshot.name(); // key === null
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.numChildren()
|
||||
*/
|
||||
(dataSnapshot: FirebaseDataSnapshot) => {
|
||||
// Given a DataSnapshot containing a child 'name' with children 'first'
|
||||
// (set to 'Fred') and 'last' (set to 'Flintstone'):
|
||||
var x = dataSnapshot.numChildren();
|
||||
// x is 1.
|
||||
var y = dataSnapshot.child('name').numChildren();
|
||||
// y is 2.
|
||||
var z = dataSnapshot.child('name/first').numChildren();
|
||||
// z is 0 since 'Fred' is a string and therefore has no children.
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnaphot.ref()
|
||||
*/
|
||||
() => {
|
||||
var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred');
|
||||
fredRef.on('value', function (fredSnapshot) {
|
||||
var fredRef2 = fredSnapshot.ref();
|
||||
// fredRef and fredRef2 both point to the same location.
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.getPriority()
|
||||
*/
|
||||
(dataSnapshot: FirebaseDataSnapshot) => {
|
||||
// Given a snapshot for data with priority 1000:
|
||||
var x = dataSnapshot.getPriority();
|
||||
// x is now 1000.
|
||||
}
|
||||
|
||||
/*
|
||||
* DataSnapshot.exportVal()
|
||||
*/
|
||||
(dataSnapshot: FirebaseDataSnapshot) => {
|
||||
firebaseRef.setWithPriority('hello', 500);
|
||||
firebaseRef.once('value', function (dataSnapshot) {
|
||||
var x = dataSnapshot.exportVal();
|
||||
// x now contains { '.value': 'hello', '.priority': 500 }
|
||||
});
|
||||
}
|
||||
(dataSnapshot: FirebaseDataSnapshot) => {
|
||||
firebaseRef.set('hello');
|
||||
firebaseRef.once('value', function (dataSnapshot) {
|
||||
var x = dataSnapshot.exportVal();
|
||||
// x now contains 'hello'
|
||||
});
|
||||
}
|
||||
(dataSnapshot: FirebaseDataSnapshot) => {
|
||||
// Note: To access these variables in JavaScript, you can use x['.value'] and x['.priority'].
|
||||
firebaseRef.setWithPriority({ a: 'hello', b: 'hi' }, 500);
|
||||
firebaseRef.once('value', function (dataSnapshot) {
|
||||
var x = dataSnapshot.exportVal();
|
||||
// x now contains { 'a': 'hello', 'b': 'hi', '.priority': 500 }
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+268
-35
@@ -1,75 +1,308 @@
|
||||
// Type definitions for Firebase API
|
||||
// Type definitions for Firebase API 2.0.2
|
||||
// Project: https://www.firebase.com/docs/javascript/firebase
|
||||
// Definitions by: Vincent Botone <https://github.com/vbortone/>
|
||||
// Definitions by: Vincent Botone <https://github.com/vbortone/>, Shin1 Kashimura <https://github.com/in-async/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface IFirebaseAuthResult {
|
||||
interface FirebaseAuthResult {
|
||||
auth: any;
|
||||
expires: number;
|
||||
}
|
||||
|
||||
interface IFirebaseDataSnapshot {
|
||||
interface FirebaseDataSnapshot {
|
||||
/**
|
||||
* Gets the JavaScript object representation of the DataSnapshot.
|
||||
*/
|
||||
val(): any;
|
||||
child(childPath: string): IFirebaseDataSnapshot;
|
||||
forEach(childAction: (childSnapshot: IFirebaseDataSnapshot) => boolean): boolean;
|
||||
/**
|
||||
* Gets a DataSnapshot for the location at the specified relative path.
|
||||
*/
|
||||
child(childPath: string): FirebaseDataSnapshot;
|
||||
/**
|
||||
* Enumerates through the DataSnapshot’s children (in the default order).
|
||||
*/
|
||||
forEach(childAction: (childSnapshot: FirebaseDataSnapshot) => void): boolean;
|
||||
forEach(childAction: (childSnapshot: FirebaseDataSnapshot) => boolean): boolean;
|
||||
/**
|
||||
* Returns true if the specified child exists.
|
||||
*/
|
||||
hasChild(childPath: string): boolean;
|
||||
/**
|
||||
* Returns true if the DataSnapshot has any children.
|
||||
*/
|
||||
hasChildren(): boolean;
|
||||
/**
|
||||
* Gets the key name of the location that generated this DataSnapshot.
|
||||
*/
|
||||
key(): string;
|
||||
/**
|
||||
* @deprecated Use key() instead.
|
||||
* Gets the key name of the location that generated this DataSnapshot.
|
||||
*/
|
||||
name(): string;
|
||||
/**
|
||||
* Gets the number of children for this DataSnapshot.
|
||||
*/
|
||||
numChildren(): number;
|
||||
/**
|
||||
* Gets the Firebase reference for the location that generated this DataSnapshot.
|
||||
*/
|
||||
ref(): Firebase;
|
||||
/**
|
||||
* Gets the priority of the data in this DataSnapshot.
|
||||
* @returns {string, number, null} The priority, or null if no priority was set.
|
||||
*/
|
||||
getPriority(): any; // string or number
|
||||
/**
|
||||
* Exports the entire contents of the DataSnapshot as a JavaScript object.
|
||||
*/
|
||||
exportVal(): Object;
|
||||
}
|
||||
|
||||
interface IFirebaseOnDisconnect {
|
||||
interface FirebaseOnDisconnect {
|
||||
/**
|
||||
* Ensures the data at this location is set to the specified value when the client is disconnected
|
||||
* (due to closing the browser, navigating to a new page, or network issues).
|
||||
*/
|
||||
set(value: any, onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Ensures the data at this location is set to the specified value and priority when the client is disconnected
|
||||
* (due to closing the browser, navigating to a new page, or network issues).
|
||||
*/
|
||||
setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void;
|
||||
setWithPriority(value: any, priority: number, onComplete?: (error: any) => void): void;
|
||||
update(value: any, onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Writes the enumerated children at this Firebase location when the client is disconnected
|
||||
* (due to closing the browser, navigating to a new page, or network issues).
|
||||
*/
|
||||
update(value: Object, onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Ensures the data at this location is deleted when the client is disconnected
|
||||
* (due to closing the browser, navigating to a new page, or network issues).
|
||||
*/
|
||||
remove(onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Cancels all previously queued onDisconnect() set or update events for this location and all children.
|
||||
*/
|
||||
cancel(onComplete?: (error: any) => void): void;
|
||||
}
|
||||
|
||||
interface IFirebaseQuery {
|
||||
on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void;
|
||||
off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void;
|
||||
once(eventType: string, successCallback: (dataSnapshot: IFirebaseDataSnapshot) => void, failureCallback?: () => void, context?: Object): void;
|
||||
limit(limit: number): IFirebaseQuery;
|
||||
startAt(priority?: string, name?: string): IFirebaseQuery;
|
||||
startAt(priority?: number, name?: string): IFirebaseQuery;
|
||||
endAt(priority?: string, name?: string): IFirebaseQuery;
|
||||
endAt(priority?: number, name?: string): IFirebaseQuery;
|
||||
interface FirebaseQuery {
|
||||
/**
|
||||
* Listens for data changes at a particular location.
|
||||
*/
|
||||
on(eventType: string, callback: (dataSnapshot: FirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: (error: any) => void, context?: Object): (dataSnapshot: FirebaseDataSnapshot, prevChildName?: string) => void;
|
||||
/**
|
||||
* Detaches a callback previously attached with on().
|
||||
*/
|
||||
off(eventType?: string, callback?: (dataSnapshot: FirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void;
|
||||
/**
|
||||
* Listens for exactly one event of the specified event type, and then stops listening.
|
||||
*/
|
||||
once(eventType: string, successCallback: (dataSnapshot: FirebaseDataSnapshot) => void, context?: Object): void;
|
||||
once(eventType: string, successCallback: (dataSnapshot: FirebaseDataSnapshot) => void, failureCallback?: (error: any) => void, context?: Object): void;
|
||||
/**
|
||||
* Generates a new Query object ordered by the specified child key.
|
||||
*/
|
||||
orderByChild(key: string): FirebaseQuery;
|
||||
/**
|
||||
* Generates a new Query object ordered by key name.
|
||||
*/
|
||||
orderByKey(): FirebaseQuery;
|
||||
/**
|
||||
* Generates a new Query object ordered by priority.
|
||||
*/
|
||||
orderByPriority(): FirebaseQuery;
|
||||
/**
|
||||
* @deprecated Use limitToFirst() and limitToLast() instead.
|
||||
* Generates a new Query object limited to the specified number of children.
|
||||
*/
|
||||
limit(limit: number): FirebaseQuery;
|
||||
/**
|
||||
* Creates a Query with the specified starting point.
|
||||
* The generated Query includes children which match the specified starting point.
|
||||
*/
|
||||
startAt(value: string, key?: string): FirebaseQuery;
|
||||
startAt(value: number, key?: string): FirebaseQuery;
|
||||
/**
|
||||
* Creates a Query with the specified ending point.
|
||||
* The generated Query includes children which match the specified ending point.
|
||||
*/
|
||||
endAt(value: string, key?: string): FirebaseQuery;
|
||||
endAt(value: number, key?: string): FirebaseQuery;
|
||||
/**
|
||||
* Creates a Query which includes children which match the specified value.
|
||||
*/
|
||||
equalTo(value: string, key?: string): FirebaseQuery;
|
||||
equalTo(value: number, key?: string): FirebaseQuery;
|
||||
/**
|
||||
* Generates a new Query object limited to the first certain number of children.
|
||||
*/
|
||||
limitToFirst(limit: number): FirebaseQuery;
|
||||
/**
|
||||
* Generates a new Query object limited to the last certain number of children.
|
||||
*/
|
||||
limitToLast(limit: number): FirebaseQuery;
|
||||
/**
|
||||
* Gets a Firebase reference to the Query's location.
|
||||
*/
|
||||
ref(): Firebase;
|
||||
}
|
||||
|
||||
declare class Firebase implements IFirebaseQuery {
|
||||
constructor(firebaseURL: string);
|
||||
auth(authToken: string, onComplete?: (error: any, result: IFirebaseAuthResult) => void, onCancel?:(error: any) => void): void;
|
||||
interface Firebase extends FirebaseQuery {
|
||||
/**
|
||||
* @deprecated Use authWithCustomToken() instead.
|
||||
* Authenticates a Firebase client using the provided authentication token or Firebase Secret.
|
||||
*/
|
||||
auth(authToken: string, onComplete?: (error: any, result: FirebaseAuthResult) => void, onCancel?:(error: any) => void): void;
|
||||
/**
|
||||
* Authenticates a Firebase client using an authentication token or Firebase Secret.
|
||||
*/
|
||||
authWithCustomToken(autoToken: string, onComplete: (error: any, authData: FirebaseAuthData) => void, options?:Object): void;
|
||||
/**
|
||||
* Authenticates a Firebase client using a new, temporary guest account.
|
||||
*/
|
||||
authAnonymously(onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void;
|
||||
/**
|
||||
* Authenticates a Firebase client using an email / password combination.
|
||||
*/
|
||||
authWithPassword(credentials: FirebaseCredentials, onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void;
|
||||
/**
|
||||
* Authenticates a Firebase client using a popup-based OAuth flow.
|
||||
*/
|
||||
authWithOAuthPopup(provider: string, onComplete:(error: any, authData: FirebaseAuthData) => void, options?: Object): void;
|
||||
/**
|
||||
* Authenticates a Firebase client using a redirect-based OAuth flow.
|
||||
*/
|
||||
authWithOAuthRedirect(provider: string, onComplete: (error: any) => void, options?: Object): void;
|
||||
/**
|
||||
* Authenticates a Firebase client using OAuth access tokens or credentials.
|
||||
*/
|
||||
authWithOAuthToken(provider: string, credentials: string, onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void;
|
||||
authWithOAuthToken(provider: string, credentials: Object, onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void;
|
||||
/**
|
||||
* Synchronously access the current authentication state of the client.
|
||||
*/
|
||||
getAuth(): FirebaseAuthData;
|
||||
/**
|
||||
* Listen for changes to the client's authentication state.
|
||||
*/
|
||||
onAuth(onComplete: (authData: FirebaseAuthData) => void, context?: Object): void;
|
||||
/**
|
||||
* Detaches a callback previously attached with onAuth().
|
||||
*/
|
||||
offAuth(onComplete: (authData: FirebaseAuthData) => void, context?: Object): void;
|
||||
/**
|
||||
* Unauthenticates a Firebase client.
|
||||
*/
|
||||
unauth(): void;
|
||||
/**
|
||||
* Gets a Firebase reference for the location at the specified relative path.
|
||||
*/
|
||||
child(childPath: string): Firebase;
|
||||
/**
|
||||
* Gets a Firebase reference to the parent location.
|
||||
*/
|
||||
parent(): Firebase;
|
||||
/**
|
||||
* Gets a Firebase reference to the root of the Firebase.
|
||||
*/
|
||||
root(): Firebase;
|
||||
/**
|
||||
* Returns the last token in a Firebase location.
|
||||
*/
|
||||
key(): string;
|
||||
/**
|
||||
* @deprecated Use key() instead.
|
||||
* Returns the last token in a Firebase location.
|
||||
*/
|
||||
name(): string;
|
||||
/**
|
||||
* Gets the absolute URL corresponding to this Firebase reference's location.
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Writes data to this Firebase location.
|
||||
*/
|
||||
set(value: any, onComplete?: (error: any) => void): void;
|
||||
update(value: any, onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Writes the enumerated children to this Firebase location.
|
||||
*/
|
||||
update(value: Object, onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Removes the data at this Firebase location.
|
||||
*/
|
||||
remove(onComplete?: (error: any) => void): void;
|
||||
push(value: any, onComplete?: (error: any) => void): Firebase;
|
||||
/**
|
||||
* Generates a new child location using a unique name and returns a Firebase reference to it.
|
||||
* @returns {Firebase} A Firebase reference for the generated location.
|
||||
*/
|
||||
push(value?: any, onComplete?: (error: any) => void): Firebase;
|
||||
/**
|
||||
* Writes data to this Firebase location. Like set() but also specifies the priority for that data.
|
||||
*/
|
||||
setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void;
|
||||
setWithPriority(value: any, priority: number, onComplete?: (error: any) => void): void;
|
||||
/**
|
||||
* Sets a priority for the data at this Firebase location.
|
||||
*/
|
||||
setPriority(priority: string, onComplete?: (error: any) => void): void;
|
||||
setPriority(priority: number, onComplete?: (error: any) => void): void;
|
||||
transaction(updateFunction: (currentData: any)=> any, onComplete?: (error: any, committed: boolean, snapshot: IFirebaseDataSnapshot) => void, applyLocally?: boolean): void;
|
||||
onDisconnect(): IFirebaseOnDisconnect;
|
||||
on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void;
|
||||
off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void;
|
||||
once(eventType: string, successCallback: (dataSnapshot: IFirebaseDataSnapshot) => void, failureCallback?: () => void, context?: Object): void;
|
||||
limit(limit: number): IFirebaseQuery;
|
||||
startAt(priority?: string, name?: string): IFirebaseQuery;
|
||||
startAt(priority?: number, name?: string): IFirebaseQuery;
|
||||
endAt(priority?: string, name?: string): IFirebaseQuery;
|
||||
endAt(priority?: number, name?: string): IFirebaseQuery;
|
||||
ref(): Firebase;
|
||||
goOffline(): void;
|
||||
goOnline(): void;
|
||||
/**
|
||||
* Atomically modifies the data at this location.
|
||||
*/
|
||||
transaction(updateFunction: (currentData: any)=> any, onComplete?: (error: any, committed: boolean, snapshot: FirebaseDataSnapshot) => void, applyLocally?: boolean): void;
|
||||
/**
|
||||
* Creates a new user account using an email / password combination.
|
||||
*/
|
||||
createUser(credentials: FirebaseCredentials, onComplete: (error: any) => void): void;
|
||||
/**
|
||||
* Change the password of an existing user using an email / password combination.
|
||||
*/
|
||||
changePassword(credentials: { email: string; oldPassword: string; newPassword: string }, onComplete: (error: any) => void): void;
|
||||
/**
|
||||
* Removes an existing user account using an email / password combination.
|
||||
*/
|
||||
removeUser(credentials: FirebaseCredentials, onComplete: (error: any) => void): void;
|
||||
/**
|
||||
* Sends a password-reset email to the owner of the account, containing a token that may be used to authenticate and change the user password.
|
||||
*/
|
||||
resetPassword(credentials: { email: string }, onComplete: (error: any) => void): void;
|
||||
onDisconnect(): FirebaseOnDisconnect;
|
||||
}
|
||||
interface FirebaseStatic {
|
||||
/**
|
||||
* Constructs a new Firebase reference from a full Firebase URL.
|
||||
*/
|
||||
new (firebaseURL: string): Firebase;
|
||||
/**
|
||||
* Manually disconnects the Firebase client from the server and disables automatic reconnection.
|
||||
*/
|
||||
goOffline(): void;
|
||||
/**
|
||||
* Manually reestablishes a connection to the Firebase server and enables automatic reconnection.
|
||||
*/
|
||||
goOnline(): void;
|
||||
|
||||
ServerValue: {
|
||||
/**
|
||||
* A placeholder value for auto-populating the current timestamp
|
||||
* (time since the Unix epoch, in milliseconds) by the Firebase servers.
|
||||
*/
|
||||
TIMESTAMP: any;
|
||||
};
|
||||
}
|
||||
declare var Firebase: FirebaseStatic;
|
||||
|
||||
// Reference: https://www.firebase.com/docs/web/api/firebase/getauth.html
|
||||
interface FirebaseAuthData {
|
||||
uid: string;
|
||||
provider: string;
|
||||
token: string;
|
||||
expires: number;
|
||||
auth: Object;
|
||||
}
|
||||
|
||||
interface FirebaseCredentials {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
@@ -19,22 +19,22 @@
|
||||
};
|
||||
|
||||
(()=>{
|
||||
window.addEventListener('GamepadConnected', (e: GamepadEvent)=>{
|
||||
window.addEventListener('GamepadConnected', (e: Gamepad.GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' connected!');
|
||||
}, false);
|
||||
window.addEventListener('GamepadDisconnected', (e: GamepadEvent)=>{
|
||||
window.addEventListener('GamepadDisconnected', (e: Gamepad.GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' disconnected!');
|
||||
}, false);
|
||||
window.addEventListener('webkitGamepadConnected', (e: GamepadEvent)=>{
|
||||
window.addEventListener('webkitGamepadConnected', (e: Gamepad.GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' connected!');
|
||||
}, false);
|
||||
window.addEventListener('webkitGamepadDisconnected', (e: GamepadEvent)=>{
|
||||
window.addEventListener('webkitGamepadDisconnected', (e: Gamepad.GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' disconnected!');
|
||||
}, false);
|
||||
window.addEventListener('mozGamepadConnected', (e: GamepadEvent)=>{
|
||||
window.addEventListener('mozGamepadConnected', (e: Gamepad.GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' connected!');
|
||||
}, false);
|
||||
window.addEventListener('mozGamepadDisconnected', (e: GamepadEvent)=>{
|
||||
window.addEventListener('mozGamepadDisconnected', (e: Gamepad.GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' disconnected!');
|
||||
}, false);
|
||||
|
||||
@@ -45,9 +45,9 @@
|
||||
{
|
||||
requestAnimationFrame.call(window, runAnimation);
|
||||
|
||||
var gamepads: GamepadList = getGamepads.call(navigator);
|
||||
var gamepads: Gamepad.GamepadList = getGamepads.call(navigator);
|
||||
for(var i = 0; i < gamepads.length; i++){
|
||||
var pad: Gamepad = gamepads[i];
|
||||
var pad: Gamepad.Gamepad = gamepads[i];
|
||||
if(pad){
|
||||
for (var k = 0; k < pad.buttons.length; k++)
|
||||
{
|
||||
|
||||
Vendored
+57
-53
@@ -3,55 +3,69 @@
|
||||
// Definitions by: Kon <http://phyzkit.net/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* This interface defines an individual gamepad device.
|
||||
*/
|
||||
interface Gamepad{
|
||||
declare module Gamepad{
|
||||
/**
|
||||
* An identification string for the gamepad. This string identifies the brand or style of connected gamepad device. Typically, this will include the USB vendor and a product ID.
|
||||
* @readonly
|
||||
* This interface defines an individual gamepad device.
|
||||
*/
|
||||
id:string;
|
||||
|
||||
/**
|
||||
* The index of the gamepad in the Navigator. When multiple gamepads are connected to a user agent, indices must be assigned on a first-come, first-serve basis, starting at zero. If a gamepad is disconnected, previously assigned indices must not be reassigned to gamepads that continue to be connected. However, if a gamepad is disconnected, and subsequently the same or a different gamepad is then connected, index entries must be reused.
|
||||
* @readonly
|
||||
*/
|
||||
index:number;
|
||||
export interface Gamepad{
|
||||
/**
|
||||
* An identification string for the gamepad. This string identifies the brand or style of connected gamepad device. Typically, this will include the USB vendor and a product ID.
|
||||
* @readonly
|
||||
*/
|
||||
id:string;
|
||||
|
||||
/**
|
||||
* The index of the gamepad in the Navigator. When multiple gamepads are connected to a user agent, indices must be assigned on a first-come, first-serve basis, starting at zero. If a gamepad is disconnected, previously assigned indices must not be reassigned to gamepads that continue to be connected. However, if a gamepad is disconnected, and subsequently the same or a different gamepad is then connected, index entries must be reused.
|
||||
* @readonly
|
||||
*/
|
||||
index:number;
|
||||
|
||||
/**
|
||||
* Last time the data for this gamepad was updated. Timestamp is a monotonically increasing value that allows the author to determine if the axes and button data have been updated from the hardware, relative to a previously saved timestamp.
|
||||
* @readonly
|
||||
*/
|
||||
timestamp:number;
|
||||
|
||||
/**
|
||||
* Array of values for all axes of the gamepad. All axis values must be linearly normalized to the range [-1.0 .. 1.0]. As appropriate, -1.0 should correspond to "up" or "left", and 1.0 should correspond to "down" or "right". Axes that are drawn from a 2D input device should appear next to each other in the axes array, X then Y. It is recommended that axes appear in decreasing order of importance, such that element 0 and 1 typically represent the X and Y axis of a directional stick.
|
||||
* @readonly
|
||||
*/
|
||||
axes:number[];
|
||||
|
||||
/**
|
||||
* Array of values for all buttons of the gamepad. All button values must be linearly normalized to the range [0.0 .. 1.0]. 0.0 must mean fully unpressed, and 1.0 must mean fully pressed. It is recommended that buttons appear in decreasing importance such that the primary button, secondary button, tertiary button, and so on appear as elements 0, 1, 2, ... in the buttons array.
|
||||
* @readonly
|
||||
*/
|
||||
buttons:number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Last time the data for this gamepad was updated. Timestamp is a monotonically increasing value that allows the author to determine if the axes and button data have been updated from the hardware, relative to a previously saved timestamp.
|
||||
* @readonly
|
||||
*
|
||||
*/
|
||||
timestamp:number;
|
||||
export interface GamepadEvent extends Event{
|
||||
/**
|
||||
* The single gamepad attribute provides access to the associated gamepad data for this event.
|
||||
* @readonly
|
||||
*/
|
||||
gamepad:Gamepad;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of values for all axes of the gamepad. All axis values must be linearly normalized to the range [-1.0 .. 1.0]. As appropriate, -1.0 should correspond to "up" or "left", and 1.0 should correspond to "down" or "right". Axes that are drawn from a 2D input device should appear next to each other in the axes array, X then Y. It is recommended that axes appear in decreasing order of importance, such that element 0 and 1 typically represent the X and Y axis of a directional stick.
|
||||
* @readonly
|
||||
export interface GamepadList{
|
||||
[index: number]: Gamepad;
|
||||
length: number;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @event gamepadconnected
|
||||
* A user agent must dispatch this event type to indicate the user has connected a gamepad. If a gamepad was already connected when the page was loaded, the gamepadconnected event will be dispatched when the user presses a button or moves an axis.
|
||||
*/
|
||||
axes:number[];
|
||||
|
||||
/**
|
||||
* Array of values for all buttons of the gamepad. All button values must be linearly normalized to the range [0.0 .. 1.0]. 0.0 must mean fully unpressed, and 1.0 must mean fully pressed. It is recommended that buttons appear in decreasing importance such that the primary button, secondary button, tertiary button, and so on appear as elements 0, 1, 2, ... in the buttons array.
|
||||
* @readonly
|
||||
/*
|
||||
* @event gamepaddisconnected
|
||||
* When a gamepad is disconnected from the user agent, if the user agent has previously dispatched a gamepadconnected event, a gamepaddisconnected event must be dispatched.
|
||||
*/
|
||||
buttons:number[];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
interface GamepadEvent extends Event{
|
||||
/**
|
||||
* The single gamepad attribute provides access to the associated gamepad data for this event.
|
||||
* @readonly
|
||||
*/
|
||||
gamepad:Gamepad;
|
||||
}
|
||||
|
||||
interface GamepadList{
|
||||
[index: number]: Gamepad;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface Navigator{
|
||||
@@ -59,20 +73,10 @@ interface Navigator{
|
||||
* The currently connected and interacted-with gamepads. Gamepads must only appear in the list if they are currently connected to the user agent, and have been interacted with by the user. Otherwise, they must not appear in the list to avoid a malicious page from fingerprinting the user based on connected devices.
|
||||
* @readonly
|
||||
*/
|
||||
getGamepads(): Gamepad[];
|
||||
getGamepads(): Gamepad.Gamepad[];
|
||||
|
||||
webkitGetGamepads(): Gamepad.GamepadList;
|
||||
|
||||
webkitGetGamepads(): GamepadList;
|
||||
|
||||
// Not supported yet :(
|
||||
// mozGetGamepads(): Gamepad[];
|
||||
}
|
||||
|
||||
/*
|
||||
* @event gamepadconnected
|
||||
* A user agent must dispatch this event type to indicate the user has connected a gamepad. If a gamepad was already connected when the page was loaded, the gamepadconnected event will be dispatched when the user presses a button or moves an axis.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @event gamepaddisconnected
|
||||
* When a gamepad is disconnected from the user agent, if the user agent has previously dispatched a gamepadconnected event, a gamepaddisconnected event must be dispatched.
|
||||
*/
|
||||
@@ -0,0 +1,50 @@
|
||||
///<reference path="glidejs.d.ts" />
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
// Copied from documentation
|
||||
$('.slider').glide();
|
||||
|
||||
$('.slider').glide({
|
||||
autoplay: 5000,
|
||||
arrows: 'body',
|
||||
navigation: 'body'
|
||||
});
|
||||
|
||||
var glide: JQueryGlide.IGlideApi = $('.slider').glide().data('api_glide');
|
||||
// Original line modified: glide.jump(3, console.log('Wooo!'));
|
||||
glide.jump(3, function () { console.log('Wooo!'); });
|
||||
|
||||
// The rest of tests
|
||||
glide.current();
|
||||
glide.reinit();
|
||||
glide.destroy();
|
||||
glide.play();
|
||||
glide.pause();
|
||||
glide.next(function () { });
|
||||
glide.prev(function () { });
|
||||
glide.nav("div");
|
||||
glide.arrows("div");
|
||||
|
||||
$(".slider").glide({ autoplay: 4000 });
|
||||
$(".slider").glide({ hoverpause: true });
|
||||
$(".slider").glide({ circular: true });
|
||||
$(".slider").glide({ animationDuration: 500 });
|
||||
$(".slider").glide({ animationTimingFunc: "cubic - bezier(0.165, 0.840, 0.440, 1.000)" });
|
||||
$(".slider").glide({ arrows: true });
|
||||
$(".slider").glide({ arrowsWrapperClass: "slider__arrows" });
|
||||
$(".slider").glide({ arrowMainClass: "slider__arrows-item" });
|
||||
$(".slider").glide({ arrowRightClass: "slider__arrows-item--right" });
|
||||
$(".slider").glide({ arrowLeftClass: "slider__arrows-item--left" });
|
||||
$(".slider").glide({ arrowRightText: "next" });
|
||||
$(".slider").glide({ arrowLeftText: "prev" });
|
||||
$(".slider").glide({ navigation: true });
|
||||
$(".slider").glide({ navigationCenter: true });
|
||||
$(".slider").glide({ navigationClass: "slider__nav" });
|
||||
$(".slider").glide({ navigationItemClass: "slider__nav-item" });
|
||||
$(".slider").glide({ navigationCurrentItemClass: "slider__nav-item--current" });
|
||||
$(".slider").glide({ keyboard: true });
|
||||
$(".slider").glide({ touchDistance: 60 });
|
||||
$(".slider").glide({ beforeInit: function () { } });
|
||||
$(".slider").glide({ afterInit: function () { } });
|
||||
$(".slider").glide({ beforeTransition: function () { } });
|
||||
$(".slider").glide({ afterTransition: function () { } });
|
||||
Vendored
+189
@@ -0,0 +1,189 @@
|
||||
// Type definitions for Glide.js v1.0.6
|
||||
// Project: http://glide.jedrzejchalubek.com/
|
||||
// Definitions by: Milan Jaros <https://github.com/milanjaros/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Glide is responsive and touch-friendly jQuery slider.
|
||||
* Based on CSS3 transitions with fallback to older broswers.
|
||||
* It's simple, lightweight and fast. Designed to slide,
|
||||
* no less, no more.
|
||||
*/
|
||||
glide(options?: JQueryGlide.IGlideOptions): JQuery;
|
||||
}
|
||||
|
||||
declare module JQueryGlide {
|
||||
interface IGlideOptions {
|
||||
/**
|
||||
* Default: 4000
|
||||
* {Int or Bool} False for turning off autoplay
|
||||
*/
|
||||
autoplay?: any;
|
||||
/**
|
||||
* Default: true {Bool} Pause autoplay on mouseover slider
|
||||
*/
|
||||
hoverpause?: boolean;
|
||||
/**
|
||||
* Default: true {Bool} Circular play (Animation continues without starting over once it reaches the last slide)
|
||||
*/
|
||||
circular?: boolean;
|
||||
|
||||
/**
|
||||
* Default: 500
|
||||
* Animation time in ms
|
||||
* @type {Int}
|
||||
*/
|
||||
animationDuration?: number;
|
||||
/**
|
||||
* Default: cubic-bezier(0.165, 0.840, 0.440, 1.000)
|
||||
* cubic-bezier(0.165, 0.840, 0.440, 1.000)
|
||||
*/
|
||||
animationTimingFunc?: string;
|
||||
|
||||
/**
|
||||
* Default: true
|
||||
* {Bool or String} Show/hide/appendTo arrows
|
||||
* True for append arrows to slider wrapper
|
||||
* False for not appending arrows
|
||||
* Id or class name (e.g. '.class-name') for appending to specific HTML markup
|
||||
*/
|
||||
arrows?: any;
|
||||
/**
|
||||
* Default: 'slider-arrows'
|
||||
* {String} Arrows wrapper class
|
||||
*/
|
||||
arrowsWrapperClass?: string;
|
||||
/**
|
||||
* Default: 'slider-arrow'
|
||||
* {String} Main class for both arrows
|
||||
*/
|
||||
arrowMainClass?: string;
|
||||
/**
|
||||
* Default: 'slider-arrow--right'
|
||||
* {String} Right arrow
|
||||
*/
|
||||
arrowRightClass?: string;
|
||||
/**
|
||||
* Default: 'next'
|
||||
* {String} Right arrow text
|
||||
*/
|
||||
arrowRightText?: string;
|
||||
/**
|
||||
* Default: 'slider-arrow--left'
|
||||
* {String} Left arrow
|
||||
*/
|
||||
arrowLeftClass?: string;
|
||||
/**
|
||||
* Default: 'prev'
|
||||
* {String} Left arrow text
|
||||
*/
|
||||
arrowLeftText?: string;
|
||||
|
||||
/**
|
||||
* Default: true
|
||||
* {Bool or String} Show/hide/appendTo bullets navigation
|
||||
* True for append arrows to slider wrapper
|
||||
* False for not appending arrows
|
||||
* Id or class name (e.g. '.class-name') for appending to specific HTML markup
|
||||
*/
|
||||
navigation?: any;
|
||||
/**
|
||||
* Default: true
|
||||
* {Bool} Center bullet navigation
|
||||
*/
|
||||
navigationCenter?: boolean;
|
||||
/**
|
||||
* Default: 'slider-nav'
|
||||
* {String} Navigation class
|
||||
*/
|
||||
navigationClass?: string;
|
||||
/**
|
||||
* Default: 'slider-nav__item'
|
||||
* {String} Navigation item class
|
||||
*/
|
||||
navigationItemClass?: string;
|
||||
/**
|
||||
* Default: 'slider-nav__item--current'
|
||||
* {String} Current navigation item class
|
||||
*/
|
||||
navigationCurrentItemClass?: string;
|
||||
|
||||
/**
|
||||
* Default: true
|
||||
* {Bool} Slide on left / right keyboard arrows press
|
||||
*/
|
||||
keyboard?: boolean;
|
||||
|
||||
/**
|
||||
* Default: 60
|
||||
* {Int or Bool} Touch settings
|
||||
*/
|
||||
touchDistance?: any;
|
||||
|
||||
/**
|
||||
* Default: function () {}
|
||||
* {Function} Callback before plugin init
|
||||
*/
|
||||
beforeInit?: Function;
|
||||
/**
|
||||
* Default: function () {}
|
||||
* {Function} Callback after plugin init
|
||||
*/
|
||||
afterInit?: Function;
|
||||
|
||||
/**
|
||||
* Default: function () {}
|
||||
* {Function} Callback before slide change
|
||||
*/
|
||||
beforeTransition?: Function;
|
||||
/**
|
||||
* Default: function() {}
|
||||
* {Function} Callback after slide change
|
||||
*/
|
||||
afterTransition?: Function;
|
||||
}
|
||||
|
||||
interface IGlideApi {
|
||||
/**
|
||||
* Returning current slide number
|
||||
*/
|
||||
current(): number;
|
||||
/**
|
||||
* Rebuild and recalculate dimensions of slider elements
|
||||
*/
|
||||
reinit(): void;
|
||||
/**
|
||||
* Destroy and cleanup slider
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* Starting autoplay
|
||||
*/
|
||||
play(): void;
|
||||
/**
|
||||
* Stopping autoplay
|
||||
*/
|
||||
pause(): void;
|
||||
/**
|
||||
* Slide one forward
|
||||
*/
|
||||
next(callback: Function): void;
|
||||
/**
|
||||
* Slide one backward
|
||||
*/
|
||||
prev(callback: Function): void;
|
||||
/**
|
||||
* Jump to current slide
|
||||
*/
|
||||
jump(distance: number, callback: Function): void;
|
||||
/**
|
||||
* Append navigation to specifed target (eq. 'body', '.class', '#id')
|
||||
*/
|
||||
nav(target: string): void;
|
||||
/**
|
||||
* Append arrows to specifed target (eq. 'body', '.class', '#id')
|
||||
*/
|
||||
arrows(target: string): void;
|
||||
}
|
||||
}
|
||||
+350
@@ -0,0 +1,350 @@
|
||||
/// <reference path="gm.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import gm = require('gm');
|
||||
import stream = require('stream');
|
||||
|
||||
var src: string;
|
||||
var matrix: string;
|
||||
var enable: boolean;
|
||||
var ltr: boolean;
|
||||
var password: string;
|
||||
var bits: number;
|
||||
var intensity: number;
|
||||
var r: number;
|
||||
var g: number;
|
||||
var b: number;
|
||||
var opacity: number;
|
||||
var x: number;
|
||||
var y: number;
|
||||
var radius: number;
|
||||
var sigma: number;
|
||||
var width: number;
|
||||
var height: number;
|
||||
var color: string;
|
||||
var channel: string;
|
||||
var type: string;
|
||||
var factor: number;
|
||||
var numColors: number;
|
||||
var operator: string;
|
||||
var multiplier: number;
|
||||
var kernel: string;
|
||||
var usePercent: boolean;
|
||||
var time: number;
|
||||
var server: string;
|
||||
var method: string;
|
||||
var percent: number;
|
||||
var encoding: string;
|
||||
var options: string;
|
||||
var file: string;
|
||||
var distance: number;
|
||||
var geometry: string;
|
||||
var direction: string;
|
||||
var name: string;
|
||||
var offset: number;
|
||||
var blackPoint: number;
|
||||
var gamma: number;
|
||||
var whitePoint: number;
|
||||
var limit: string;
|
||||
var format: string;
|
||||
var iterations: number;
|
||||
var count: number;
|
||||
var b: number;
|
||||
var s: number;
|
||||
var h: number;
|
||||
var dest: string;
|
||||
var images: string[];
|
||||
var angle: number;
|
||||
var NxN: string;
|
||||
var size: number;
|
||||
var command: string;
|
||||
var index: number;
|
||||
var threshold: number;
|
||||
var attribute: string;
|
||||
var attrValue: string;
|
||||
var format: string;
|
||||
var font: string;
|
||||
var quality: number;
|
||||
var align: string;
|
||||
var depth: number;
|
||||
var readStream: stream.PassThrough;
|
||||
|
||||
gm(src)
|
||||
.adjoin()
|
||||
.affine(matrix)
|
||||
.antialias(enable)
|
||||
.append(src)
|
||||
.append(src, ltr)
|
||||
.authenticate(password)
|
||||
.autoOrient()
|
||||
.backdrop()
|
||||
.bitdepth(bits)
|
||||
.blackThreshold(intensity)
|
||||
.blackThreshold(r, g, b)
|
||||
.blackThreshold(r, g, b, opacity)
|
||||
.bluePrimary(x, y)
|
||||
.blur(radius)
|
||||
.blur(radius, sigma)
|
||||
.border(width, height)
|
||||
.borderColor(color)
|
||||
.box(color)
|
||||
.channel(channel)
|
||||
.charcoal(factor)
|
||||
.chop(width, height)
|
||||
.chop(width, height, x, y)
|
||||
.clip()
|
||||
.coalesce()
|
||||
.colorize(r, g, b)
|
||||
.colorMap(type)
|
||||
.colors(numColors)
|
||||
.colorspace(type)
|
||||
.compose(operator)
|
||||
.compress(type)
|
||||
.contrast(multiplier)
|
||||
.convolve(kernel)
|
||||
.createDirectories()
|
||||
.crop(width, height)
|
||||
.crop(width, height, x, y)
|
||||
.crop(width, height, x, y, usePercent)
|
||||
.cycle(factor)
|
||||
.deconstruct()
|
||||
.define()
|
||||
.delay(time)
|
||||
.density(width, height)
|
||||
.despeckle()
|
||||
.displace(x, y)
|
||||
.display(server)
|
||||
.dispose(method)
|
||||
.dissolve(percent)
|
||||
.dither()
|
||||
.dither(enable)
|
||||
.edge()
|
||||
.edge(radius)
|
||||
.emboss()
|
||||
.emboss(radius)
|
||||
.encoding(encoding)
|
||||
.endian(type)
|
||||
.enhance()
|
||||
.equalize()
|
||||
.extent(width, height)
|
||||
.extent(width, height, options)
|
||||
.file(file)
|
||||
.filter(type)
|
||||
.flatten()
|
||||
.flip()
|
||||
.flop()
|
||||
.foreground(color)
|
||||
.frame(width, height, width, height)
|
||||
.fuzz(distance)
|
||||
.fuzz(distance, usePercent)
|
||||
.gamma(r, b, g)
|
||||
.gaussian(radius)
|
||||
.gaussian(radius, sigma)
|
||||
.geometry(width, height)
|
||||
.geometry(width, height, options)
|
||||
.geometry(geometry)
|
||||
.greenPrimary(x, y)
|
||||
.gravity(direction)
|
||||
.highlightColor(color)
|
||||
.highlightStyle(type)
|
||||
.iconGeometry(geometry)
|
||||
.implode()
|
||||
.implode(factor)
|
||||
.intent(type)
|
||||
.interlace(type)
|
||||
.label(name)
|
||||
.lat(width, height, offset)
|
||||
.lat(width, height, offset, usePercent)
|
||||
.level(blackPoint, gamma, whitePoint)
|
||||
.level(blackPoint, gamma, whitePoint, usePercent)
|
||||
.limit(type, limit)
|
||||
.list(type)
|
||||
.log(format)
|
||||
.loop(iterations)
|
||||
.lower(width, height)
|
||||
.magnify(factor)
|
||||
.map(file)
|
||||
.mask(file)
|
||||
.matte()
|
||||
.matteColor(color)
|
||||
.maximumError(count)
|
||||
.median()
|
||||
.median(radius)
|
||||
.minify(factor)
|
||||
.mode(type)
|
||||
.modulate(b, s, h)
|
||||
.monitor()
|
||||
.monochrome()
|
||||
.morph(src, dest)
|
||||
.morph(src, dest, (err, stdout, stderr, cmd) => {
|
||||
})
|
||||
.morph(images, dest)
|
||||
.morph(images, dest, (err, stdout, stderr, cmd) => {
|
||||
})
|
||||
.mosaic()
|
||||
.motionBlur(radius)
|
||||
.motionBlur(radius, sigma)
|
||||
.motionBlur(radius, sigma, angle)
|
||||
.name()
|
||||
.negative()
|
||||
.noise(type)
|
||||
.noise(radius)
|
||||
.noop()
|
||||
.normalize()
|
||||
.opaque(color)
|
||||
.operator(channel, operator, factor)
|
||||
.operator(channel, operator, factor, usePercent)
|
||||
.orderedDither(channel, NxN)
|
||||
.outputDirectory(dest)
|
||||
.page(width, height)
|
||||
.page(width, height, options)
|
||||
.pause(time)
|
||||
.pen(color)
|
||||
.ping()
|
||||
.pointSize(size)
|
||||
.noProfile()
|
||||
.preview(type)
|
||||
.paint(radius)
|
||||
.process(command)
|
||||
.profile(file)
|
||||
.progress()
|
||||
.randomThreshold(channel, NxN)
|
||||
.quality(factor)
|
||||
.raise(width, height)
|
||||
.recolor(matrix)
|
||||
.redPrimary(x, y)
|
||||
.region(width, height)
|
||||
.region(width, height, x, y)
|
||||
.remote()
|
||||
.render()
|
||||
.repage('+')
|
||||
.repage(width, height, x, y)
|
||||
.repage(width, height, x, y, options)
|
||||
.sample(geometry)
|
||||
.samplingFactor(factor, factor)
|
||||
.rawSize(width, height)
|
||||
.rawSize(width, height, offset)
|
||||
.resample(width, height)
|
||||
.resize(width, height)
|
||||
.resize(width, height, options)
|
||||
.roll(x, y)
|
||||
.rotate(color, angle)
|
||||
.scene(index)
|
||||
.scenes(index, index)
|
||||
.scale(width, height)
|
||||
.screen()
|
||||
.segment(threshold, threshold)
|
||||
.sepia()
|
||||
.set(attribute, attrValue)
|
||||
.setFormat(format)
|
||||
.shade(angle, distance)
|
||||
.shadow(radius)
|
||||
.shadow(radius, sigma)
|
||||
.sharedMemory()
|
||||
.shave(width, height)
|
||||
.shave(width, height, usePercent)
|
||||
.sharpen(radius)
|
||||
.sharpen(radius, sigma)
|
||||
.shear(angle, angle)
|
||||
.silent()
|
||||
.snaps(count)
|
||||
.solarize(threshold)
|
||||
.spread(distance)
|
||||
.stegano(offset)
|
||||
.stereo()
|
||||
.strip()
|
||||
.swirl(angle)
|
||||
.textFont(font)
|
||||
.threshold(threshold)
|
||||
.threshold(threshold, usePercent)
|
||||
.thumb(width, height, dest, (err, stdout, stderr, cmd) => {
|
||||
})
|
||||
.thumb(width, height, dest, quality, (err, stdout, stderr, cmd) => {
|
||||
})
|
||||
.thumb(width, height, dest, quality, align, (err, stdout, stderr, cmd) => {
|
||||
})
|
||||
.tile(file)
|
||||
.title(name)
|
||||
.transform(color)
|
||||
.transparent(color)
|
||||
.treeDepth(depth)
|
||||
.trim()
|
||||
.type(type)
|
||||
.update(time)
|
||||
.units(type)
|
||||
.unsharp(radius)
|
||||
.unsharp(radius, sigma)
|
||||
.unsharp(radius, sigma, factor)
|
||||
.unsharp(radius, sigma, factor, threshold)
|
||||
.usePixmap()
|
||||
.view()
|
||||
.virtualPixel(method)
|
||||
.visual(type)
|
||||
.watermark(b, s)
|
||||
.wave(factor, distance)
|
||||
.whitePoint(x, y)
|
||||
.whiteThreshold(intensity)
|
||||
.whiteThreshold(r, g, b)
|
||||
.whiteThreshold(r, g, b, opacity)
|
||||
.window(name)
|
||||
.windowGroup()
|
||||
.color((err, color) => {
|
||||
})
|
||||
.depth((err, bitdepth) => {
|
||||
})
|
||||
.filesize((err, size) => {
|
||||
})
|
||||
.format((err, format) => {
|
||||
})
|
||||
.identify((err, info) => {
|
||||
})
|
||||
.res((err, resolution) => {
|
||||
})
|
||||
.size((err, size) => {
|
||||
})
|
||||
.orientation((err, orient) => {
|
||||
})
|
||||
.draw(options)
|
||||
.drawArc(x, y, x, y, radius, radius)
|
||||
.drawBezier(x, y, x, y)
|
||||
.drawBezier(x, y, x, y, x, y)
|
||||
.drawBezier(x, y, x, y, x, y, x, y)
|
||||
.drawCircle(x, y, x, y)
|
||||
.drawEllipse(x, y, radius, radius, radius, radius)
|
||||
.drawLine(x, y, x, y)
|
||||
.drawPoint(x, y)
|
||||
.drawPolygon(x, y, x, y, x, y)
|
||||
.drawPolygon(x, y, x, y, x, y, x, y)
|
||||
.drawPolyline(x, y, x, y, x, y)
|
||||
.drawPolyline(x, y, x, y, x, y, x, y)
|
||||
.drawRectangle(x, y, x, y)
|
||||
.drawRectangle(x, y, x, y, radius)
|
||||
.drawRectangle(x, y, x, y, radius, radius)
|
||||
.drawText(x, y, name, direction)
|
||||
.fill(color)
|
||||
.font(font)
|
||||
.font(font, size)
|
||||
.fontSize(size)
|
||||
.stroke(color)
|
||||
.stroke(color, width)
|
||||
.setDraw(type, x, y, method)
|
||||
.write(dest, (err, stdout, stderr, cmd) => {
|
||||
});
|
||||
|
||||
gm.compare(file, file, (err, isEqual, equality, raw) => {
|
||||
});
|
||||
|
||||
readStream = gm(src).stream();
|
||||
readStream = gm(src).stream(format);
|
||||
readStream = gm(src).stream(format, (err, stdout, stderr, cmd) => {
|
||||
});
|
||||
|
||||
gm(src).toBuffer((err, buffer) => {
|
||||
});
|
||||
gm(src).toBuffer(format, (err, buffer) => {
|
||||
});
|
||||
|
||||
var imageMagick = gm.subClass({ imageMagick: true });
|
||||
var readStream = imageMagick(src)
|
||||
.adjoin()
|
||||
.stream();
|
||||
Vendored
+623
@@ -0,0 +1,623 @@
|
||||
// Type definitions for gm 1.17.0
|
||||
// Project: https://github.com/aheckmann/gm
|
||||
// Definitions by: Joel Spadin <https://github.com/ChaosinaCan>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gm" {
|
||||
import stream = require('stream');
|
||||
|
||||
function m(image: string): m.State;
|
||||
|
||||
module m {
|
||||
export interface ClassOptions {
|
||||
imageMagick?: boolean;
|
||||
}
|
||||
|
||||
export interface CompareCallback {
|
||||
(err: Error, isEqual: boolean, equality: number, raw: number): any;
|
||||
}
|
||||
|
||||
export interface GetterCallback<T> {
|
||||
(err: Error, value: T): any;
|
||||
}
|
||||
|
||||
export interface WriteCallback {
|
||||
(err: Error, stdout: string, stderr: string, cmd: string): any;
|
||||
}
|
||||
|
||||
export interface ChannelInfo<T> {
|
||||
Red: T;
|
||||
Green: T;
|
||||
Blue: T;
|
||||
}
|
||||
|
||||
export interface CompareOptions {
|
||||
file?: string;
|
||||
highlightColor?: string;
|
||||
highlightStyle?: string;
|
||||
tolerance?: number;
|
||||
}
|
||||
|
||||
export interface ColorStatistics {
|
||||
Minimum: string;
|
||||
Maximum: string;
|
||||
Mean: string;
|
||||
'Standard Deviation': string;
|
||||
}
|
||||
|
||||
export interface Dimensions {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface ImageInfo {
|
||||
'Background Color': string;
|
||||
'Border Color': string;
|
||||
'Channel Depths': ChannelInfo<string>;
|
||||
'Channel Statistics': ChannelInfo<ColorStatistics>;
|
||||
Class: string;
|
||||
color: number;
|
||||
Compose: string;
|
||||
Compression: string;
|
||||
depth: number;
|
||||
Depth: string;
|
||||
Dispose: string;
|
||||
Filesize: string;
|
||||
format: string;
|
||||
Format: string;
|
||||
Geometry: string;
|
||||
Interlace: string;
|
||||
Iterations: string;
|
||||
'JPEG-Quality'?: string;
|
||||
'JPEG-Colorspace'?: string;
|
||||
'JPEG-Colorspace-Name'?: string;
|
||||
'JPEG-Sampling-factors'?: string;
|
||||
'Matte Color': string;
|
||||
Orientation: string;
|
||||
'Page geometry': string;
|
||||
path: string;
|
||||
|
||||
'Profile-color'?: string;
|
||||
'Profile-iptc'?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
'Profile-EXIF'?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
'Profile-XMP'?: string;
|
||||
Resolution?: string;
|
||||
size: Dimensions;
|
||||
Signature: string;
|
||||
Software: string;
|
||||
Tainted: string;
|
||||
Type: string;
|
||||
}
|
||||
|
||||
export interface State {
|
||||
// Image Operations
|
||||
adjoin(): State;
|
||||
affine(matrix: string): State;
|
||||
antialias(enable: boolean): State;
|
||||
append(image: string, ltr?: boolean): State;
|
||||
authenticate(password: string): State;
|
||||
autoOrient(): State;
|
||||
backdrop(): State;
|
||||
bitdepth(bits: number): State;
|
||||
blackThreshold(intensity: number): State;
|
||||
blackThreshold(red: number, green: number, blue: number, opacity?: number): State;
|
||||
bluePrimary(x: number, y: number): State;
|
||||
blur(radius: number, sigma?: number): State;
|
||||
border(width: number, height: number): State;
|
||||
borderColor(color: string): State;
|
||||
box(color: string): State;
|
||||
channel(type: 'Red'): State;
|
||||
channel(type: 'Green'): State;
|
||||
channel(type: 'Blue'): State;
|
||||
channel(type: 'Opacity'): State;
|
||||
channel(type: 'Matte'): State;
|
||||
channel(type: 'Cyan'): State;
|
||||
channel(type: 'Magenta'): State;
|
||||
channel(type: 'Yellow'): State;
|
||||
channel(type: 'Black'): State;
|
||||
channel(type: 'Gray'): State;
|
||||
channel(type: string): State;
|
||||
charcoal(factor: number): State;
|
||||
chop(width: number, height: number, x?: number, y?: number): State;
|
||||
clip(): State;
|
||||
coalesce(): State;
|
||||
colorize(red: number, green: number, blue: number): State;
|
||||
colorMap(type: 'shared'): State;
|
||||
colorMap(type: 'private'): State;
|
||||
colorMap(type: string): State;
|
||||
colors(colors: number): State;
|
||||
colorspace(space: 'CineonLog'): State;
|
||||
colorspace(space: 'CMYK'): State;
|
||||
colorspace(space: 'GRAY'): State;
|
||||
colorspace(space: 'HSL'): State;
|
||||
colorspace(space: 'HSB'): State;
|
||||
colorspace(space: 'OHTA'): State;
|
||||
colorspace(space: 'RGB'): State;
|
||||
colorspace(space: 'Rec601Luma'): State;
|
||||
colorspace(space: 'Rec709Luma'): State;
|
||||
colorspace(space: 'Rec601YCbCr'): State;
|
||||
colorspace(space: 'Rec709YCbCr'): State;
|
||||
colorspace(space: 'Transparent'): State;
|
||||
colorspace(space: 'XYZ'): State;
|
||||
colorspace(space: 'YCbCr'): State;
|
||||
colorspace(space: 'YIQ'): State;
|
||||
colorspace(space: 'YPbPr'): State;
|
||||
colorspace(space: 'YUV'): State;
|
||||
colorspace(space: string): State;
|
||||
compose(operator: 'Over'): State;
|
||||
compose(operator: 'In'): State;
|
||||
compose(operator: 'Out'): State;
|
||||
compose(operator: 'Atop'): State;
|
||||
compose(operator: 'Xor'): State;
|
||||
compose(operator: 'Plus'): State;
|
||||
compose(operator: 'Minus'): State;
|
||||
compose(operator: 'Add'): State;
|
||||
compose(operator: 'Subtract'): State;
|
||||
compose(operator: 'Difference'): State;
|
||||
compose(operator: 'Divide'): State;
|
||||
compose(operator: 'Multiply'): State;
|
||||
compose(operator: 'Bumpmap'): State;
|
||||
compose(operator: 'Copy'): State;
|
||||
compose(operator: 'CopyRed'): State;
|
||||
compose(operator: 'CopyGreen'): State;
|
||||
compose(operator: 'CopyBlue'): State;
|
||||
compose(operator: 'CopyOpacity'): State;
|
||||
compose(operator: 'CopyCyan'): State;
|
||||
compose(operator: 'CopyMagenta'): State;
|
||||
compose(operator: 'CopyYellow'): State;
|
||||
compose(operator: 'CopyBlack'): State;
|
||||
compose(operator: string): State;
|
||||
compress(type: 'None'): State;
|
||||
compress(type: 'BZip'): State;
|
||||
compress(type: 'Fax'): State;
|
||||
compress(type: 'Group4'): State;
|
||||
compress(type: 'JPEG'): State;
|
||||
compress(type: 'Lossless'): State;
|
||||
compress(type: 'LZW'): State;
|
||||
compress(type: 'RLE'): State;
|
||||
compress(type: 'Zip'): State;
|
||||
compress(type: 'LZMA'): State;
|
||||
compress(type: string): State;
|
||||
contrast(multiplier: number): State;
|
||||
convolve(kernel: string): State;
|
||||
createDirectories(): State;
|
||||
crop(width: number, height: number, x?: number, y?: number, percent?: boolean): State;
|
||||
cycle(amount: number): State;
|
||||
deconstruct(): State;
|
||||
define(): State;
|
||||
delay(milliseconds: number): State;
|
||||
density(width: number, height: number): State;
|
||||
despeckle(): State;
|
||||
displace(horizontal: number, vertical: number): State;
|
||||
display(xServer: string): State;
|
||||
dispose(method: 'Undefined'): State;
|
||||
dispose(method: 'None'): State;
|
||||
dispose(method: 'Background'): State;
|
||||
dispose(method: 'Previous'): State;
|
||||
dispose(method: string): State;
|
||||
dissolve(percent: number): State;
|
||||
dither(enable?: boolean): State;
|
||||
edge(radius?: number): State;
|
||||
emboss(radius?: number): State;
|
||||
encoding(encoding: 'AdobeCustom'): State;
|
||||
encoding(encoding: 'AdobeExpert'): State;
|
||||
encoding(encoding: 'AdobeStandard'): State;
|
||||
encoding(encoding: 'AppleRoman'): State;
|
||||
encoding(encoding: 'BIG5'): State;
|
||||
encoding(encoding: 'GB2312'): State;
|
||||
encoding(encoding: 'Latin 2'): State;
|
||||
encoding(encoding: 'None'): State;
|
||||
encoding(encoding: 'SJIScode'): State;
|
||||
encoding(encoding: 'Symbol'): State;
|
||||
encoding(encoding: 'Unicode'): State;
|
||||
encoding(encoding: 'Wansung'): State;
|
||||
encoding(encoding: string): State;
|
||||
endian(type: 'MSB'): State;
|
||||
endian(type: 'LSB'): State;
|
||||
endian(type: 'Native'): State;
|
||||
endian(type: string): State;
|
||||
enhance(): State;
|
||||
equalize(): State;
|
||||
extent(width: number, height: number, options?: string): State;
|
||||
file(filename: string): State;
|
||||
filter(type: 'Point'): State;
|
||||
filter(type: 'Box'): State;
|
||||
filter(type: 'Triangle'): State;
|
||||
filter(type: 'Hermite'): State;
|
||||
filter(type: 'Hanning'): State;
|
||||
filter(type: 'Hamming'): State;
|
||||
filter(type: 'Blackman'): State;
|
||||
filter(type: 'Gaussian'): State;
|
||||
filter(type: 'Quadratic'): State;
|
||||
filter(type: 'Cubic'): State;
|
||||
filter(type: 'Catrom'): State;
|
||||
filter(type: 'Mitchell'): State;
|
||||
filter(type: 'Lanczos'): State;
|
||||
filter(type: 'Bessel'): State;
|
||||
filter(type: 'Sinc'): State;
|
||||
filter(type: string): State;
|
||||
flatten(): State;
|
||||
flip(): State;
|
||||
flop(): State;
|
||||
foreground(color: string): State;
|
||||
frame(width: number, height: number, outerBevelWidth: number, outBevelHeight: number): State;
|
||||
fuzz(distance: number, percent?: boolean): State;
|
||||
gamma(r: number, g: number, b: number): State;
|
||||
gaussian(radius: number, sigma?: number): State;
|
||||
/** Width and height are specified in percents */
|
||||
geometry(width: number, height: number, option: '%'): State;
|
||||
/** Specify maximum area in pixels */
|
||||
geometry(width: number, height: number, option: '@'): State;
|
||||
/** Ignore aspect ratio */
|
||||
geometry(width: number, height: number, option: '!'): State;
|
||||
/** Width and height are minimum values */
|
||||
geometry(width: number, height: number, option: '^'): State;
|
||||
/** Change dimensions only if image is smaller than width or height */
|
||||
geometry(width: number, height: number, option: '<'): State;
|
||||
/** Change dimensions only if image is larger than width or height */
|
||||
geometry(width: number, height: number, option: '>'): State;
|
||||
geometry(width: number, height?: number, option?: string): State;
|
||||
geometry(geometry: string): State;
|
||||
greenPrimary(x: number, y: number): State;
|
||||
gravity(direction: 'NorthWest'): State;
|
||||
gravity(direction: 'North'): State;
|
||||
gravity(direction: 'NorthEast'): State;
|
||||
gravity(direction: 'West'): State;
|
||||
gravity(direction: 'Center'): State;
|
||||
gravity(direction: 'East'): State;
|
||||
gravity(direction: 'SouthWest'): State;
|
||||
gravity(direction: 'South'): State;
|
||||
gravity(direction: 'SouthEast'): State;
|
||||
gravity(direction: string): State;
|
||||
highlightColor(color: string): State;
|
||||
highlightStyle(style: 'Assign'): State;
|
||||
highlightStyle(style: 'Threshold'): State;
|
||||
highlightStyle(style: 'Tint'): State;
|
||||
highlightStyle(style: 'XOR'): State;
|
||||
highlightStyle(style: string): State;
|
||||
iconGeometry(geometry: string): State;
|
||||
implode(factor?: number): State;
|
||||
intent(type: 'Absolute'): State;
|
||||
intent(type: 'Perceptual'): State;
|
||||
intent(type: 'Relative'): State;
|
||||
intent(type: 'Saturation'): State;
|
||||
intent(type: string): State;
|
||||
interlace(type: 'None'): State;
|
||||
interlace(type: 'Line'): State;
|
||||
interlace(type: 'Plane'): State;
|
||||
interlace(type: 'Partition'): State;
|
||||
interlace(type: string): State;
|
||||
label(name: string): State;
|
||||
lat(width: number, height: number, offset: number, percent?: boolean): State;
|
||||
level(blackPoint: number, gamma: number, whitePoint: number, percent?: boolean): State;
|
||||
limit(type: 'disk', val: string): State;
|
||||
limit(type: 'file', val: string): State;
|
||||
limit(type: 'map', val: string): State;
|
||||
limit(type: 'memory', val: string): State;
|
||||
limit(type: 'pixels', val: string): State;
|
||||
limit(type: 'threads', val: string): State;
|
||||
limit(type: string, val: string): State;
|
||||
list(type: string): State;
|
||||
list(type: 'Color'): State;
|
||||
list(type: 'Delegate'): State;
|
||||
list(type: 'Format'): State;
|
||||
list(type: 'Magic'): State;
|
||||
list(type: 'Module'): State;
|
||||
list(type: 'Resource'): State;
|
||||
list(type: 'Type'): State;
|
||||
log(format: string): State;
|
||||
loop(iterations: number): State;
|
||||
lower(width: number, height: number): State;
|
||||
magnify(factor: number): State;
|
||||
map(filename: string): State;
|
||||
mask(filename: string): State;
|
||||
matte(): State;
|
||||
matteColor(color: string): State;
|
||||
maximumError(limit: number): State;
|
||||
median(radius?: number): State;
|
||||
minify(factor: number): State;
|
||||
mode(mode: 'frame'): State;
|
||||
mode(mode: 'unframe'): State;
|
||||
mode(mode: 'concatenate'): State;
|
||||
mode(mode: string): State;
|
||||
modulate(b: number, s: number, h: number): State;
|
||||
monitor(): State;
|
||||
monochrome(): State;
|
||||
morph(otherImg: string, outName: string, callback?: WriteCallback): State;
|
||||
morph(otherImg: string[], outName: string, callback?: WriteCallback): State;
|
||||
mosaic(): State;
|
||||
motionBlur(radius: number, sigma?: number, angle?: number): State;
|
||||
name(): State;
|
||||
negative(): State;
|
||||
noise(type: 'uniform'): State;
|
||||
noise(type: 'gaussian'): State;
|
||||
noise(type: 'multiplicative'): State;
|
||||
noise(type: 'impulse'): State;
|
||||
noise(type: 'laplacian'): State;
|
||||
noise(type: 'poisson'): State;
|
||||
noise(type: string): State;
|
||||
noise(radius: number): State;
|
||||
noop(): State;
|
||||
normalize(): State;
|
||||
opaque(color: string): State;
|
||||
operator(channel: string, operator: 'Add', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'And', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Assign', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Depth', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Divide', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Gamma', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Negate', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'LShift', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Log', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Max', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Min', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Multiply', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Or', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Pow', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'RShift', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Subtract', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Threshold', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Threshold-White', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Threshold-White-Negate', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Threshold-Black', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Threshold-Black-Negate', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Xor', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Noise-Gaussian', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Noise-Impulse', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Noise-Laplacian', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Noise-Multiplicative', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Noise-Poisson', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Noise-Random', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: 'Noise-Uniform', rvalue: number, percent?: boolean): State;
|
||||
operator(channel: string, operator: string, rvalue: number, percent?: boolean): State;
|
||||
orderedDither(channelType: 'All', NxN: string): State;
|
||||
orderedDither(channelType: 'Intensity', NxN: string): State;
|
||||
orderedDither(channelType: 'Red', NxN: string): State;
|
||||
orderedDither(channelType: 'Green', NxN: string): State;
|
||||
orderedDither(channelType: 'Blue', NxN: string): State;
|
||||
orderedDither(channelType: 'Cyan', NxN: string): State;
|
||||
orderedDither(channelType: 'Magenta', NxN: string): State;
|
||||
orderedDither(channelType: 'Yellow', NxN: string): State;
|
||||
orderedDither(channelType: 'Black', NxN: string): State;
|
||||
orderedDither(channelType: 'Opacity', NxN: string): State;
|
||||
orderedDither(channelType: string, NxN: string): State;
|
||||
outputDirectory(directory: string): State;
|
||||
page(width: number, height: number, arg?: '%'): State;
|
||||
page(width: number, height: number, arg?: '!'): State;
|
||||
page(width: number, height: number, arg?: '<'): State;
|
||||
page(width: number, height: number, arg?: '>'): State;
|
||||
page(width: number, height: number, arg?: string): State;
|
||||
pause(seconds: number): State;
|
||||
pen(color: string): State;
|
||||
ping(): State;
|
||||
pointSize(size: number): State;
|
||||
noProfile(): State;
|
||||
preview(type: 'Rotate'): State;
|
||||
preview(type: 'Shear'): State;
|
||||
preview(type: 'Roll'): State;
|
||||
preview(type: 'Hue'): State;
|
||||
preview(type: 'Saturation'): State;
|
||||
preview(type: 'Brightness'): State;
|
||||
preview(type: 'Gamma'): State;
|
||||
preview(type: 'Spiff'): State;
|
||||
preview(type: 'Dull'): State;
|
||||
preview(type: 'Grayscale'): State;
|
||||
preview(type: 'Quantize'): State;
|
||||
preview(type: 'Despeckle'): State;
|
||||
preview(type: 'ReduceNoise'): State;
|
||||
preview(type: 'AddNoise'): State;
|
||||
preview(type: 'Sharpen'): State;
|
||||
preview(type: 'Blur'): State;
|
||||
preview(type: 'Threshold'): State;
|
||||
preview(type: 'EdgeDetect'): State;
|
||||
preview(type: 'Spread'): State;
|
||||
preview(type: 'Shade'): State;
|
||||
preview(type: 'Raise'): State;
|
||||
preview(type: 'Segment'): State;
|
||||
preview(type: 'Solarize'): State;
|
||||
preview(type: 'Swirl'): State;
|
||||
preview(type: 'Implode'): State;
|
||||
preview(type: 'Wave'): State;
|
||||
preview(type: 'OilPaint'): State;
|
||||
preview(type: 'CharcoalDrawing'): State;
|
||||
preview(type: 'JPEG'): State;
|
||||
preview(type: string): State;
|
||||
paint(radius: number): State;
|
||||
process(command: string): State;
|
||||
profile(filename: string): State;
|
||||
progress(): State;
|
||||
randomThreshold(channelType: 'All', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: 'Intensity', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: 'Red', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: 'Green', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: 'Blue', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: 'Cyan', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: 'Magenta', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: 'Yellow', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: 'Black', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: 'Opacity', LOWxHIGH: string): State;
|
||||
randomThreshold(channelType: string, LOWxHIGH: string): State;
|
||||
quality(level: number): State;
|
||||
raise(width: number, height: number): State;
|
||||
recolor(matrix: string): State;
|
||||
redPrimary(x: number, y: number): State;
|
||||
region(width: number, height: number, x?: number, y?: number): State;
|
||||
remote(): State;
|
||||
render(): State;
|
||||
repage(reset: '+'): State;
|
||||
repage(reset: string): State;
|
||||
repage(width: number, height: number, xoff: number, yoff: number, arg?: string): State;
|
||||
sample(geometry: string): State;
|
||||
samplingFactor(horizontalFactor: number, verticalFactor: number): State;
|
||||
rawSize(width: number, height: number, offset?: number): State;
|
||||
resample(horizontal: number, vertical: number): State;
|
||||
/** Width and height are specified in percents */
|
||||
resize(width: number, height: number, option: '%'): State;
|
||||
/** Specify maximum area in pixels */
|
||||
resize(width: number, height: number, option: '@'): State;
|
||||
/** Ignore aspect ratio */
|
||||
resize(width: number, height: number, option: '!'): State;
|
||||
/** Width and height are minimum values */
|
||||
resize(width: number, height: number, option: '^'): State;
|
||||
/** Change dimensions only if image is smaller than width or height */
|
||||
resize(width: number, height: number, option: '<'): State;
|
||||
/** Change dimensions only if image is larger than width or height */
|
||||
resize(width: number, height: number, option: '>'): State;
|
||||
resize(width: number, height?: number, option?: string): State;
|
||||
roll(horizontal: number, vertical: number): State;
|
||||
rotate(backgroundColor: string, degrees: number): State;
|
||||
scene(index: number): State;
|
||||
scenes(start: number, end: number): State;
|
||||
scale(width: number, height: number): State;
|
||||
screen(): State;
|
||||
segment(clustherThreshold: number, smoothingThreshold: number): State;
|
||||
sepia(): State;
|
||||
set(attribute: string, value: string): State;
|
||||
setFormat(format: string): State;
|
||||
shade(azimuth: number, elevation: number): State;
|
||||
shadow(radius: number, sigma?: number): State;
|
||||
sharedMemory(): State;
|
||||
shave(width: number, height: number, percent?: boolean): State;
|
||||
sharpen(radius: number, sigma?: number): State;
|
||||
shear(xDegrees: number, yDegress: number): State;
|
||||
silent(): State;
|
||||
snaps(count: number): State;
|
||||
solarize(threshold: number): State;
|
||||
spread(amount: number): State;
|
||||
stegano(offset: number): State;
|
||||
stereo(): State;
|
||||
strip(): State;
|
||||
swirl(degrees: number): State;
|
||||
textFont(font: string): State;
|
||||
threshold(value: number, percent?: boolean): State;
|
||||
thumb(width: number, height: number, outName: string, callback: WriteCallback): State;
|
||||
thumb(width: number, height: number, outName: string, quality: number, callback: WriteCallback): State;
|
||||
thumb(width: number, height: number, outName: string, quality: number, align: 'topleft', callback: WriteCallback): State;
|
||||
thumb(width: number, height: number, outName: string, quality: number, align: 'center', callback: WriteCallback): State;
|
||||
thumb(width: number, height: number, outName: string, quality: number, align: string, callback: WriteCallback): State;
|
||||
tile(filename: string): State;
|
||||
title(title: string): State;
|
||||
transform(color: string): State;
|
||||
transparent(color: string): State;
|
||||
treeDepth(depth: number): State;
|
||||
trim(): State;
|
||||
type(type: 'Bilevel'): State;
|
||||
type(type: 'Grayscale'): State;
|
||||
type(type: 'Palette'): State;
|
||||
type(type: 'PaletteMatte'): State;
|
||||
type(type: 'TrueColor'): State;
|
||||
type(type: 'TrueColorMatte'): State;
|
||||
type(type: 'ColorSeparation'): State;
|
||||
type(type: 'ColorSeparationMatte'): State;
|
||||
type(type: 'Optimize'): State;
|
||||
type(type: string): State;
|
||||
update(seconds: number): State;
|
||||
units(type: 'Undefined'): State;
|
||||
units(type: 'PixelsPerInch'): State;
|
||||
units(type: 'PixelsPerCentimeter'): State;
|
||||
units(type: string): State;
|
||||
unsharp(radius: number, sigma?: number, amount?: number, threshold?: number): State;
|
||||
usePixmap(): State;
|
||||
view(): State;
|
||||
virtualPixel(method: 'Constant'): State;
|
||||
virtualPixel(method: 'Edge'): State;
|
||||
virtualPixel(method: 'Mirror'): State;
|
||||
virtualPixel(method: 'Tile'): State;
|
||||
virtualPixel(method: string): State;
|
||||
visual(type: 'StaticGray'): State;
|
||||
visual(type: 'GrayScale'): State;
|
||||
visual(type: 'StaticColor'): State;
|
||||
visual(type: 'PseudoColor'): State;
|
||||
visual(type: 'TrueColor'): State;
|
||||
visual(type: 'DirectColor'): State;
|
||||
visual(type: 'default'): State;
|
||||
visual(type: string): State;
|
||||
watermark(brightness: number, saturation: number): State;
|
||||
wave(amplitude: number, wavelength: number): State;
|
||||
whitePoint(x: number, y: number): State;
|
||||
whiteThreshold(intensity: number): State;
|
||||
whiteThreshold(red: number, green: number, blue: number, opacity?: number): State;
|
||||
window(id: string): State;
|
||||
windowGroup(): State;
|
||||
|
||||
// Getters
|
||||
color(callback: GetterCallback<number>): State;
|
||||
depth(callback: GetterCallback<number>): State;
|
||||
filesize(callback: GetterCallback<string>): State;
|
||||
format(callback: GetterCallback<string>): State;
|
||||
identify(callback: GetterCallback<ImageInfo>): State;
|
||||
res(callback: GetterCallback<string>): State;
|
||||
size(callback: GetterCallback<Dimensions>): State;
|
||||
orientation(callback: GetterCallback<string>): State;
|
||||
|
||||
// Drawing Operations
|
||||
draw(args: string): State;
|
||||
drawArc(x0: number, y0: number, x1: number, y1: number, r0: number, r1: number): State;
|
||||
drawBezier(x0: number, y0: number, x1: number, y1: number): State;
|
||||
drawBezier(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): State;
|
||||
drawBezier(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, ...coords: number[]): State;
|
||||
drawCircle(x0: number, y0: number, x1: number, y1: number): State;
|
||||
drawEllipse(x0: number, y0: number, rx: number, ry: number, a0: number, a1: number): State;
|
||||
drawLine(x0: number, y0: number, x1: number, y1: number): State;
|
||||
drawPoint(x: number, y: number): State;
|
||||
drawPolygon(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): State;
|
||||
drawPolygon(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, ...coords: number[]): State;
|
||||
drawPolyline(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number): State;
|
||||
drawPolyline(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, ...coords: number[]): State;
|
||||
drawRectangle(x0: number, y0: number, x1: number, y1: number): State;
|
||||
drawRectangle(x0: number, y0: number, x1: number, y1: number, rc: number): State;
|
||||
drawRectangle(x0: number, y0: number, x1: number, y1: number, wc: number, hc: number): State;
|
||||
drawText(x: number, y: number, text: string, gravity: 'NorthWest'): State;
|
||||
drawText(x: number, y: number, text: string, gravity: 'North'): State;
|
||||
drawText(x: number, y: number, text: string, gravity: 'NorthEast'): State;
|
||||
drawText(x: number, y: number, text: string, gravity: 'West'): State;
|
||||
drawText(x: number, y: number, text: string, gravity: 'Center'): State;
|
||||
drawText(x: number, y: number, text: string, gravity: 'East'): State;
|
||||
drawText(x: number, y: number, text: string, gravity: 'SouthWest'): State;
|
||||
drawText(x: number, y: number, text: string, gravity: 'South'): State;
|
||||
drawText(x: number, y: number, text: string, gravity: 'SouthEast'): State;
|
||||
drawText(x: number, y: number, text: string, gravity?: string): State;
|
||||
fill(color: string): State;
|
||||
font(name: string, size?: number): State;
|
||||
fontSize(size: number): State;
|
||||
stroke(color: string, width?: number): State;
|
||||
strokeWidth(width: number): State;
|
||||
setDraw(property: 'color', x: number, y: number, method: 'point'): State;
|
||||
setDraw(property: 'color', x: number, y: number, method: 'replace'): State;
|
||||
setDraw(property: 'color', x: number, y: number, method: 'floodfill'): State;
|
||||
setDraw(property: 'color', x: number, y: number, method: 'filltoborder'): State;
|
||||
setDraw(property: 'color', x: number, y: number, method: 'reset'): State;
|
||||
setDraw(property: 'matte', x: number, y: number, method: 'point'): State;
|
||||
setDraw(property: 'matte', x: number, y: number, method: 'replace'): State;
|
||||
setDraw(property: 'matte', x: number, y: number, method: 'floodfill'): State;
|
||||
setDraw(property: 'matte', x: number, y: number, method: 'filltoborder'): State;
|
||||
setDraw(property: 'matte', x: number, y: number, method: 'reset'): State;
|
||||
setDraw(property: string, x: number, y: number, method: string): State;
|
||||
|
||||
// Commands
|
||||
stream(callback?: WriteCallback): stream.PassThrough;
|
||||
stream(format: string, callback?: WriteCallback): stream.PassThrough;
|
||||
toBuffer(callback: (err: Error, buffer: Buffer) => any): stream.PassThrough;
|
||||
toBuffer(format: string, callback: (err: Error, buffer: Buffer) => any): stream.PassThrough;
|
||||
write(filename: string, callback: WriteCallback): void;
|
||||
}
|
||||
|
||||
export interface SubClass {
|
||||
(image: string): State;
|
||||
}
|
||||
|
||||
export function compare(filename1: string, filename2: string, callback: CompareCallback): void;
|
||||
export function compare(filename1: string, filename2: string, tolerance: number, callback: CompareCallback): void;
|
||||
export function compare(filename1: string, filename2: string, options: CompareOptions, callback: CompareCallback): void;
|
||||
|
||||
export function subClass(options: ClassOptions): SubClass;
|
||||
}
|
||||
|
||||
export = m;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="hammerjs-1.1.3.d.ts" />
|
||||
|
||||
// plugin check
|
||||
if (!Hammer.HAS_TOUCHEVENTS && !Hammer.HAS_POINTEREVENTS) {
|
||||
Hammer.plugins.fakeMultitouch();
|
||||
Hammer.plugins.showTouches();
|
||||
}
|
||||
|
||||
// instance method check
|
||||
var el = document.getElementById("container");
|
||||
|
||||
Hammer(el).on("doubletap", function () {
|
||||
alert('you doubletapped me!');
|
||||
});
|
||||
|
||||
var hammertime = Hammer(el, {
|
||||
drag: false,
|
||||
transform: false
|
||||
}).off("tap", function (event:HammerEvent) {
|
||||
alert('hello!');
|
||||
});
|
||||
|
||||
hammertime.enable(false);
|
||||
|
||||
hammertime.on("touch drag transform", function (ev: HammerEvent) {
|
||||
if (!ev.gesture) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.gesture.deltaX >= 20) {
|
||||
hammertime.trigger("swipe", ev.gesture);
|
||||
}
|
||||
});
|
||||
|
||||
// jQuery check
|
||||
$("#element")
|
||||
.hammer({
|
||||
// Options
|
||||
})
|
||||
.on("tap", function (ev) {
|
||||
console.log(ev);
|
||||
});
|
||||
|
||||
$("#container").hammer({
|
||||
prevent_default: false,
|
||||
drag_block_vertical: false
|
||||
}).on("hold tap doubletap transformstart transform transformend dragstart drag dragend release swipe", function (ev) {
|
||||
});
|
||||
Vendored
+142
@@ -0,0 +1,142 @@
|
||||
// Type definitions for Hammer.js 1.1.3
|
||||
// Project: http://eightmedia.github.com/hammer.js/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Drew Noakes <https://drewnoakes.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare var Hammer: HammerStatic;
|
||||
|
||||
interface HammerStatic {
|
||||
(element: any, options?: HammerOptions): HammerInstance;
|
||||
|
||||
VERSION: number;
|
||||
HAS_POINTEREVENTS: boolean;
|
||||
HAS_TOUCHEVENTS: boolean;
|
||||
UPDATE_VELOCITY_INTERVAL: number;
|
||||
POINTER_MOUSE: HammerPointerType;
|
||||
POINTER_TOUCH: HammerPointerType;
|
||||
POINTER_PEN: HammerPointerType;
|
||||
|
||||
DIRECTION_UP: HammerDirectionType;
|
||||
DIRECTION_DOWN: HammerDirectionType;
|
||||
DIRECTION_LEFT: HammerDirectionType;
|
||||
DIRECTION_RIGH: HammerDirectionType;
|
||||
|
||||
EVENT_START: HammerTouchEventState;
|
||||
EVENT_MOVE: HammerTouchEventState;
|
||||
EVENT_END: HammerTouchEventState;
|
||||
|
||||
plugins: any;
|
||||
gestures: any;
|
||||
READY: boolean;
|
||||
}
|
||||
|
||||
declare class HammerInstance {
|
||||
constructor(element: any, options?: HammerOptions);
|
||||
|
||||
on(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
|
||||
off(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
|
||||
enable(toggle: boolean): HammerInstance;
|
||||
|
||||
// You shouldn't normally use this internal method. Only use it when you know what you're doing! You can read the sourcecode for information about how to use this.
|
||||
trigger(gesture: string, eventData: HammerGestureEventData): HammerInstance;
|
||||
}
|
||||
|
||||
// Gesture Options : https://github.com/EightMedia/hammer.js/wiki/Getting-Started#gesture-options
|
||||
interface HammerOptions {
|
||||
behavior?: {
|
||||
contentZooming?: string;
|
||||
tapHighlightColor?: string;
|
||||
touchAction?: string;
|
||||
touchCallout?: string;
|
||||
userDrag?: string;
|
||||
userSelect?: string;
|
||||
};
|
||||
doubleTapDistance?: number;
|
||||
doubleTapInterval?: number;
|
||||
drag?: boolean;
|
||||
dragBlockHorizontal?: boolean;
|
||||
dragBlockVertical?: boolean;
|
||||
dragDistanceCorrection?: boolean;
|
||||
dragLockMinDistance?: number;
|
||||
dragLockToAxis?: boolean;
|
||||
dragMaxTouches?: number;
|
||||
dragMinDistance?: number;
|
||||
gesture?: boolean;
|
||||
hold?: boolean;
|
||||
holdThreshold?: number;
|
||||
holdTimeout?: number;
|
||||
preventDefault?: boolean;
|
||||
preventMouse?: boolean;
|
||||
release?: boolean;
|
||||
showTouches?: boolean;
|
||||
swipe?: boolean;
|
||||
swipeMaxTouches?: number;
|
||||
swipeMinTouches?: number;
|
||||
swipeVelocityX?: number;
|
||||
swipeVelocityY?: number;
|
||||
tap?: boolean;
|
||||
tapAlways?: boolean;
|
||||
tapMaxDistance?: number;
|
||||
tapMaxTime?: number;
|
||||
touch?: boolean;
|
||||
transform?: boolean;
|
||||
transformMinRotation?: number;
|
||||
transformMinScale?: number;
|
||||
}
|
||||
|
||||
interface HammerGestureEventData {
|
||||
timestamp: number;
|
||||
target: HTMLElement;
|
||||
touches: HammerPoint[];
|
||||
pointerType: HammerPointerType;
|
||||
center: HammerPoint;
|
||||
deltaTime: number;
|
||||
deltaX: number;
|
||||
deltaY: number;
|
||||
velocityX: number;
|
||||
velocityY: number;
|
||||
angle: number;
|
||||
interimAngle: number;
|
||||
direction: HammerDirectionType;
|
||||
interimDirection: HammerDirectionType;
|
||||
distance: number;
|
||||
scale: number;
|
||||
rotation: number;
|
||||
eventType: HammerTouchEventState;
|
||||
srcEvent: any;
|
||||
startEvent: any;
|
||||
|
||||
stopPropagation(): void;
|
||||
preventDefault(): void;
|
||||
stopDetect(): void;
|
||||
}
|
||||
|
||||
interface HammerPoint {
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
|
||||
interface HammerEvent {
|
||||
type: string;
|
||||
gesture: HammerGestureEventData;
|
||||
|
||||
stopPropagation(): void;
|
||||
preventDefault(): void;
|
||||
|
||||
}
|
||||
|
||||
declare enum HammerPointerType {
|
||||
}
|
||||
declare enum HammerDirectionType {
|
||||
}
|
||||
declare enum HammerTouchEventState {
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
hammer(options?: HammerOptions): JQuery;
|
||||
}
|
||||
+115
-49
@@ -1,49 +1,115 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="hammerjs.d.ts" />
|
||||
|
||||
// plugin check
|
||||
if (!Hammer.HAS_TOUCHEVENTS && !Hammer.HAS_POINTEREVENTS) {
|
||||
Hammer.plugins.fakeMultitouch();
|
||||
Hammer.plugins.showTouches();
|
||||
}
|
||||
|
||||
// instance method check
|
||||
var el = document.getElementById("container");
|
||||
|
||||
Hammer(el).on("doubletap", function () {
|
||||
alert('you doubletapped me!');
|
||||
});
|
||||
|
||||
var hammertime = Hammer(el, {
|
||||
drag: false,
|
||||
transform: false
|
||||
}).off("tap", function (event:HammerEvent) {
|
||||
alert('hello!');
|
||||
});
|
||||
|
||||
hammertime.enable(false);
|
||||
|
||||
hammertime.on("touch drag transform", function (ev: HammerEvent) {
|
||||
if (!ev.gesture) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.gesture.deltaX >= 20) {
|
||||
hammertime.trigger("swipe", ev.gesture);
|
||||
}
|
||||
});
|
||||
|
||||
// jQuery check
|
||||
$("#element")
|
||||
.hammer({
|
||||
// Options
|
||||
})
|
||||
.on("tap", function (ev) {
|
||||
console.log(ev);
|
||||
});
|
||||
|
||||
$("#container").hammer({
|
||||
prevent_default: false,
|
||||
drag_block_vertical: false
|
||||
}).on("hold tap doubletap transformstart transform transformend dragstart drag dragend release swipe", function (ev) {
|
||||
});
|
||||
// Tests based on examples at http://hammerjs.github.io/examples/
|
||||
|
||||
/// <reference path="hammerjs.d.ts" />
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
// create a simple instance
|
||||
// by default, it only adds horizontal recognizers
|
||||
var mc = new Hammer( myElement );
|
||||
|
||||
// listen to events...
|
||||
mc.on( "panleft panright tap press", function ( ev )
|
||||
{
|
||||
myElement.textContent = ev.type + " gesture detected.";
|
||||
} );
|
||||
})();
|
||||
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
// create a simple instance
|
||||
// by default, it only adds horizontal recognizers
|
||||
var mc = new Hammer( myElement );
|
||||
|
||||
// let the pan gesture support all directions.
|
||||
// this will block the vertical scrolling on a touch-device while on the element
|
||||
mc.get( 'pan' ).set( {direction: Hammer.DIRECTION_ALL} );
|
||||
|
||||
// listen to events...
|
||||
mc.on( "panleft panright panup pandown tap press", function ( ev:HammerInput )
|
||||
{
|
||||
myElement.textContent = ev.type + " gesture detected.";
|
||||
} );
|
||||
})();
|
||||
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
var mc = new Hammer.Manager( myElement );
|
||||
|
||||
// create a pinch and rotate recognizer
|
||||
// these require 2 pointers
|
||||
var pinch = new Hammer.Pinch();
|
||||
var rotate = new Hammer.Rotate();
|
||||
|
||||
// we want to detect both the same time
|
||||
pinch.recognizeWith( rotate );
|
||||
|
||||
// add to the Manager
|
||||
mc.add( [pinch, rotate] );
|
||||
|
||||
|
||||
mc.on( "pinch rotate", function ( ev:HammerInput )
|
||||
{
|
||||
myElement.textContent += ev.type + " ";
|
||||
} );
|
||||
})();
|
||||
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
// We create a manager object, which is the same as Hammer(), but without the presetted recognizers.
|
||||
var mc = new Hammer.Manager( myElement );
|
||||
|
||||
// Default, tap recognizer
|
||||
mc.add( new Hammer.Tap() );
|
||||
|
||||
// Tap recognizer with minimal 4 taps
|
||||
mc.add( new Hammer.Tap( {event: 'quadrupletap', taps: 4} ) );
|
||||
|
||||
// we want to recognize this simulatenous, so a quadrupletap will be detected even while a tap has been recognized.
|
||||
// the tap event will be emitted on every tap
|
||||
mc.get( 'quadrupletap' ).recognizeWith( 'tap' );
|
||||
|
||||
|
||||
mc.on( "tap quadrupletap", function ( ev )
|
||||
{
|
||||
myElement.textContent += ev.type + " ";
|
||||
} );
|
||||
})();
|
||||
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
// We create a manager object, which is the same as Hammer(), but without the presetted recognizers.
|
||||
var mc = new Hammer.Manager( myElement );
|
||||
|
||||
|
||||
// Tap recognizer with minimal 2 taps
|
||||
mc.add( new Hammer.Tap( {event: 'doubletap', taps: 2} ) );
|
||||
// Single tap recognizer
|
||||
mc.add( new Hammer.Tap( {event: 'singletap'} ) );
|
||||
|
||||
|
||||
// we want to recognize this simulatenous, so a quadrupletap will be detected even while a tap has been recognized.
|
||||
mc.get( 'doubletap' ).recognizeWith( 'singletap' );
|
||||
// we only want to trigger a tap, when we don't have detected a doubletap
|
||||
mc.get( 'singletap' ).requireFailure( 'doubletap' );
|
||||
|
||||
|
||||
mc.on( "singletap doubletap", function ( ev )
|
||||
{
|
||||
myElement.textContent += ev.type + " ";
|
||||
} );
|
||||
})();
|
||||
Vendored
+327
-142
@@ -1,142 +1,327 @@
|
||||
// Type definitions for Hammer.js 1.1.3
|
||||
// Project: http://eightmedia.github.com/hammer.js/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Drew Noakes <https://drewnoakes.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare var Hammer: HammerStatic;
|
||||
|
||||
interface HammerStatic {
|
||||
(element: any, options?: HammerOptions): HammerInstance;
|
||||
|
||||
VERSION: number;
|
||||
HAS_POINTEREVENTS: boolean;
|
||||
HAS_TOUCHEVENTS: boolean;
|
||||
UPDATE_VELOCITY_INTERVAL: number;
|
||||
POINTER_MOUSE: HammerPointerType;
|
||||
POINTER_TOUCH: HammerPointerType;
|
||||
POINTER_PEN: HammerPointerType;
|
||||
|
||||
DIRECTION_UP: HammerDirectionType;
|
||||
DIRECTION_DOWN: HammerDirectionType;
|
||||
DIRECTION_LEFT: HammerDirectionType;
|
||||
DIRECTION_RIGH: HammerDirectionType;
|
||||
|
||||
EVENT_START: HammerTouchEventState;
|
||||
EVENT_MOVE: HammerTouchEventState;
|
||||
EVENT_END: HammerTouchEventState;
|
||||
|
||||
plugins: any;
|
||||
gestures: any;
|
||||
READY: boolean;
|
||||
}
|
||||
|
||||
declare class HammerInstance {
|
||||
constructor(element: any, options?: HammerOptions);
|
||||
|
||||
on(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
|
||||
off(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
|
||||
enable(toggle: boolean): HammerInstance;
|
||||
|
||||
// You shouldn't normally use this internal method. Only use it when you know what you're doing! You can read the sourcecode for information about how to use this.
|
||||
trigger(gesture: string, eventData: HammerGestureEventData): HammerInstance;
|
||||
}
|
||||
|
||||
// Gesture Options : https://github.com/EightMedia/hammer.js/wiki/Getting-Started#gesture-options
|
||||
interface HammerOptions {
|
||||
behavior?: {
|
||||
contentZooming?: string;
|
||||
tapHighlightColor?: string;
|
||||
touchAction?: string;
|
||||
touchCallout?: string;
|
||||
userDrag?: string;
|
||||
userSelect?: string;
|
||||
};
|
||||
doubleTapDistance?: number;
|
||||
doubleTapInterval?: number;
|
||||
drag?: boolean;
|
||||
dragBlockHorizontal?: boolean;
|
||||
dragBlockVertical?: boolean;
|
||||
dragDistanceCorrection?: boolean;
|
||||
dragLockMinDistance?: number;
|
||||
dragLockToAxis?: boolean;
|
||||
dragMaxTouches?: number;
|
||||
dragMinDistance?: number;
|
||||
gesture?: boolean;
|
||||
hold?: boolean;
|
||||
holdThreshold?: number;
|
||||
holdTimeout?: number;
|
||||
preventDefault?: boolean;
|
||||
preventMouse?: boolean;
|
||||
release?: boolean;
|
||||
showTouches?: boolean;
|
||||
swipe?: boolean;
|
||||
swipeMaxTouches?: number;
|
||||
swipeMinTouches?: number;
|
||||
swipeVelocityX?: number;
|
||||
swipeVelocityY?: number;
|
||||
tap?: boolean;
|
||||
tapAlways?: boolean;
|
||||
tapMaxDistance?: number;
|
||||
tapMaxTime?: number;
|
||||
touch?: boolean;
|
||||
transform?: boolean;
|
||||
transformMinRotation?: number;
|
||||
transformMinScale?: number;
|
||||
}
|
||||
|
||||
interface HammerGestureEventData {
|
||||
timestamp: number;
|
||||
target: HTMLElement;
|
||||
touches: HammerPoint[];
|
||||
pointerType: HammerPointerType;
|
||||
center: HammerPoint;
|
||||
deltaTime: number;
|
||||
deltaX: number;
|
||||
deltaY: number;
|
||||
velocityX: number;
|
||||
velocityY: number;
|
||||
angle: number;
|
||||
interimAngle: number;
|
||||
direction: HammerDirectionType;
|
||||
interimDirection: HammerDirectionType;
|
||||
distance: number;
|
||||
scale: number;
|
||||
rotation: number;
|
||||
eventType: HammerTouchEventState;
|
||||
srcEvent: any;
|
||||
startEvent: any;
|
||||
|
||||
stopPropagation(): void;
|
||||
preventDefault(): void;
|
||||
stopDetect(): void;
|
||||
}
|
||||
|
||||
interface HammerPoint {
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
|
||||
interface HammerEvent {
|
||||
type: string;
|
||||
gesture: HammerGestureEventData;
|
||||
|
||||
stopPropagation(): void;
|
||||
preventDefault(): void;
|
||||
|
||||
}
|
||||
|
||||
declare enum HammerPointerType {
|
||||
}
|
||||
declare enum HammerDirectionType {
|
||||
}
|
||||
declare enum HammerTouchEventState {
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
hammer(options?: HammerOptions): JQuery;
|
||||
}
|
||||
// Type definitions for Hammer.js 2.0.4
|
||||
// Project: http://hammerjs.github.io/
|
||||
// Definitions by: Philip Bulley <https://github.com/milkisevil/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var Hammer:HammerStatic;
|
||||
|
||||
interface HammerStatic
|
||||
{
|
||||
new( element:HTMLElement, options?:any ): HammerManager;
|
||||
|
||||
defaults:HammerDefaults;
|
||||
|
||||
VERSION: number;
|
||||
|
||||
INPUT_START: number;
|
||||
INPUT_MOVE: number;
|
||||
INPUT_END: number;
|
||||
INPUT_CANCEL: number;
|
||||
|
||||
STATE_POSSIBLE: number;
|
||||
STATE_BEGAN: number;
|
||||
STATE_CHANGED: number;
|
||||
STATE_ENDED: number;
|
||||
STATE_RECOGNIZED: number;
|
||||
STATE_CANCELLED: number;
|
||||
STATE_FAILED: number;
|
||||
|
||||
DIRECTION_NONE: number;
|
||||
DIRECTION_LEFT: number;
|
||||
DIRECTION_RIGHT: number;
|
||||
DIRECTION_UP: number;
|
||||
DIRECTION_DOWN: number;
|
||||
DIRECTION_HORIZONTAL: number;
|
||||
DIRECTION_VERTICAL: number;
|
||||
DIRECTION_ALL: number;
|
||||
|
||||
Manager: HammerManager;
|
||||
Input: HammerInput;
|
||||
TouchAction: TouchAction;
|
||||
|
||||
TouchInput: TouchInput;
|
||||
MouseInput: MouseInput;
|
||||
PointerEventInput: PointerEventInput;
|
||||
TouchMouseInput: TouchMouseInput;
|
||||
SingleTouchInput: SingleTouchInput;
|
||||
|
||||
Recognizer: RecognizerStatic;
|
||||
AttrRecognizer: AttrRecognizerStatic;
|
||||
Tap: TapRecognizerStatic;
|
||||
Pan: PanRecognizerStatic;
|
||||
Swipe: SwipeRecognizerStatic;
|
||||
Pinch: PinchRecognizerStatic;
|
||||
Rotate: RotateRecognizerStatic;
|
||||
Press: PressRecognizerStatic;
|
||||
|
||||
on( target:EventTarget, types:string, handler:Function ):void;
|
||||
off( target:EventTarget, types:string, handler:Function ):void;
|
||||
each( obj:any, iterator:Function, context:any ): void;
|
||||
merge( dest:any, src:any ): any;
|
||||
extend( dest:any, src:any, merge:boolean ): any;
|
||||
inherit( child:Function, base:Function, properties:any ):any;
|
||||
bindFn( fn:Function, context:any ):Function;
|
||||
prefixed( obj:any, property:string ):string;
|
||||
}
|
||||
|
||||
interface HammerDefaults
|
||||
{
|
||||
domEvents:boolean;
|
||||
enable:boolean;
|
||||
preset:any[];
|
||||
touchAction:string;
|
||||
cssProps:CssProps;
|
||||
|
||||
inputClass():void;
|
||||
inputTarget():void;
|
||||
}
|
||||
|
||||
interface CssProps
|
||||
{
|
||||
contentZooming:string;
|
||||
tapHighlightColor:string;
|
||||
touchCallout:string;
|
||||
touchSelect:string;
|
||||
userDrag:string;
|
||||
userSelect:string;
|
||||
}
|
||||
|
||||
interface HammerOptions extends HammerDefaults
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
interface HammerManager
|
||||
{
|
||||
new( element:HTMLElement, options?:any ):HammerManager;
|
||||
|
||||
add( recogniser:Recognizer ):Recognizer;
|
||||
add( recogniser:Recognizer ):HammerManager;
|
||||
add( recogniser:Recognizer[] ):Recognizer;
|
||||
add( recogniser:Recognizer[] ):HammerManager;
|
||||
destroy():void;
|
||||
emit( event:string, data:any ):void;
|
||||
get( recogniser:Recognizer ):Recognizer;
|
||||
get( recogniser:string ):Recognizer;
|
||||
off( events:string, handler:( event:HammerInput ) => void ):void;
|
||||
on( events:string, handler:( event:HammerInput ) => void ):void;
|
||||
recognize( inputData:any ):void;
|
||||
remove( recogniser:Recognizer ):HammerManager;
|
||||
remove( recogniser:string ):HammerManager;
|
||||
set( options:HammerOptions ):HammerManager;
|
||||
stop( force:boolean ):void;
|
||||
}
|
||||
|
||||
declare class HammerInput
|
||||
{
|
||||
constructor( manager:HammerManager, callback:Function );
|
||||
|
||||
destroy():void;
|
||||
handler():void;
|
||||
init():void;
|
||||
|
||||
/** Name of the event. Like panstart. */
|
||||
type:string;
|
||||
|
||||
/** Movement of the X axis. */
|
||||
deltaX:number;
|
||||
|
||||
/** Movement of the Y axis. */
|
||||
deltaY:number;
|
||||
|
||||
/** Total time in ms since the first input. */
|
||||
deltaTime:number;
|
||||
|
||||
/** Distance moved. */
|
||||
distance:number;
|
||||
|
||||
/** Angle moved. */
|
||||
angle:number;
|
||||
|
||||
/** Velocity on the X axis, in px/ms. */
|
||||
velocityX:number;
|
||||
|
||||
/** Velocity on the Y axis, in px/ms */
|
||||
velocityY:number;
|
||||
|
||||
/** Highest velocityX/Y value. */
|
||||
velocity:number;
|
||||
|
||||
/** Direction moved. Matches the DIRECTION constants. */
|
||||
direction:number;
|
||||
|
||||
/** Direction moved from it's starting point. Matches the DIRECTION constants. */
|
||||
offsetDirection:string;
|
||||
|
||||
/** Scaling that has been done when multi-touch. 1 on a single touch. */
|
||||
scale:number;
|
||||
|
||||
/** Rotation that has been done when multi-touch. 0 on a single touch. */
|
||||
rotation:number;
|
||||
|
||||
/** Center position for multi-touch, or just the single pointer. */
|
||||
center:HammerPoint;
|
||||
|
||||
/** Source event object, type TouchEvent, MouseEvent or PointerEvent. */
|
||||
srcEvent:Event; // TODO: Update to Union Type (TouchEvent | MouseEvent | PointerEvent) if it lands in TS1.4
|
||||
|
||||
/** Target that received the event. */
|
||||
target:HTMLElement;
|
||||
|
||||
/** Primary pointer type, could be touch, mouse, pen or kinect. */
|
||||
pointerType:string;
|
||||
|
||||
/** Event type, matches the INPUT constants. */
|
||||
eventType:string;
|
||||
|
||||
/** true when the first input. */
|
||||
isFirst:boolean;
|
||||
|
||||
/** true when the final (last) input. */
|
||||
isFinal:boolean;
|
||||
|
||||
/** Array with all pointers, including the ended pointers (touchend, mouseup). */
|
||||
pointers:any[];
|
||||
|
||||
/** Array with all new/moved/lost pointers. */
|
||||
changedPointers:any[];
|
||||
|
||||
/** Reference to the srcEvent.preventDefault() method. Only for experts! */
|
||||
preventDefault:Function;
|
||||
}
|
||||
|
||||
declare class MouseInput extends HammerInput
|
||||
{
|
||||
constructor( manager:HammerManager, callback:Function );
|
||||
}
|
||||
|
||||
declare class PointerEventInput extends HammerInput
|
||||
{
|
||||
constructor( manager:HammerManager, callback:Function );
|
||||
}
|
||||
|
||||
declare class SingleTouchInput extends HammerInput
|
||||
{
|
||||
constructor( manager:HammerManager, callback:Function );
|
||||
}
|
||||
|
||||
declare class TouchInput extends HammerInput
|
||||
{
|
||||
constructor( manager:HammerManager, callback:Function );
|
||||
}
|
||||
|
||||
declare class TouchMouseInput extends HammerInput
|
||||
{
|
||||
constructor( manager:HammerManager, callback:Function );
|
||||
}
|
||||
|
||||
interface RecognizerStatic
|
||||
{
|
||||
new( options?:any ):Recognizer;
|
||||
}
|
||||
|
||||
interface Recognizer
|
||||
{
|
||||
defaults:any;
|
||||
|
||||
canEmit():boolean;
|
||||
canRecognizeWith( otherRecognizer:Recognizer ):boolean;
|
||||
dropRecognizeWith( otherRecognizer:Recognizer ):Recognizer;
|
||||
dropRecognizeWith( otherRecognizer:string ):Recognizer;
|
||||
dropRequireFailure( otherRecognizer:Recognizer ):Recognizer;
|
||||
dropRequireFailure( otherRecognizer:string ):Recognizer;
|
||||
emit( input:HammerInput ):void;
|
||||
getTouchAction():any[];
|
||||
hasRequireFailures():boolean;
|
||||
process( inputData:HammerInput ):string;
|
||||
recognize( inputData:HammerInput ):void;
|
||||
recognizeWith( otherRecognizer:Recognizer ):Recognizer;
|
||||
recognizeWith( otherRecognizer:string ):Recognizer;
|
||||
requireFailure( otherRecognizer:Recognizer ):Recognizer;
|
||||
requireFailure( otherRecognizer:string ):Recognizer;
|
||||
reset():void;
|
||||
set( options?:any ):Recognizer;
|
||||
tryEmit( input:HammerInput ):void;
|
||||
}
|
||||
|
||||
interface AttrRecognizerStatic
|
||||
{
|
||||
attrTest( input:HammerInput ):boolean;
|
||||
process( input:HammerInput ):any;
|
||||
}
|
||||
|
||||
interface AttrRecognizer extends Recognizer
|
||||
{
|
||||
new( options?:any ):AttrRecognizer;
|
||||
}
|
||||
|
||||
interface PanRecognizerStatic
|
||||
{
|
||||
new( options?:any ):PanRecognizer;
|
||||
}
|
||||
|
||||
interface PanRecognizer extends AttrRecognizer
|
||||
{
|
||||
}
|
||||
|
||||
interface PinchRecognizerStatic
|
||||
{
|
||||
new( options?:any ):PinchRecognizer;
|
||||
}
|
||||
|
||||
interface PinchRecognizer extends AttrRecognizer
|
||||
{
|
||||
}
|
||||
|
||||
interface PressRecognizerStatic
|
||||
{
|
||||
new( options?:any ):PressRecognizer;
|
||||
}
|
||||
|
||||
interface PressRecognizer extends AttrRecognizer
|
||||
{
|
||||
}
|
||||
|
||||
interface RotateRecognizerStatic
|
||||
{
|
||||
new( options?:any ):RotateRecognizer;
|
||||
}
|
||||
|
||||
interface RotateRecognizer extends AttrRecognizer
|
||||
{
|
||||
}
|
||||
|
||||
interface SwipeRecognizerStatic
|
||||
{
|
||||
new( options?:any ):SwipeRecognizer;
|
||||
}
|
||||
|
||||
interface SwipeRecognizer
|
||||
{
|
||||
}
|
||||
|
||||
interface TapRecognizerStatic
|
||||
{
|
||||
new( options?:any ):TapRecognizer;
|
||||
}
|
||||
|
||||
interface TapRecognizer extends AttrRecognizer
|
||||
{
|
||||
}
|
||||
|
||||
declare class TouchAction
|
||||
{
|
||||
constructor( manager:HammerManager, value:string );
|
||||
|
||||
compute():string;
|
||||
preventDefaults( input:HammerInput ):void;
|
||||
preventSrc( srcEvent:any ):void;
|
||||
set( value:string ):void;
|
||||
update():void;
|
||||
}
|
||||
|
||||
interface HammerPoint
|
||||
{
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
Vendored
+9
-1
@@ -629,6 +629,14 @@ interface JQueryCoordinates {
|
||||
top: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Elements in the array returned by serializeArray()
|
||||
*/
|
||||
interface JQuerySerializeArrayElement {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface JQueryAnimationOptions {
|
||||
/**
|
||||
* A string or number determining how long the animation will run.
|
||||
@@ -1321,7 +1329,7 @@ interface JQuery {
|
||||
/**
|
||||
* Encode a set of form elements as an array of names and values.
|
||||
*/
|
||||
serializeArray(): Object[];
|
||||
serializeArray(): JQuerySerializeArrayElement[];
|
||||
|
||||
/**
|
||||
* Adds the specified class(es) to each of the set of matched elements.
|
||||
|
||||
Vendored
+1
-1
@@ -208,7 +208,7 @@ declare module linq {
|
||||
ThenBy(keySelector: ($) => T): OrderedEnumerable<T>;
|
||||
ThenBy(keySelector: string): OrderedEnumerable<T>;
|
||||
ThenByDescending(keySelector: ($) => T): OrderedEnumerable<T>;
|
||||
ThenByDescending(keySelector: T): OrderedEnumerable<T>;
|
||||
ThenByDescending(keySelector: string): OrderedEnumerable<T>;
|
||||
}
|
||||
|
||||
interface Grouping<T> extends Enumerable<T> {
|
||||
|
||||
Vendored
+8
@@ -6324,6 +6324,14 @@ declare module _ {
|
||||
noop(): void;
|
||||
}
|
||||
|
||||
//_.constant
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that returns value..
|
||||
**/
|
||||
constant<T>(value: T): T;
|
||||
}
|
||||
|
||||
//_.create
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Vendored
+6
@@ -12,6 +12,12 @@ declare module "nock" {
|
||||
|
||||
module nock {
|
||||
export function cleanAll(): void;
|
||||
|
||||
export function disableNetConnect(): void;
|
||||
export function enableNetConnect(): void;
|
||||
export function enableNetConnect(regex: RegExp): void;
|
||||
export function enableNetConnect(domain: string): void;
|
||||
|
||||
export var recorder: Recorder;
|
||||
|
||||
export interface Scope {
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
import Imap = require('imap');
|
||||
var inspect = require('util').inspect;
|
||||
|
||||
var imap = new Imap({
|
||||
user: 'mygmailname@gmail.com',
|
||||
password: 'mygmailpassword',
|
||||
host: 'imap.gmail.com',
|
||||
port: 993,
|
||||
tls: true
|
||||
});
|
||||
|
||||
imap.once('ready', function () {
|
||||
imap.openBox('INBOX', true,function (err, box) {
|
||||
if (err) throw err;
|
||||
var f = imap.seq.fetch('1:3', {
|
||||
bodies: 'HEADER.FIELDS (FROM TO SUBJECT DATE)',
|
||||
struct: true
|
||||
});
|
||||
f.on('message', function (msg, seqno) {
|
||||
console.log('Message #%d', seqno);
|
||||
var prefix = '(#' + seqno + ') ';
|
||||
msg.on('body', function (stream, info) {
|
||||
var buffer = '';
|
||||
stream.on('data', function (chunk) {
|
||||
buffer += chunk.toString('utf8');
|
||||
});
|
||||
stream.once('end', function () {
|
||||
console.log(prefix + 'Parsed header: %s', inspect(Imap.parseHeader(buffer)));
|
||||
});
|
||||
});
|
||||
msg.once('attributes', function (attrs) {
|
||||
console.log(prefix + 'Attributes: %s', inspect(attrs, false, 8));
|
||||
});
|
||||
msg.once('end', function () {
|
||||
console.log(prefix + 'Finished');
|
||||
});
|
||||
});
|
||||
f.once('error', function (err) {
|
||||
console.log('Fetch error: ' + err);
|
||||
});
|
||||
f.once('end', function () {
|
||||
console.log('Done fetching all messages!');
|
||||
imap.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
imap.once('error', function (err) {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
imap.once('end', function () {
|
||||
console.log('Connection ended');
|
||||
});
|
||||
|
||||
imap.connect();
|
||||
|
||||
imap.openBox('INBOX', true, function (err, box) {
|
||||
if (err) throw err;
|
||||
var f = imap.seq.fetch(box.messages.total + ':*', { bodies: ['HEADER.FIELDS (FROM)', 'TEXT'] });
|
||||
f.on('message', function (msg, seqno) {
|
||||
console.log('Message #%d', seqno);
|
||||
var prefix = '(#' + seqno + ') ';
|
||||
msg.on('body', function (stream, info) {
|
||||
if (info.which === 'TEXT')
|
||||
console.log(prefix + 'Body [%s] found, %d total bytes', inspect(info.which), info.size);
|
||||
var buffer = '', count = 0;
|
||||
stream.on('data', function (chunk) {
|
||||
count += chunk.length;
|
||||
buffer += chunk.toString('utf8');
|
||||
if (info.which === 'TEXT')
|
||||
console.log(prefix + 'Body [%s] (%d/%d)', inspect(info.which), count, info.size);
|
||||
});
|
||||
stream.once('end', function () {
|
||||
if (info.which !== 'TEXT')
|
||||
console.log(prefix + 'Parsed header: %s', inspect(Imap.parseHeader(buffer)));
|
||||
else
|
||||
console.log(prefix + 'Body [%s] Finished', inspect(info.which));
|
||||
});
|
||||
});
|
||||
msg.once('attributes', function (attrs) {
|
||||
console.log(prefix + 'Attributes: %s', inspect(attrs, false, 8));
|
||||
});
|
||||
msg.once('end', function () {
|
||||
console.log(prefix + 'Finished');
|
||||
});
|
||||
});
|
||||
f.once('error', function (err) {
|
||||
console.log('Fetch error: ' + err);
|
||||
});
|
||||
f.once('end', function () {
|
||||
console.log('Done fetching all messages!');
|
||||
imap.end();
|
||||
});
|
||||
});
|
||||
|
||||
var fs = require('fs'), fileStream : any;
|
||||
|
||||
imap.openBox('INBOX', true,function (err, box) {
|
||||
if (err) throw err;
|
||||
imap.search(['UNSEEN', ['SINCE', 'May 20, 2010']], function (err : Error, results: any) {
|
||||
if (err) throw err;
|
||||
var f = imap.fetch(results, { bodies: '' });
|
||||
f.on('message', function (msg, seqno) {
|
||||
console.log('Message #%d', seqno);
|
||||
var prefix = '(#' + seqno + ') ';
|
||||
msg.on('body', function (stream, info) {
|
||||
console.log(prefix + 'Body');
|
||||
stream.pipe(fs.createWriteStream('msg-' + seqno + '-body.txt'));
|
||||
});
|
||||
msg.once('attributes', function (attrs) {
|
||||
console.log(prefix + 'Attributes: %s', inspect(attrs, false, 8));
|
||||
});
|
||||
msg.once('end', function () {
|
||||
console.log(prefix + 'Finished');
|
||||
});
|
||||
});
|
||||
f.once('error', function (err) {
|
||||
console.log('Fetch error: ' + err);
|
||||
});
|
||||
f.once('end', function () {
|
||||
console.log('Done fetching all messages!');
|
||||
imap.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
Vendored
+102
@@ -0,0 +1,102 @@
|
||||
// Type definitions for node imap
|
||||
// Project: https://github.com/mscdex/node-imap
|
||||
// Definitions by: Steve Fenton <https://github.com/Steve-Fenton>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "imap" {
|
||||
interface ImapOptions {
|
||||
user: string;
|
||||
password: string;
|
||||
host: string;
|
||||
port: number;
|
||||
tls: boolean;
|
||||
}
|
||||
|
||||
interface ImapBox {
|
||||
name: string;
|
||||
readOnly: boolean;
|
||||
newKeywords: boolean;
|
||||
uidvalidity: number;
|
||||
uidnext: number;
|
||||
flags: any[]; // TODO
|
||||
permFlags: any[]; // TODO
|
||||
persistentUIDs: boolean;
|
||||
messages: {
|
||||
total: number;
|
||||
'new': number;
|
||||
unseen: number;
|
||||
}
|
||||
}
|
||||
|
||||
interface ImapChunk {
|
||||
toString(charset: string): string;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface ImapFetch {
|
||||
once(event: 'end', callback: () => void): void;
|
||||
once(event: 'error', callback: (error: Error) => void): void;
|
||||
once(event: string, callback: Function): void;
|
||||
|
||||
on(event: 'message', callback: (msg: ImapMessage, seqno: number) => void): void;
|
||||
on(event: string, callback: Function): void;
|
||||
}
|
||||
|
||||
interface ImapBodyStream {
|
||||
once(event: 'end', callback: () => void): void;
|
||||
once(event: string, callback: Function): void;
|
||||
|
||||
on(event: 'data', callback: (chunk: ImapChunk) => void): void;
|
||||
on(event: string, callback: Function): void;
|
||||
|
||||
pipe(stream: any): void;
|
||||
}
|
||||
|
||||
interface ImapMessage {
|
||||
// TODO: typeof attributes
|
||||
once(event: 'attributes', callback: (attributes: any) => void): void;
|
||||
once(event: string, callback: Function): void;
|
||||
|
||||
// TODO: typeof info
|
||||
on(event: 'body', callback: (stream: ImapBodyStream, info: any) => void): void;
|
||||
on(event: string, callback: Function): void;
|
||||
}
|
||||
|
||||
class Imap {
|
||||
constructor(options: ImapOptions);
|
||||
|
||||
connect(): void;
|
||||
|
||||
//TODO:
|
||||
// param a
|
||||
openBox(name: string, a: boolean, callback: (err: Error, box: ImapBox) => void) : void;
|
||||
|
||||
//TODO:
|
||||
// param a
|
||||
// param b
|
||||
once(event: 'end', callback: () => void): void;
|
||||
once(event: 'error', callback: (error: Error) => void): void;
|
||||
once(a: string, callback: Function) : void;
|
||||
|
||||
end(): void;
|
||||
|
||||
//TODO:
|
||||
// return type
|
||||
parseHeader(header: string): any;
|
||||
static parseHeader(header: string): any;
|
||||
|
||||
search(searchTerms: any[], callback: Function): void;
|
||||
|
||||
fetch(results: any, options: {}): ImapFetch;
|
||||
|
||||
//TODO:
|
||||
// type
|
||||
seq: {
|
||||
fetch(messageSourceQuery: string, options: {}): ImapFetch;
|
||||
};
|
||||
}
|
||||
|
||||
export = Imap;
|
||||
}
|
||||
Vendored
+6
-6
@@ -465,7 +465,7 @@ declare module "zlib" {
|
||||
}
|
||||
|
||||
declare module "os" {
|
||||
export function tmpDir(): string;
|
||||
export function tmpdir(): string;
|
||||
export function hostname(): string;
|
||||
export function type(): string;
|
||||
export function platform(): string;
|
||||
@@ -767,13 +767,13 @@ declare module "dgram" {
|
||||
port: number;
|
||||
size: number;
|
||||
}
|
||||
|
||||
|
||||
interface AddressInfo {
|
||||
address: string;
|
||||
family: string;
|
||||
port: number;
|
||||
address: string;
|
||||
family: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
|
||||
export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
|
||||
|
||||
interface Socket extends events.EventEmitter {
|
||||
|
||||
Vendored
+3
-3
@@ -465,7 +465,7 @@ declare module "zlib" {
|
||||
}
|
||||
|
||||
declare module "os" {
|
||||
export function tmpDir(): string;
|
||||
export function tmpdir(): string;
|
||||
export function hostname(): string;
|
||||
export function type(): string;
|
||||
export function platform(): string;
|
||||
@@ -528,8 +528,8 @@ declare module "https" {
|
||||
};
|
||||
export interface Server extends tls.Server { }
|
||||
export function createServer(options: ServerOptions, requestListener?: Function): Server;
|
||||
export function request(options: RequestOptions, callback?: (res: events.EventEmitter) =>void ): http.ClientRequest;
|
||||
export function get(options: RequestOptions, callback?: (res: events.EventEmitter) =>void ): http.ClientRequest;
|
||||
export function request(options: RequestOptions, callback?: (res: http.ClientResponse) =>void ): http.ClientRequest;
|
||||
export function get(options: RequestOptions, callback?: (res: http.ClientResponse) =>void ): http.ClientRequest;
|
||||
export var globalAgent: Agent;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
/// <reference path="./phantom.d.ts" />
|
||||
|
||||
import phantom = require("phantom");
|
||||
|
||||
phantom.create((ph: phantom.PhantomJS): void => {
|
||||
ph.createPage((page): void => {
|
||||
page.open("http://www.google.com", (status: string): void => {
|
||||
console.log("opened google? ", status);
|
||||
page.evaluate((): string => {
|
||||
return document.title;
|
||||
}, (result: string): void => {
|
||||
console.log('Page title is ' + result);
|
||||
ph.exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var _ph: phantom.PhantomJS;
|
||||
phantom.create("--web-security=no", "--ignore-ssl-errors=yes", { port: 12345 }, (ph) => {
|
||||
console.log("Phantom Bridge Initiated");
|
||||
_ph = ph;
|
||||
});
|
||||
var _page: phantom.WebPage;
|
||||
_ph.createPage((page) => {
|
||||
console.log("Page created!");
|
||||
_page = page;
|
||||
});
|
||||
|
||||
_page.open("http://www.google.com", function (status) {
|
||||
if (status == "success") {
|
||||
console.log("Page is open!");
|
||||
_page.close();
|
||||
}
|
||||
});
|
||||
|
||||
_page.evaluate(function() {
|
||||
var title = (<HTMLElement>document.querySelector("title")).innerText
|
||||
console.log("The page title is " + title)
|
||||
})
|
||||
_page.evaluate(function(selector) {
|
||||
var text = (<HTMLElement>document.querySelector(selector)).innerText
|
||||
console.log(selector + " contains the following text: " + text)
|
||||
}, function(result) {}, "title")
|
||||
_page.evaluate(function(selector) {
|
||||
var text = (<HTMLElement>document.querySelector(selector)).innerText
|
||||
return text
|
||||
}, function(result) {
|
||||
console.log("The element contains the following text: " + result)
|
||||
}, "title");
|
||||
|
||||
|
||||
_page.set('viewportSize', { width: 1920, height: 1080 }, function (result) {
|
||||
console.log("Viewport set to: " + result.width + "x" + result.height);
|
||||
});
|
||||
_page.set('onConsoleMessage', function (msg: string) {
|
||||
console.log("Phantom Console: " + msg);
|
||||
});
|
||||
_page.set('onUrlChanged', function(url: string) {
|
||||
console.log("New URL: "+url);
|
||||
});
|
||||
_page.set('onResourceRequested', function () {
|
||||
console.log("Resource requested..");
|
||||
});
|
||||
_page.set('onResourceReceived', function (res: any) {
|
||||
if (res.stage == 'end') {
|
||||
console.log("Resource received!")
|
||||
}
|
||||
});
|
||||
_page.set('onLoadStarted', function () {
|
||||
console.log("Loading started");
|
||||
});
|
||||
_page.set('onLoadFinished', function (status: string) {
|
||||
console.log("Loading finished, the page is " + ((status == "success") ? "open." : "not open!"));
|
||||
});
|
||||
_page.set('settings.loadImages', false);
|
||||
_page.set('settings.resourceTimeout', 1000);
|
||||
|
||||
|
||||
_page.set('settings.viewportSize', {
|
||||
width : 1920,
|
||||
height : 1080
|
||||
});
|
||||
_page.open("http://google.co.jp", (status) => {
|
||||
_page.render("/tmp/google-top.jpg", {
|
||||
format : 'jpeg',
|
||||
quality : '80'
|
||||
});
|
||||
_ph.exit();
|
||||
});
|
||||
|
||||
|
||||
phantom.create((ph) => {
|
||||
ph.addCookie('cookie_name', 'cookie_value', 'localhost', () => {});
|
||||
ph.getCookies((cookies) => {});
|
||||
|
||||
ph.createPage((page) => {
|
||||
page.set('Referer', 'http://google.com');
|
||||
page.set('settings.userAgent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1');
|
||||
|
||||
page.open("http://localhost:9901/cookie", (status) => {
|
||||
var someFunc = (aaa: string, my_obj: Object) => {
|
||||
var attribute_to_want = aaa;
|
||||
var h2Arr: string[] = [];
|
||||
var results = document.querySelectorAll(attribute_to_want);
|
||||
for (var i = 0, len = results.length; i < len; ++i) {
|
||||
var result = <HTMLElement>results[i];
|
||||
h2Arr.push(result.innerText);
|
||||
}
|
||||
return {
|
||||
h2: h2Arr,
|
||||
aaa: this.arguments,
|
||||
obj: my_obj
|
||||
};
|
||||
};
|
||||
var finishedFunc = (result: any) => {
|
||||
ph.exit();
|
||||
};
|
||||
page.evaluate(someFunc, finishedFunc, 'div', {wahtt: 111});
|
||||
});
|
||||
});
|
||||
|
||||
ph.createPage((page) => {
|
||||
page.open('http://www.phantomjs.org', (status) => {
|
||||
if (status === 'success') {
|
||||
page.includeJs('http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', () => {
|
||||
page.injectJs('do.js', (res) => {
|
||||
page.evaluate(() => {
|
||||
return document.title;
|
||||
}, (title: string) => {
|
||||
console.log(title);
|
||||
ph.exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
page.sendEvent('click', 350, 320);
|
||||
page.sendEvent('click', 350, 320, 'right');
|
||||
page.sendEvent('keypress', 'A', null, null, 0x02000000 | 0x08000000);
|
||||
page.sendEvent('keypress', 'A');
|
||||
|
||||
page.setViewportSize(800, 640);
|
||||
page.setPaperSize({
|
||||
width: '200px',
|
||||
height: '300px',
|
||||
margin: '0px'
|
||||
});
|
||||
page.setPaperSize({
|
||||
format: 'A4',
|
||||
orientation: 'portrait',
|
||||
margin: '1cm'
|
||||
});
|
||||
page.setPaperSize({
|
||||
width: '5in',
|
||||
height: '7in',
|
||||
margin: {
|
||||
top: '50px',
|
||||
left: '20px'
|
||||
}
|
||||
});
|
||||
page.setZoomFactor(0.25);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
// Type definitions for PhantomJS bridge for NodeJS 0.7.0
|
||||
// Project: https://github.com/sgentle/phantomjs-node
|
||||
// Definitions by: horiuchi <https://github.com/horiuchi/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "phantom" {
|
||||
|
||||
function create(callback: (ph: PhantomJS) => void): void;
|
||||
function create(options: ICreateOptions, callback: (ph: PhantomJS) => void): void;
|
||||
function create(arg: string, callback: (ph: PhantomJS) => void): void;
|
||||
function create(arg: string, options: ICreateOptions, callback: (ph: PhantomJS) => void): void;
|
||||
function create(arg1: string, arg2: string, callback: (ph: PhantomJS) => void): void;
|
||||
function create(arg1: string, arg2: string, options: ICreateOptions, callback: (ph: PhantomJS) => void): void;
|
||||
function create(arg1: string, arg2: string, arg3: string, callback: (ph: PhantomJS) => void): void;
|
||||
function create(arg1: string, arg2: string, arg3: string, options: ICreateOptions, callback: (ph: PhantomJS) => void): void;
|
||||
|
||||
interface PhantomJS {
|
||||
createPage(callback: (page: WebPage) => void): void;
|
||||
exit(returnValue?: number): void;
|
||||
injectJs(filename: string, callback?: (result: boolean) => void): void;
|
||||
|
||||
addCookie(name: string, value: string, domain: string, callback?: (res: boolean) => void): void;
|
||||
clearCookies(callback?: () => void): void;
|
||||
getCookies(callback: (cookies: { name: string; value: string; domain?: string; }[]) => void): void;
|
||||
}
|
||||
|
||||
interface WebPage {
|
||||
open(url: string, callback: (status: string) => void): void;
|
||||
close(): void;
|
||||
|
||||
get(key: string, callback: (result: any) => void): void;
|
||||
set(key: string, value: any, callback?: (result: any) => void): void;
|
||||
setHeaders(headers: Object, callback?: () => void): void;
|
||||
setViewportSize(width: number, height: number, callback?: () => void): void;
|
||||
setPaperSize(options: IPaperSizeOptions, callback?: () => void): void;
|
||||
setZoomFactor(factor: number, callback?: () => void): void;
|
||||
|
||||
evaluate(callback: () => void): void;
|
||||
evaluate<R>(callback: () => R, returnCallback: (result: R) => void): void;
|
||||
evaluate<T>(callback: (arg: T) => void, returnCallback: () => void, arg: T): void;
|
||||
evaluate<T, R>(callback: (arg: T) => R, returnCallback: (result: R) => void, arg: T): void;
|
||||
evaluate<T1, T2, R>(callback: (arg1: T1, arg2: T2) => R, returnCallback: (result: R) => void, arg1: T1, arg2: T2): void;
|
||||
evaluate<T1, T2, T3, R>(callback: (arg1: T1, arg2: T2, arg3: T3) => R, returnCallback: (result: R) => void, arg1: T1, arg2: T2, arg3: T3): void;
|
||||
includeJs(url: string, callback?: () => void): void;
|
||||
injectJs(filename: string, callback?: (res: boolean) => void): void;
|
||||
sendEvent(mouseEventType: string, mouseX: number, mouseY: number, button?: string): void;
|
||||
sendEvent(keyboardEventType: string, key: string, null1?: void, null2?: void, modifier?: number): void;
|
||||
uploadFile(selector: string, filename: string): void;
|
||||
|
||||
render(filename: string, callback?: () => void): void;
|
||||
render(filename: string, options?: { format?: string; quality?: string; }, callback?: () => void): void;
|
||||
renderBase64(type: string, callback: (data: string) => void): void;
|
||||
|
||||
goBack(): void;
|
||||
goForward(): void;
|
||||
reload(): void;
|
||||
|
||||
getContent(callback: (content: string) => void): void;
|
||||
setContent(html: string, url: string, callback?: (status: string) => void): void;
|
||||
getCookies(callback: (cookies: { name: string; value: string; domain?: string; }[]) => void): void;
|
||||
}
|
||||
|
||||
interface ICreateOptions {
|
||||
binary?: string;
|
||||
hostname?: string;
|
||||
path?: string;
|
||||
port?: number;
|
||||
}
|
||||
interface IPaperSizeOptions {
|
||||
width?: string;
|
||||
height?: string;
|
||||
format?: string;
|
||||
orientation?: string;
|
||||
margin?: any; // string | { top?: string; left?: string; bottom?: string; right?: string; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
///<reference path="playerFramework.d.ts" />
|
||||
|
||||
var el = document.createElement("div");
|
||||
var player = new PlayerFramework.MediaPlayer(el);
|
||||
|
||||
// Getters
|
||||
var currentSrc = player.currentSrc;
|
||||
var interactiveModel = player.defaultInteractiveViewModel;
|
||||
var duration = player.duration;
|
||||
var element = player.element;
|
||||
var ended = player.ended;
|
||||
var error = player.error;
|
||||
var initialTime = player.initialTime;
|
||||
var audioAllowed = player.isAudioAllowed;
|
||||
var captionsAllowed = player.isCaptionsAllowed;
|
||||
var currentTime = player.isCurrentTimeLive;
|
||||
var timeAllowed = player.isElapsedTimeAllowed;
|
||||
var forwardAllowed = player.isFastForwardAllowed;
|
||||
var fullscreenAllowed = player.isFullScreenAllowed;
|
||||
var goLiveAllowed = player.isGoLiveAllowed;
|
||||
var live = player.isLive;
|
||||
var mediaQualityAllowed = player.isMediaQualityAllowed;
|
||||
var muteAllowed = player.isMuteAllowed;
|
||||
var pauseAllowed = player.isPauseAllowed;
|
||||
var playPauseAllowed = player.isPlayPauseAllowed;
|
||||
var playResumeAllowed = player.isPlayResumeAllowed;
|
||||
var remainingTimeAllowed = player.isRemainingTimeAllowed;
|
||||
var replayAllowed = player.isReplayAllowed;
|
||||
var rewindAllowed = player.isRewindAllowed;
|
||||
var strengthAllowed = player.isSignalStrengthAllowed;
|
||||
var aheadAllowed = player.isSkipAheadAllowed;
|
||||
var backAllowed = player.isSkipBackAllowed;
|
||||
var nextAllowed = player.isSkipNextAllowed;
|
||||
var prevAllowed = player.isSkipPreviousAllowed;
|
||||
var motionAllowed = player.isSlowMotionAllowed;
|
||||
var timelineAllowed = player.isTimelineAllowed;
|
||||
var volumeAllowed = player.isVolumeAllowed;
|
||||
var muteAllowed = player.isVolumeMuteAllowed;
|
||||
var optimalPlayback = player.msIsLayoutOptimalForPlayback;
|
||||
var stereo = player.msIsStereo3D;
|
||||
var playToSource = player.msPlayToSource;
|
||||
var networkState = player.networkState;
|
||||
var paused = player.paused;
|
||||
var playlistPlugin = player.playlistPlugin;
|
||||
var readyState = player.readyState;
|
||||
var scrubbing = player.scrubbing;
|
||||
var seeking = player.seeking;
|
||||
var videoHeight = player.videoHeight;
|
||||
var videoWidth = player.videoWidth;
|
||||
|
||||
// Getters/Setters
|
||||
player.advertisingState = PlayerFramework.AdvertisingState.linear;
|
||||
player.autobuffer = false;
|
||||
player.autohide = false;
|
||||
player.autohideBehavior = PlayerFramework.AutohideBehavior.all;
|
||||
player.autohideTime = 0;
|
||||
player.autoload = false;
|
||||
player.autoplay = false;
|
||||
player.controls = false;
|
||||
player.currentTime = 0;
|
||||
player.defaultPlaybackRate = 0;
|
||||
player.endTime = 0;
|
||||
player.height = '100px';
|
||||
player.interactiveActivationMode = PlayerFramework.InteractionType.all;
|
||||
player.interactiveDeactivationMode = PlayerFramework.InteractionType.all;
|
||||
player.interactiveViewModel = new PlayerFramework.InteractiveViewModel();
|
||||
player.isAudioEnabled = false;
|
||||
player.isAudioVisible = false;
|
||||
player.isCaptionsVisible = false;
|
||||
player.isElapsedTimeEnabled = false;
|
||||
player.isElapsedTimeVisible = false;
|
||||
player.isFastForwardEnabled = false;
|
||||
player.isFastForwardVisible = false;
|
||||
player.isFullScreen = false;
|
||||
player.isFullScreenEnabled = false;
|
||||
player.isFullScreenVisible = false;
|
||||
player.isGoLiveEnabled = false;
|
||||
player.isGoLiveVisible = false;
|
||||
player.isInteractive = false;
|
||||
player.isMediaQualityEnabled = false;
|
||||
player.isMediaQualityVisible = false;
|
||||
player.isMuteEnabled = false;
|
||||
player.isMuteVisible = false;
|
||||
player.isPauseEnabled = false;
|
||||
player.isPauseVisible = false;
|
||||
player.isPlayPauseEnabled = false;
|
||||
player.isPlayPauseVisible = false;
|
||||
player.isPlayResumeEnabled = false;
|
||||
player.isPlayResumeVisible = false;
|
||||
player.isRemainingTimeEnabled = false;
|
||||
player.isRemainingTimeVisible = false;
|
||||
player.isReplayEnabled = false;
|
||||
player.isReplayVisible = false;
|
||||
player.isRewindEnabled = false;
|
||||
player.isRewindVisible = false;
|
||||
player.isSignalStrengthEnabled = false;
|
||||
player.isSignalStrengthVisible = false;
|
||||
player.isSkipAheadEnabled = false;
|
||||
player.isSkipAheadVisible = false;
|
||||
player.isSkipBackEnabled = false;
|
||||
player.isSkipBackVisible = false;
|
||||
player.isSkipNextEnabled = false;
|
||||
player.isSkipNextVisible = false;
|
||||
player.isSkipPreviousEnabled = false;
|
||||
player.isSkipPreviousVisible = false;
|
||||
player.isSlowMotion = false;
|
||||
player.isSlowMotionEnabled = false;
|
||||
player.isSlowMotionVisible = false;
|
||||
player.isStartTimeOffset = false;
|
||||
player.isTimelineEnabled = false;
|
||||
player.isTimelineVisible = false;
|
||||
player.isVolumeEnabled = false;
|
||||
player.isVolumeMuteEnabled = false;
|
||||
player.isVolumeMuteVisible = false;
|
||||
player.isVolumeVisible = false;
|
||||
player.liveTime = 0;
|
||||
player.liveTimeBuffer = 0;
|
||||
player.loop = false;
|
||||
player.mediaElement = <HTMLMediaElement>document.createElement('video');
|
||||
player.mediaExtensionManager = new Windows.Media.MediaExtensionManager();
|
||||
player.mediaQuality = PlayerFramework.MediaQuality.highDefinition;
|
||||
player.msAudioCategory = 'audioCategory';
|
||||
player.msAudioDeviceType = 'deviceType';
|
||||
player.msHorizontalMirror = false;
|
||||
player.msPlayToDisabled = false;
|
||||
player.msPlayToPrimary = false;
|
||||
player.msRealTime = false;
|
||||
player.msStereo3DPackingMode = 'stereoMode';
|
||||
player.msStereo3DRenderMode = 'stereoMode';
|
||||
player.msZoom = false;
|
||||
player.muted = false;
|
||||
|
||||
player.playbackRate = 0;
|
||||
player.playerState = PlayerFramework.PlayerState.starting;
|
||||
player.poster = 'poster';
|
||||
player.preload = 'preload';
|
||||
player.replayOffset = 0;
|
||||
player.seekWhileScrubbing = false;
|
||||
player.signalStrength = 0;
|
||||
|
||||
player.skipAheadInterval = 0;
|
||||
player.skipBackInterval = 0;
|
||||
player.slowMotionPlaybackRate = 0;
|
||||
player.src = 'srcUrl';
|
||||
player.startTime = 0;
|
||||
player.startupTime = 0;
|
||||
player.testForMediaPack = false;
|
||||
player.volume = 50;
|
||||
player.width = '100px';
|
||||
|
||||
|
||||
// Methods
|
||||
player.addClass('className');
|
||||
player.addEventListener('eventName', () => { });
|
||||
player.addEventListener('eventName', () => { }, false);
|
||||
player.addTextTrack('kind');
|
||||
player.addTextTrack('kind', 'label');
|
||||
player.addTextTrack('kind', 'label', 'language');
|
||||
var canPlay = player.canPlayType('type');
|
||||
player.decreasePlaybackRate();
|
||||
player.dispose();
|
||||
player.focus();
|
||||
player.increasePlaybackRate();
|
||||
player.load();
|
||||
player.pause();
|
||||
player.play();
|
||||
player.playResume();
|
||||
player.removeClass('className');
|
||||
player.removeEventListener('eventName', () => { });
|
||||
player.replay();
|
||||
player.retry();
|
||||
player.stop();
|
||||
player.update({});
|
||||
|
||||
Vendored
+1965
File diff suppressed because it is too large
Load Diff
Vendored
+6
@@ -217,6 +217,12 @@ interface PouchDB extends PouchApi {
|
||||
}
|
||||
|
||||
declare var PouchDB: PouchDB;
|
||||
|
||||
// Support AMD require
|
||||
declare module 'pouchdb' {
|
||||
export = PouchDB;
|
||||
}
|
||||
|
||||
//
|
||||
// emit is the function that the PouchFilter.map function should call in order to add a particular item to
|
||||
// a filter view.
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
/// <reference path="../rx/rx.async.d.ts"/>
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts"/>
|
||||
/// <reference path="../q/Q.d.ts"/>
|
||||
import When = require("../when/when");
|
||||
|
||||
/// <reference path="../when/when"/>
|
||||
|
||||
var thenNum: PromisesAPlus.Thenable<number>;
|
||||
var thenStr: PromisesAPlus.Thenable<string>;
|
||||
|
||||
+48
-1
@@ -94,6 +94,7 @@ Q.fbind((dateString?: string) => new Date(dateString), "11/11/1991")().then(d =>
|
||||
|
||||
Q.when(8, num => num + "!");
|
||||
Q.when(Q(8), num => num + "!").then(str => str.split(','));
|
||||
var voidPromise: Q.Promise<void> = Q.when();
|
||||
|
||||
declare function saveToDisk(): Q.Promise<any>;
|
||||
declare function saveToCloud(): Q.Promise<any>;
|
||||
@@ -137,4 +138,50 @@ class Repo {
|
||||
}
|
||||
|
||||
var kitty = new Repo();
|
||||
Q.nbind(kitty.find, kitty)({ cute: true }).done((kitties: any[]) => {});
|
||||
Q.nbind(kitty.find, kitty)({ cute: true }).done((kitties: any[]) => {});
|
||||
|
||||
|
||||
/*
|
||||
* Test: Can "rethrow" rejected promises
|
||||
*/
|
||||
module TestCanRethrowRejectedPromises {
|
||||
|
||||
interface Foo {
|
||||
a: number;
|
||||
}
|
||||
|
||||
function nestedBar(): Q.Promise<Foo> {
|
||||
var deferred = Q.defer<Foo>();
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function bar(): Q.Promise<Foo> {
|
||||
return nestedBar()
|
||||
.then((foo:Foo) => {
|
||||
console.log("Lorem ipsum");
|
||||
})
|
||||
.fail((error) => {
|
||||
console.log("Intermediate error handling");
|
||||
|
||||
/*
|
||||
* Cannot do this, because:
|
||||
* error TS2322: Type 'Promise<void>' is not assignable to type 'Promise<Foo>'
|
||||
*/
|
||||
//throw error;
|
||||
|
||||
return Q.reject<Foo>(error);
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
bar()
|
||||
.finally(() => {
|
||||
console.log("Cleanup")
|
||||
})
|
||||
.done()
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,18 +3,11 @@
|
||||
// Definitions by: Barrie Nemetchek <https://github.com/bnemetchek>, Andrew Gaspar <https://github.com/AndrewGaspar/>, John Reilly <https://github.com/johnnyreilly>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
/**
|
||||
* If value is a Q promise, returns the promise.
|
||||
* If value is a promise from another library it is coerced into a Q promise (where possible).
|
||||
*/
|
||||
declare function Q<T>(promise: Q.IPromise<T>): Q.Promise<T>;
|
||||
/**
|
||||
* If value is a Q promise, returns the promise.
|
||||
* If value is a promise from another library it is coerced into a Q promise (where possible).
|
||||
*/
|
||||
declare function Q<T>(promise: JQueryPromise<T>): Q.Promise<T>;
|
||||
/**
|
||||
* If value is not a promise, returns a promise that is fulfilled with value.
|
||||
*/
|
||||
@@ -74,8 +67,8 @@ declare module Q {
|
||||
*/
|
||||
spread<U>(onFulfilled: Function, onRejected?: Function): Promise<U>;
|
||||
|
||||
fail<U>(onRejected: (reason: any) => U): Promise<U>;
|
||||
fail<U>(onRejected: (reason: any) => IPromise<U>): Promise<U>;
|
||||
fail<U>(onRejected: (reason: any) => U): Promise<U>;
|
||||
/**
|
||||
* A sugar method, equivalent to promise.then(undefined, onRejected).
|
||||
*/
|
||||
@@ -188,6 +181,9 @@ declare module Q {
|
||||
reason?: any;
|
||||
}
|
||||
|
||||
// If no value provided, returned promise will be of void type
|
||||
export function when(): Promise<void>;
|
||||
|
||||
// if no fulfill, reject, or progress provided, returned promise will be of same type
|
||||
export function when<T>(value: IPromise<T>): Promise<T>;
|
||||
export function when<T>(value: T): Promise<T>;
|
||||
@@ -329,7 +325,7 @@ declare module Q {
|
||||
/**
|
||||
* Returns a promise that is rejected with reason.
|
||||
*/
|
||||
export function reject(reason?: any): Promise<any>;
|
||||
export function reject<T>(reason?: any): Promise<T>;
|
||||
|
||||
export function Promise<T>(resolver: (resolve: (val: IPromise<T>) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise<T>;
|
||||
export function Promise<T>(resolver: (resolve: (val: T) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise<T>;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/// <reference path="./rest.d.ts" />
|
||||
|
||||
import rest = require('rest');
|
||||
import mime = require('rest/interceptor/mime');
|
||||
import errorCode = require('rest/interceptor/errorCode');
|
||||
import registry = require('rest/mime/registry');
|
||||
|
||||
rest('/').then(function(response) {
|
||||
console.log('response: ', response);
|
||||
});
|
||||
|
||||
|
||||
var client = rest.wrap(mime);
|
||||
client({ path: '/data.json' }).then(function(response) {
|
||||
console.log('response: ', response);
|
||||
});
|
||||
|
||||
client = rest.wrap(mime).wrap(errorCode, { code: 500 });
|
||||
client({ path: '/data.json' }).then(
|
||||
function(response) {
|
||||
console.log('response: ', response);
|
||||
},
|
||||
function(response) {
|
||||
console.error('response error: ', response);
|
||||
}
|
||||
);
|
||||
|
||||
registry.register('application/vnd.com.example', {
|
||||
read: function(str: string) {
|
||||
var obj: any;
|
||||
// do string to object conversions
|
||||
return obj;
|
||||
},
|
||||
write: function(obj: any) {
|
||||
var str: string;
|
||||
// do object to string conversions
|
||||
return str;
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
// Type definitions for rest.js v1.2.0
|
||||
// Project: https://github.com/cujojs/rest
|
||||
// Definitions by: Wim Looman <https://github.com/Nemo157>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../when/when.d.ts" />
|
||||
|
||||
declare module "rest" {
|
||||
import when = require("when");
|
||||
|
||||
export = rest;
|
||||
|
||||
function rest(path: string): rest.ResponsePromise;
|
||||
function rest(request: rest.Request): rest.ResponsePromise;
|
||||
|
||||
module rest {
|
||||
export function wrap(interceptor: Interceptor): Client;
|
||||
|
||||
export interface Request {
|
||||
method?: string;
|
||||
path?: string;
|
||||
params?: any;
|
||||
headers?: any;
|
||||
entity?: any;
|
||||
}
|
||||
|
||||
export interface Status {
|
||||
code: number;
|
||||
text?: string;
|
||||
}
|
||||
|
||||
export interface Headers {
|
||||
[index: string]: any // string or string[]
|
||||
}
|
||||
|
||||
export interface Response {
|
||||
request: Request;
|
||||
raw: any;
|
||||
status: Status;
|
||||
headers: Headers;
|
||||
entity: any;
|
||||
}
|
||||
|
||||
export interface ResponsePromise extends when.Promise<Response> {
|
||||
entity(): when.Promise<any>;
|
||||
status(): when.Promise<number>;
|
||||
headers(): when.Promise<Headers>;
|
||||
header(headerName: string): when.Promise<any>; // string or string[]
|
||||
}
|
||||
|
||||
export interface Interceptor {
|
||||
(parent?: Client, config?: any): Client;
|
||||
}
|
||||
|
||||
export interface Client {
|
||||
(path: string): ResponsePromise;
|
||||
(request: Request): ResponsePromise;
|
||||
|
||||
skip(): Client;
|
||||
wrap(interceptor: Interceptor, config?: any): Client;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "rest/interceptor/errorCode" {
|
||||
import rest = require("rest");
|
||||
|
||||
var errorCode: rest.Interceptor;
|
||||
|
||||
export = errorCode;
|
||||
}
|
||||
|
||||
declare module "rest/interceptor/mime" {
|
||||
import rest = require("rest");
|
||||
|
||||
var mime: rest.Interceptor;
|
||||
|
||||
export = mime;
|
||||
}
|
||||
|
||||
declare module "rest/mime/registry" {
|
||||
import when = require("when");
|
||||
|
||||
export interface MIMEConverter {
|
||||
read(value: string): any; // any or when.Promise<any>;
|
||||
write(value: any): any; // string or when.Promise<string>;
|
||||
}
|
||||
|
||||
export function lookup(mimeType: string): when.Promise<MIMEConverter>;
|
||||
|
||||
export function register(mimeType: string, converter: MIMEConverter): void;
|
||||
}
|
||||
Vendored
+3
-3
@@ -7241,7 +7241,7 @@ declare module SP {
|
||||
}
|
||||
|
||||
export class Status {
|
||||
static addStatus(strTitle: string, strHtml: string, atBegining: boolean): string;
|
||||
static addStatus(strTitle: string, strHtml?: string, atBegining?: boolean): string;
|
||||
static appendStatus(sid: string, strTitle: string, strHtml: string): string;
|
||||
static updateStatus(sid: string, strHtml: string): void;
|
||||
static setStatusPriColor(sid: string, strColor: string): void;
|
||||
@@ -8410,11 +8410,11 @@ declare module SP.WorkflowServices {
|
||||
/** RestrictToScope is a GUID value, used in conjunction with the RestrictToType property to further restrict the scope of the definition.
|
||||
For example, if the RestrictToType is "List", then setting the RestrictToScope to a particular list identifier limits the definition to be associable only to the specified list.
|
||||
If the RestrictToType is "List" but the RestrictToScope is null or the empty string, then the definition is associable to any list. */
|
||||
get_restrictScope(): string;
|
||||
get_restrictToScope(): string;
|
||||
/** RestrictToScope is a GUID value, used in conjunction with the RestrictToType property to further restrict the scope of the definition.
|
||||
For example, if the RestrictToType is "List", then setting the RestrictToScope to a particular list identifier limits the definition to be associable only to the specified list.
|
||||
If the RestrictToType is "List" but the RestrictToScope is null or the empty string, then the definition is associable to any list. */
|
||||
set_restrictScope(value: string): string;
|
||||
set_restrictToScope(value: string): string;
|
||||
/** RestrictToType determines the possible event source type for a workflow subscription that uses this definition.
|
||||
Possible values include "List", "Site", the empty string, or null. */
|
||||
get_restrictToType(): string;
|
||||
|
||||
Vendored
+2
-1
@@ -1500,7 +1500,8 @@ declare module Slick {
|
||||
public fastSort(field: string, ascending: boolean): void;
|
||||
public fastSort(field: Function, ascending: boolean): void; // todo: typeof(field), should be the same callback as Array.sort
|
||||
public reSort(): void;
|
||||
public setGrouping(groupingInfo: GroupingOptions<T>[]): void;
|
||||
public setGrouping(groupingInfos: GroupingOptions<T>[]): void;
|
||||
public setGrouping(groupingInfo: GroupingOptions<T>): void;
|
||||
public getGrouping(): GroupingOptions<T>[];
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
//Copied from the snap homepage http://snapsvg.io/
|
||||
|
||||
///<reference path="snapsvg.d.ts"/>
|
||||
// First lets create our drawing surface out of existing SVG element
|
||||
// If you want to create new surface just provide dimensions
|
||||
// like s = Snap(800, 600);
|
||||
var s = Snap("#svg");
|
||||
// Lets create big circle in the middle:
|
||||
var bigCircle = s.circle(150, 150, 100);
|
||||
// By default its black, lets change its attributes
|
||||
bigCircle.attr({
|
||||
fill: "#bada55",
|
||||
stroke: "#000",
|
||||
strokeWidth: 5
|
||||
});
|
||||
// Now lets create another small circle:
|
||||
var smallCircle = s.circle(100, 150, 70);
|
||||
// Lets put this small circle and another one into a group:
|
||||
var discs = s.group(smallCircle, s.circle(200, 150, 70));
|
||||
// Now we can change attributes for the whole group
|
||||
discs.attr({
|
||||
fill: "#fff"
|
||||
});
|
||||
// Now more interesting stuff
|
||||
// Lets assign this group as a mask for our big circle
|
||||
bigCircle.attr({
|
||||
mask: discs
|
||||
});
|
||||
// Despite our small circle now is a part of a group
|
||||
// and a part of a mask we could still access it:
|
||||
smallCircle.animate({ r: 50 }, 1000);
|
||||
// We don’t have reference for second small circle,
|
||||
// but we could easily grab it with CSS selectors:
|
||||
discs.select("circle:nth-child(2)").animate({ r: 50 }, 1000);
|
||||
// Now lets create pattern
|
||||
var p = s.path("M10-5-10,15M15,0,0,15M0-5-20,15").attr({
|
||||
fill: "none",
|
||||
stroke: "#bada55",
|
||||
strokeWidth: 5
|
||||
});
|
||||
// To create pattern,
|
||||
// just specify dimensions in pattern method:
|
||||
p = p.pattern(0, 0, 10, 10);
|
||||
// Then use it as a fill on big circle
|
||||
bigCircle.attr({
|
||||
fill: p
|
||||
});
|
||||
// We could also grab pattern from SVG
|
||||
// already embedded into our page
|
||||
discs.attr({
|
||||
fill: Snap("#pattern")
|
||||
});
|
||||
// Lets change fill of circles to gradient
|
||||
// This string means relative radial gradient
|
||||
// from white to black
|
||||
discs.attr({ fill: "r()#fff-#000" });
|
||||
// Note that you have two gradients for each circle
|
||||
// If we want them to share one gradient,
|
||||
// we need to use absolute gradient with capital R
|
||||
discs.attr({ fill: "R(150, 150, 100)#fff-#000" });
|
||||
// Of course we could animate color as well
|
||||
p.select("path").animate({ stroke: "#f00" }, 1000);
|
||||
// Now lets load external SVG file:
|
||||
Snap.load("mascot.svg", function (f:Snap.Fragment) {
|
||||
// Note that we traversre and change attr before SVG
|
||||
// is even added to the page
|
||||
f.selectAll("polygon[fill='#09B39C']").attr({ fill: "#bada55" });
|
||||
var g = f.select("g");
|
||||
s.append(g);
|
||||
// Making croc draggable. Go ahead drag it around!
|
||||
g.drag();
|
||||
// Obviously drag could take event handlers too
|
||||
// That’s better! selectAll for the rescue.
|
||||
});
|
||||
// Writing text as simple as:
|
||||
s.text(200, 100, "Snap.svg");
|
||||
// Provide an array of strings (or arrays), to generate tspans
|
||||
var t = s.text(200, 120, ["Snap", ".", "svg"]);
|
||||
t.selectAll("tspan:nth-child(3)").attr({
|
||||
fill: "#900",
|
||||
"font-size": "20px"
|
||||
});
|
||||
|
||||
Vendored
+289
@@ -0,0 +1,289 @@
|
||||
// Type definitions for Snap-SVG 0.3
|
||||
// Project: https://github.com/adobe-webplatform/Snap.svg
|
||||
// Definitions by: Lars Klein <https://github.com/lhk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare function mina(a:number, A:number, b:number, B:number, get:Function, set:Function, easing?:Function):Object;
|
||||
declare module mina {
|
||||
export interface Mina {
|
||||
id: string;
|
||||
duration: Function;
|
||||
easing: Function;
|
||||
speed: Function;
|
||||
status: Function;
|
||||
stop: Function;
|
||||
}
|
||||
|
||||
export function backin(n:number):number;
|
||||
export function backout(n:number):number;
|
||||
export function bounce(n:number):number;
|
||||
export function easein(n:number):number;
|
||||
export function easeinout(n:number):number;
|
||||
export function easeout(n:number):number;
|
||||
export function elastic(n:number):number;
|
||||
export function getById(id:string):Object;
|
||||
export function linear(n:number):number;
|
||||
export function time():number;
|
||||
}
|
||||
|
||||
declare function Snap(width:number,height:number):Snap.Paper;
|
||||
declare function Snap(query:string):Snap.Paper;
|
||||
declare function Snap(DOM:SVGElement):Snap.Paper;
|
||||
|
||||
declare module Snap {
|
||||
|
||||
export var filter:Filter;
|
||||
export var path:Path;
|
||||
|
||||
export function Matrix(a:number,b:number,c:number,d:number,e:number,f:number):Matrix;
|
||||
export function Matrix(svgMatrix:SVGMatrix):Matrix;
|
||||
|
||||
export function ajax(url:string,postData:string,callback:Function,scope?:Object):XMLHttpRequest;
|
||||
export function ajax(url:string,postData:Object,callback:Function,scope?:Object):XMLHttpRequest;
|
||||
export function ajax(url:string,callback:Function,scope?:Object):XMLHttpRequest;
|
||||
export function format(token:string,json:Object):string;
|
||||
export function fragment(varargs:any):Fragment;
|
||||
export function getElementByPoint(x:number,y:number):Object;
|
||||
export function is(o:any,type:string):boolean;
|
||||
export function load(url:string,callback:Function,scope?:Object):void;
|
||||
export function plugin(f:Function):void;
|
||||
export function select(query:string):Snap.Element;
|
||||
export function selectAll(query:string):any;
|
||||
export function snapTo(values:Array<number>,value:number,tolerance?:number):number;
|
||||
|
||||
export function animate(from:number,to:number,setter:Function,duration:number,easing:Function,callback:Function):mina.Mina;
|
||||
export function animate(from:Array<number>,to:number,setter:Function,duration:number,easing:Function,callback:Function):mina.Mina;
|
||||
export function animate(from:number,to:Array<number>,setter:Function,duration:number,easing:Function,callback:Function):mina.Mina;
|
||||
export function animate(from:Array<number>,to:Array<number>,setter:Function,duration:number,easing:Function,callback:Function):mina.Mina;
|
||||
export function animation(attr:Object,duration:number,easing?:Function,callback?:Function):Object;
|
||||
|
||||
export function color(clr:string):Object;export function getRGB(color:string):Object;
|
||||
export function hsb(h:number,s:number,b:number):HSB;
|
||||
export function hsl(h:number,s:number,l:number):HSL;
|
||||
export function rgb(r:number,g:number,b:number):RGB;
|
||||
export function hsb2rgb(h:number,s:number,v:number):RGB;
|
||||
export function hsl2rgb(h:number,s:number,l:number):RGB;
|
||||
export function rgb2hsb(r:number,g:number,b:number):HSB;
|
||||
export function rgb2hsl(r:number,g:number,b:number):HSL;
|
||||
|
||||
export function angle(x1:number,y1:number,x2:number,y2:number,x3?:number,y3?:number):number;
|
||||
export function rad(deg:number):number;
|
||||
export function deg(rad:number):number;
|
||||
|
||||
export function parse(svg:string):Fragment;
|
||||
export function parsePathString(pathString:string):Array<any>;
|
||||
export function parsePathString(pathString:Array<string>):Array<any>;
|
||||
export function parseTransformString(TString:string):Array<any>;
|
||||
export function parseTransformString(TString:Array<string>):Array<any>;
|
||||
|
||||
export interface RGB{
|
||||
r:number;
|
||||
g:number;
|
||||
b:number;
|
||||
hex:string;
|
||||
}
|
||||
|
||||
export interface HSB{
|
||||
h:number;
|
||||
s:number;
|
||||
b:number;
|
||||
}
|
||||
export interface HSL{
|
||||
h:number;
|
||||
s:number;
|
||||
l:number;
|
||||
}
|
||||
|
||||
export interface BBox{
|
||||
cx:number;
|
||||
cy:number;
|
||||
h:number;
|
||||
height:number;
|
||||
path:number;
|
||||
r0:number;
|
||||
r1:number;
|
||||
r2:number;
|
||||
vb:string;
|
||||
w:number;
|
||||
width:number;
|
||||
x2:number;
|
||||
x:number;
|
||||
y2:number;
|
||||
y:number;
|
||||
}
|
||||
|
||||
export interface Element {
|
||||
add():void;
|
||||
addClass(value:string):Snap.Element;
|
||||
after(el:Snap.Element):Snap.Element;
|
||||
animate(attrs:Object,duration:number,easing?:Function,callback?:Function):Snap.Element;
|
||||
animate(animation:any):Snap.Element;
|
||||
append(el:Snap.Element):Snap.Element;
|
||||
appendTo(el:Snap.Element):Snap.Element;
|
||||
asPX(attr:string,value?:string):Snap.Element;
|
||||
attr(params:Object):Snap.Element;
|
||||
attr(param:string):string;
|
||||
before(el:Snap.Element):Snap.Element;
|
||||
clone():Snap.Element;
|
||||
data(key:string,value?:any):any;
|
||||
getBBox():BBox;
|
||||
getPointAtLength(length:number):Object;
|
||||
getSubpath(from:number,to:number):string;
|
||||
getTotalLength():number;
|
||||
hasClass(value:string):boolean;
|
||||
inAnim():Object;
|
||||
innerSVG():string;
|
||||
insertAfter(el:Snap.Element):Snap.Element;
|
||||
insertBefore(el:Snap.Element):Snap.Element;
|
||||
marker(x:number,y:number,width:number,height:number,refX:number,refY:number):Snap.Element;
|
||||
node:Element;
|
||||
outerSVG():string;
|
||||
parent():Snap.Element;
|
||||
pattern(x:any,y:any,width:any,height:any):Snap.Element;
|
||||
prepend(el:Snap.Element):Snap.Element;
|
||||
prependTo(el:Snap.Element):Snap.Element;
|
||||
remove():Snap.Element;
|
||||
removeClass(value:string):Snap.Element;
|
||||
removeData(key?:string):Snap.Element;
|
||||
select(query:string):Snap.Element;
|
||||
selectAll(query: string): Snap.Set;
|
||||
selectAll(): Snap.Set;
|
||||
stop():Snap.Element;
|
||||
toDefs():Snap.Element;
|
||||
toPattern(x:number,y:number,width:number,height:number):Object;
|
||||
toPattern(x:string,y:string,width:string,height:string):Object;
|
||||
toString():string;
|
||||
toggleClass(value:string,flag:boolean):Snap.Element;
|
||||
transform(tstr:string):any;
|
||||
type:string;
|
||||
use():Object;
|
||||
|
||||
click(handler:Function):Snap.Element;
|
||||
unclick(handler:Function):Snap.Element;
|
||||
dblclick(handler:Function):Snap.Element;
|
||||
undblclick(handler:Function):Snap.Element;
|
||||
mousedown(handler:Function):Snap.Element;
|
||||
unmousedown(handler:Function):Snap.Element;
|
||||
mousemove(handler:Function):Snap.Element;
|
||||
unmousemove(handler:Function):Snap.Element;
|
||||
mouseout(handler:Function):Snap.Element;
|
||||
unmouseout(handler:Function):Snap.Element;
|
||||
mouseover(handler:Function):Snap.Element;
|
||||
unmouseover(handler:Function):Snap.Element;
|
||||
mouseup(handler:Function):Snap.Element;
|
||||
unmouseup(handler:Function):Snap.Element;
|
||||
touchstart(handler:Function):Snap.Element;
|
||||
untouchstart(handler:Function):Snap.Element;
|
||||
touchmove(handler:Function):Snap.Element;
|
||||
untouchmove(handler:Function):Snap.Element;
|
||||
touchend(handler:Function):Snap.Element;
|
||||
untouchend(handler:Function):Snap.Element;
|
||||
touchcancel(handler:Function):Snap.Element;
|
||||
untouchcancel(handler:Function):Snap.Element;
|
||||
hover(f_in:Function,f_out:Function,icontext?:Object,ocontext?:Object):Snap.Element;
|
||||
unhover(f_in: Function, f_out: Function): Snap.Element;
|
||||
drag(): void;
|
||||
drag(onmove:Function,onstart:Function,onend:Function,mcontext?:Object,scontext?:Object,econtext?:Object):Snap.Element;
|
||||
undrag():Snap.Element;
|
||||
}
|
||||
|
||||
export interface Fragment {
|
||||
//TODO: The documentation says that selectAll returns a set, but the getting started guide
|
||||
// uses .attr on the returned object. That's not supported by a set
|
||||
select(query:string):Snap.Element;
|
||||
selectAll(query:string):Snap.Set;
|
||||
selectAll():Snap.Set;
|
||||
}
|
||||
|
||||
export interface Matrix {
|
||||
add(a:number,b:number,c:number,d:number,e:number,f:number):void;
|
||||
add(matrix:Matrix):void;
|
||||
clone():Matrix;
|
||||
determinant():number;
|
||||
invert():Matrix;
|
||||
rotate(a:number,x:number,y:number):void;
|
||||
scale(x:number,y?:number,cx?:number,cy?:number):void;
|
||||
split():Object;
|
||||
toTransformString():string;
|
||||
translate(x:number,y:number):void;
|
||||
x(x:number,y:number):number;
|
||||
y(x:number,y:number):number;
|
||||
|
||||
}
|
||||
|
||||
interface Paper extends Snap.Element {
|
||||
|
||||
clear():void;
|
||||
el(name:string, attr:Object):Snap.Element;
|
||||
gradient(gradient:string):any;
|
||||
g(varargs:any):Object;
|
||||
group(el:any,...els:any[]):any;
|
||||
mask(varargs:any):Object;
|
||||
ptrn(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
svg(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
toString():string;
|
||||
use(id?:string):Object;
|
||||
use(id?:Snap.Element):Object;
|
||||
|
||||
circle(x:number,y:number,r:number):Snap.Element;
|
||||
ellipse(x:number,y:number,rx:number,ry:number):Snap.Element;
|
||||
image(src:string,x:number,y:number,width:number,height:number):Snap.Element;
|
||||
line(x1:number,y1:number,x2:number,y2:number):Snap.Element;
|
||||
path(pathString?:string):Snap.Element;
|
||||
polygon(varargs:any[]):Snap.Element;
|
||||
polyline(varargs:any[]):Snap.Element;
|
||||
rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element;
|
||||
text(x:number,y:number,text:string):Snap.Element;
|
||||
text(x:number,y:number,text:Array<string>):Snap.Element;
|
||||
}
|
||||
|
||||
export interface Set {
|
||||
animate(attrs:Object,duration:number,easing?:Function,callback?:Function):Snap.Element;
|
||||
attr(params: Object): Snap.Element;
|
||||
attr(param: string): string;
|
||||
bind(attr: string, callback: Function): Snap.Set;
|
||||
bind(attr:string,element:Snap.Element):Snap.Set;
|
||||
bind(attr:string,element:Snap.Element,eattr:string):Snap.Set;
|
||||
clear():Snap.Set;
|
||||
exclude(element:Snap.Element):boolean;
|
||||
forEach(callback:Function,thisArg?:Object):Snap.Set;
|
||||
pop():Snap.Element;
|
||||
push(el:Snap.Element):Snap.Element;
|
||||
push(els:Snap.Element[]):Snap.Element;
|
||||
splice(index:number,count:number,insertion?:Object[]):Snap.Element[];
|
||||
}
|
||||
|
||||
interface Filter {
|
||||
blur(x:number,y?:number):string;
|
||||
brightness(amount:number):string;
|
||||
contrast(amount:number):string;
|
||||
grayscale(amount:number):string;
|
||||
hueRotate(angle:number):string;
|
||||
invert(amount:number):string;
|
||||
saturate(amount:number):string;
|
||||
sepia(amount:number):string;
|
||||
shadow(dx:number,dy:number,blur?:number,color?:string,opacity?:number):string;
|
||||
}
|
||||
|
||||
interface Path {
|
||||
bezierBBox(...args:number[]):Object;
|
||||
bezierBBox(bez:Array<number>):Object;
|
||||
findDotsAtSegment(p1x:number,p1y:number,c1x:number,
|
||||
c1y:number,c2x:number,c2y:number,
|
||||
p2x:number,p2y:number,t:number):Object;
|
||||
getBBox(path:string):Object;
|
||||
getPointAtLength(path:string,length:number):Object;
|
||||
getSubpath(path:string,from:number,to:number):string;
|
||||
getTotalLength(path:string):number;
|
||||
intersection(path1:string,path2:string):Array<any>;
|
||||
isBBoxIntersect(bbox1:string,bbox2:string):boolean
|
||||
isPointInside(path:string,x:number,y:number):boolean;
|
||||
isPointInsideBBox(bbox:string,x:string,y:string):boolean;
|
||||
map(path:string,matrix:Snap.Matrix):string;
|
||||
map(path:string,matrix:Object):string;
|
||||
toAbsolute(path:string):Array<any>;
|
||||
toCubic(pathString:string):Array<any>;
|
||||
toCubic(pathString:Array<string>):Array<any>;
|
||||
toRelative(path:string):Array<any>;
|
||||
}
|
||||
}
|
||||
Vendored
+12
-4
@@ -3674,7 +3674,7 @@ declare module THREE {
|
||||
/**
|
||||
* Adds v to this vector.
|
||||
*/
|
||||
add(a: Object): Vector3;
|
||||
add(a: Vector): Vector3;
|
||||
addScalar(s: number): Vector3;
|
||||
|
||||
/**
|
||||
@@ -5434,7 +5434,7 @@ declare module THREE {
|
||||
};
|
||||
}
|
||||
|
||||
export class PlaneBufferGeometry extends Geometry {
|
||||
export class PlaneBufferGeometry extends BufferGeometry {
|
||||
constructor(width: number, height: number, widthSegments?: number, heightSegments?: number);
|
||||
|
||||
parameters: {
|
||||
@@ -5445,7 +5445,15 @@ declare module THREE {
|
||||
};
|
||||
}
|
||||
|
||||
export class PlaneGeometry extends PlaneBufferGeometry {
|
||||
export class PlaneGeometry extends Geometry {
|
||||
constructor(width: number, height: number, widthSegments?: number, heightSegments?: number);
|
||||
|
||||
parameters: {
|
||||
width: number;
|
||||
height: number;
|
||||
widthSegments: number;
|
||||
heightSegments: number;
|
||||
};
|
||||
}
|
||||
|
||||
export class PolyhedronGeometry extends Geometry {
|
||||
@@ -5759,4 +5767,4 @@ declare module THREE {
|
||||
|
||||
declare module 'three' {
|
||||
export=THREE;
|
||||
}
|
||||
}
|
||||
|
||||
+1207
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,205 @@
|
||||
/// <reference path="timezonecomplete-1.9.0.d.ts" />
|
||||
|
||||
import tc = require("timezonecomplete-1.9.0");
|
||||
|
||||
var b: boolean;
|
||||
var n: number;
|
||||
var s: string;
|
||||
var w: tc.WeekDay;
|
||||
|
||||
n = tc.timeUnitToMilliseconds(tc.TimeUnit.Month);
|
||||
b = tc.isLeapYear(2014);
|
||||
n = tc.daysInMonth(2014, 10);
|
||||
n = tc.daysInYear(2014);
|
||||
n = tc.dayOfYear(2014, 1, 2);
|
||||
w = tc.firstWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday);
|
||||
w = tc.lastWeekDayOfMonth(2014, 1, tc.WeekDay.Sunday);
|
||||
n = tc.weekDayOnOrAfter(2014, 1, 14, tc.WeekDay.Monday);
|
||||
n = tc.weekDayOnOrBefore(2014, 1, 14, tc.WeekDay.Monday);
|
||||
n = tc.secondOfDay(13, 59, 59);
|
||||
n = tc.weekOfMonth(2014, 1, 1);
|
||||
|
||||
// DURATION
|
||||
|
||||
var d: tc.Duration;
|
||||
var d1: tc.Duration = tc.Duration.hours(24);
|
||||
var d2: tc.Duration = tc.Duration.minutes(24);
|
||||
var d3: tc.Duration = tc.Duration.seconds(24);
|
||||
var d4: tc.Duration = tc.Duration.milliseconds(24);
|
||||
var d5: tc.Duration = new tc.Duration(24);
|
||||
var d6: tc.Duration = new tc.Duration("00:01");
|
||||
var d7: tc.Duration = d6.clone();
|
||||
var d8: tc.Duration = new tc.Duration(4, tc.TimeUnit.Second);
|
||||
|
||||
n = d7.wholeHours();
|
||||
n = d7.hours();
|
||||
n = d7.minutes();
|
||||
n = d7.minute();
|
||||
n = d7.seconds();
|
||||
n = d7.second();
|
||||
n = d7.milliseconds();
|
||||
n = d7.millisecond();
|
||||
s = d7.sign();
|
||||
b = d7.lessThan(d6);
|
||||
b = d7.greaterThan(d6);
|
||||
d = d7.min(d6);
|
||||
d = d7.max(d6);
|
||||
d = d7.multiply(3);
|
||||
d = d7.divide(0.3);
|
||||
d = d7.add(d6);
|
||||
d = d7.sub(d6);
|
||||
s = d7.toString();
|
||||
|
||||
// TIMEZONE
|
||||
|
||||
var t: tc.TimeZone;
|
||||
var k: tc.TimeZoneKind;
|
||||
|
||||
t = tc.TimeZone.local();
|
||||
t = tc.TimeZone.utc();
|
||||
t = tc.TimeZone.zone(2);
|
||||
t = tc.TimeZone.zone("+01:00");
|
||||
s = t.name();
|
||||
k = t.kind();
|
||||
b = t.equals(t);
|
||||
b = t.isUtc();
|
||||
n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123);
|
||||
n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123);
|
||||
n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get);
|
||||
n = t.offsetForZoneDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.GetUTC);
|
||||
s = t.toString();
|
||||
s = tc.TimeZone.offsetToString(2);
|
||||
n = tc.TimeZone.stringToOffset("+00:01");
|
||||
|
||||
// REALTIMESOURCE
|
||||
|
||||
var date: Date = (new tc.RealTimeSource()).now();
|
||||
|
||||
// DATETIME
|
||||
|
||||
var dt: tc.DateTime;
|
||||
|
||||
var ts: tc.TimeSource = tc.DateTime.timeSource;
|
||||
|
||||
dt = tc.DateTime.nowLocal();
|
||||
dt = tc.DateTime.nowUtc();
|
||||
dt = tc.DateTime.now(tc.TimeZone.local());
|
||||
dt = new tc.DateTime();
|
||||
dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC");
|
||||
dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc());
|
||||
dt = new tc.DateTime(date, tc.DateFunctions.Get);
|
||||
dt = new tc.DateTime(date, tc.DateFunctions.Get, tc.TimeZone.utc());
|
||||
dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123);
|
||||
dt = new tc.DateTime(2014, 1, 1, 13, 5, 1, 123, tc.TimeZone.utc());
|
||||
dt = new tc.DateTime(89949284);
|
||||
dt = new tc.DateTime(89949284, tc.TimeZone.utc());
|
||||
dt = dt.clone();
|
||||
t = dt.zone();
|
||||
n = dt.offset();
|
||||
n = dt.year();
|
||||
n = dt.month();
|
||||
n = dt.day();
|
||||
n = dt.hour();
|
||||
n = dt.minute();
|
||||
n = dt.second();
|
||||
n = dt.weekNumber();
|
||||
n = dt.weekOfMonth();
|
||||
n = dt.secondOfDay();
|
||||
n = dt.dayOfYear();
|
||||
n = dt.millisecond();
|
||||
n = dt.unixUtcMillis();
|
||||
n = dt.utcYear();
|
||||
n = dt.utcMonth();
|
||||
n = dt.utcDay();
|
||||
n = dt.utcHour();
|
||||
n = dt.utcMinute();
|
||||
n = dt.utcSecond();
|
||||
n = dt.utcMillisecond();
|
||||
n = dt.utcWeekNumber();
|
||||
n = dt.utcWeekOfMonth();
|
||||
n = dt.utcSecondOfDay();
|
||||
n = dt.utcDayOfYear();
|
||||
s = dt.format("%Y-%m-%d");
|
||||
dt.convert(tc.TimeZone.local());
|
||||
dt = dt.toZone(tc.TimeZone.utc());
|
||||
date = dt.toDate();
|
||||
dt = dt.add(tc.Duration.seconds(2));
|
||||
dt = dt.add(2, tc.TimeUnit.Year);
|
||||
dt = dt.add(2, tc.TimeUnit.Month);
|
||||
dt = dt.add(2, tc.TimeUnit.Week);
|
||||
dt = dt.add(2, tc.TimeUnit.Day);
|
||||
dt = dt.add(2, tc.TimeUnit.Hour);
|
||||
dt = dt.add(2, tc.TimeUnit.Minute);
|
||||
dt = dt.add(2, tc.TimeUnit.Second);
|
||||
dt = dt.addLocal(2, tc.TimeUnit.Second);
|
||||
dt = dt.sub(tc.Duration.seconds(2));
|
||||
dt = dt.sub(2, tc.TimeUnit.Year);
|
||||
dt = dt.sub(2, tc.TimeUnit.Month);
|
||||
dt = dt.sub(2, tc.TimeUnit.Week);
|
||||
dt = dt.sub(2, tc.TimeUnit.Day);
|
||||
dt = dt.sub(2, tc.TimeUnit.Hour);
|
||||
dt = dt.sub(2, tc.TimeUnit.Minute);
|
||||
dt = dt.sub(2, tc.TimeUnit.Second);
|
||||
dt = dt.subLocal(2, tc.TimeUnit.Second);
|
||||
d = dt.diff(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.lessThan(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.lessEqual(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.greaterThan(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
b = dt.greaterEqual(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
dt = dt.min(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
dt = dt.max(new tc.DateTime(9289234, tc.TimeZone.local()));
|
||||
s = dt.toIsoString();
|
||||
s = dt.toString();
|
||||
s = dt.toUtcString();
|
||||
|
||||
var wd: tc.WeekDay;
|
||||
wd = dt.weekDay();
|
||||
wd = dt.utcWeekDay();
|
||||
|
||||
// PERIOD
|
||||
|
||||
s = tc.periodDstToString(tc.PeriodDst.RegularIntervals);
|
||||
s = tc.periodDstToString(tc.PeriodDst.RegularLocalTime);
|
||||
|
||||
var p: tc.Period;
|
||||
|
||||
p = new tc.Period(tc.DateTime.nowLocal(), 1, tc.TimeUnit.Hour, tc.PeriodDst.RegularLocalTime);
|
||||
dt = p.start();
|
||||
n = p.amount();
|
||||
var tu: tc.TimeUnit = p.unit();
|
||||
var pd: tc.PeriodDst = p.dst();
|
||||
dt = p.findFirst(tc.DateTime.nowLocal());
|
||||
dt = p.findNext(dt);
|
||||
s = p.toIsoString();
|
||||
s = p.toString();
|
||||
b = p.isBoundary(dt);
|
||||
|
||||
|
||||
// GLOBALS
|
||||
d = tc.min(tc.Duration.seconds(2), tc.Duration.seconds(3));
|
||||
d = tc.max(tc.Duration.seconds(2), tc.Duration.seconds(3));
|
||||
|
||||
dt = tc.min(new tc.DateTime(2), new tc.DateTime(3));
|
||||
dt = tc.max(new tc.DateTime(2), new tc.DateTime(3));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,10 +26,14 @@ var d1: tc.Duration = tc.Duration.hours(24);
|
||||
var d2: tc.Duration = tc.Duration.minutes(24);
|
||||
var d3: tc.Duration = tc.Duration.seconds(24);
|
||||
var d4: tc.Duration = tc.Duration.milliseconds(24);
|
||||
var d5: tc.Duration = new tc.Duration(24);
|
||||
var d6: tc.Duration = new tc.Duration("00:01");
|
||||
var d7: tc.Duration = d6.clone();
|
||||
var d8: tc.Duration = new tc.Duration(4, tc.TimeUnit.Second);
|
||||
var d5: tc.Duration = tc.hours(24);
|
||||
var d6: tc.Duration = tc.minutes(24);
|
||||
var d7: tc.Duration = tc.seconds(24);
|
||||
var d8: tc.Duration = tc.milliseconds(24);
|
||||
var d9: tc.Duration = new tc.Duration(24);
|
||||
var d10: tc.Duration = new tc.Duration("00:01");
|
||||
var d11: tc.Duration = d6.clone();
|
||||
var d12: tc.Duration = new tc.Duration(4, tc.TimeUnit.Second);
|
||||
|
||||
n = d7.wholeHours();
|
||||
n = d7.hours();
|
||||
@@ -59,10 +63,16 @@ t = tc.TimeZone.local();
|
||||
t = tc.TimeZone.utc();
|
||||
t = tc.TimeZone.zone(2);
|
||||
t = tc.TimeZone.zone("+01:00");
|
||||
t = tc.local();
|
||||
t = tc.utc();
|
||||
t = tc.zone(2);
|
||||
t = tc.zone("+01:00");
|
||||
t = tc.zone("Europe/Amsterdam", false);
|
||||
s = t.name();
|
||||
k = t.kind();
|
||||
b = t.equals(t);
|
||||
b = t.isUtc();
|
||||
b = t.dst();
|
||||
n = t.offsetForUtc(2014, 1, 1, 13, 0, 5, 123);
|
||||
n = t.offsetForZone(2014, 1, 1, 13, 0, 5, 123);
|
||||
n = t.offsetForUtcDate(new Date(2014, 1, 1, 13, 0, 5, 123), tc.DateFunctions.Get);
|
||||
@@ -84,6 +94,9 @@ var ts: tc.TimeSource = tc.DateTime.timeSource;
|
||||
dt = tc.DateTime.nowLocal();
|
||||
dt = tc.DateTime.nowUtc();
|
||||
dt = tc.DateTime.now(tc.TimeZone.local());
|
||||
dt = tc.nowLocal();
|
||||
dt = tc.nowUtc();
|
||||
dt = tc.now(tc.TimeZone.local());
|
||||
dt = new tc.DateTime();
|
||||
dt = new tc.DateTime("2014-01-01T13:05:01.123 UTC");
|
||||
dt = new tc.DateTime("2014-01-01T13:05:01.123", tc.TimeZone.utc());
|
||||
|
||||
+103
-19
@@ -1,4 +1,4 @@
|
||||
// Type definitions for timezonecomplete 1.9.0
|
||||
// Type definitions for timezonecomplete 1.10.0
|
||||
// Project: https://github.com/SpiritIT/timezonecomplete
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -22,8 +22,15 @@ declare module 'timezonecomplete' {
|
||||
export import secondOfDay = basics.secondOfDay;
|
||||
import datetime = require("__timezonecomplete/datetime");
|
||||
export import DateTime = datetime.DateTime;
|
||||
export import now = datetime.now;
|
||||
export import nowLocal = datetime.nowLocal;
|
||||
export import nowUtc = datetime.nowUtc;
|
||||
import duration = require("__timezonecomplete/duration");
|
||||
export import Duration = duration.Duration;
|
||||
export import hours = duration.hours;
|
||||
export import minutes = duration.minutes;
|
||||
export import seconds = duration.seconds;
|
||||
export import milliseconds = duration.milliseconds;
|
||||
import javascript = require("__timezonecomplete/javascript");
|
||||
export import DateFunctions = javascript.DateFunctions;
|
||||
import period = require("__timezonecomplete/period");
|
||||
@@ -37,6 +44,9 @@ declare module 'timezonecomplete' {
|
||||
export import NormalizeOption = timezone.NormalizeOption;
|
||||
export import TimeZoneKind = timezone.TimeZoneKind;
|
||||
export import TimeZone = timezone.TimeZone;
|
||||
export import local = timezone.local;
|
||||
export import utc = timezone.utc;
|
||||
export import zone = timezone.zone;
|
||||
import globals = require("__timezonecomplete/globals");
|
||||
export import min = globals.min;
|
||||
export import max = globals.max;
|
||||
@@ -299,9 +309,22 @@ declare module '__timezonecomplete/basics' {
|
||||
declare module '__timezonecomplete/datetime' {
|
||||
import basics = require("__timezonecomplete/basics");
|
||||
import duration = require("__timezonecomplete/duration");
|
||||
import javascript = require("__timezonecomplete/javascript");
|
||||
import timesource = require("__timezonecomplete/timesource");
|
||||
import javascript = require("__timezonecomplete/javascript");
|
||||
import timezone = require("__timezonecomplete/timezone");
|
||||
/**
|
||||
* Current date+time in local time
|
||||
*/
|
||||
export function nowLocal(): DateTime;
|
||||
/**
|
||||
* Current date+time in UTC time
|
||||
*/
|
||||
export function nowUtc(): DateTime;
|
||||
/**
|
||||
* Current date+time in the given time zone
|
||||
* @param timeZone The desired time zone (optional, defaults to UTC).
|
||||
*/
|
||||
export function now(timeZone?: timezone.TimeZone): DateTime;
|
||||
/**
|
||||
* DateTime class which is time zone-aware
|
||||
* and which can be mocked for testing purposes.
|
||||
@@ -314,18 +337,18 @@ declare module '__timezonecomplete/datetime' {
|
||||
*/
|
||||
static timeSource: timesource.TimeSource;
|
||||
/**
|
||||
* Current date+time in local time (derived from DateTime.timeSource.now()).
|
||||
* Current date+time in local time
|
||||
*/
|
||||
static nowLocal(): DateTime;
|
||||
/**
|
||||
* Current date+time in UTC time (derived from DateTime.timeSource.now()).
|
||||
* Current date+time in UTC time
|
||||
*/
|
||||
static nowUtc(): DateTime;
|
||||
/**
|
||||
* Current date+time in the given time zone (derived from DateTime.timeSource.now()).
|
||||
* @param timeZone The desired time zone.
|
||||
* Current date+time in the given time zone
|
||||
* @param timeZone The desired time zone (optional, defaults to UTC).
|
||||
*/
|
||||
static now(timeZone: timezone.TimeZone): DateTime;
|
||||
static now(timeZone?: timezone.TimeZone): DateTime;
|
||||
/**
|
||||
* Constructor. Creates current time in local timezone.
|
||||
*/
|
||||
@@ -673,6 +696,30 @@ declare module '__timezonecomplete/datetime' {
|
||||
|
||||
declare module '__timezonecomplete/duration' {
|
||||
import basics = require("__timezonecomplete/basics");
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of hours (may be fractional or negative)
|
||||
* @return A duration of n hours
|
||||
*/
|
||||
export function hours(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of minutes (may be fractional or negative)
|
||||
* @return A duration of n minutes
|
||||
*/
|
||||
export function minutes(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of seconds (may be fractional or negative)
|
||||
* @return A duration of n seconds
|
||||
*/
|
||||
export function seconds(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of milliseconds (may be fractional or negative)
|
||||
* @return A duration of n milliseconds
|
||||
*/
|
||||
export function milliseconds(n: number): Duration;
|
||||
/**
|
||||
* Time duration. Create one e.g. like this: var d = Duration.hours(1).
|
||||
* Note that time durations do not take leap seconds etc. into account:
|
||||
@@ -681,25 +728,25 @@ declare module '__timezonecomplete/duration' {
|
||||
export class Duration {
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of hours
|
||||
* @param n Number of hours (may be fractional or negative)
|
||||
* @return A duration of n hours
|
||||
*/
|
||||
static hours(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of minutes
|
||||
* @param n Number of minutes (may be fractional or negative)
|
||||
* @return A duration of n minutes
|
||||
*/
|
||||
static minutes(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of seconds
|
||||
* @param n Number of seconds (may be fractional or negative)
|
||||
* @return A duration of n seconds
|
||||
*/
|
||||
static seconds(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of milliseconds
|
||||
* @param n Number of milliseconds (may be fractional or negative)
|
||||
* @return A duration of n milliseconds
|
||||
*/
|
||||
static milliseconds(n: number): Duration;
|
||||
@@ -993,6 +1040,35 @@ declare module '__timezonecomplete/timesource' {
|
||||
|
||||
declare module '__timezonecomplete/timezone' {
|
||||
import javascript = require("__timezonecomplete/javascript");
|
||||
/**
|
||||
* The local time zone for a given date as per OS settings. Note that time zones are cached
|
||||
* so you don't necessarily get a new object each time.
|
||||
*/
|
||||
export function local(): TimeZone;
|
||||
/**
|
||||
* Coordinated Universal Time zone. Note that time zones are cached
|
||||
* so you don't necessarily get a new object each time.
|
||||
*/
|
||||
export function utc(): TimeZone;
|
||||
/**
|
||||
* @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30. Note that time zones are cached
|
||||
* so you don't necessarily get a new object each time.
|
||||
* @returns a time zone with the given fixed offset
|
||||
*/
|
||||
export function zone(offset: number): TimeZone;
|
||||
/**
|
||||
* Time zone for an offset string or an IANA time zone string. Note that time zones are cached
|
||||
* so you don't necessarily get a new object each time.
|
||||
* @param s Empty string for no time zone (null is returned),
|
||||
* "localtime" for local time,
|
||||
* a TZ database time zone name (e.g. Europe/Amsterdam),
|
||||
* or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see:
|
||||
* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
* @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for
|
||||
* "localtime", timezonecomplete will adhere to the computer settings, the DST flag
|
||||
* does not have any effect.
|
||||
*/
|
||||
export function zone(name: string, dst?: boolean): TimeZone;
|
||||
/**
|
||||
* The type of time zone
|
||||
*/
|
||||
@@ -1046,29 +1122,37 @@ declare module '__timezonecomplete/timezone' {
|
||||
*/
|
||||
static utc(): TimeZone;
|
||||
/**
|
||||
* Returns a time zone object from the cache. If it does not exist, it is created.
|
||||
* @return The time zone with the given offset w.r.t. UTC in minutes, e.g. 90 for +01:30
|
||||
* Time zone with a fixed offset
|
||||
* @param offset offset w.r.t. UTC in minutes, e.g. 90 for +01:30
|
||||
*/
|
||||
static zone(offset: number): TimeZone;
|
||||
/**
|
||||
* Returns a time zone object from the cache. If it does not exist, it is created.
|
||||
* @param s: Empty string for local time, a TZ database time zone name (e.g. Europe/Amsterdam)
|
||||
* or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see:
|
||||
* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
* Time zone for an offset string or an IANA time zone string. Note that time zones are cached
|
||||
* so you don't necessarily get a new object each time.
|
||||
* @param s Empty string for no time zone (null is returned),
|
||||
* "localtime" for local time,
|
||||
* a TZ database time zone name (e.g. Europe/Amsterdam),
|
||||
* or an offset string (either +01:30, +0130, +01, Z). For a full list of names, see:
|
||||
* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
* @param dst Optional, default true: adhere to Daylight Saving Time if applicable. Note for
|
||||
* "localtime", timezonecomplete will adhere to the computer settings, the DST flag
|
||||
* does not have any effect.
|
||||
*/
|
||||
static zone(s: string): TimeZone;
|
||||
static zone(s: string, dst?: boolean): TimeZone;
|
||||
/**
|
||||
* Do not use this constructor, use the static
|
||||
* TimeZone.zone() method instead.
|
||||
* @param name NORMALIZED name, assumed to be correct
|
||||
* @param dst Adhere to Daylight Saving Time if applicable, ignored for local time and fixed offsets
|
||||
*/
|
||||
constructor(name: string);
|
||||
constructor(name: string, dst?: boolean);
|
||||
/**
|
||||
* The time zone identifier. Can be an offset "-01:30" or an
|
||||
* IANA time zone name "Europe/Amsterdam", or "localtime" for
|
||||
* the local time zone.
|
||||
*/
|
||||
name(): string;
|
||||
dst(): boolean;
|
||||
/**
|
||||
* The kind of time zone (Local/Offset/Proper)
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference path="touch-events.d.ts"/>
|
||||
|
||||
var touchEvent:TouchEvent;
|
||||
var list:TouchList;
|
||||
var touch:Touch;
|
||||
|
||||
list = touchEvent.touches;
|
||||
list = touchEvent.targetTouches;
|
||||
list = touchEvent.changedTouches;
|
||||
|
||||
var flag:boolean;
|
||||
flag = touchEvent.altKey;
|
||||
flag = touchEvent.metaKey;
|
||||
flag = touchEvent.ctrlKey;
|
||||
flag = touchEvent.shiftKey;
|
||||
|
||||
var len:number = list.length;
|
||||
touch = list.item(0);
|
||||
|
||||
var x: number;
|
||||
var y: number;
|
||||
var id: number;
|
||||
|
||||
id = touch.identifier;
|
||||
x = touch.screenX;
|
||||
y = touch.screenY;
|
||||
x = touch.clientX;
|
||||
y = touch.clientY;
|
||||
x = touch.pageX;
|
||||
y = touch.pageY;
|
||||
|
||||
var target:EventTarget;
|
||||
target = touch.target;
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for HTML Touch Events
|
||||
// Project: http://www.w3.org/TR/touch-events/
|
||||
// Definitions by: Kevin Barabash <https://github.com/kevinb7>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface TouchEvent extends UIEvent {
|
||||
touches: TouchList;
|
||||
targetTouches: TouchList;
|
||||
changedTouches: TouchList;
|
||||
altKey: boolean;
|
||||
metaKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
|
||||
interface TouchList {
|
||||
length: number;
|
||||
item: (index: number) => Touch;
|
||||
}
|
||||
|
||||
interface Touch {
|
||||
identifier: number;
|
||||
target: EventTarget;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
@@ -24,6 +24,7 @@ watch.watchTree(str, (f: any, curr: fs.Stats, prev: fs.Stats) => {
|
||||
watch.watchTree(str, opts, (f: any, curr: fs.Stats, prev: fs.Stats) => {
|
||||
|
||||
});
|
||||
watch.unwatchTree(str);
|
||||
watch.createMonitor(str, (monitor: watch.Monitor) => {
|
||||
|
||||
});
|
||||
|
||||
Vendored
+1
@@ -30,6 +30,7 @@ declare module "watch" {
|
||||
|
||||
export function watchTree(root: string, callback: (f: any, curr: fs.Stats, prev: fs.Stats) => void): void;
|
||||
export function watchTree(root: string, options: Options, callback: (f: any, curr: fs.Stats, prev: fs.Stats) => void): void;
|
||||
export function unwatchTree(root: string): void;
|
||||
export function createMonitor(root: string, callback: (monitor: Monitor) => void): void;
|
||||
export function createMonitor(root: string, options: Options, callback: (monitor: Monitor) => void): void;
|
||||
}
|
||||
|
||||
@@ -5,15 +5,15 @@ if (navigator.requestMIDIAccess !== undefined) {
|
||||
navigator.requestMIDIAccess().then(onSuccessCallback, onErrorCallback);
|
||||
}
|
||||
|
||||
var onSuccessCallback = (item: Midi.MIDIAccess)=>{
|
||||
var onSuccessCallback = (item: WebMidi.MIDIAccess)=>{
|
||||
this._midiPort = item;
|
||||
|
||||
item.onconnect = (event: Midi.MIDIConnectionEvent)=>{
|
||||
item.onconnect = (event: WebMidi.MIDIConnectionEvent)=>{
|
||||
console.log("onconnect");
|
||||
console.log(event);
|
||||
};
|
||||
|
||||
item.ondisconnect = (event: Midi.MIDIConnectionEvent)=>{
|
||||
item.ondisconnect = (event: WebMidi.MIDIConnectionEvent)=>{
|
||||
console.log("ondisconnect");
|
||||
console.log(event);
|
||||
};
|
||||
@@ -56,7 +56,7 @@ var onSuccessCallback = (item: Midi.MIDIAccess)=>{
|
||||
}
|
||||
|
||||
for(var cnt = 0; cnt < this._inputs.length; cnt++){
|
||||
this._inputs[cnt].onmidimessage = (event: Midi.MIDIMessageEvent)=>{
|
||||
this._inputs[cnt].onmidimessage = (event: WebMidi.MIDIMessageEvent)=>{
|
||||
this.onMidiMessage(event.data);
|
||||
};
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -10,10 +10,10 @@ interface Navigator {
|
||||
* When invoked, returns a Promise object representing a request for access to MIDI devices on the user's system.
|
||||
* @param options settings that may be provided to the requestMIDIAccess request.
|
||||
*/
|
||||
requestMIDIAccess (options?: Midi.MidiOptions): Promise<Midi.MIDIAccess>;
|
||||
requestMIDIAccess (options?: WebMidi.MidiOptions): Promise<WebMidi.MIDIAccess>;
|
||||
}
|
||||
|
||||
declare module Midi{
|
||||
declare module WebMidi{
|
||||
/**
|
||||
* optional settings that may be provided to the requestMIDIAccess request.
|
||||
*/
|
||||
|
||||
Vendored
+3
-1
@@ -79,4 +79,6 @@ declare module When {
|
||||
}
|
||||
}
|
||||
|
||||
export = When;
|
||||
declare module "when" {
|
||||
export = When;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user