mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-28 12:43:06 +08:00
+23
-3
@@ -86,6 +86,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](buffer-equal/buffer-equal.d.ts) [buffer-equal](https://github.com/substack/node-buffer-equal) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](bl/bl.d.ts) [BufferList](https://github.com/rvagg/bl) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](bufferstream/bufferstream.d.ts) [bufferstream](https://github.com/dodo/node-bufferstream) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](bunyan-prettystream/bunyan-prettystream.d.ts) [bunyan-prettystream](https://www.npmjs.com/package/bunyan-prettystream) by [Jason Swearingen](https://github.com/jasonswearingen)
|
||||
* [:link:](business-rules-engine/business-rules-engine.d.ts) [business-rules-engine](https://github.com/rsamec/form) by [Roman Samec](https://github.com/rsamec)
|
||||
* [:link:](byline/byline.d.ts) [byline](https://github.com/jahewson/node-byline) by [Stefan Steinhart](https://github.com/reppners)
|
||||
* [:link:](camljs/camljs.d.ts) [camljs](http://camljs.codeplex.com) by [Andrey Markeev](http://markeev.com)
|
||||
@@ -103,6 +104,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](chartjs/chart.d.ts) [Chart.js](https://github.com/nnnick/Chart.js) by [Steve Fenton](https://github.com/Steve-Fenton)
|
||||
* [:link:](checksum/checksum.d.ts) [checksum](https://github.com/dshaw/checksum) by [Rogier Schouten](https://github.com/rogierschouten)
|
||||
* [:link:](cheerio/cheerio.d.ts) [Cheerio](https://github.com/cheeriojs/cheerio) by [Bret Little](https://github.com/blittle), [VILIC VANE](http://vilic.info), [Wayne Maurer](https://github.com/wmaurer)
|
||||
* [:link:](chokidar/chokidar.d.ts) [chokidar](https://github.com/paulmillr/chokidar) by [Stefan Steinhart](https://github.com/reppners)
|
||||
* [:link:](chosen/chosen.jquery.d.ts) [Chosen.JQuery](http://harvesthq.github.com/chosen) by [Boris Yankov](https://github.com/borisyankov)
|
||||
* [:link:](chroma-js/chroma-js.d.ts) [Chroma.js](https://github.com/gka/chroma.js) by [Sebastian Brückner](https://github.com/invliD)
|
||||
* [: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)
|
||||
@@ -159,6 +161,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](dot/dot.d.ts) [doT](https://github.com/olado/doT) by [ZombieHunter](https://github.com/ZombieHunter)
|
||||
* [:link:](dotdotdot/dotdotdot.d.ts) [dotdotdot](http://dotdotdot.frebsite.nl) by [Milan Jaros](https://github.com/milanjaros)
|
||||
* [:link:](doublearray/doublearray.d.ts) [doublearray](https://github.com/takuyaa/doublearray) by [MIZUSHIMA Junki](https://github.com/mzsm)
|
||||
* [:link:](drop/drop.d.ts) [Drop](http://github.hubspot.com/drop) by [Adi Dahiya](https://github.com/adidahiya)
|
||||
* [:link:](dropboxjs/dropboxjs.d.ts) [dropbox-js](https://github.com/dropbox/dropbox-js) by [Steve Fenton](https://github.com/Steve-Fenton), [Pedro Casaubon](https://github.com/xperiments)
|
||||
* [:link:](dropzone/dropzone.d.ts) [Dropzone](http://www.dropzonejs.com) by [Natan Vivo](https://github.com/nvivo)
|
||||
* [:link:](dts-bundle/dts-bundle.d.ts) [dts-bundle](https://github.com/TypeStrong/dts-bundle) by [Asana](https://asana.com)
|
||||
@@ -254,19 +257,25 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](greensock/greensock.d.ts) [GreenSock Animation Platform](http://www.greensock.com/get-started-js) by [Robert S](https://github.com/codebelt)
|
||||
* [:link:](gridfs-stream/gridfs-stream.d.ts) [gridfs-stream](https://github.com/aheckmann/gridfs-stream) by [Lior Mualem](https://github.com/liorm)
|
||||
* [: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:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io)
|
||||
* [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io)
|
||||
* [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io)
|
||||
* [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io)
|
||||
* [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io)
|
||||
* [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com)
|
||||
* [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-concat/gulp-concat.d.ts) [gulp-concat](http://github.com/wearefractal/gulp-concat) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [:link:](gulp-flatten/gulp-flatten.d.ts) [gulp-flatten](https://github.com/armed/gulp-flatten) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [:link:](gulp-gh-pages/gulp-gh-pages.d.ts) [gulp-gh-pages](https://github.com/rowoot/gulp-gh-pages) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-if/gulp-if.d.ts) [gulp-if](https://github.com/robrich/gulp-if) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-inject/gulp-inject.d.ts) [gulp-inject](https://github.com/klei/gulp-inject) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [:link:](gulp-istanbul/gulp-istanbul.d.ts) [gulp-istanbul](https://github.com/SBoudrias/gulp-istanbul) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-less/gulp-less.d.ts) [gulp-less](https://github.com/plus3network/gulp-less) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [:link:](gulp-minify-css/gulp-minify-css.d.ts) [gulp-minify-css](https://github.com/jonathanepollack/gulp-minify-css) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [:link:](gulp-mocha/gulp-mocha.d.ts) [gulp-mocha](https://github.com/sindresorhus/gulp-mocha) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-rename/gulp-rename.d.ts) [gulp-rename](https://github.com/hparra/gulp-rename) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-replace/gulp-replace.d.ts) [gulp-replace](https://github.com/lazd/gulp-replace) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-sass/gulp-sass.d.ts) [gulp-sass](https://github.com/dlmanning/gulp-sass) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-sourcemaps/gulp-sourcemaps.d.ts) [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-tsd/gulp-tsd.d.ts) [gulp-tsd](https://github.com/moznion/gulp-tsd) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [:link:](gulp-tslint/gulp-tslint.d.ts) [gulp-tslint](https://github.com/panuhorsmalahti/gulp-tslint) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-typedoc/gulp-typedoc.d.ts) [gulp-typedoc](https://github.com/rogierschouten/gulp-typedoc) by [Asana](https://asana.com)
|
||||
* [:link:](gulp-typescript/gulp-typescript.d.ts) [gulp-typescript](https://github.com/ivogabe/gulp-typescript) by [Asana](https://asana.com)
|
||||
@@ -321,7 +330,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](jjv/jjv.d.ts) [JJV](https://github.com/acornejo/jjv) by [Wim Looman](https://github.com/Nemo157)
|
||||
* [:link:](jjve/jjve.d.ts) [JJVE](https://github.com/silas/jjve) by [Wim Looman](https://github.com/Nemo157)
|
||||
* [:link:](joi/joi.d.ts) [joi](https://github.com/spumko/joi) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](jointjs/jointjs.d.ts) [Joint JS](http://www.jointjs.com) by [Aidan Reel](http://github.com/areel), [David Durman](http://github.com/DavidDurman)
|
||||
* [:link:](jointjs/jointjs.d.ts) [Joint JS](http://www.jointjs.com) by [Aidan Reel](http://github.com/areel), [David Durman](http://github.com/DavidDurman), [Ewout Van Gossum](https://github.com/DenEwout)
|
||||
* [:link:](jqrangeslider/jqrangeslider.d.ts) [jQRangeSlider](http://ghusse.github.com/jQRangeSlider) by [Dániel Tar](https://github.com/qcz)
|
||||
* [:link:](jquery/jquery.d.ts) [jQuery 1.10.x / 2.0.x](http://jquery.com) by [Boris Yankov](https://github.com/borisyankov), [Christian Hoffmeister](https://github.com/choffmeister), [Steve Fenton](https://github.com/Steve-Fenton), [Diullei Gomes](https://github.com/Diullei), [Tass Iliopoulos](https://github.com/tasoili), [Jason Swearingen](https://github.com/jasons-novaleaf), [Sean Hill](https://github.com/seanski), [Guus Goossens](https://github.com/Guuz), [Kelly Summerlin](https://github.com/ksummerlin), [Basarat Ali Syed](https://github.com/basarat), [Nicholas Wolverson](https://github.com/nwolverson), [Derek Cicerone](https://github.com/derekcicerone), [Andrew Gaspar](https://github.com/AndrewGaspar), [James Harrison Fisher](https://github.com/jameshfisher), [Seikichi Kondo](https://github.com/seikichi), [Benjamin Jackman](https://github.com/benjaminjackman), [Poul Sorensen](https://github.com/s093294), [Josh Strobl](https://github.com/JoshStrobl), [John Reilly](https://github.com/johnnyreilly), [Dick van den Brink](https://github.com/DickvdBrink)
|
||||
* [:link:](jquery.blockUI/jquery.blockUI.d.ts) [jQuery BlockUI Plugin](http://malsup.com/jquery/block) by [Jeffrey Lee](http://blog.darkthread.net)
|
||||
@@ -393,6 +402,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](js-yaml/js-yaml.d.ts) [js-yaml](https://github.com/nodeca/js-yaml) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](jsbn/jsbn.d.ts) [jsbn](http://www-cs-students.stanford.edu/%7Etjw/jsbn) by [Eugene Chernyshov](https://github.com/Evgenus)
|
||||
* [:link:](jscrollpane/jscrollpane.d.ts) [jScrollPane](http://jscrollpane.kelvinluck.com) by [Dániel Tar](https://github.com/qcz)
|
||||
* [:link:](js-data/js-data.d.ts) [JSData](https://github.com/js-data/js-data) by [Stefan Steinhart](https://github.com/reppners)
|
||||
* [:link:](js-data-http/js-data-http.d.ts) [JSData Http Adapter](https://github.com/js-data/js-data-http) by [Stefan Steinhart](https://github.com/reppners)
|
||||
* [:link:](js-data-angular/js-data-angular.d.ts) [JSDataAngular](https://github.com/js-data/js-data-angular) by [Stefan Steinhart](https://github.com/reppners)
|
||||
* [:link:](jsdeferred/jsdeferred.d.ts) [JSDeferred](https://github.com/cho45/jsdeferred) by [Daisuke Mino](https://github.com/minodisk)
|
||||
* [:link:](jsdom/jsdom.d.ts) [jsdom](https://github.com/tmpvar/jsdom) by [Asana](https://asana.com)
|
||||
* [:link:](jsesc/jsesc.d.ts) [jsesc](https://github.com/mathiasbynens/jsesc) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
@@ -462,6 +474,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](lscache/lscache.d.ts) [lscache](https://github.com/pamelafox/lscache) by [Chris Martinez](https://github.com/Chris-Martinezz)
|
||||
* [:link:](lunr/lunr.d.ts) [lunr.js](https://github.com/olivernn/lunr.js) by [Sebastian Lenz](https://github.com/sebastian-lenz)
|
||||
* [:link:](lz-string/lz-string.d.ts) [lz-string](https://github.com/pieroxy/lz-string) by [Roman Nikitin](https://github.com/M0ns1gn0r)
|
||||
* [:link:](main-bower-files/main-bower-files.d.ts) [main-bower-files](https://github.com/ck86/main-bower-files) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [:link:](mapbox/mapbox.d.ts) [Mapbox](https://www.mapbox.com/mapbox.js) by [Maxime Fabre](https://github.com/anahkiasen)
|
||||
* [:link:](mapsjs/mapsjs.d.ts) [Mapsjs](https://github.com/mapsjs) by [Matthew James Davis](https://github.com/davismj)
|
||||
* [:link:](marionette/marionette.d.ts) [Marionette](https://github.com/marionettejs) by [Zeeshan Hamid](https://github.com/zhamid), [Natan Vivo](https://github.com/nvivo), [Sven Tschui](https://github.com/sventschui)
|
||||
@@ -470,6 +483,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](mathjax/mathjax.d.ts) [MathJax](https://github.com/mathjax/MathJax) by [Roland Zwaga](https://github.com/rolandzwaga)
|
||||
* [:link:](mCustomScrollbar/mCustomScrollbar.d.ts) [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) by [Sarah Williams](https://github.com/flurg)
|
||||
* [:link:](memory-cache/memory-cache.d.ts) [memory-cache](http://github.com/ptarjan/node-cache) by [Jeff Goddard](https://github.com/jedigo)
|
||||
* [:link:](merge-stream/merge-stream.d.ts) [merge-stream](https://github.com/grncdr/merge-stream) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [:link:](mess/mess.d.ts) [mess](https://github.com/bobrik/node-mess) by [Wim Looman](https://github.com/Nemo157)
|
||||
* [:link:](messenger/messenger.d.ts) [Messenger.js](https://github.com/HubSpot/messenger) by [Derek Cicerone](https://github.com/derekcicerone)
|
||||
* [:link:](meteor/meteor.d.ts) [Meteor](http://www.meteor.com) by [Dave Allen](https://github.com/fullflavedave)
|
||||
@@ -521,6 +535,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](needle/needle.d.ts) [needle](https://github.com/tomas/needle) by [San Chen](https://github.com/bigsan)
|
||||
* [:link:](nexpect/nexpect.d.ts) [nexpect](https://github.com/nodejitsu/nexpect) by [vvakame](http://github.com/vvakame)
|
||||
* [:link:](ng-grid/ng-grid.d.ts) [ng-grid](http://angular-ui.github.io/ng-grid) by [Ken Smith](https://github.com/smithkl42), [Roland Zwaga](https://github.com/rolandzwaga), [Kent Cooper](https://github.com/kentcooper)
|
||||
* [:link:](angular-idle/angular-idle.d.ts) [ng-idle](http://hackedbychinese.github.io/ng-idle) by [mthamil](https://github.com/mthamil)
|
||||
* [:link:](ngprogress/ngprogress.d.ts) [ngProgress](http://victorbjelkholm.github.io/ngProgress) by [Martin McWhorter](https://github.com/martinmcwhorter)
|
||||
* [:link:](ngprogress-lite/ngprogress-lite.d.ts) [ngprogress-lite](https://github.com/voronianski/ngprogress-lite) by [Luke Forder](https://github.com/LukeForder)
|
||||
* [:link:](nightmare/nightmare.d.ts) [Nightmare](https://github.com/segmentio/nightmare) by [horiuchi](https://github.com/horiuchi)
|
||||
@@ -538,6 +553,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](multiparty/multiparty.d.ts) [node-multiparty](https://github.com/andrewrk/node-multiparty) by [Ken Fukuyama](https://github.com/kenfdev)
|
||||
* [:link:](mysql/mysql.d.ts) [node-mysql](https://github.com/felixge/node-mysql) by [William Johnston](https://github.com/wjohnsto)
|
||||
* [:link:](node-persist/node-persist.d.ts) [node-persist](https://github.com/simonlast/node-persist) by [Spencer Williams](http://spencerwi.com)
|
||||
* [:link:](node-polyglot/node-polyglot.d.ts) [node-polyglot](https://github.com/airbnb/polyglot.js) by [Tim Jackson-Kiely](https://github.com/timjk)
|
||||
* [:link:](promptly/promptly.d.ts) [node-promptly](https://github.com/IndigoUnited/node-promptly) by [Dan Spencer](https://github.com/danrspencer)
|
||||
* [:link:](radius/radius.d.ts) [node-radius](https://github.com/retailnext/node-radius) by [Peter Harris](https://github.com/codeanimal)
|
||||
* [:link:](node-uuid/node-uuid.d.ts) [node-uuid.js](https://github.com/broofa/node-uuid) by [Jeff May](https://github.com/jeffmay)
|
||||
@@ -613,6 +629,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](rabbit.js/rabbit.js.d.ts) [rabbit.js](https://github.com/squaremo/rabbit.js) by [Wonshik Kim](https://github.com/wokim)
|
||||
* [:link:](ractive/ractive.d.ts) [Ractive 0.7.0 edge f22ab8ad0a640591b1c263f57e21d1565cb26bf5](http://ractivejs.org) by [Han Lin Yap](http://yap.nu)
|
||||
* [:link:](raphael/raphael.d.ts) [Raphael](http://raphaeljs.com) by [CheCoxshall](https://github.com/CheCoxshall)
|
||||
* [:link:](rappid/rappid.d.ts) [Rappid](http://jointjs.com/about-rappid) by [Ewout Van Gossum](https://github.com/DenEwout)
|
||||
* [:link:](ravenjs/ravenjs.d.ts) [Raven.js](https://github.com/getsentry/raven-js) by [Santi Albo](https://github.com/santialbo)
|
||||
* [:link:](react/react.d.ts) [React](http://facebook.github.io/react) by [Asana](https://asana.com)
|
||||
* [:link:](react-router/react-router.d.ts) [React Router](https://github.com/rackt/react-router) by [Yuichi Murata](https://github.com/mrk21)
|
||||
@@ -633,6 +650,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](riotjs/riotjs.d.ts) [riot.js](https://github.com/moot/riotjs) by [vvakame](https://github.com/vvakame)
|
||||
* [:link:](routie/routie.d.ts) [routie](https://github.com/jgallen23/routie) by [Adilson](https://github.com/Adilson)
|
||||
* [:link:](rtree/rtree.d.ts) [rtree](https://github.com/leaflet-extras/RTree) by [Omede Firouz](https://github.com/oefirouz)
|
||||
* [:link:](run-sequence/run-sequence.d.ts) [run-sequence](https://github.com/OverZealous/run-sequence) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [: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)
|
||||
@@ -696,6 +714,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](stats/stats.d.ts) [Stats.js r12](http://github.com/mrdoob/stats.js) by [Gregory Dalton](https://github.com/gregolai)
|
||||
* [:link:](status-bar/status-bar.d.ts) [status-bar](https://github.com/atom/status-bar) by [vvakame](https://github.com/vvakame)
|
||||
* [:link:](storejs/storejs.d.ts) [store.js](https://github.com/marcuswestin/store.js) by [Vincent Bortone](https://github.com/vbortone)
|
||||
* [:link:](stream-series/stream-series.d.ts) [stream-series](https://github.com/rschmukler/stream-series) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
|
||||
* [:link:](stream-to-array/stream-to-array.d.ts) [stream-to-array](https://github.com/stream-utils/stream-to-array) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](stripe/stripe.d.ts) [stripe](https://stripe.com) by [Eric J. Smith](https://github.com/ejsmith)
|
||||
* [:link:](stylus/stylus.d.ts) [stylus](https://github.com/LearnBoost/stylus) by [Maxime LUCE](https://github.com/SomaticIT)
|
||||
@@ -718,6 +737,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](tedious/tedious.d.ts) [tedious](https://pekim.github.io/tedious) by [Rogier Schouten](https://github.com/rogierschouten)
|
||||
* [:link:](tedious-connection-pool/tedious-connection-pool.d.ts) [tedious-connection-pool](https://github.com/pekim/tedious-connection-pool) by [Cyprien Autexier](https://github.com/sandorfr)
|
||||
* [:link:](teechart/teechart.d.ts) [TeeChart](http://www.steema.com) by [Steema Software](https://steema.com)
|
||||
* [:link:](tether/tether.d.ts) [Tether](http://github.hubspot.com/tether) by [Adi Dahiya](https://github.com/adidahiya)
|
||||
* [:link:](text-buffer/text-buffer.d.ts) [text-buffer](https://github.com/atom/text-buffer) by [vvakame](https://github.com/vvakame)
|
||||
* [:link:](text-encoding/text-encoding.d.ts) [text-encoding](https://github.com/inexorabletash/text-encoding) by [MIZUNE Pine](https://github.com/pine613)
|
||||
* [:link:](threejs/three-canvasrenderer.d.ts) [three.js (CanvasRenderer.js)](https://github.com/mrdoob/three.js/blob/master/examples/js/renderers/CanvasRenderer.js) by [Satoru Kimura](https://github.com/gyohk)
|
||||
|
||||
@@ -6,10 +6,13 @@ var hotkeyProvider: ng.hotkeys.HotkeysProvider;
|
||||
var hotkeyObj: ng.hotkeys.Hotkey;
|
||||
|
||||
hotkeyProvider.add("mod+s", "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} );
|
||||
hotkeyProvider.add(["mod+s"], "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} );
|
||||
hotkeyProvider.add(hotkeyObj);
|
||||
hotkeyProvider.bindTo(scope);
|
||||
hotkeyProvider.del("mod+s");
|
||||
hotkeyProvider.del(["mod+s"]);
|
||||
hotkeyProvider.get("mod+s");
|
||||
hotkeyProvider.get(["mod+s"]);
|
||||
hotkeyProvider.toggleCheatSheet();
|
||||
|
||||
hotkeyProvider.add(hotkeyObj.combo, hotkeyObj.description ,hotkeyObj.callback);
|
||||
@@ -21,5 +24,10 @@ hotkeyProvider.bindTo(scope)
|
||||
combo: 'w',
|
||||
description: 'blah blah',
|
||||
callback: function() {}
|
||||
})
|
||||
.add({
|
||||
combo: ['w', 'mod+w'],
|
||||
description: 'blah blah',
|
||||
callback: function() {}
|
||||
});
|
||||
|
||||
|
||||
Vendored
+6
-6
@@ -14,19 +14,19 @@ declare module ng.hotkeys {
|
||||
cheatSheetHotkey: string;
|
||||
cheatSheetDescription: string;
|
||||
|
||||
add(combo: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
|
||||
add(combo: string|string[], callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
|
||||
|
||||
add(combo: string, description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
|
||||
add(combo: string|string[], description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
|
||||
|
||||
add(hotkeyObj: ng.hotkeys.Hotkey): ng.hotkeys.Hotkey;
|
||||
|
||||
bindTo(scope : ng.IScope): ng.hotkeys.HotkeysProviderChained;
|
||||
|
||||
del(combo: string): void;
|
||||
del(combo: string|string[]): void;
|
||||
|
||||
del(hotkeyObj: ng.hotkeys.Hotkey): void;
|
||||
|
||||
get(combo: string): ng.hotkeys.Hotkey;
|
||||
get(combo: string|string[]): ng.hotkeys.Hotkey;
|
||||
|
||||
toggleCheatSheet(): void;
|
||||
|
||||
@@ -34,13 +34,13 @@ declare module ng.hotkeys {
|
||||
}
|
||||
|
||||
interface HotkeysProviderChained {
|
||||
add(combo: string, description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained;
|
||||
add(combo: string|string[], description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained;
|
||||
|
||||
add(hotkeyObj: ng.hotkeys.Hotkey): HotkeysProviderChained;
|
||||
}
|
||||
|
||||
interface Hotkey {
|
||||
combo: string;
|
||||
combo: string|string[];
|
||||
description?: string;
|
||||
callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void;
|
||||
action?: string;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="./angular-idle.d.ts" />
|
||||
|
||||
angular.module('app', ['ngIdle'])
|
||||
.config(['$keepaliveProvider', '$idleProvider',
|
||||
($keepaliveProvider: ng.idle.IKeepAliveProvider, $idleProvider: ng.idle.IIdleProvider) => {
|
||||
$idleProvider.activeOn('mousemove keydown DOMMouseScroll mousewheel mousedown');
|
||||
$idleProvider.idleDuration(5);
|
||||
$idleProvider.warningDuration(5);
|
||||
$idleProvider.keepalive(true)
|
||||
$idleProvider.autoResume(true);
|
||||
$keepaliveProvider.interval(10);
|
||||
}])
|
||||
.run(['$keepalive', '$idle', ($keepalive: ng.idle.IKeepAliveService, $idle: ng.idle.IIdleService) => {
|
||||
$idle.watch();
|
||||
|
||||
if ($idle.running() || $idle.idling()) {
|
||||
$idle.unwatch();
|
||||
}
|
||||
|
||||
$keepalive.start();
|
||||
$keepalive.ping();
|
||||
$keepalive.stop();
|
||||
}]);
|
||||
Vendored
+134
@@ -0,0 +1,134 @@
|
||||
// Type definitions for ng-idle v0.3.5
|
||||
// Project: http://hackedbychinese.github.io/ng-idle/
|
||||
// Definitions by: mthamil <https://github.com/mthamil>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ng.idle {
|
||||
|
||||
/**
|
||||
* Used to configure the $keepalive service.
|
||||
*/
|
||||
interface IKeepAliveProvider extends IServiceProvider {
|
||||
|
||||
/**
|
||||
* If configured, options will be used to issue a request using $http.
|
||||
* If the value is null, no HTTP request will be issued.
|
||||
* You can specify a string, which it will assume to be a URL to a simple GET request.
|
||||
* Otherwise, you can use the same options $http takes. However, cache will always be false.
|
||||
*
|
||||
* @param value May be string or object, default is null.
|
||||
*/
|
||||
http(value: any): void;
|
||||
|
||||
/**
|
||||
* This specifies how often the keepalive event is triggered and the
|
||||
* HTTP request is issued.
|
||||
*
|
||||
* @param seconds Integer, default is 5 minutes. Must be greater than 0.
|
||||
*/
|
||||
interval(seconds: number): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* $keepalive will use a timeout to periodically wake, broadcast a $keepalive event on the root scope,
|
||||
* and optionally make an $http request. By default, the $idle service will stop and start $keepalive
|
||||
* when a user becomes idle or returns from idle, respectively. It is also started automatically when
|
||||
* $idle.watch() is called. This can be disabled by configuring the $idleProvider.
|
||||
*/
|
||||
interface IKeepAliveService {
|
||||
|
||||
/**
|
||||
* Starts pinging periodically until stop() is called.
|
||||
*/
|
||||
start(): void;
|
||||
|
||||
/**
|
||||
* Stops pinging.
|
||||
*/
|
||||
stop(): void;
|
||||
|
||||
/**
|
||||
* Performs one ping only.
|
||||
*/
|
||||
ping(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to configure the $idle service.
|
||||
*/
|
||||
interface IIdleProvider extends IServiceProvider {
|
||||
|
||||
/**
|
||||
* Specifies the DOM events the service will watch to reset the idle timeout.
|
||||
* Multiple events should be separated by a space.
|
||||
*
|
||||
* @param events string, default 'mousemove keydown DOMMouseScroll mousewheel mousedown'
|
||||
*/
|
||||
activeOn(events: string): void;
|
||||
|
||||
/**
|
||||
* The idle timeout duration in seconds. After this amount of time passes without the user
|
||||
* performing an action that triggers one of the watched DOM events, the user is considered
|
||||
* idle.
|
||||
*
|
||||
* @param seconds integer, default is 20min
|
||||
*/
|
||||
idleDuration(seconds: number): void;
|
||||
|
||||
/**
|
||||
* The amount of time the user has to respond (in seconds) before they have been considered
|
||||
* timed out.
|
||||
*
|
||||
* @param seconds integer, default is 30s
|
||||
*/
|
||||
warningDuration(seconds: number): void;
|
||||
|
||||
/**
|
||||
* When true, user activity will automatically interrupt the warning countdown and reset the
|
||||
* idle state. If false, you will need to manually call watch() when you want to start
|
||||
* watching for idleness again.
|
||||
*
|
||||
* @param enabled boolean, default is true
|
||||
*/
|
||||
autoResume(enabled: boolean): void;
|
||||
|
||||
/**
|
||||
* When true, the $keepalive service is automatically stopped and started as needed.
|
||||
*
|
||||
* @param enabled boolean, default is true
|
||||
*/
|
||||
keepalive(enabled: boolean): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* $idle, once watch() is called, will start a timeout which if expires, will enter a warning state
|
||||
* countdown. Once the countdown reaches zero, idle will broadcast a timeout event indicating the
|
||||
* user has timed out (where your app should log them out or whatever you like). If the user performs
|
||||
* an action that triggers a watched DOM event that bubbles up to document.body, this will reset the
|
||||
* idle/warning state and start the process over again.
|
||||
*/
|
||||
interface IIdleService {
|
||||
|
||||
/**
|
||||
* Whether or not the watch() has been called and it is watching for idleness.
|
||||
*/
|
||||
running(): boolean;
|
||||
|
||||
/**
|
||||
* Whether or not the user appears to be idle.
|
||||
*/
|
||||
idling(): boolean;
|
||||
|
||||
/**
|
||||
* Starts watching for idleness, or resets the idle/warning state and continues watching.
|
||||
*/
|
||||
watch(): void;
|
||||
|
||||
/**
|
||||
* Stops watching for idleness, and resets the idle/warning state.
|
||||
*/
|
||||
unwatch(): void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="angular-ui-sortable.d.ts" />
|
||||
|
||||
var myApp = angular.module('testModule');
|
||||
|
||||
interface MySortableControllerScope extends ng.IScope {
|
||||
items: SortableModelInfo[];
|
||||
sortableOptions: ng.ui.UISortableOptions<SortableModelInfo>;
|
||||
sortingLog: SortLogInfo[];
|
||||
}
|
||||
|
||||
interface SortableModelInfo {
|
||||
text: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
interface SortLogInfo {
|
||||
ID: number;
|
||||
Text: string;
|
||||
}
|
||||
|
||||
myApp.controller('sortableController', function ($scope: MySortableControllerScope) {
|
||||
$scope.sortableOptions = {
|
||||
activate: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
beforeStop: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
change: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
deactivate: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
out: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
over: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
receive: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
remove: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
sort: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
start: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
},
|
||||
stop: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
var uiitem: ng.ui.UISortableUIItem<SortableModelInfo> = ui.item;
|
||||
var uiitemscope: ng.IScope = uiitem.scope();
|
||||
var uiitemsortable: ng.ui.UISortableProperties<SortableModelInfo> = uiitem.sortable;
|
||||
|
||||
var dropindex: number = uiitemsortable.dropindex;
|
||||
var droptarget: number = uiitemsortable.droptarget;
|
||||
var droptargetModel: SortableModelInfo[] = uiitemsortable.droptargetModel;
|
||||
var index: number = uiitemsortable.index;
|
||||
var model: SortableModelInfo = uiitemsortable.model;
|
||||
var moved: SortableModelInfo = uiitemsortable.moved;
|
||||
var received: Boolean = uiitemsortable.received;
|
||||
var source: ng.IAugmentedJQuery = uiitemsortable.source;
|
||||
var sourceModel: SortableModelInfo[] = uiitemsortable.sourceModel;
|
||||
|
||||
var logEntry = {
|
||||
ID: $scope.sortingLog.length + 1,
|
||||
Text: 'Moved element: ' + ui.item.sortable.model.text
|
||||
};
|
||||
$scope.sortingLog.push(logEntry);
|
||||
},
|
||||
update: function(e, ui) {
|
||||
var jQueryEventObject: JQueryEventObject = e;
|
||||
var uiSortableUIParams: ng.ui.UISortableUIParams<SortableModelInfo> = ui;
|
||||
var voidcanceled: void = ui.item.sortable.cancel();
|
||||
var isCanceled: Boolean = ui.item.sortable.isCanceled();
|
||||
var isCustomHelperUsed: Boolean =ui.item.sortable.isCustomHelperUsed();
|
||||
}
|
||||
};
|
||||
|
||||
$scope.sortableOptions.appendTo = document.body;
|
||||
$scope.sortableOptions.appendTo = angular.element(document.body);
|
||||
$scope.sortableOptions.appendTo = 'body';
|
||||
$scope.sortableOptions.axis = 'x';
|
||||
$scope.sortableOptions.axis = 'y';
|
||||
$scope.sortableOptions.axis = false;
|
||||
$scope.sortableOptions.cancel = '.disabled';
|
||||
$scope.sortableOptions.connectWith = '.connectedSortable';
|
||||
$scope.sortableOptions.connectWith = false;
|
||||
$scope.sortableOptions.containment = 'parent';
|
||||
$scope.sortableOptions.containment = 'body';
|
||||
$scope.sortableOptions.containment = document.body;
|
||||
$scope.sortableOptions.containment = false;
|
||||
$scope.sortableOptions.cursor = 'move';
|
||||
$scope.sortableOptions.cursorAt = false;
|
||||
$scope.sortableOptions.cursorAt = { left: 5 };
|
||||
$scope.sortableOptions.delay = 300;
|
||||
$scope.sortableOptions.disabled = true;
|
||||
$scope.sortableOptions.distance = 5;
|
||||
$scope.sortableOptions.dropOnEmpty = false;
|
||||
$scope.sortableOptions.forceHelperSize = true;
|
||||
$scope.sortableOptions.forcePlaceholderSize = true;
|
||||
$scope.sortableOptions.grid = false;
|
||||
$scope.sortableOptions.grid = [20, 10];
|
||||
$scope.sortableOptions.handle = '.handle';
|
||||
$scope.sortableOptions.helper = 'clone';
|
||||
$scope.sortableOptions.helper = function(e: JQueryEventObject, item: ng.IAugmentedJQuery) {
|
||||
return item.clone();
|
||||
};
|
||||
$scope.sortableOptions.items = '> li:not(.disabled)';
|
||||
$scope.sortableOptions.opacity = false;
|
||||
$scope.sortableOptions.opacity = 0.5;
|
||||
$scope.sortableOptions.placeholder = false;
|
||||
$scope.sortableOptions.placeholder = 'sortable-placeholder';
|
||||
$scope.sortableOptions.revert = true;
|
||||
$scope.sortableOptions.revert = 300;
|
||||
$scope.sortableOptions.scroll = false;
|
||||
$scope.sortableOptions.scrollSensitivity = 10;
|
||||
$scope.sortableOptions.scrollSpeed = 40;
|
||||
$scope.sortableOptions.tolerance = 'pointer';
|
||||
$scope.sortableOptions.zIndex = 9999;
|
||||
|
||||
$scope.sortableOptions['ui-floating'] = undefined;
|
||||
$scope.sortableOptions['ui-floating'] = null;
|
||||
$scope.sortableOptions['ui-floating'] = false;
|
||||
$scope.sortableOptions['ui-floating'] = true;
|
||||
$scope.sortableOptions['ui-floating'] = "auto";
|
||||
});
|
||||
Vendored
+210
@@ -0,0 +1,210 @@
|
||||
// Type definitions for angular.ui.sortable module v0.13+
|
||||
// Project: https://github.com/angular-ui/ui-sortable
|
||||
// Definitions by: Thodoris Greasidis <https://github.com/thgreasi>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ng.ui {
|
||||
|
||||
interface UISortableOptions<T> extends SortableOptions<T> {
|
||||
'ui-floating'?: string|boolean;
|
||||
}
|
||||
|
||||
interface UISortableProperties<T> {
|
||||
/**
|
||||
* Holds the index of the drop target that the dragged item was dropped.
|
||||
*/
|
||||
dropindex: number;
|
||||
|
||||
/**
|
||||
* Holds the ui-sortable element that the dragged item was dropped on.
|
||||
*/
|
||||
droptarget: number;
|
||||
|
||||
/**
|
||||
* Holds the array that is specified by the `ng-model` attribute of the [`droptarget`](#droptarget) ui-sortable element.
|
||||
*/
|
||||
droptargetModel: Array<T>;
|
||||
|
||||
/**
|
||||
* Holds the original index of the item dragged.
|
||||
*/
|
||||
index: number;
|
||||
|
||||
/**
|
||||
* Holds the JavaScript object that is used as the model of the dragged item, as specified by the ng-repeat of the [`source`](#source) ui-sortable element and the item's [`index`](#index).
|
||||
*/
|
||||
model: T;
|
||||
|
||||
/**
|
||||
* Holds the model of the dragged item only when a sorting happens between two connected ui-sortable elements.
|
||||
* In other words: `'moved' in ui.item.sortable` will return false only when a sorting is withing the same ui-sortable element ([`source`](#source) equals to the [`droptarget`](#droptarget)).
|
||||
*/
|
||||
moved?: T;
|
||||
|
||||
/**
|
||||
* When sorting between two connected sortables, it will be set to true inside the `update` callback of the [`droptarget`](#droptarget).
|
||||
*/
|
||||
received: Boolean;
|
||||
|
||||
/**
|
||||
* Holds the ui-sortable element that the dragged item originated from.
|
||||
*/
|
||||
source: ng.IAugmentedJQuery
|
||||
|
||||
/**
|
||||
* Holds the array that is specified by the `ng-model` of the [`source`](#source) ui-sortable element.
|
||||
*/
|
||||
sourceModel: Array<T>;
|
||||
|
||||
/**
|
||||
* Can be called inside the `update` callback, in order to prevent/revert a sorting.
|
||||
* Should be used instead of the [jquery-ui-sortable cancel()](http://api.jqueryui.com/sortable/#method-cancel) method.
|
||||
*/
|
||||
cancel(): void;
|
||||
|
||||
/**
|
||||
* Returns whether the current sorting is marked as canceled, by an earlier call to [`ui.item.sortable.cancel()`](#cancel).
|
||||
*/
|
||||
isCanceled(): Boolean;
|
||||
|
||||
/**
|
||||
* Returns whether the [`helper`](http://api.jqueryui.com/sortable/#option-helper) element used for the current sorting, is one of the original ui-sortable list elements.
|
||||
*/
|
||||
isCustomHelperUsed(): Boolean;
|
||||
}
|
||||
|
||||
interface UISortableUIItem<T> extends ng.IAugmentedJQuery {
|
||||
sortable: UISortableProperties<T>;
|
||||
}
|
||||
|
||||
interface UISortableUIParams<T> extends SortableUIParams {
|
||||
item: UISortableUIItem<T>;
|
||||
}
|
||||
|
||||
// Base Sortable //////////////////////////////////////////////////
|
||||
|
||||
interface SortableCursorAtOptions {
|
||||
top?: number;
|
||||
left?: number;
|
||||
right?: number;
|
||||
bottom?: number;
|
||||
}
|
||||
|
||||
interface SortableHelperFunctionOption {
|
||||
(event: JQueryEventObject, ui: ng.IAugmentedJQuery): JQuery;
|
||||
}
|
||||
|
||||
interface SortableOptions<T> extends SortableEvents<T> {
|
||||
/**
|
||||
* jQuery, Element, Selector or string
|
||||
* Default: "parent"
|
||||
*/
|
||||
appendTo?: any;
|
||||
/**
|
||||
* "X", "Y" or false
|
||||
* Default: false
|
||||
*/
|
||||
axis?: string|boolean;
|
||||
/**
|
||||
* Selector
|
||||
* Default: "input,textarea,button,select,option"
|
||||
*/
|
||||
cancel?: string;
|
||||
/**
|
||||
* Selector or false
|
||||
* Default: false
|
||||
*/
|
||||
connectWith?: string|boolean;
|
||||
/**
|
||||
* Element, Selector, string or false
|
||||
* Default: false
|
||||
*/
|
||||
containment?: any;
|
||||
cursor?: string;
|
||||
/**
|
||||
* Moves the sorting element or helper so the cursor always appears to drag from the same position. Coordinates can be given as a hash using a combination of one or two keys SortableCursorAtOptions: { top, left, right, bottom }
|
||||
* Default: false
|
||||
*/
|
||||
cursorAt?: SortableCursorAtOptions|boolean;
|
||||
delay?: number;
|
||||
disabled?: boolean;
|
||||
distance?: number;
|
||||
dropOnEmpty?: boolean;
|
||||
forceHelperSize?: boolean;
|
||||
forcePlaceholderSize?: boolean;
|
||||
/**
|
||||
* Array of numbers or false
|
||||
* Default: false
|
||||
*/
|
||||
grid?: number[]|boolean;
|
||||
/**
|
||||
* Selector or Element
|
||||
*/
|
||||
handle?: any;
|
||||
/**
|
||||
* "original", "clone" or Function()
|
||||
* Default: "original"
|
||||
*/
|
||||
helper?: string|SortableHelperFunctionOption;
|
||||
/**
|
||||
* Selector
|
||||
*/
|
||||
items?: string;
|
||||
/**
|
||||
* Number or false
|
||||
* Default: false
|
||||
*/
|
||||
opacity?: number|boolean;
|
||||
/**
|
||||
* string or false
|
||||
* Default: false
|
||||
*/
|
||||
placeholder?: string|boolean;
|
||||
/**
|
||||
* boolean or number
|
||||
* Default: false
|
||||
*/
|
||||
revert?: number|boolean;
|
||||
scroll?: boolean;
|
||||
scrollSensitivity?: number;
|
||||
scrollSpeed?: number;
|
||||
/**
|
||||
* "intersect" or "pointer"
|
||||
* Default: "intersect"
|
||||
*/
|
||||
tolerance?: string;
|
||||
zIndex?: number;
|
||||
}
|
||||
|
||||
interface SortableUIParams {
|
||||
helper: ng.IAugmentedJQuery;
|
||||
item: ng.IAugmentedJQuery;
|
||||
offset: any;
|
||||
position: any;
|
||||
originalPosition: any;
|
||||
sender: ng.IAugmentedJQuery;
|
||||
placeholder: ng.IAugmentedJQuery;
|
||||
}
|
||||
|
||||
interface SortableEvent<T> {
|
||||
(event: JQueryEventObject, ui: UISortableUIParams<T>): void;
|
||||
}
|
||||
|
||||
interface SortableEvents<T> {
|
||||
activate?: SortableEvent<T>;
|
||||
beforeStop?: SortableEvent<T>;
|
||||
change?: SortableEvent<T>;
|
||||
deactivate?: SortableEvent<T>;
|
||||
out?: SortableEvent<T>;
|
||||
over?: SortableEvent<T>;
|
||||
receive?: SortableEvent<T>;
|
||||
remove?: SortableEvent<T>;
|
||||
sort?: SortableEvent<T>;
|
||||
start?: SortableEvent<T>;
|
||||
stop?: SortableEvent<T>;
|
||||
update?: SortableEvent<T>;
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+12
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS 1.3 (ngAnimate module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Adi Dahiya <https://github.com/adidahiya>, Raphael Schweizer <https://github.com/rasch>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular.d.ts" />
|
||||
@@ -25,6 +25,17 @@ declare module ng.animate {
|
||||
*/
|
||||
enabled(value?: boolean, element?: JQuery): boolean;
|
||||
|
||||
/**
|
||||
* Performs an inline animation on the element.
|
||||
*
|
||||
* @param element the element that will be the focus of the animation
|
||||
* @param from a collection of CSS styles that will be applied to the element at the start of the animation
|
||||
* @param to a collection of CSS styles that the element will animate towards
|
||||
* @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate')
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
animate(element: JQuery, from: any, to: any, className?: string): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Appends the element to the parentElement element that resides in the document and then runs the enter animation.
|
||||
*
|
||||
|
||||
Vendored
+2
-2
@@ -1262,7 +1262,7 @@ declare module ng {
|
||||
statusText?: string;
|
||||
}
|
||||
|
||||
interface IHttpPromise<T> extends IPromise<T> {
|
||||
interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> {
|
||||
success(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
|
||||
error(callback: IHttpPromiseCallback<any>): IHttpPromise<T>;
|
||||
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => IPromise<TResult>|TResult, errorCallback?: (response: IHttpPromiseCallbackArg<any>) => any): IPromise<TResult>;
|
||||
@@ -1448,7 +1448,7 @@ declare module ng {
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
bindToController?: boolean;
|
||||
link?: IDirectiveLinkFn;
|
||||
link?: IDirectiveLinkFn | IDirectivePrePost;
|
||||
name?: string;
|
||||
priority?: number;
|
||||
replace?: boolean;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path="arcgis-js-api.d.ts" />
|
||||
|
||||
import esri = require("esri");
|
||||
import Map = require("esri/map");
|
||||
import Point = require("esri/geometry/Point");
|
||||
|
||||
export = MapController;
|
||||
|
||||
class MapController {
|
||||
map: Map;
|
||||
|
||||
constructor(public mapDiv: string) {
|
||||
}
|
||||
|
||||
start() {
|
||||
var point = new Point(-122.45, 37.75); // long, lat
|
||||
|
||||
var mapOptions: esri.MapOptions = {};
|
||||
mapOptions.basemap = "topo";
|
||||
mapOptions.center = point;
|
||||
mapOptions.zoom = 13;
|
||||
|
||||
this.map = new Map(this.mapDiv, mapOptions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
--noImplicitAny --module amd
|
||||
Vendored
+16049
File diff suppressed because it is too large
Load Diff
Vendored
+2
-2
@@ -9,7 +9,7 @@ declare module "byline" {
|
||||
import stream = require("stream");
|
||||
|
||||
export interface LineStreamOptions extends stream.TransformOptions {
|
||||
keepEmptyLines: boolean;
|
||||
keepEmptyLines?: boolean;
|
||||
}
|
||||
|
||||
export interface LineStream extends stream.Transform {
|
||||
@@ -35,4 +35,4 @@ declare module "byline" {
|
||||
export function createStream(stream:NodeJS.ReadableStream, options?:LineStreamOptions):LineStream;
|
||||
|
||||
export var LineStream:LineStreamCreatable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/// <reference path="chokidar.d.ts" />
|
||||
|
||||
import fs = require('fs');
|
||||
import chokidar = require('chokidar');
|
||||
|
||||
var watcher = chokidar.watch('file, dir, or glob', {
|
||||
ignored: /[\/\\]\./, persistent: true
|
||||
});
|
||||
|
||||
var log = console.log.bind(console);
|
||||
|
||||
watcher
|
||||
.on('add', function(path:string) { log('File', path, 'has been added'); })
|
||||
.on('addDir', function(path:string) { log('Directory', path, 'has been added'); })
|
||||
.on('change', function(path:string) { log('File', path, 'has been changed'); })
|
||||
.on('unlink', function(path:string) { log('File', path, 'has been removed'); })
|
||||
.on('unlinkDir', function(path:string) { log('Directory', path, 'has been removed'); })
|
||||
.on('error', function(error:any) { log('Error happened', error); })
|
||||
.on('ready', function() { log('Initial scan complete. Ready for changes.'); })
|
||||
.on('raw', function(event:Event, path:string, details:any) { log('Raw event info:', event, path, details); })
|
||||
|
||||
// 'add', 'addDir' and 'change' events also receive stat() results as second
|
||||
// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats
|
||||
watcher.on('change', function(path:string, stats:fs.Stats) {
|
||||
if (stats) console.log('File', path, 'changed size to', stats.size);
|
||||
});
|
||||
|
||||
// Watch new files.
|
||||
watcher.add('new-file');
|
||||
watcher.add(['new-file-2', 'new-file-3', '**/other-file*']);
|
||||
|
||||
// Un-watch some files.
|
||||
watcher.unwatch('new-file*');
|
||||
|
||||
// Only needed if watching is `persistent: true`.
|
||||
watcher.close();
|
||||
|
||||
// One-liner
|
||||
require('chokidar').watch('.', {ignored: /[\/\\]\./}).on('all', function(event:string, path:string) {
|
||||
console.log(event, path);
|
||||
});
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// Type definitions for chokidar 1.0.0
|
||||
// Project: https://github.com/paulmillr/chokidar
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "fs"
|
||||
{
|
||||
interface FSWatcher
|
||||
{
|
||||
add(fileDirOrGlob:string):void;
|
||||
add(filesDirsOrGlobs:Array<string>):void;
|
||||
unwatch(fileDirOrGlob:string):void;
|
||||
unwatch(filesDirsOrGlobs:Array<string>):void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "chokidar"
|
||||
{
|
||||
interface WatchOptions
|
||||
{
|
||||
persistent?:boolean;
|
||||
ignored?:any;
|
||||
ignoreInitial?:boolean;
|
||||
followSymlinks?:boolean;
|
||||
cwd?:string;
|
||||
usePolling?:boolean;
|
||||
useFsEvents?:boolean;
|
||||
alwaysStat?:boolean;
|
||||
depth?:number;
|
||||
interval?:number;
|
||||
binaryInterval?:number;
|
||||
ignorePermissionErrors?:boolean;
|
||||
atomic?:boolean;
|
||||
}
|
||||
|
||||
import fs = require("fs");
|
||||
|
||||
function watch( fileDirOrGlob:string, options?:WatchOptions ):fs.FSWatcher;
|
||||
function watch( filesDirsOrGlobs:Array<string>, options?:WatchOptions ):fs.FSWatcher;
|
||||
}
|
||||
Vendored
+9
-1
@@ -5,6 +5,13 @@
|
||||
|
||||
/// <reference path='../webrtc/MediaStream.d.ts'/>
|
||||
|
||||
////////////////////
|
||||
// Global object
|
||||
////////////////////
|
||||
interface Window {
|
||||
chrome: typeof chrome;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Alarms
|
||||
////////////////////
|
||||
@@ -1538,7 +1545,8 @@ declare module chrome.runtime {
|
||||
}
|
||||
|
||||
interface Port {
|
||||
postMessage: Function;
|
||||
postMessage: (message: Object) => void;
|
||||
disconnect: () => void;
|
||||
sender?: MessageSender;
|
||||
onDisconnect: chrome.events.Event;
|
||||
onMessage: PortMessageEvent;
|
||||
|
||||
Vendored
+3
-3
@@ -728,7 +728,7 @@ declare module D3 {
|
||||
};
|
||||
|
||||
classed: {
|
||||
(name: string): string;
|
||||
(name: string): boolean;
|
||||
(name: string, value: any): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any): Selection;
|
||||
(classValueMap: Object): Selection;
|
||||
@@ -1673,8 +1673,8 @@ declare module D3 {
|
||||
}
|
||||
|
||||
export interface Symbol {
|
||||
type: (string:string) => Symbol;
|
||||
size: (number:number) => Symbol;
|
||||
type: (symbolType: string | ((datum: any, index: number) => string)) => Symbol;
|
||||
size: (size: number | ((datum: any, index: number) => number)) => Symbol;
|
||||
(datum:any, index:number): string;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
///<reference path="../tether/tether.d.ts" />
|
||||
///<reference path="drop.d.ts" />
|
||||
|
||||
var yellowBox = document.querySelector(".yellow");
|
||||
var greenBox = document.querySelector(".green");
|
||||
|
||||
var d = new Drop({
|
||||
position: "bottom left",
|
||||
openOn: "click",
|
||||
constrainToWindow: true,
|
||||
constrainToScrollParent: true,
|
||||
classes: "",
|
||||
tetherOptions: {}
|
||||
});
|
||||
|
||||
d.open();
|
||||
d.close();
|
||||
d.remove();
|
||||
d.toggle();
|
||||
d.position();
|
||||
d.destroy();
|
||||
|
||||
d.on("open", () => null);
|
||||
d.on("close", () => null);
|
||||
d.once("close", () => null);
|
||||
d.off("close", () => null);
|
||||
d.off("open");
|
||||
|
||||
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
// Type definitions for Drop v0.5
|
||||
// Project: http://github.hubspot.com/drop/
|
||||
// Definitions by: Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../tether/tether.d.ts" />
|
||||
|
||||
declare module drop {
|
||||
|
||||
interface DropStatic {
|
||||
new(options: IDropOptions): Drop;
|
||||
}
|
||||
|
||||
interface IDropOptions {
|
||||
target?: Element;
|
||||
content?: Element | string | (() => string);
|
||||
position?: string;
|
||||
openOn?: string;
|
||||
constrainToWindow?: boolean;
|
||||
constrainToScrollParent?: boolean;
|
||||
remove?: boolean;
|
||||
tetherOptions?: tether.ITetherOptions;
|
||||
}
|
||||
|
||||
interface Drop {
|
||||
content: HTMLElement;
|
||||
open(): void;
|
||||
close(): void;
|
||||
remove(): void;
|
||||
toggle(): void;
|
||||
position(): void;
|
||||
destroy(): void;
|
||||
/*
|
||||
* Drop instances fire "open" and "close" events.
|
||||
*/
|
||||
on(event: string, handler: Function, context?: any): void;
|
||||
once(event: string, handler: Function, context?: any): void;
|
||||
off(event: string, handler?: Function): void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "drop" {
|
||||
export = drop;
|
||||
}
|
||||
|
||||
declare var Drop: drop.DropStatic;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="extend.d.ts" />
|
||||
|
||||
import assert = require('assert');
|
||||
import extend = require('extend');
|
||||
|
||||
var objectBase = {
|
||||
test: 'base'
|
||||
};
|
||||
|
||||
var objectOne = {
|
||||
test: 'one',
|
||||
iamone: true
|
||||
};
|
||||
|
||||
var objectTwo = {
|
||||
test: 2,
|
||||
iamtwo: true
|
||||
};
|
||||
|
||||
var objectThree = {
|
||||
iamthree: true,
|
||||
depth: {
|
||||
innerType: 'deep'
|
||||
}
|
||||
};
|
||||
|
||||
var extended = extend(objectBase, objectOne);
|
||||
assert(extended.test === 'one');
|
||||
assert(extended.iamone === true);
|
||||
|
||||
var moreExtended = extend(objectBase, objectOne, objectTwo);
|
||||
assert(moreExtended.test === 2);
|
||||
assert(moreExtended.iamone === true);
|
||||
assert(moreExtended.iamtwo === true);
|
||||
|
||||
var deepExtended = extend(true, objectBase, objectOne, objectTwo, objectThree);
|
||||
assert(deepExtended.iamone === true);
|
||||
assert(moreExtended.iamtwo === true);
|
||||
assert(deepExtended.iamthree === true);
|
||||
assert(deepExtended.depth.innerType === 'one');
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for extend v2.0.0
|
||||
// Project: https://www.npmjs.com/package/extend
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
declare module "extend" {
|
||||
|
||||
function extend(deepOrObject:boolean | Object, ...objectN: Object[]): any;
|
||||
export = extend;
|
||||
}
|
||||
@@ -7,7 +7,7 @@ declare function writeDataToLogFile(fileWriter:FileWriterSync): void;
|
||||
|
||||
function useAsyncFS(fs:FileSystem):void {
|
||||
// see getAsText example in [FILE-API-ED].
|
||||
fs.root.getFile("already_there.txt", null, function (f:FileEntry): void{
|
||||
fs.root.getFile("already_there.txt", null, function (f): void{
|
||||
|
||||
// In the example of the specification, there is a following code:
|
||||
//
|
||||
@@ -19,7 +19,7 @@ function useAsyncFS(fs:FileSystem):void {
|
||||
});
|
||||
|
||||
// But now we can also write to the file; see [FILE-WRITER-ED].
|
||||
fs.root.getFile("logFile", {create: true}, function (f:FileEntry): void{
|
||||
fs.root.getFile("logFile", {create: true}, function (f): void{
|
||||
f.createWriter(writeDataToLogFile);
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+23
-3
@@ -197,7 +197,7 @@ interface Entry {
|
||||
* @param successCallback A callback that is called to return the parent Entry.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
getParent(successCallback:EntryCallback, errorCallback?:ErrorCallback):void;
|
||||
getParent(successCallback:DirectoryEntryCallback, errorCallback?:ErrorCallback):void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,7 +223,7 @@ interface DirectoryEntry extends Entry {
|
||||
* @param successCallback A callback that is called to return the File selected or created.
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*/
|
||||
getFile(path:string, options?:Flags, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void;
|
||||
getFile(path:string, options?:Flags, successCallback?:FileEntryCallback, errorCallback?:ErrorCallback):void;
|
||||
|
||||
/**
|
||||
* Creates or looks up a directory.
|
||||
@@ -240,7 +240,7 @@ interface DirectoryEntry extends Entry {
|
||||
* @param errorCallback A callback that is called when errors happen.
|
||||
*
|
||||
*/
|
||||
getDirectory(path:string, options?:Flags, successCallback?:EntryCallback, errorCallback?:ErrorCallback):void;
|
||||
getDirectory(path:string, options?:Flags, successCallback?:DirectoryEntryCallback, errorCallback?:ErrorCallback):void;
|
||||
|
||||
/**
|
||||
* Deletes a directory and all of its contents, if any. In the event of an error [e.g. trying to delete a directory that contains a file that cannot be removed], some of the contents of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
|
||||
@@ -307,6 +307,26 @@ interface EntryCallback {
|
||||
(entry:Entry):void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface is the callback used to look up FileEntry objects.
|
||||
*/
|
||||
interface FileEntryCallback {
|
||||
/**
|
||||
* @param entry
|
||||
*/
|
||||
(entry:FileEntry):void;
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface is the callback used to look up DirectoryEntry objects.
|
||||
*/
|
||||
interface DirectoryEntryCallback {
|
||||
/**
|
||||
* @param entry
|
||||
*/
|
||||
(entry:DirectoryEntry):void;
|
||||
}
|
||||
|
||||
/**
|
||||
* When readEntries() succeeds, the following callback is made.
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -107,7 +107,7 @@ declare module jquery.flot {
|
||||
ticks?: any; // null or number or ticks array or (fn: axis -> ticks array)
|
||||
tickSize?: any; // number or array
|
||||
minTickSize?: any; // number or array
|
||||
tickFormatter?: (t: number) => string; // (fn: number, object -> string) or string
|
||||
tickFormatter?: (t: number, a?: axis) => string; // (fn: number, object -> string) or string
|
||||
tickDecimals?: number;
|
||||
|
||||
labelWidth?: number;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path="./gulp-concat.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import concat = require("gulp-concat");
|
||||
|
||||
gulp.task("concat:simple", () => {
|
||||
gulp.src(["file*.txt"])
|
||||
.pipe(concat("file.txt"))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("concat:newLine", () => {
|
||||
gulp.src(["file*.txt"])
|
||||
.pipe(concat("file.txt", { newLine: ";" }))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("concat:vinyl", () => {
|
||||
gulp.src(["file*.txt"])
|
||||
.pipe(concat({ path: "file.txt", stat: { mode: 0666 } }))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// Type definitions for gulp-concat
|
||||
// Project: http://github.com/wearefractal/gulp-concat
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-concat" {
|
||||
|
||||
interface IOptions {
|
||||
newLine: string;
|
||||
}
|
||||
|
||||
interface IFsStats {
|
||||
dev?: number;
|
||||
ino?: number;
|
||||
mode?: number;
|
||||
nlink?: number;
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
rdev?: number;
|
||||
size?: number;
|
||||
blksize?: number;
|
||||
blocks?: number;
|
||||
atime?: Date;
|
||||
mtime?: Date;
|
||||
ctime?: Date;
|
||||
}
|
||||
|
||||
interface IVinylOptions {
|
||||
cwd?: string;
|
||||
base?: string;
|
||||
path?: string;
|
||||
stat?: IFsStats;
|
||||
contents?: NodeJS.ReadableStream | Buffer;
|
||||
}
|
||||
|
||||
function concat(filename: string, options?: IOptions): NodeJS.ReadWriteStream;
|
||||
function concat(options: IVinylOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
export = concat;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="./gulp-flatten.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import flatten = require("gulp-flatten");
|
||||
|
||||
gulp.task("flatten:simple", () => {
|
||||
gulp.src(["files/**/*.txt"])
|
||||
.pipe(flatten())
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("flatten:newPath", () => {
|
||||
gulp.src(["files/**/*.txt"])
|
||||
.pipe(flatten({ newPath: "new/path" }))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for gulp-flatten
|
||||
// Project: https://github.com/armed/gulp-flatten
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-flatten" {
|
||||
|
||||
interface IOptions {
|
||||
newPath: string;
|
||||
}
|
||||
|
||||
function flatten(options?: IOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
export = flatten;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/// <reference path="./gulp-inject.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import inject = require("gulp-inject");
|
||||
|
||||
gulp.task("inject:simple", () => {
|
||||
gulp.src("src/index.html")
|
||||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false })))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("inject:relative", () => {
|
||||
gulp.src(["src/index.html"])
|
||||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }), { relative: true }))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("inject:starttag", () => {
|
||||
gulp.src(["src/index.html"])
|
||||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }), { starttag: "<!-- inject:head:{{ext}} -->" }))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("inject:name", () => {
|
||||
gulp.src(["src/index.html"])
|
||||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }), { name: "head" }))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("inject:transform", () => {
|
||||
gulp.src(["files.json"])
|
||||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css", "src/**/*.html"], { read: false }), {
|
||||
starttag: "\"{{ext}}\": [",
|
||||
endtag: "]",
|
||||
transform: (filepath, file, i, length) => {
|
||||
return " \"" + filepath + "\"" + (i + 1 < length ? "," : "");
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for gulp-inject
|
||||
// Project: https://github.com/klei/gulp-inject
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../vinyl/vinyl.d.ts" />
|
||||
|
||||
declare module "gulp-inject" {
|
||||
|
||||
import File = require("vinyl");
|
||||
|
||||
interface ITagFunction {
|
||||
(targetExt: string, sourceExt: string): string;
|
||||
}
|
||||
|
||||
interface ITransformFunction {
|
||||
(filepath: string, file?: File, index?: number, length?: number, targetFile?: File): string;
|
||||
}
|
||||
|
||||
interface IOptions {
|
||||
ignorePath?: string | string[];
|
||||
relative?: boolean;
|
||||
addPrefix?: string;
|
||||
addRootSlash?: boolean;
|
||||
name?: string;
|
||||
starttag?: string | ITagFunction;
|
||||
endtag?: string | ITagFunction;
|
||||
transform?: ITransformFunction;
|
||||
selfClosingTag?: boolean;
|
||||
}
|
||||
|
||||
function inject(sources: NodeJS.ReadableStream, options?: IOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
export = inject;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="./gulp-less.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import less = require("gulp-less");
|
||||
|
||||
gulp.task("less", () => {
|
||||
gulp.src("less/**/*.less")
|
||||
.pipe(less({
|
||||
paths: ["less/includes"]
|
||||
}))
|
||||
.pipe(gulp.dest("public/css"));
|
||||
});
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for gulp-less
|
||||
// Project: https://github.com/plus3network/gulp-less
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-less" {
|
||||
|
||||
interface IOptions {
|
||||
paths: string[];
|
||||
plugins?: any[];
|
||||
}
|
||||
|
||||
function less(options?: IOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
export = less;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="./gulp-minify-css.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import minifyCSS = require("gulp-minify-css");
|
||||
|
||||
gulp.task("minify-css", () => {
|
||||
gulp.src("css/**/*.css")
|
||||
.pipe(minifyCSS({ keepBreaks: true }))
|
||||
.pipe(gulp.dest("dist"));
|
||||
});
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for gulp-minify-css
|
||||
// Project: https://github.com/jonathanepollack/gulp-minify-css
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "gulp-minify-css" {
|
||||
|
||||
interface IOptions {
|
||||
cache?: boolean;
|
||||
advanced?: boolean;
|
||||
aggressiveMerging?: boolean;
|
||||
benchmark?: boolean;
|
||||
compatibility?: string;
|
||||
debug?: boolean;
|
||||
inliner?: Object;
|
||||
keepBreaks?: boolean;
|
||||
keepSpecialComments?: string | number;
|
||||
processImport?: boolean;
|
||||
rebase?: boolean;
|
||||
relativeTo?: string;
|
||||
root?: string;
|
||||
roundingPrecision?: number;
|
||||
shorthandCompacting?: boolean;
|
||||
}
|
||||
|
||||
function minifyCSS(options?: IOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
export = minifyCSS;
|
||||
}
|
||||
Vendored
+1
-1
@@ -7,6 +7,6 @@
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-mocha" {
|
||||
function mocha(setupOptions: MochaSetupOptions): NodeJS.ReadWriteStream;
|
||||
function mocha(setupOptions?: MochaSetupOptions): NodeJS.ReadWriteStream;
|
||||
export = mocha;
|
||||
}
|
||||
Vendored
+6
-2
@@ -10,8 +10,12 @@ declare module "gulp-replace" {
|
||||
skipBinary?: boolean;
|
||||
}
|
||||
|
||||
function replace(pattern: string, replacement: string, opts?: Options): NodeJS.ReadWriteStream;
|
||||
function replace(pattern: RegExp, replacement: string, opts?: Options): NodeJS.ReadWriteStream;
|
||||
interface Replacer {
|
||||
(match: string): string
|
||||
}
|
||||
|
||||
function replace(pattern: string, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream;
|
||||
function replace(pattern: RegExp, replacement: string | Replacer, opts?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
export = replace;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="./gulp-tsd.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import tsd = require("gulp-tsd");
|
||||
|
||||
gulp.task("tsd", () => {
|
||||
gulp.src("gulp_tsd.json")
|
||||
.pipe(tsd());
|
||||
});
|
||||
|
||||
gulp.task("tsd:options", callback => {
|
||||
tsd({
|
||||
command: "reinstall",
|
||||
config: "tsd.json"
|
||||
}, callback);
|
||||
});
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for gulp-tsd
|
||||
// Project: https://github.com/moznion/gulp-tsd
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
declare module "gulp-tsd" {
|
||||
|
||||
interface IOptions {
|
||||
command?: string;
|
||||
latest?: boolean;
|
||||
config?: string;
|
||||
opts?: Object;
|
||||
}
|
||||
|
||||
function tsd(opts?: IOptions, callback?: gulp.ITaskCallback): NodeJS.ReadWriteStream;
|
||||
|
||||
export = tsd;
|
||||
}
|
||||
Vendored
+9
-1
@@ -191,7 +191,15 @@ interface HighchartsBoolOrShadow {
|
||||
interface HighchartsChartResetZoomButton {
|
||||
position: HighchartsPosition;
|
||||
relativeTo?: string;
|
||||
theme?: any; //TO DO
|
||||
theme?: HighchartsChartResetZoomButtonTheme; //TO DO
|
||||
}
|
||||
|
||||
interface HighchartsChartResetZoomButtonTheme {
|
||||
fill?:string; //css HEX colours.
|
||||
stroke?: string;//css HEX colours.
|
||||
r?: number; // Radius %
|
||||
states?: any; // HTML element states eg: hover, with css attributes in object.
|
||||
display?:string; // css attr eg: 'none'
|
||||
}
|
||||
|
||||
interface HighchartsChartOptions {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="ini.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import fs = require("fs");
|
||||
import ini = require("ini");
|
||||
|
||||
var ini_content = fs.readFileSync("path_to_file.ini", "utf-8");
|
||||
|
||||
var ini_object: any = ini.decode(ini_content);
|
||||
var ini_rev_string: string = ini.encode(ini_object);
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// Type definitions for ini v1.3.3
|
||||
// Project: https://github.com/isaacs/ini
|
||||
// Definitions by: Marcin Porębski <https://github.com/marcinporebski>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "ini"
|
||||
{
|
||||
interface EncodeOptions {
|
||||
section: string
|
||||
whitespace: boolean
|
||||
}
|
||||
|
||||
function decode(inistring: string): any;
|
||||
|
||||
function parse(initstring: string): any;
|
||||
|
||||
function encode(object: any, options?: EncodeOptions): string;
|
||||
|
||||
function stringify(object: any, options?: EncodeOptions): string;
|
||||
|
||||
function safe(val: string): string;
|
||||
|
||||
function unsafe(val: string): string;
|
||||
|
||||
}
|
||||
Vendored
+71
-84
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Joint JS 0.6
|
||||
// Type definitions for Joint JS 0.9.3
|
||||
// Project: http://www.jointjs.com/
|
||||
// Definitions by: Aidan Reel <http://github.com/areel>, David Durman <http://github.com/DavidDurman>
|
||||
// Definitions by: Aidan Reel <http://github.com/areel>, David Durman <http://github.com/DavidDurman>, Ewout Van Gossum <https://github.com/DenEwout>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../backbone/backbone.d.ts" />
|
||||
@@ -16,34 +16,36 @@ declare module joint {
|
||||
}
|
||||
|
||||
class Graph extends Backbone.Model {
|
||||
initialize();
|
||||
fromJSON(json: any);
|
||||
clear();
|
||||
addCell(cell: Cell);
|
||||
addCells(cells: Cell[]);
|
||||
getConnectedLinks(cell: Cell, opt?: any): Link[];
|
||||
disconnectLinks(cell: Cell);
|
||||
removeLinks(cell: Cell);
|
||||
addCell(cell:Cell) : void;
|
||||
addCells(cells:Cell[]) : void;
|
||||
initialize() : void;
|
||||
fromJSON(json:any) : void;
|
||||
toJSON() : Object;
|
||||
clear() : void;
|
||||
getConnectedLinks(cell:Cell, opt?:any):Link[];
|
||||
disconnectLinks(cell:Cell) : void;
|
||||
removeLinks(cell:Cell) : void;
|
||||
findModelsFromPoint(point:{x : number; y: number}):Element[];
|
||||
}
|
||||
|
||||
class Cell extends Backbone.Model {
|
||||
toJSON();
|
||||
remove(options?: any);
|
||||
toFront();
|
||||
toBack();
|
||||
embed(cell: Cell);
|
||||
unembed(cell: Cell);
|
||||
getEmbeddedCells(): Cell[];
|
||||
clone(opt?: any): Backbone.Model; // @todo: return can either be Cell or Cell[].
|
||||
attr(attrs: any): Cell;
|
||||
toJSON() : Object;
|
||||
remove(options?:any) : void;
|
||||
toFront() : void;
|
||||
toBack() : void;
|
||||
embed(cell:Cell) : void;
|
||||
unembed(cell:Cell) : void;
|
||||
getEmbeddedCells():Cell[];
|
||||
clone(opt?:any):Backbone.Model; // @todo: return can either be Cell or Cell[].
|
||||
attr(attrs:any):Cell;
|
||||
}
|
||||
|
||||
class Element extends Cell {
|
||||
position(x: number, y: number): Element;
|
||||
translate(tx: number, ty?: number): Element;
|
||||
resize(width: number, height: number): Element;
|
||||
rotate(angle: number, absolute): Element;
|
||||
position(x:number, y:number):Element;
|
||||
translate(tx:number, ty?:number):Element;
|
||||
resize(width:number, height:number):Element;
|
||||
rotate(angle:number, options : {absolute : boolean; origin: {x:number;y:number}}):Element;
|
||||
remove(): void;
|
||||
}
|
||||
|
||||
interface IDefaults {
|
||||
@@ -51,9 +53,10 @@ declare module joint {
|
||||
}
|
||||
|
||||
class Link extends Cell {
|
||||
defaults(): IDefaults;
|
||||
disconnect(): Link;
|
||||
label(idx?: number, value?: any): any; // @todo: returns either a label under idx or Link if both idx and value were passed
|
||||
defaults():IDefaults;
|
||||
disconnect():Link;
|
||||
label(idx?:number, value?:any):any; // @todo: returns either a label under idx or Link if both idx and value were passed
|
||||
remove(): void;
|
||||
}
|
||||
|
||||
interface IOptions {
|
||||
@@ -66,82 +69,66 @@ declare module joint {
|
||||
}
|
||||
|
||||
class Paper extends Backbone.View<Backbone.Model> {
|
||||
options: IOptions;
|
||||
setDimensions(width: number, height: number);
|
||||
scale(sx: number, sy?: number, ox?: number, oy?: number): Paper;
|
||||
rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already
|
||||
findView(el: any): CellView;
|
||||
findViewByModel(modelOrId: any): CellView;
|
||||
findViewsFromPoint(p: { x: number; y: number; }): CellView[];
|
||||
findViewsInArea(r: { x: number; y: number; width: number; height: number; }): CellView[];
|
||||
snapToGrid(p): { x: number; y: number; };
|
||||
options:IOptions;
|
||||
|
||||
setDimensions(width:number, height:number) : void;
|
||||
scale(sx:number, sy?:number, ox?:number, oy?:number):Paper;
|
||||
rotate(deg:number, ox?:number, oy?:number):Paper; // @todo not released yet though it's in the source code already
|
||||
findView(el:any):CellView;
|
||||
findViewByModel(modelOrId:any):CellView;
|
||||
findViewsFromPoint(p:{ x: number; y: number; }):CellView[];
|
||||
findViewsInArea(r:{ x: number; y: number; width: number; height: number; }):CellView[];
|
||||
}
|
||||
|
||||
class ElementView extends CellView {
|
||||
scale(sx: number, sy: number);
|
||||
class ElementView extends CellView {
|
||||
scale(sx:number, sy:number) : void;
|
||||
}
|
||||
|
||||
class CellView extends Backbone.View<Cell> {
|
||||
getBBox(): { x: number; y: number; width: number; height: number; };
|
||||
highlight(el?: any);
|
||||
unhighlight(el?: any);
|
||||
findMagnet(el: any);
|
||||
getSelector(el: any);
|
||||
getBBox():{ x: number; y: number; width: number; height: number; };
|
||||
highlight(el?:any): void;
|
||||
unhighlight(el?:any): void;
|
||||
findMagnet(el:any): void;
|
||||
getSelector(el:any): void;
|
||||
|
||||
pointerdblclick(evt:any, x:number, y:number):void;
|
||||
pointerclick(evt:any, x:number, y:number):void;
|
||||
pointerdown(evt:any, x:number, y:number):void;
|
||||
pointermove(evt:any, x:number, y:number):void;
|
||||
pointerup(evt:any, x:number, y:number):void;
|
||||
}
|
||||
|
||||
class LinkView extends CellView {
|
||||
getConnectionLength(): number;
|
||||
getPointAtLength(length: number): { x: number; y: number; };
|
||||
getConnectionLength():number;
|
||||
getPointAtLength(length:number):{ x: number; y: number; };
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module ui {
|
||||
interface Handle {
|
||||
name : string;
|
||||
position : string;
|
||||
icon: string;
|
||||
}
|
||||
|
||||
class SelectionView extends Backbone.Model {
|
||||
paper:joint.dia.Paper;
|
||||
graph:joint.dia.Graph;
|
||||
model:Backbone.Collection<joint.dia.Cell>;
|
||||
|
||||
constructor(opt:{
|
||||
paper : joint.dia.Paper;
|
||||
graph : joint.dia.Graph;
|
||||
model : Backbone.Collection<joint.dia.Cell>
|
||||
});
|
||||
|
||||
createSelectionBox(cellView:joint.dia.CellView);
|
||||
destroySelectionBox(cellView:joint.dia.CellView);
|
||||
startSelecting(evt:any);
|
||||
cancelSelection();
|
||||
|
||||
addHandle(handle:Handle);
|
||||
removeHandle(name:string);
|
||||
changeHandle(name:string, handle:Handle);
|
||||
}
|
||||
}
|
||||
module ui {}
|
||||
|
||||
module shapes {
|
||||
module basic {
|
||||
class Generic extends joint.dia.Element { }
|
||||
class Rect extends Generic { }
|
||||
class Text extends Generic { }
|
||||
class Circle extends Generic { }
|
||||
class Image extends Generic { }
|
||||
class Generic extends joint.dia.Element {
|
||||
}
|
||||
class Rect extends Generic {
|
||||
}
|
||||
class Text extends Generic {
|
||||
}
|
||||
class Circle extends Generic {
|
||||
}
|
||||
class Image extends Generic {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module util {
|
||||
function uuid(): string;
|
||||
function guid(obj: any): string;
|
||||
function mixin(objects: any[]): any;
|
||||
function supplement(objects: any[]): any;
|
||||
function deepMixin(objects: any[]): any;
|
||||
function deepSupplement(objects: any[], defaultIndicator?: any): any;
|
||||
function uuid():string;
|
||||
function guid(obj:any):string;
|
||||
function mixin(objects:any[]):any;
|
||||
function supplement(objects:any[]):any;
|
||||
function deepMixin(objects:any[]):any;
|
||||
function deepSupplement(objects:any[], defaultIndicator?:any):any;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/// <reference path="gridster.d.ts" />
|
||||
|
||||
var el: HTMLElement = new HTMLElement();
|
||||
|
||||
interface SerializeData {
|
||||
x?: number;
|
||||
y?: number;
|
||||
@@ -18,7 +16,7 @@ var options: GridsterOptions = {
|
||||
}
|
||||
};
|
||||
|
||||
var gridster = <Gridster>$('.gridster ul').gridster(el, options).data('grister');
|
||||
var gridster = <Gridster>$('.gridster ul').gridster(options).data('grister');
|
||||
gridster.add_widget('<li class="new">The HTML of the widget...</li>', 2, 1);
|
||||
gridster.remove_widget($('gridster li').eq(3).get(0));
|
||||
var json = gridster.serialize<SerializeData>();
|
||||
|
||||
Vendored
+1
-2
@@ -160,11 +160,10 @@ interface JQuery {
|
||||
|
||||
/**
|
||||
* Gridster
|
||||
* @param el The HTMLElement that contains all the widgets.
|
||||
* @param options An object with all the gridster options you want to overwrite.
|
||||
* @return Gridster jQuery instance.
|
||||
**/
|
||||
gridster(el: HTMLElement, options?: GridsterOptions): JQuery;
|
||||
gridster(options?: GridsterOptions): JQuery;
|
||||
}
|
||||
|
||||
interface Gridster {
|
||||
|
||||
+26
-2
@@ -3212,7 +3212,7 @@ function test_EventIsCallable() {
|
||||
}
|
||||
|
||||
$.when<any>($.ajax("/my/page.json")).then(a => a.asdf); // is type JQueryPromise<any>
|
||||
$.when($.ajax("/my/page.json")).then((a?,b?,c?) => a.asdf); // is type JQueryPromise<any>
|
||||
$.when<any>($.ajax("/my/page.json")).then((a?,b?,c?) => a.asdf); // is type JQueryPromise<any>
|
||||
$.when("asdf", "jkl;").done((x,y) => x.length + y.length, (x,y) => x.length + y.length);
|
||||
|
||||
var f1 = $.when("fetch"); // Is type JQueryPromise<string>
|
||||
@@ -3370,4 +3370,28 @@ function test_promise_then_change_type() {
|
||||
count().done(data => {
|
||||
}).fail((exception: Error) => {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function test_promise_then_not_return_deferred() {
|
||||
var state: string;
|
||||
|
||||
var deferred: JQueryDeferred<any> = $.Deferred();
|
||||
state = deferred.state();
|
||||
deferred = deferred.progress();
|
||||
deferred = deferred.done();
|
||||
deferred = deferred.fail();
|
||||
deferred = deferred.always();
|
||||
deferred = deferred.notify();
|
||||
deferred = deferred.resolve();
|
||||
deferred = deferred.reject();
|
||||
promise = deferred.promise();
|
||||
promise = deferred.then(function () { });
|
||||
|
||||
var promise: JQueryPromise<any> = $.Deferred().promise();
|
||||
state = promise.state();
|
||||
promise = promise.then(function () { });
|
||||
promise = promise.progress();
|
||||
promise = promise.done();
|
||||
promise = promise.fail();
|
||||
promise = promise.always();
|
||||
}
|
||||
|
||||
Vendored
+27
-70
@@ -276,7 +276,15 @@ interface JQueryGenericPromise<T> {
|
||||
* @param doneFilter A function that is called when the Deferred is resolved.
|
||||
* @param failFilter An optional function that is called when the Deferred is rejected.
|
||||
*/
|
||||
then<U>(doneFilter: (value: T) => U|JQueryGenericPromise<U>, failFilter?: (reason: any) => U|JQueryGenericPromise<U>): JQueryGenericPromise<U>;
|
||||
then<U>(doneFilter: (value: T, ...values: any[]) => U|JQueryPromise<U>, failFilter?: (...reasons: any[]) => U|JQueryPromise<U>, progressFilter?: (...progression: any[]) => any): JQueryPromise<U>;
|
||||
|
||||
/**
|
||||
* Determine the current state of a Deferred object.
|
||||
*/
|
||||
state(): string;
|
||||
|
||||
// Deprecated - given no typings
|
||||
pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,120 +294,81 @@ interface JQueryPromiseCallback<T> {
|
||||
(value?: T, ...args: any[]): void;
|
||||
}
|
||||
|
||||
interface JQueryPromiseOperator<T, R> {
|
||||
(callback: JQueryPromiseCallback<T>, ...callbacks: JQueryPromiseCallback<T>[]): JQueryPromise<R>;
|
||||
(callback: JQueryPromiseCallback<T>[], ...callbacks: JQueryPromiseCallback<T>[]): JQueryPromise<R>;
|
||||
interface JQueryPromiseOperator<T, U> {
|
||||
(callback1: JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[], ...callbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<U>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for the JQuery promise, part of callbacks
|
||||
*/
|
||||
interface JQueryPromise<T> {
|
||||
interface JQueryPromise<T> extends JQueryGenericPromise<T> {
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is either resolved or rejected.
|
||||
*
|
||||
* @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected.
|
||||
* @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
|
||||
*/
|
||||
always: JQueryPromiseOperator<any, T>;
|
||||
always(alwaysCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...alwaysCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is resolved.
|
||||
*
|
||||
* @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved.
|
||||
* @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
|
||||
*/
|
||||
done: JQueryPromiseOperator<T, T>;
|
||||
done(doneCallback1?: JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[], ...doneCallbackN: Array<JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[]>): JQueryPromise<T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is rejected.
|
||||
*
|
||||
* @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected.
|
||||
* @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
|
||||
*/
|
||||
fail: JQueryPromiseOperator<any, T>;
|
||||
fail(failCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...failCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object generates progress notifications.
|
||||
*
|
||||
* @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications.
|
||||
*/
|
||||
progress(progressCallback: JQueryPromiseCallback<T>): JQueryPromise<T>;
|
||||
progress(progressCallbacks: JQueryPromiseCallback<T>[]): JQueryPromise<T>;
|
||||
|
||||
/**
|
||||
* Determine the current state of a Deferred object.
|
||||
*/
|
||||
state(): string;
|
||||
|
||||
// Deprecated - given no typings
|
||||
pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise<any>;
|
||||
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
|
||||
*
|
||||
* @param doneFilter A function that is called when the Deferred is resolved.
|
||||
* @param failFilter An optional function that is called when the Deferred is rejected.
|
||||
* @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
|
||||
*/
|
||||
then<U>(doneFilter: (value: T) => U|JQueryGenericPromise<U>, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise<U>, progressFilter?: (...progression: any[]) => any): JQueryPromise<U>;
|
||||
|
||||
// Because JQuery Promises Suck
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
|
||||
*
|
||||
* @param doneFilter A function that is called when the Deferred is resolved.
|
||||
* @param failFilter An optional function that is called when the Deferred is rejected.
|
||||
* @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
|
||||
*/
|
||||
then<U>(doneFilter: (...values: any[]) => U|JQueryGenericPromise<U>, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise<U>, progressFilter?: (...progression: any[]) => any): JQueryPromise<U>;
|
||||
progress(progressCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...progressCallbackN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryPromise<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for the JQuery deferred, part of callbacks
|
||||
*/
|
||||
interface JQueryDeferred<T> extends JQueryPromise<T> {
|
||||
interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is either resolved or rejected.
|
||||
*
|
||||
* @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected.
|
||||
* @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
|
||||
*/
|
||||
always(alwaysCallbacks1?: JQueryPromiseCallback<T>, ...alwaysCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
always(alwaysCallbacks1?: JQueryPromiseCallback<T>[], ...alwaysCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
always(alwaysCallbacks1?: JQueryPromiseCallback<T>, ...alwaysCallbacks2: any[]): JQueryDeferred<T>;
|
||||
always(alwaysCallbacks1?: JQueryPromiseCallback<T>[], ...alwaysCallbacks2: any[]): JQueryDeferred<T>;
|
||||
always(alwaysCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...alwaysCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryDeferred<T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is resolved.
|
||||
*
|
||||
* @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved.
|
||||
* @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
|
||||
*/
|
||||
done(doneCallbacks1?: JQueryPromiseCallback<T>, ...doneCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
done(doneCallbacks1?: JQueryPromiseCallback<T>[], ...doneCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
done(doneCallbacks1?: JQueryPromiseCallback<T>, ...doneCallbacks2: any[]): JQueryDeferred<T>;
|
||||
done(doneCallbacks1?: JQueryPromiseCallback<T>[], ...doneCallbacks2: any[]): JQueryDeferred<T>;
|
||||
done(doneCallback1?: JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[], ...doneCallbackN: Array<JQueryPromiseCallback<T>|JQueryPromiseCallback<T>[]>): JQueryDeferred<T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object is rejected.
|
||||
*
|
||||
* @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected.
|
||||
* @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
|
||||
*/
|
||||
fail(failCallbacks1?: JQueryPromiseCallback<T>, ...failCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
fail(failCallbacks1?: JQueryPromiseCallback<T>[], ...failCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
fail(failCallbacks1?: JQueryPromiseCallback<T>, ...failCallbacks2: any[]): JQueryDeferred<T>;
|
||||
fail(failCallbacks1?: JQueryPromiseCallback<T>[], ...failCallbacks2: any[]): JQueryDeferred<T>;
|
||||
fail(failCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...failCallbacksN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryDeferred<T>;
|
||||
/**
|
||||
* Add handlers to be called when the Deferred object generates progress notifications.
|
||||
*
|
||||
* @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications.
|
||||
*/
|
||||
progress(progressCallback: JQueryPromiseCallback<T>): JQueryDeferred<T>;
|
||||
progress(progressCallbacks: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
|
||||
progress(progressCallback1?: JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[], ...progressCallbackN: Array<JQueryPromiseCallback<any>|JQueryPromiseCallback<any>[]>): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Call the progressCallbacks on a Deferred object with the given args.
|
||||
*
|
||||
* @param args Optional arguments that are passed to the progressCallbacks.
|
||||
*/
|
||||
notify(...args: any[]): JQueryDeferred<T>;
|
||||
notify(value?: any, ...args: any[]): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Call the progressCallbacks on a Deferred object with the given context and args.
|
||||
@@ -407,21 +376,21 @@ interface JQueryDeferred<T> extends JQueryPromise<T> {
|
||||
* @param context Context passed to the progressCallbacks as the this object.
|
||||
* @param args Optional arguments that are passed to the progressCallbacks.
|
||||
*/
|
||||
notifyWith(context: any, ...args: any[]): JQueryDeferred<T>;
|
||||
notifyWith(context: any, value?: any, ...args: any[]): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Reject a Deferred object and call any failCallbacks with the given args.
|
||||
*
|
||||
* @param args Optional arguments that are passed to the failCallbacks.
|
||||
*/
|
||||
reject(...args: any[]): JQueryDeferred<T>;
|
||||
reject(value?: any, ...args: any[]): JQueryDeferred<T>;
|
||||
/**
|
||||
* Reject a Deferred object and call any failCallbacks with the given context and args.
|
||||
*
|
||||
* @param context Context passed to the failCallbacks as the this object.
|
||||
* @param args An optional array of arguments that are passed to the failCallbacks.
|
||||
*/
|
||||
rejectWith(context: any, ...args: any[]): JQueryDeferred<T>;
|
||||
rejectWith(context: any, value?: any, ...args: any[]): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Resolve a Deferred object and call any doneCallbacks with the given args.
|
||||
@@ -437,7 +406,7 @@ interface JQueryDeferred<T> extends JQueryPromise<T> {
|
||||
* @param context Context passed to the doneCallbacks as the this object.
|
||||
* @param args An optional array of arguments that are passed to the doneCallbacks.
|
||||
*/
|
||||
resolveWith(context: any, ...args: any[]): JQueryDeferred<T>;
|
||||
resolveWith(context: any, value?: T, ...args: any[]): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Return a Deferred's Promise object.
|
||||
@@ -805,19 +774,7 @@ interface JQueryStatic {
|
||||
*
|
||||
* @param deferreds One or more Deferred objects, or plain JavaScript objects.
|
||||
*/
|
||||
when<T>(...deferreds: JQueryGenericPromise<T>[]): JQueryPromise<T>;
|
||||
/**
|
||||
* Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
|
||||
*
|
||||
* @param deferreds One or more Deferred objects, or plain JavaScript objects.
|
||||
*/
|
||||
when<T>(...deferreds: T[]): JQueryPromise<T>;
|
||||
/**
|
||||
* Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
|
||||
*
|
||||
* @param deferreds One or more Deferred objects, or plain JavaScript objects.
|
||||
*/
|
||||
when<T>(...deferreds: any[]): JQueryPromise<T>;
|
||||
when<T>(...deferreds: Array<T|JQueryPromise<T>/* as JQueryDeferred<T> */>): JQueryPromise<T>;
|
||||
|
||||
/**
|
||||
* Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/// <reference path="js-data-angular.d.ts" />
|
||||
|
||||
interface IUser {
|
||||
|
||||
}
|
||||
|
||||
interface CustomScope extends ng.IScope {
|
||||
|
||||
comments: Array<any>;
|
||||
user: IUser;
|
||||
users: Array<IUser>;
|
||||
}
|
||||
|
||||
angular.module('myApp')
|
||||
.controller('commentsCtrl', function ($scope:CustomScope, store:JSData.DS, Comment:JSData.DSResourceDefinition<any>, User:JSData.DSResourceDefinition<any>) {
|
||||
|
||||
Comment.findAll().then(function (comments) {
|
||||
$scope.comments = comments;
|
||||
});
|
||||
|
||||
// shortest version
|
||||
User.bindOne(1, $scope, 'user');
|
||||
|
||||
// short version
|
||||
store.bindOne('user', 1, $scope, 'user');
|
||||
|
||||
// long version
|
||||
$scope.$watch(function () {
|
||||
return store.lastModified('user', 1);
|
||||
}, function () {
|
||||
$scope.user = store.get<IUser>('user', 1);
|
||||
});
|
||||
|
||||
var params = {
|
||||
where: {
|
||||
age: {
|
||||
'>': 30
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// shortest verions
|
||||
User.bindAll(params, $scope, 'users');
|
||||
|
||||
// short version
|
||||
store.bindAll('user', params, $scope, 'users');
|
||||
|
||||
// long version
|
||||
$scope.$watch(function () {
|
||||
return store.lastModified('user');
|
||||
}, function () {
|
||||
$scope.users = store.filter('user', params);
|
||||
});
|
||||
});
|
||||
|
||||
angular.module('myApp')
|
||||
.run(function (DS:JSData.DS) {
|
||||
// We don't register the "User" resource
|
||||
// as a service, so it can only be used
|
||||
// via DS.<method>('user', ...)
|
||||
// The advantage here is that this code
|
||||
// is guaranteed to be executed, and you
|
||||
// only ever have to inject "DS"
|
||||
DS.defineResource('user');
|
||||
})
|
||||
.factory('Comment', function (DS:JSData.DS) {
|
||||
// This code won't execute unless you actually
|
||||
// inject "Comment" somewhere in your code.
|
||||
// Thanks Angular...
|
||||
// Some like injecting actual Resource
|
||||
// definitions, instead of just "DS"
|
||||
return DS.defineResource('comment');
|
||||
});
|
||||
|
||||
angular.module('myApp')
|
||||
.config(function (DSProvider:JSData.DSProvider) {
|
||||
DSProvider.defaults.basePath = '/myApi'; // etc.
|
||||
});
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for JSDataAngular v2.1.0
|
||||
// Project: https://github.com/js-data/js-data-angular
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../js-data/js-data.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module JSData {
|
||||
|
||||
interface DSProvider {
|
||||
defaults:DSConfiguration;
|
||||
}
|
||||
|
||||
interface DS {
|
||||
|
||||
bindAll<T>(resourceName:string, params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array<T>)=>void):Function;
|
||||
|
||||
bindOne<T>(resourceName:string, id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function;
|
||||
}
|
||||
|
||||
interface DSResourceDefinition<T> {
|
||||
|
||||
bindAll<T>(params:DSFilterParams, scope:ng.IScope, expr:string, cb?:(err:DSError, items:Array<T>)=>void):Function;
|
||||
|
||||
bindOne<T>(id:string | number, scope:ng.IScope, expr:string, cb?:(err:DSError, item:T)=>void):Function;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
/// <reference path="js-data-http.d.ts" />
|
||||
|
||||
var adapter = new DSHttpAdapter();
|
||||
var store = new JSData.DS();
|
||||
store.registerAdapter('http', adapter, { default: true });
|
||||
|
||||
var ADocument:JSData.DSResourceDefinition<any> = store.defineResource<any>('document');
|
||||
|
||||
ADocument.inject({ id: 5, author: 'John' });
|
||||
|
||||
// bypass the data store
|
||||
adapter.update(ADocument, 5, { author: 'Johnny' }).then(function (document:any) {
|
||||
document; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// The updated document has NOT been injected into the data store because we bypassed the data store
|
||||
ADocument.get(document.id); // { id: 5, author: 'John' }
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.update(5, { author: 'Johnny' }).then(function (document:any) {
|
||||
document; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// the updated document has been injected into the data store
|
||||
ADocument.get(document.id); // { id: 5, author: 'Johnny' }
|
||||
});
|
||||
|
||||
ADocument.inject({ id: 5, author: 'John' });
|
||||
ADocument.inject({ id: 6, author: 'John' });
|
||||
|
||||
// bypass the data store
|
||||
adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
documents[0]; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// The updated documents have NOT been injected into the data store because we bypassed the data store
|
||||
ADocument.filter({ author: 'John' }); // [{...}, {...}]
|
||||
ADocument.filter({ author: 'Johnny' }); // []
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.updateAll({ author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
documents[0]; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// the updated documents have been injected into the data store
|
||||
ADocument.filter({ author: 'John' }); // []
|
||||
ADocument.filter({ author: 'Johnny' }); // [{...}, {...}]
|
||||
});
|
||||
|
||||
adapter.PUT('/user/1', { name: 'Johnny' }).then(function (data) {
|
||||
data.data; // { id: 1, name: 'Johnny', ... }
|
||||
data.headers; // {...}
|
||||
data.status; // 200
|
||||
data.config; //{...}
|
||||
});
|
||||
|
||||
adapter.POST('/user/1', { name: 'John' }).then(function (data) {
|
||||
data.data; // { id: 1, name: 'John', ... }
|
||||
data.headers; // {...}
|
||||
data.status; // 200
|
||||
data.config; //{...}
|
||||
});
|
||||
|
||||
adapter.HTTP({ url: '/user/1', method: 'put', data: { name: 'Johnny' }}).then(function (data) {
|
||||
data.data; // { id: 1, name: 'Johnny', ... }
|
||||
data.headers; // {...}
|
||||
data.status; // 200
|
||||
data.config; //{...}
|
||||
});
|
||||
|
||||
adapter.GET('/user/1').then(function (data) {
|
||||
data.data; // { id: 1, ... }
|
||||
data.headers; // {...}
|
||||
data.status; // 200
|
||||
data.config; //{...}
|
||||
});
|
||||
|
||||
var User:JSData.DSResourceDefinition<any> = store.defineResource('user');
|
||||
|
||||
var params:any = {
|
||||
age: {
|
||||
'>': 30
|
||||
}
|
||||
};
|
||||
|
||||
// bypass the data store
|
||||
adapter.findAll(User, params).then(function (users) {
|
||||
// users[0].age; 55 // etc., etc.
|
||||
|
||||
// the users have NOT been injected into the data store because we bypassed the data store
|
||||
User.filter(params); // []
|
||||
});
|
||||
|
||||
// normally you would go through the data store
|
||||
User.findAll(params).then(function (users) {
|
||||
// users[0].age; 55 // etc., etc.
|
||||
|
||||
// the users have been injected into the data store
|
||||
User.filter(params); // [{...}, {...}, ...]
|
||||
});
|
||||
|
||||
// bypass the data store
|
||||
adapter.find(ADocument, 5).then(function (document:any) {
|
||||
document; // { id: 5, author: 'John Anderson' }
|
||||
|
||||
// the document has NOT been injected into the data store because we bypassed the data store
|
||||
ADocument.get(document.id); // undefined
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.find(5).then(function (document:any) {
|
||||
document; // { id: 5, author: 'John Anderson' }
|
||||
|
||||
// the document has been injected into the data store
|
||||
ADocument.get(document.id); // { id: 5, author: 'John Anderson' }
|
||||
});
|
||||
|
||||
var params:any = {
|
||||
author: 'John'
|
||||
};
|
||||
|
||||
// bypass the data store
|
||||
adapter.destroyAll(ADocument, params).then(function () {
|
||||
// the documents have NOT been ejected from the data store because we bypassed the data store
|
||||
ADocument.filter(params); // [{...}, {...}, ...]
|
||||
});
|
||||
|
||||
// normally you would go through the data store
|
||||
ADocument.destroyAll(params).then(function () {
|
||||
// the documents have been ejected from the data store
|
||||
ADocument.filter(params); // []
|
||||
});
|
||||
|
||||
ADocument.inject({ id: 5, author: 'John' });
|
||||
|
||||
// bypass the data store
|
||||
adapter.destroy(ADocument, 5).then(function () {
|
||||
// the document is still in the data store because we bypassed the data store
|
||||
//ADocument.get(document.id); // { id: 5, author: 'John' }
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.destroy(5).then(function () {
|
||||
// the document has been ejected from the data store
|
||||
//ADocument.get(document.id); // undefined
|
||||
});
|
||||
|
||||
adapter.DEL('/user/1').then(function (data) {
|
||||
data.data; // 1
|
||||
data.headers; // {...}
|
||||
data.status; // 204
|
||||
data.config; //{...}
|
||||
});
|
||||
|
||||
// bypass the data store
|
||||
adapter.create(ADocument, { author: 'John' }).then(function (document:any) {
|
||||
document; // { id: 5, author: 'John' }
|
||||
|
||||
// The new document has NOT been injected into the data store because we bypassed the data store
|
||||
ADocument.get(document.id); // undefined
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.create({ author: 'John' }).then(function (document:any) {
|
||||
document; // { id: 5, author: 'John' }
|
||||
|
||||
// the new document has been injected into the data store
|
||||
ADocument.get(document.id); // { id: 5, author: 'John' }
|
||||
});
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for JSData Http Adapter v1.2.0
|
||||
// Project: https://github.com/js-data/js-data-http
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../js-data/js-data.d.ts" />
|
||||
|
||||
declare module JSData {
|
||||
|
||||
interface DSHttpAdapterOptions {
|
||||
serialize?: (resourceName:string, data:any)=>any;
|
||||
deserialize?: (resourceName:string, data:any)=>any;
|
||||
queryTransform?: (resourceName:string, params:DSFilterParams)=>any;
|
||||
httpConfig?: any;
|
||||
forceTrailingSlash?: boolean;
|
||||
log?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
error?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
}
|
||||
|
||||
interface DSHttpAdapterPromiseResolveType {
|
||||
data: any;
|
||||
headers: any;
|
||||
status: number;
|
||||
config: any;
|
||||
}
|
||||
|
||||
interface DSHttpAdapter extends IDSAdapter {
|
||||
|
||||
new(options?:DSHttpAdapterOptions):DSHttpAdapter;
|
||||
|
||||
// DSHttpAdapter uses axios so options are axios config objects.
|
||||
HTTP(options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
DEL(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
GET(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
POST(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
PUT(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
}
|
||||
}
|
||||
|
||||
declare var DSHttpAdapter:JSData.DSHttpAdapter;
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="js-data.d.ts" />
|
||||
|
||||
import JSData = require('js-data');
|
||||
//TODO
|
||||
//import DSRedisAdapter = require('js-data-redis')
|
||||
var store = new JSData.DS();
|
||||
|
||||
// register and use http by default for async operations
|
||||
//TODO
|
||||
//store.registerAdapter('redis', new DSRedisAdapter(), {default: true});
|
||||
|
||||
// simplest model definition
|
||||
var User = store.defineResource('user');
|
||||
|
||||
User.find(1).then(function (user: any) {
|
||||
user; // { id: 1, name: 'John' }
|
||||
});
|
||||
@@ -0,0 +1,524 @@
|
||||
/// <reference path="js-data.d.ts" />
|
||||
|
||||
interface IUser {
|
||||
id?: number;
|
||||
name?: string;
|
||||
age?: number;
|
||||
first?: string;
|
||||
last?: string;
|
||||
comments?:Array<any>;
|
||||
profile?:any;
|
||||
}
|
||||
|
||||
interface IUserWithMethod extends IUser {
|
||||
fullName?: () => string;
|
||||
}
|
||||
|
||||
interface IUserWithComputedProperty extends IUser {
|
||||
fullName?: string;
|
||||
}
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
// register and use http by default for async operations
|
||||
//TODO
|
||||
//store.registerAdapter('http', new DSHttpAdapter(), {default: true});
|
||||
|
||||
// simplest model definition
|
||||
var User = store.defineResource<IUser>('user');
|
||||
|
||||
User.find(1).then(function (user:IUser) {
|
||||
user; // { id: 1, name: 'John' }
|
||||
});
|
||||
|
||||
var user:IUser = User.createInstance<IUser>({name: 'John'});
|
||||
|
||||
var store = new JSData.DS();
|
||||
var User = store.defineResource('user');
|
||||
var user:IUser = User.inject<IUser>({id: 1, name: 'John'});
|
||||
var user2:IUser = User.inject<IUser>({id: 1, age: 30});
|
||||
|
||||
user; // User { id: 1, name: 'John', age: 30 }
|
||||
user2; // User { id: 1, name: 'John', age: 30 }
|
||||
User.get(1); // User { id: 1, name: 'John', age: 30 }
|
||||
user === user2; // true
|
||||
user === User.get(1); // true
|
||||
user2 === User.get(1); // true
|
||||
|
||||
var store = new JSData.DS({
|
||||
// set a default lifecycle hook
|
||||
afterCreate: function () {
|
||||
}
|
||||
});
|
||||
|
||||
var User = store.defineResource<IUser>({
|
||||
name: 'user',
|
||||
// override the hook for this resource
|
||||
afterCreate: function () {
|
||||
}
|
||||
});
|
||||
|
||||
User.create({
|
||||
name: 'john'
|
||||
}, {
|
||||
// override the hook just for this method call
|
||||
afterCreate: function () {
|
||||
}
|
||||
}).then(()=> {
|
||||
|
||||
});
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
var UserWithMethod = store.defineResource<IUserWithMethod>({
|
||||
name: 'user',
|
||||
methods: {
|
||||
fullName: function () {
|
||||
return this.first + ' ' + this.last;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var userWithMethod = UserWithMethod.createInstance<IUserWithMethod>({first: 'John', last: 'Anderson'});
|
||||
|
||||
userWithMethod.fullName(); // "John Anderson"
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
var UserWithComputedProperty = store.defineResource<IUserWithComputedProperty>({
|
||||
name: 'user',
|
||||
computed: {
|
||||
// each function's argument list defines the fields
|
||||
// that the computed property depends on
|
||||
fullName: ['first', 'last', function (first:string, last:string) {
|
||||
return first + ' ' + last;
|
||||
}],
|
||||
// shortand, use the array syntax above if you want
|
||||
// you computed properties to work after you've
|
||||
// minified your code. Shorthand style won't work when minified
|
||||
initials: function (first:string, last:string) {
|
||||
return first.toUpperCase()[0] + '. ' + last.toUpperCase()[0] + '.';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var userWithComputedProperty:IUserWithComputedProperty = UserWithComputedProperty.inject<IUserWithComputedProperty>({
|
||||
id: 1,
|
||||
first: 'John',
|
||||
last: 'Anderson'
|
||||
});
|
||||
|
||||
userWithComputedProperty.fullName; // "John Anderson"
|
||||
|
||||
userWithComputedProperty.first = 'Fred';
|
||||
|
||||
// js-data relies on dirty-checking, so the
|
||||
// computed property (probably) hasn't been updated yet
|
||||
userWithComputedProperty.fullName; // "John Anderson"
|
||||
|
||||
// If your browser supports Object.observe this will have no effect
|
||||
// otherwise it will trigger the dirty-checking
|
||||
store.digest();
|
||||
|
||||
userWithComputedProperty.fullName; // "Fred Anderson"
|
||||
|
||||
interface IComment {
|
||||
comments?: any;
|
||||
profile?: any;
|
||||
}
|
||||
|
||||
var aComment:JSData.DSResourceDefinition<IComment> = store.defineResource<IComment>('comment');
|
||||
|
||||
// Get all comments where comment.userId == 5
|
||||
aComment.filter({
|
||||
where: {
|
||||
userId: {
|
||||
'==': 5
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all comments where comment.userId == 5
|
||||
aComment.filter({
|
||||
userId: 5
|
||||
});
|
||||
|
||||
// Get all comments where comment.userId === 5
|
||||
aComment.filter({
|
||||
where: {
|
||||
userId: {
|
||||
'===': 5
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all comments where comment.userId != 5
|
||||
aComment.filter({
|
||||
where: {
|
||||
userId: {
|
||||
'!=': 5
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all comments where comment.userId !== 5
|
||||
aComment.filter({
|
||||
where: {
|
||||
userId: {
|
||||
'!==': 5
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.age > 30
|
||||
User.filter({
|
||||
where: {
|
||||
age: {
|
||||
'>': 30
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.age >= 30
|
||||
User.filter({
|
||||
where: {
|
||||
age: {
|
||||
'>=': 30
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.age < 30
|
||||
User.filter({
|
||||
where: {
|
||||
age: {
|
||||
'<': 30
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.name is in "John Anderson"
|
||||
User.filter({
|
||||
where: {
|
||||
name: {
|
||||
'in': 'John Anderson'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.role is in ["admin", "owner"]
|
||||
User.filter({
|
||||
where: {
|
||||
role: {
|
||||
'in': ['admin', 'owner']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.name is NOT in "John Anderson"
|
||||
User.filter({
|
||||
where: {
|
||||
name: {
|
||||
'notIn': 'John Anderson'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.role is NOT in ["admin", "owner"]
|
||||
User.filter({
|
||||
where: {
|
||||
role: {
|
||||
'notIn': ['admin', 'owner']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.name contains "John"
|
||||
User.filter({
|
||||
where: {
|
||||
name: {
|
||||
'contains': 'John'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Get all users where user.roles contains "admin"
|
||||
User.filter({
|
||||
where: {
|
||||
roles: {
|
||||
'contains': 'admin'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Sorts users by age in ascending order
|
||||
User.filter({
|
||||
orderBy: 'age'
|
||||
});
|
||||
|
||||
// Sorts users by age in descending order
|
||||
User.filter({
|
||||
orderBy: ['age', 'DESC']
|
||||
});
|
||||
|
||||
// Sorts users by age in descending order and then sort by name in ascending order to break a tie
|
||||
User.filter({
|
||||
orderBy: [
|
||||
['age', 'DESC'],
|
||||
['name', 'ASC']
|
||||
]
|
||||
});
|
||||
|
||||
var PAGE_SIZE = 20;
|
||||
var currentPage = 1;
|
||||
|
||||
interface IPost {
|
||||
|
||||
}
|
||||
|
||||
var Post:JSData.DSResourceDefinition<IPost>;
|
||||
|
||||
// Grab the first "page" of posts
|
||||
Post.filter({
|
||||
offset: PAGE_SIZE * (currentPage - 1),
|
||||
limit: PAGE_SIZE
|
||||
});
|
||||
|
||||
var User = store.defineResource({
|
||||
name: 'user',
|
||||
relations: {
|
||||
hasMany: {
|
||||
comment: {
|
||||
localField: 'comments',
|
||||
foreignKey: 'userId'
|
||||
}
|
||||
},
|
||||
hasOne: {
|
||||
profile: {
|
||||
localField: 'profile',
|
||||
foreignKey: 'userId'
|
||||
}
|
||||
},
|
||||
belongsTo: {
|
||||
organization: {
|
||||
localKey: 'organizationId',
|
||||
localField: 'organization',
|
||||
|
||||
// if you add this to a belongsTo relation
|
||||
// then js-data will attempt to use
|
||||
// a nested url structure, e.g. /organization/15/user/4
|
||||
parent: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var Organization = store.defineResource({
|
||||
name: 'organization',
|
||||
relations: {
|
||||
hasMany: {
|
||||
// this is an example of multiple relations
|
||||
// of the same type to the same resource
|
||||
user: [
|
||||
{
|
||||
localField: 'users',
|
||||
foreignKey: 'organizationId'
|
||||
},
|
||||
{
|
||||
localField: 'owners',
|
||||
foreignKey: 'organizationId'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var Profile = store.defineResource({
|
||||
name: 'profile',
|
||||
relations: {
|
||||
belongsTo: {
|
||||
user: {
|
||||
localField: 'user',
|
||||
localKey: 'userId'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var OtherComment = store.defineResource<IComment>({
|
||||
name: 'comment',
|
||||
relations: {
|
||||
belongsTo: {
|
||||
user: {
|
||||
localField: 'user',
|
||||
localKey: 'userId'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
User.find(10).then(function (user:IUser) {
|
||||
// let's assume the server only returned the user
|
||||
user.comments; // undefined
|
||||
user.profile; // undefined
|
||||
|
||||
User.loadRelations(user, ['comment', 'profile']).then(function (user:IUser) {
|
||||
user.comments; // array
|
||||
user.profile; // object
|
||||
});
|
||||
});
|
||||
|
||||
var OtherOtherComment = store.defineResource<IComment>({
|
||||
name: 'comment',
|
||||
relations: {
|
||||
belongsTo: {
|
||||
post: {
|
||||
parent: true,
|
||||
localKey: 'postId',
|
||||
localField: 'post'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// The comment isn't in the data store yet, so js-data wouldn't know
|
||||
// what the id of the parent "post" would be, so we pass it in manually
|
||||
OtherOtherComment.find(5, {params: {postId: 4}}); // GET /post/4/comment/5
|
||||
|
||||
// vs
|
||||
|
||||
var promise = OtherOtherComment.find(5); // GET /comment/5
|
||||
|
||||
promise.then().catch().finally();
|
||||
|
||||
OtherOtherComment.inject({id: 1, postId: 2});
|
||||
|
||||
// We don't have to provide the parentKey here
|
||||
// because js-data found it in the comment
|
||||
OtherOtherComment.update(1, {content: 'stuff'}); // PUT /post/2/comment/1
|
||||
|
||||
// If you don't want the nested for just one of the calls then
|
||||
// you can do the following:
|
||||
OtherOtherComment.update(1, {content: 'stuff'}, {params: {postId: false}}); // PUT /comment/1
|
||||
|
||||
var store = new JSData.DS({
|
||||
// set the default
|
||||
beforeCreate: function (resource, data, cb) {
|
||||
// do something general
|
||||
cb(null, data);
|
||||
}
|
||||
});
|
||||
|
||||
var User = store.defineResource({
|
||||
name: 'user',
|
||||
// set just for this resource
|
||||
beforeCreate: function (resource, data, cb) {
|
||||
// do something more specific to "users"
|
||||
cb(null, data);
|
||||
}
|
||||
});
|
||||
|
||||
User.create({name: 'John'}, {
|
||||
// set just for this method call
|
||||
beforeCreate: function (resource, data, cb) {
|
||||
// do something specific for this method call
|
||||
cb(null, data);
|
||||
}
|
||||
});
|
||||
|
||||
module CustomAdapterTest {
|
||||
|
||||
class MyCustomAdapter implements JSData.IDSAdapter {
|
||||
|
||||
// All of the methods shown here must return a promise
|
||||
|
||||
// "definition" is a resource defintion that would
|
||||
// be returned by DS#defineResource
|
||||
|
||||
// "options" would be the options argument that
|
||||
// was passed into the DS method that is calling
|
||||
// the adapter method
|
||||
|
||||
create(definition:JSData.DSResourceDefinition<any>, attrs:Object, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the created item
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
find(definition:JSData.DSResourceDefinition<any>, id:any, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the found item
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
findAll(definition:JSData.DSResourceDefinition<any>, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the found items
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
update(definition:JSData.DSResourceDefinition<any>, id:any, attrs:Object, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the updated items
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
updateAll(definition:JSData.DSResourceDefinition<any>, attrs:Object, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the updated items
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
destroy(definition:JSData.DSResourceDefinition<any>, id:any, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must return a promise
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
destroyAll(definition:JSData.DSResourceDefinition<any>, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must return a promise
|
||||
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
var store = new JSData.DS();
|
||||
store.registerAdapter('mca', new MyCustomAdapter(), {default: true});
|
||||
// the data store will now use your custom adapter by default
|
||||
}
|
||||
|
||||
/**
|
||||
* showing the use of open ended interface to realize typings
|
||||
* on the Datastore.definitions object where all resource definitions
|
||||
* are saved.
|
||||
*/
|
||||
|
||||
interface MyCustomDataStore {
|
||||
|
||||
myResource: JSData.DSResourceDefinition<MyResourceDefinition>
|
||||
}
|
||||
|
||||
interface MyResourceDefinition {
|
||||
|
||||
}
|
||||
|
||||
module JSData {
|
||||
|
||||
interface DS {
|
||||
|
||||
definitions: MyCustomDataStore;
|
||||
}
|
||||
}
|
||||
|
||||
var store = new JSData.DS();
|
||||
|
||||
var myResourceDefinition = store.defineResource<MyResourceDefinition>('myResource');
|
||||
|
||||
myResourceDefinition = store.definitions.myResource;
|
||||
Vendored
+285
@@ -0,0 +1,285 @@
|
||||
// Type definitions for JSData v1.5.4
|
||||
// Project: https://github.com/js-data/js-data
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// js-data module (js-data.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// defining what exists in JSData and how it looks
|
||||
declare module JSData {
|
||||
|
||||
interface JSDataPromise<R> {
|
||||
|
||||
then<U>(onFulfilled?: (value: R) => U | JSDataPromise<U>, onRejected?: (error: any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
|
||||
catch<U>(onRejected?: (error: any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
|
||||
// enhanced with finally
|
||||
finally<U>(finallyCb?:() => U):JSDataPromise<U>;
|
||||
}
|
||||
|
||||
//TODO switch to class again when typescript supports open ended class declaration
|
||||
interface DS {
|
||||
|
||||
new(config?:DSConfiguration):DS;
|
||||
|
||||
// rather undocumented
|
||||
errors:DSErrors;
|
||||
|
||||
// those are objects containing the defined resources and adapters
|
||||
definitions:any;
|
||||
adapters:any;
|
||||
|
||||
defaults:DSConfiguration;
|
||||
|
||||
// async
|
||||
create<T>(resourceName:string, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
destroy(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
destroyAll(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
find<T>(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
findAll<T>(resourceName:string, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
loadRelations<T>(resourceName:string, idOrInstance:string | number | Object, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
update<T>(resourceName:string, id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
updateAll<T>(resourceName:string, attrs:Object, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
reap(resourceName:string, options?:DSConfiguration):JSDataPromise<any>;
|
||||
refresh<T>(resourceName:string, id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
save<T>(resourceName:string, id:string | number, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
|
||||
// sync
|
||||
changeHistory(resourceName:string, id?:string | number):Array<Object>;
|
||||
changes(resourceName:string, id:string | number):Object;
|
||||
compute<T>(resourceName:string, idOrInstance:number | string | Object ):T;
|
||||
createInstance<T>(resourceName:string, attrs?:T, options?:DSAdapterOperationConfiguration):T;
|
||||
defineResource<T>(resourceNameOrDefinition:string | DSResourceDefinitionConfiguration):DSResourceDefinition<T>;
|
||||
digest():void;
|
||||
eject<T>(resourceName:string, id:string | number, options?:DSConfiguration):T;
|
||||
ejectAll<T>(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array<T>;
|
||||
filter<T>(resourceName:string, params:DSFilterParams, options?:DSConfiguration):Array<T>;
|
||||
get<T>(resourceName:string, id:string | number, options?:DSConfiguration):T;
|
||||
getAll<T>(resourceName:string, ids?:Array<string | number>):Array<T>;
|
||||
hasChanges(resourceName:string, id:string | number):boolean;
|
||||
inject<T>(resourceName:string, attrs:T, options?:DSConfiguration):T;
|
||||
inject<T>(resourceName:string, items:Array<T>, options?:DSConfiguration):Array<T>;
|
||||
is(resourceName:string, object:Object): boolean;
|
||||
lastModified(resourceName:string, id?:string | number):number; // timestamp
|
||||
lastSaved(resourceName:string, id?:string | number):number; // timestamp
|
||||
link<T>(resourceName:string, id:string | number, relations?:Array<string>):T;
|
||||
linkAll<T>(resourceName:string, params:DSFilterParams, relations?:Array<string>):T;
|
||||
linkInverse<T>(resourceName:string, id:string | number, relations?:Array<string>):T;
|
||||
previous<T>(resourceName:string, id:string | number):T;
|
||||
unlinkInverse<T>(resourceName:string, id:string | number, relations?:Array<string>):T;
|
||||
|
||||
registerAdapter(adapterId:string, adapter:IDSAdapter, options?:{default: boolean}):void;
|
||||
}
|
||||
|
||||
interface DSConfiguration extends IDSResourceLifecycleEventHandlers {
|
||||
actions?: Object;
|
||||
allowSimpleWhere?: boolean;
|
||||
basePath?: string;
|
||||
bypassCache?: boolean;
|
||||
cacheResponse?: boolean;
|
||||
defaultAdapter?: string;
|
||||
defaultFilter?: (collection:Array<any>, resourceName:string, params:DSFilterParams, options:DSConfiguration)=>Array<any>;
|
||||
eagerEject?: boolean;
|
||||
// TODO enable when eagerInject in DS#create is implemented
|
||||
//eagerInject?: boolean;
|
||||
endpoint?: string;
|
||||
error?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
fallbackAdapters?: Array<string>;
|
||||
findAllFallbackAdapters?: Array<string>;
|
||||
findAllStrategy?: string;
|
||||
findBelongsTo?: boolean;
|
||||
findFallbackAdapters?: Array<string>;
|
||||
findHasOne?: boolean;
|
||||
findHasMany?: boolean;
|
||||
findInverseLinks?: boolean;
|
||||
findStrategy?: string
|
||||
idAttribute?: string;
|
||||
ignoredChanges?: Array<RegExp | string>;
|
||||
// TODO ignoreMissing is undocumented
|
||||
//ignoreMissing: boolean;
|
||||
keepChangeHistory?: boolean;
|
||||
loadFromServer?: boolean;
|
||||
log?: boolean | ((message?: any, ...optionalParams: any[])=> void);
|
||||
maxAge?: number;
|
||||
notify?: boolean;
|
||||
reapAction?: string;
|
||||
reapInterval?: number;
|
||||
resetHistoryOnInject?: boolean;
|
||||
strategy?: string;
|
||||
upsert?: boolean;
|
||||
useClass?: boolean;
|
||||
useFilter?: boolean;
|
||||
}
|
||||
|
||||
interface DSAdapterOperationConfiguration extends DSConfiguration {
|
||||
adapter?: string
|
||||
}
|
||||
|
||||
interface DSSaveConfiguration extends DSAdapterOperationConfiguration {
|
||||
changesOnly?: boolean;
|
||||
}
|
||||
|
||||
interface DSResourceDefinitionConfiguration extends DSConfiguration {
|
||||
name: string;
|
||||
computed?: any;
|
||||
methods?: any;
|
||||
relations?: {
|
||||
hasMany?: Object;
|
||||
hasOne?: Object;
|
||||
belongsTo?: Object;
|
||||
};
|
||||
}
|
||||
|
||||
interface DSResourceDefinition<T> extends DSResourceDefinitionConfiguration {
|
||||
|
||||
//async
|
||||
create<T>(attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
destroy(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
destroyAll(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<any>;
|
||||
find<T>(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
findAll<T>(params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
loadRelations<T>(idOrInstance:string | number | Object, relations:string | Array<string>, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
update<T>(id:string | number, attrs:Object, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
updateAll<T>(attrs:Object, params?:DSFilterParams, options?:DSAdapterOperationConfiguration):JSDataPromise<Array<T>>;
|
||||
reap(resourceNametions?:DSConfiguration):JSDataPromise<any>;
|
||||
refresh<T>(id:string | number, options?:DSAdapterOperationConfiguration):JSDataPromise<T>;
|
||||
save<T>(id:string | number, options?:DSSaveConfiguration):JSDataPromise<T>;
|
||||
|
||||
// sync
|
||||
changeHistory(id?:string | number):Array<Object>;
|
||||
changes(id:string | number):Object;
|
||||
compute<T>(idOrInstance:number | string | Object ):T;
|
||||
createInstance<T>(attrs?:T, options?:DSAdapterOperationConfiguration):T;
|
||||
digest():void;
|
||||
eject<T>(id:string | number, options?:DSConfiguration):T;
|
||||
ejectAll<T>(params:DSFilterParams, options?:DSConfiguration):Array<T>;
|
||||
filter<T>(params:DSFilterParams, options?:DSConfiguration):Array<T>;
|
||||
get<T>(id:string | number, options?:DSConfiguration):T;
|
||||
getAll<T>(ids?:Array<string | number>):Array<T>;
|
||||
hasChanges(id:string | number):boolean;
|
||||
inject<T>(attrs:T, options?:DSConfiguration):T;
|
||||
inject<T>(items:Array<T>, options?:DSConfiguration):Array<T>;
|
||||
is(object:Object): boolean;
|
||||
lastModified(id?:string | number):number; // timestamp
|
||||
lastSaved(id?:string | number):number; // timestamp
|
||||
link<T>(id:string | number, relations?:Array<string>):T;
|
||||
linkAll<T>(params:DSFilterParams, relations?:Array<string>):T;
|
||||
linkInverse<T>(id:string | number, relations?:Array<string>):T;
|
||||
previous<T>(id:string | number):T;
|
||||
unlinkInverse<T>(id:string | number, relations?:Array<string>):T;
|
||||
}
|
||||
|
||||
interface DSFilterParams {
|
||||
where?: Object;
|
||||
|
||||
limit?: number;
|
||||
|
||||
skip?: number;
|
||||
offset?: number;
|
||||
|
||||
orderBy?: string | Array<string> | Array<Array<string>>;
|
||||
sort?: string | Array<string> | Array<Array<string>>;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleValidateEventHandlers {
|
||||
beforeValidate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
validate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterValidate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleCreateEventHandlers {
|
||||
beforeCreate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterCreate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleCreateInstanceEventHandlers {
|
||||
beforeCreateInstance?: (resourceName:string, data:any)=>void;
|
||||
afterCreateInstance?: (resourceName:string, data:any)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleUpdateEventHandlers {
|
||||
beforeUpdate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterUpdate?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleDestroyEventHandlers {
|
||||
beforeDestroy?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
afterDestroy?: (resourceName:string, data:any, cb:(err:any, data?:any)=>void)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleInjectEventHandlers {
|
||||
beforeInject?: (resourceName:string, data:any)=>void;
|
||||
afterInject?: (resourceName:string, data:any)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleEjectEventHandlers {
|
||||
beforeEject?: (resourceName:string, data:any)=>void;
|
||||
afterEject?: (resourceName:string, data:any)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleReapEventHandlers {
|
||||
beforeReap?: (resourceName:string, data:any)=>void;
|
||||
afterReap?: (resourceName:string, data:any)=>void;
|
||||
}
|
||||
|
||||
interface IDSResourceLifecycleEventHandlers extends IDSResourceLifecycleCreateEventHandlers,
|
||||
IDSResourceLifecycleCreateInstanceEventHandlers,
|
||||
IDSResourceLifecycleValidateEventHandlers,
|
||||
IDSResourceLifecycleUpdateEventHandlers,
|
||||
IDSResourceLifecycleDestroyEventHandlers,
|
||||
IDSResourceLifecycleInjectEventHandlers,
|
||||
IDSResourceLifecycleEjectEventHandlers,
|
||||
IDSResourceLifecycleReapEventHandlers {
|
||||
|
||||
}
|
||||
|
||||
// errors
|
||||
interface DSErrors {
|
||||
|
||||
// types
|
||||
IllegalArgumentError:DSError;
|
||||
IA:DSError;
|
||||
RuntimeError:DSError;
|
||||
R:DSError;
|
||||
NonexistentResourceError:DSError;
|
||||
NER:DSError;
|
||||
}
|
||||
|
||||
interface DSError extends Error {
|
||||
new (message?:string):DSError;
|
||||
message: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
// DSAdapter interface
|
||||
interface IDSAdapter {
|
||||
create<T>(config:DSResourceDefinition<T>, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
|
||||
destroy<T>(config:DSResourceDefinition<T>, id:string | number, options?:DSConfiguration):JSDataPromise<any>;
|
||||
|
||||
destroyAll<T>(config:DSResourceDefinition<T>, params:DSFilterParams, options?:DSConfiguration):JSDataPromise<any>;
|
||||
|
||||
find<T>(config:DSResourceDefinition<T>, id:string | number, options?:DSConfiguration):JSDataPromise<T>;
|
||||
|
||||
findAll<T>(config:DSResourceDefinition<T>, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise<T>;
|
||||
|
||||
update<T>(config:DSResourceDefinition<T>, id:string | number, attrs:Object, options?:DSConfiguration):JSDataPromise<T>;
|
||||
|
||||
updateAll<T>(config:DSResourceDefinition<T>, attrs:Object, params?:DSFilterParams, options?:DSConfiguration):JSDataPromise<T>;
|
||||
}
|
||||
}
|
||||
|
||||
// declaring the existing global js object
|
||||
declare var JSData:{
|
||||
DS: JSData.DS;
|
||||
DSErrors: JSData.DSErrors;
|
||||
};
|
||||
|
||||
//Support node require
|
||||
declare module 'js-data' {
|
||||
|
||||
export = JSData;
|
||||
}
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
/// <reference path="jssha.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
var imported = require("jssha");
|
||||
|
||||
var shaObj1:jsSHA.jsSHA = new jsSHA("This is a Test", "TEXT", "UTF8");
|
||||
var shaObj2 = new imported("This is a Test", "TEXT");
|
||||
|
||||
var hash1:string = shaObj2.getHash("SHA-512", "HEX");
|
||||
var hash2:string = shaObj2.getHash("SHA-512", "HEX", 2);
|
||||
var hash3:string = shaObj2.getHash("SHA-512", "HEX", 2, {outputUpper: false, b64Pad: "foobar"});
|
||||
|
||||
var format:jsSHA.OutputFormatOptions = {outputUpper: false, b64Pad: "foobar"};
|
||||
var hmac1 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX");
|
||||
var hmac2 = shaObj2.getHMAC("SecretKey", "TEXT", "SHA-512", "HEX", format);
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
// Type definitions for jsSHA
|
||||
// Project: https://github.com/Caligatio/jsSHA
|
||||
// Definitions by: David Li <https://github.com/randombk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module jsSHA {
|
||||
export interface OutputFormatOptions {
|
||||
outputUpper : boolean;
|
||||
b64Pad : string;
|
||||
}
|
||||
|
||||
export interface jsSHA {
|
||||
/**
|
||||
* jsSHA is the workhorse of the library. Instantiate it with the string to
|
||||
* be hashed as the parameter
|
||||
*
|
||||
* @constructor
|
||||
* @this {jsSHA}
|
||||
* @param {string} srcString The string to be hashed
|
||||
* @param {string} inputFormat The format of srcString, HEX, TEXT, B64, or BYTES
|
||||
* @param {string=} encoding The text encoding to use to encode the source
|
||||
* string
|
||||
*/
|
||||
new (srcString:string, inputFormat:string, encoding?:string):jsSHA;
|
||||
|
||||
/**
|
||||
* Returns the desired SHA hash of the string specified at instantiation
|
||||
* using the specified parameters
|
||||
*
|
||||
* @param {string} variant The desired SHA variant (SHA-1, SHA-224,
|
||||
* SHA-256, SHA-384, or SHA-512)
|
||||
* @param {string} format The desired output formatting (B64, HEX, or BYTES)
|
||||
* @param {number=} numRounds The number of rounds of hashing to be
|
||||
* executed
|
||||
* @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts
|
||||
* Hash list of output formatting options
|
||||
* @return {string} The string representation of the hash in the format
|
||||
* specified
|
||||
*/
|
||||
getHash(variant:string, format:string, numRounds?:number, outputFormatOpts?:OutputFormatOptions):string;
|
||||
|
||||
/**
|
||||
* Returns the desired HMAC of the string specified at instantiation
|
||||
* using the key and variant parameter
|
||||
*
|
||||
* @param {string} key The key used to calculate the HMAC
|
||||
* @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES
|
||||
* @param {string} variant The desired SHA variant (SHA-1, SHA-224,
|
||||
* SHA-256, SHA-384, or SHA-512)
|
||||
* @param {string} outputFormat The desired output formatting
|
||||
* (B64, HEX, or BYTES)
|
||||
* @param {{outputUpper : boolean, b64Pad : string}=} outputFormatOpts
|
||||
* associative array of output formatting options
|
||||
* @return {string} The string representation of the hash in the format
|
||||
* specified
|
||||
*/
|
||||
getHMAC(key:string, inputFormat:string, variant:string, outputFormat:string, outputFormatOpts?:OutputFormatOptions):string;
|
||||
}
|
||||
}
|
||||
|
||||
declare var jsSHA: jsSHA.jsSHA;
|
||||
declare module 'jssha' {
|
||||
export = jsSHA;
|
||||
}
|
||||
Vendored
+399
-27
@@ -1,7 +1,8 @@
|
||||
// Type definitions for jsTree v3.0.4
|
||||
// Type definitions for jsTree v3.0.9
|
||||
// Project: http://www.jstree.com/
|
||||
// Definitions by: Adam Pluciński <https://github.com/adaskothebeast>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// 45 commit df38535 2015-03-02 13:23 +2:00
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
@@ -14,7 +15,6 @@ interface JQueryStatic {
|
||||
* @type {JSTreeStatic}
|
||||
*/
|
||||
jstree?: JSTreeStatic;
|
||||
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
@@ -165,6 +165,11 @@ interface JSTreeStaticDefaults {
|
||||
*/
|
||||
dnd?: JSTreeStaticDefaultsDragNDrop;
|
||||
|
||||
/**
|
||||
* Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading).
|
||||
*/
|
||||
massload?: JSTreeStaticDefaultsMassload;
|
||||
|
||||
/**
|
||||
* stores all defaults for the search plugin
|
||||
*/
|
||||
@@ -347,6 +352,12 @@ interface JSTreeStaticDefaultsCore {
|
||||
* @name $.jstree.defaults.core.force_text
|
||||
*/
|
||||
force_text?: boolean;
|
||||
|
||||
/**
|
||||
* Should the node should be toggled if the text is double clicked . Defaults to `true`
|
||||
* @name $.jstree.defaults.core.dblclick_toggle
|
||||
*/
|
||||
dblclick_toggle?: boolean;
|
||||
}
|
||||
|
||||
interface JSTreeStaticDefaultsCoreThemes {
|
||||
@@ -524,17 +535,71 @@ interface JSTreeStaticDefaultsDragNDrop {
|
||||
* @plugin dnd
|
||||
*/
|
||||
inside_pos: any;
|
||||
|
||||
/**
|
||||
* when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node
|
||||
* @name $.jstree.defaults.dnd.drag_selection
|
||||
* @plugin dnd
|
||||
*/
|
||||
drag_selection: boolean;
|
||||
|
||||
/**
|
||||
* controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices.
|
||||
* @name $.jstree.defaults.dnd.touch
|
||||
* @plugin dnd
|
||||
*/
|
||||
touch: boolean;
|
||||
|
||||
/**
|
||||
* controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target.
|
||||
* @name $.jstree.defaults.dnd.large_drop_target
|
||||
* @plugin dnd
|
||||
*/
|
||||
large_drop_target: boolean;
|
||||
|
||||
/**
|
||||
* controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected".
|
||||
* @name $.jstree.defaults.dnd.large_drag_target
|
||||
* @plugin dnd
|
||||
*/
|
||||
large_drag_target: boolean;
|
||||
}
|
||||
|
||||
interface JSTreeStaticDefaultsMassload {
|
||||
/**
|
||||
* massload configuration
|
||||
*
|
||||
* It is possible to set this to a standard jQuery-like AJAX config.
|
||||
* In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used.
|
||||
*
|
||||
* You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result.
|
||||
*
|
||||
* Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array.
|
||||
*
|
||||
* {
|
||||
* "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }],
|
||||
* "id2" : [{ "text" : "Child of ID2", "id" : "c3" }]
|
||||
* }
|
||||
*
|
||||
* @name $.jstree.defaults.massload
|
||||
* @plugin massload
|
||||
*/
|
||||
|
||||
url: any;
|
||||
|
||||
data: any;
|
||||
}
|
||||
|
||||
interface JSTreeStaticDefaultsSearch {
|
||||
/**
|
||||
* a jQuery-like AJAX config, which jstree uses if a server should be queried for results.
|
||||
*
|
||||
* A `str` (which is the search string) parameter will be added with the request.
|
||||
* A `str` (which is the search string) parameter will be added with the request,
|
||||
* an optional `inside` parameter will be added if the search is limited to a node id.
|
||||
* The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed.
|
||||
* Leave this setting as `false` to not query the server. You can also set this to a function,
|
||||
* which will be invoked in the instance's scope and receive 2 parameters -
|
||||
* the search string and the callback to call with the array of nodes to load.
|
||||
* which will be invoked in the instance's scope and receive 3 parameters - the search string,
|
||||
* the callback to call with the array of nodes to load, and the optional node ID to limit the search to
|
||||
* @name $.jstree.defaults.search.ajax
|
||||
* @plugin search
|
||||
*/
|
||||
@@ -556,7 +621,7 @@ interface JSTreeStaticDefaultsSearch {
|
||||
|
||||
/**
|
||||
* Indicates if the tree should be filtered (by default) to show only matching nodes
|
||||
* (keep in mind this can be a heavy on large trees in old browsers).
|
||||
* (keep in mind this can be a heavy on large trees in old browsers).
|
||||
* This setting can be changed at runtime when calling the search method. Default is `false`.
|
||||
* @name $.jstree.defaults.search.show_only_matches
|
||||
* @plugin search
|
||||
@@ -637,12 +702,65 @@ interface JSTreeStaticDefaultsUnique {
|
||||
}
|
||||
|
||||
interface JSTree extends JQuery {
|
||||
/**
|
||||
* used to decorate an instance with a plugin. Used internally.
|
||||
* @private
|
||||
* @name plugin(deco [, opts])
|
||||
* @param {String} deco the plugin to decorate with
|
||||
* @param {Object} opts options for the plugin
|
||||
* @return {jsTree}
|
||||
*/
|
||||
plugin: (deco: string, opts?: any) => JSTree;
|
||||
|
||||
/**
|
||||
* used to decorate an instance with a plugin. Used internally.
|
||||
* @private
|
||||
* @name init(el, options)
|
||||
* @param {DOMElement|jQuery|String} el the element we are transforming
|
||||
* @param {Object} options options for this instance
|
||||
* @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree
|
||||
*/
|
||||
init: (el:any, options:any) => void;
|
||||
|
||||
/**
|
||||
* destroy an instance
|
||||
* @name destroy()
|
||||
* @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact
|
||||
*/
|
||||
destroy: (keep_html?: boolean) => void;
|
||||
|
||||
/**
|
||||
* part of the destroying of an instance. Used internally.
|
||||
* @private
|
||||
* @name teardown()
|
||||
*/
|
||||
teardown: () => void;
|
||||
|
||||
/**
|
||||
* bind all events. Used internally.
|
||||
* @private
|
||||
* @name bind()
|
||||
*/
|
||||
bind: () => any;
|
||||
|
||||
/**
|
||||
* part of the destroying of an instance. Used internally.
|
||||
* @private
|
||||
* @name unbind()
|
||||
*/
|
||||
unbind: () => any;
|
||||
|
||||
/**
|
||||
* trigger an event. Used internally.
|
||||
* @private
|
||||
* @name trigger(ev [, data])
|
||||
* @param {String} ev the name of the event to trigger
|
||||
* @param {Object} data additional data to pass with the event
|
||||
*/
|
||||
/*
|
||||
* defined in JQuery
|
||||
*/
|
||||
// trigger: (ev: string, data?: Object) => any;
|
||||
|
||||
/**
|
||||
* returns the jQuery extended instance container
|
||||
@@ -651,6 +769,50 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
get_container: () => JQuery;
|
||||
|
||||
/**
|
||||
* returns the jQuery extended main UL node inside the instance container. Used internally.
|
||||
* @private
|
||||
* @name get_container_ul()
|
||||
* @return {jQuery}
|
||||
*/
|
||||
get_container_ul: () => JQuery;
|
||||
|
||||
/**
|
||||
* gets string replacements (localization). Used internally.
|
||||
* @private
|
||||
* @name get_string(key)
|
||||
* @param {String} key
|
||||
* @return {String}
|
||||
*/
|
||||
get_string: (key: string) => string;
|
||||
|
||||
/**
|
||||
* gets the first child of a DOM node. Used internally.
|
||||
* @private
|
||||
* @name _firstChild(dom)
|
||||
* @param {DOMElement} dom
|
||||
* @return {DOMElement}
|
||||
*/
|
||||
_firstChild: (dom: HTMLElement) => HTMLElement;
|
||||
|
||||
/**
|
||||
* gets the next sibling of a DOM node. Used internally.
|
||||
* @private
|
||||
* @name _nextSibling(dom)
|
||||
* @param {DOMElement} dom
|
||||
* @return {DOMElement}
|
||||
*/
|
||||
_nextSibling: (dom: HTMLElement) => HTMLElement;
|
||||
|
||||
/**
|
||||
* gets the previous sibling of a DOM node. Used internally.
|
||||
* @private
|
||||
* @name _previousSibling(dom)
|
||||
* @param {DOMElement} dom
|
||||
* @return {DOMElement}
|
||||
*/
|
||||
_previousSibling: (dom: HTMLElement) => HTMLElement;
|
||||
|
||||
/**
|
||||
* get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc)
|
||||
* @name get_node(obj [, as_dom])
|
||||
@@ -763,6 +925,107 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
load_node: (obj: any, callback: (node: any, status: boolean) => void) => boolean;
|
||||
|
||||
/**
|
||||
* load an array of nodes (will also load unavailable nodes as soon as the appear in the structure). Used internally.
|
||||
* @private
|
||||
* @name _load_nodes(nodes [, callback])
|
||||
* @param {array} nodes
|
||||
* @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes
|
||||
* @param {Boolean} is_callback - if false reloads node (AP - original comment missing in source code)
|
||||
*/
|
||||
_load_nodes: (nodes: any[], callback?: (nodes: any[]) => void, is_callback?: boolean) => void;
|
||||
|
||||
/**
|
||||
* loads all unloaded nodes
|
||||
* @name load_all([obj, callback])
|
||||
* @param {mixed} obj the node to load recursively, omit to load all nodes in the tree
|
||||
* @param {function} callback a function to be executed once loading all the nodes is complete,
|
||||
* @trigger load_all.jstree
|
||||
*/
|
||||
load_all: (obj: any, callback: () => void) => void;
|
||||
|
||||
/**
|
||||
* handles the actual loading of a node. Used only internally.
|
||||
* @private
|
||||
* @name _load_node(obj [, callback])
|
||||
* @param {mixed} obj
|
||||
* @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status
|
||||
* @return {Boolean}
|
||||
*/
|
||||
_load_node: (obj: any, callback?: (status: boolean) => void) => boolean;
|
||||
|
||||
/**
|
||||
* adds a node to the list of nodes to redraw. Used only internally.
|
||||
* @private
|
||||
* @name _node_changed(obj)
|
||||
* @param {mixed} obj
|
||||
*/
|
||||
_node_changed: (obj: any) => void;
|
||||
|
||||
/**
|
||||
* appends HTML content to the tree. Used internally.
|
||||
* @private
|
||||
* @name _append_html_data(obj, data)
|
||||
* @param {mixed} obj the node to append to
|
||||
* @param {String} data the HTML string to parse and append
|
||||
* @param {function} callback function which takes boolean flag executes after append (AP: originally lack of comment)
|
||||
* @trigger model.jstree, changed.jstree
|
||||
*/
|
||||
_append_html_data: (dom: any, data: string, cb: (flag: boolean) => void) => void;
|
||||
|
||||
/**
|
||||
* appends JSON content to the tree. Used internally.
|
||||
* @private
|
||||
* @name _append_json_data(obj, data)
|
||||
* @param {mixed} dom the node to append to
|
||||
* @param {String} data the JSON object to parse and append
|
||||
* @param {function} cb function which takes boolean flag executes after append (AP: originally lack of comment)
|
||||
* @param {Boolean} force_processing internal param - do not set
|
||||
* @trigger model.jstree, changed.jstree
|
||||
*/
|
||||
_append_json_data: (dom: any, data: string, cb: (flag: boolean) => void, force_processing: boolean) => void;
|
||||
|
||||
/**
|
||||
* parses a node from a jQuery object and appends them to the in memory tree model. Used internally.
|
||||
* @private
|
||||
* @name _parse_model_from_html(d [, p, ps])
|
||||
* @param {jQuery} d the jQuery object to parse
|
||||
* @param {String} p the parent ID
|
||||
* @param {Array} ps list of all parents
|
||||
* @return {String} the ID of the object added to the model
|
||||
*/
|
||||
_parse_model_from_html: (d: JQuery, p?: string, ps?: any[]) => string;
|
||||
|
||||
/**
|
||||
* parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally.
|
||||
* @private
|
||||
* @name _parse_model_from_flat_json(d [, p, ps])
|
||||
* @param {Object} d the JSON object to parse
|
||||
* @param {String} p the parent ID
|
||||
* @param {Array} ps list of all parents
|
||||
* @return {String} the ID of the object added to the model
|
||||
*/
|
||||
_parse_model_from_flat_json: (d: any, p?: string, ps?: any[]) => string;
|
||||
|
||||
/**
|
||||
* parses a node from a JSON object and appends it to the in memory tree model. Used internally.
|
||||
* @private
|
||||
* @name _parse_model_from_json(d [, p, ps])
|
||||
* @param {Object} d the JSON object to parse
|
||||
* @param {String} p the parent ID
|
||||
* @param {Array} ps list of all parents
|
||||
* @return {String} the ID of the object added to the model
|
||||
*/
|
||||
_parse_model_from_json: (d: any, p?: string, ps?: any[]) => string;
|
||||
|
||||
/**
|
||||
* redraws all nodes that need to be redrawn. Used internally.
|
||||
* @private
|
||||
* @name _redraw()
|
||||
* @trigger redraw.jstree
|
||||
*/
|
||||
_redraw: () => void ;
|
||||
|
||||
/**
|
||||
* redraws all nodes that need to be redrawn or optionally - the whole tree
|
||||
* @name redraw([full])
|
||||
@@ -770,6 +1033,25 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
redraw: (full?: boolean) => void;
|
||||
|
||||
/**
|
||||
* redraws a single node's children. Used internally.
|
||||
* @private
|
||||
* @name draw_children(node)
|
||||
* @param {mixed} node the node whose children will be redrawn
|
||||
*/
|
||||
draw_children: (node: any) => void;
|
||||
|
||||
/**
|
||||
* redraws a single node. Used internally.
|
||||
* @private
|
||||
* @name redraw_node(node, deep, is_callback, force_render)
|
||||
* @param {mixed} node the node to redraw
|
||||
* @param {Boolean} deep should child nodes be redrawn too
|
||||
* @param {Boolean} is_callback is this a recursion call
|
||||
* @param {Boolean} force_render should children of closed parents be drawn anyway
|
||||
*/
|
||||
redraw_node: (node: any, deep: boolean, is_callback: boolean, force_render: boolean) => void;
|
||||
|
||||
/**
|
||||
* opens a node, revaling its children. If the node is not loaded it will be loaded and opened once ready.
|
||||
* @name open_node(obj [, callback, animation])
|
||||
@@ -781,6 +1063,14 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
open_node: (obj: any, callback?: any, animation?: any) => void;
|
||||
|
||||
/**
|
||||
* opens every parent of a node (node should be loaded)
|
||||
* @name _open_to(obj)
|
||||
* @param {mixed} obj the node to reveal
|
||||
* @private
|
||||
*/
|
||||
_open_to: (obj:any) => void;
|
||||
|
||||
/**
|
||||
* closes a node, hiding its children
|
||||
* @name close_node(obj [, animation])
|
||||
@@ -841,6 +1131,34 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
disable_node: (obj: any) => boolean;
|
||||
|
||||
/**
|
||||
* called when a node is selected by the user. Used internally.
|
||||
* @private
|
||||
* @name activate_node(obj, e)
|
||||
* @param {mixed} obj the node
|
||||
* @param {Object} e the related event
|
||||
* @trigger activate_node.jstree, changed.jstree
|
||||
*/
|
||||
activate_node: (obj: any, e: any) => void;
|
||||
|
||||
/**
|
||||
* applies the hover state on a node, called when a node is hovered by the user. Used internally.
|
||||
* @private
|
||||
* @name hover_node(obj)
|
||||
* @param {mixed} obj
|
||||
* @trigger hover_node.jstree
|
||||
*/
|
||||
hover_node: (obj: any) => void;
|
||||
|
||||
/**
|
||||
* removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally.
|
||||
* @private
|
||||
* @name dehover_node(obj)
|
||||
* @param {mixed} obj
|
||||
* @trigger dehover_node.jstree
|
||||
*/
|
||||
dehover_node: (obj: any) => void;
|
||||
|
||||
/**
|
||||
* select a node
|
||||
* @name select_node(obj [, supress_event, prevent_open])
|
||||
@@ -908,6 +1226,24 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
get_bottom_selected: (full?: any) => any[];
|
||||
|
||||
/**
|
||||
* gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally.
|
||||
* @name get_state()
|
||||
* @private
|
||||
* @return {Object}
|
||||
*/
|
||||
get_state: () => any;
|
||||
|
||||
/**
|
||||
* sets the state of the tree. Used internally.
|
||||
* @name set_state(state [, callback])
|
||||
* @private
|
||||
* @param {Object} state the state to restore
|
||||
* @param {Function} callback an optional function to execute once the state is restored.
|
||||
* @trigger set_state.jstree
|
||||
*/
|
||||
set_state: (state: any, callback: () => void) => void;
|
||||
|
||||
/**
|
||||
* refreshes the tree - all nodes are reloaded with calls to `load_node`.
|
||||
* @name refresh()
|
||||
@@ -943,6 +1279,17 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
get_text: (obj: any) => string;
|
||||
|
||||
/**
|
||||
* set the text value of a node. Used internally, please use `rename_node(obj, val)`.
|
||||
* @private
|
||||
* @name set_text(obj, val)
|
||||
* @param {mixed} obj the node, you can pass an array to set the text on multiple nodes
|
||||
* @param {String} val the new text value
|
||||
* @return {Boolean}
|
||||
* @trigger set_text.jstree
|
||||
*/
|
||||
set_text: (obj:any, val:string) => boolean;
|
||||
|
||||
/**
|
||||
* gets a JSON representation of a node (or the whole tree)
|
||||
* @name get_json([obj, options])
|
||||
@@ -989,6 +1336,19 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
delete_node: (obj: any) => boolean;
|
||||
|
||||
/**
|
||||
* check if an operation is premitted on the tree. Used internally.
|
||||
* @private
|
||||
* @name check(chk, obj, par, pos)
|
||||
* @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node"
|
||||
* @param {mixed} obj the node
|
||||
* @param {mixed} par the parent
|
||||
* @param {mixed} pos the position to insert at, or if "rename_node" - the new name
|
||||
* @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node
|
||||
* @return {Boolean}
|
||||
*/
|
||||
check: (chk: string, obj: any, par: any, pos: any, more: any) => boolean;
|
||||
|
||||
/**
|
||||
* get the last error
|
||||
* @name last_error()
|
||||
@@ -1005,9 +1365,10 @@ interface JSTree extends JQuery {
|
||||
* @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position
|
||||
* @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded
|
||||
* @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn
|
||||
* @param {Boolean} instance internal parameter indicating if the node comes from another instance
|
||||
* @trigger move_node.jstree
|
||||
*/
|
||||
move_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean) => void;
|
||||
move_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void;
|
||||
|
||||
/**
|
||||
* copy a node to a new parent
|
||||
@@ -1018,9 +1379,10 @@ interface JSTree extends JQuery {
|
||||
* @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position
|
||||
* @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded
|
||||
* @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn
|
||||
* @param {Boolean} instance internal parameter indicating if the node comes from another instance
|
||||
* @trigger model.jstree copy_node.jstree
|
||||
*/
|
||||
copy_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean) => void;
|
||||
copy_node: (obj: any, par: any, pos?: any, callback?: (node: any, new_par: any, pos: any) => void, is_loaded?: boolean, skip_redraw?: boolean, origin?: boolean) => void;
|
||||
|
||||
/**
|
||||
* cut a node (a later call to `paste(obj)` would move the node)
|
||||
@@ -1193,15 +1555,12 @@ interface JSTree extends JQuery {
|
||||
show_icon: (obj: any) => void;
|
||||
|
||||
/**
|
||||
* redraws a single node. Used internally.
|
||||
* set the undetermined state where and if necessary. Used internally.
|
||||
* @private
|
||||
* @name redraw_node(node, deep, is_callback)
|
||||
* @param {mixed} node the node to redraw
|
||||
* @param {Boolean} deep should child nodes be redrawn too
|
||||
* @param {Boolean} is_callback is this a recursion call
|
||||
* @param {Boolean} force_render should children of closed parents be drawn anyway
|
||||
* @name _undetermined()
|
||||
* @plugin checkbox
|
||||
*/
|
||||
redraw_node: (obj: any, deep?: boolean, is_callback?: boolean, force_render?: boolean) => any;
|
||||
_undetermined: () => void;
|
||||
|
||||
/**
|
||||
* show the node checkbox icons
|
||||
@@ -1232,16 +1591,6 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
is_undetermined: (obj: any) => boolean;
|
||||
|
||||
/**
|
||||
* called when a node is selected by the user. Used internally.
|
||||
* @private
|
||||
* @name activate_node(obj, e)
|
||||
* @param {mixed} obj the node
|
||||
* @param {Object} e the related event
|
||||
* @trigger activate_node.jstree, changed.jstree
|
||||
*/
|
||||
activate_node: (obj: any, e: any) => any;
|
||||
|
||||
/**
|
||||
* check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally)
|
||||
* @name check_node(obj)
|
||||
@@ -1315,7 +1664,6 @@ interface JSTree extends JQuery {
|
||||
/**
|
||||
* context menu plugin
|
||||
*/
|
||||
teardown: () => void;
|
||||
|
||||
/**
|
||||
* prepare and show the context menu for a node
|
||||
@@ -1329,16 +1677,31 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
show_contextmenu: (obj: any, x?: number, y?: number, e?: any) => void;
|
||||
|
||||
/**
|
||||
* show the prepared context menu for a node
|
||||
* @name _show_contextmenu(obj, x, y, i)
|
||||
* @param {mixed} obj the node
|
||||
* @param {Number} x the x-coordinate relative to the document to show the menu at
|
||||
* @param {Number} y the y-coordinate relative to the document to show the menu at
|
||||
* @param {Number} i the object of items to show
|
||||
* @plugin contextmenu
|
||||
* @trigger show_contextmenu.jstree
|
||||
* @private
|
||||
*/
|
||||
_show_contextmenu: (obj: any, x: number, y: number, i: number) => void;
|
||||
|
||||
/**
|
||||
* used to search the tree nodes for a given string
|
||||
* @name search(str [, skip_async])
|
||||
* @param {String} str the search string
|
||||
* @param {Boolean} skip_async if set to true server will not be queried even if configured
|
||||
* @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers)
|
||||
* @param {mixed} inside an optional node to whose children to limit the search
|
||||
* @param {Boolean} append if set to true the results of this search are appended to the previous search
|
||||
* @plugin search
|
||||
* @trigger search.jstree
|
||||
*/
|
||||
search: (str: string, skip_async?: boolean, show_only_matches?: boolean) => void;
|
||||
search: (str: string, skip_async?: boolean, show_only_matches?: boolean, inside?: any, append?: boolean) => void;
|
||||
|
||||
/**
|
||||
* used to clear the last search (removes classes and shows all nodes if filtering is on)
|
||||
@@ -1348,6 +1711,15 @@ interface JSTree extends JQuery {
|
||||
*/
|
||||
clear_search: () => void;
|
||||
|
||||
/**
|
||||
* opens nodes that need to be opened to reveal the search results. Used only internally.
|
||||
* @private
|
||||
* @name _search_open(d)
|
||||
* @param {Array} d an array of node IDs
|
||||
* @plugin search
|
||||
*/
|
||||
_search_open: (d: string[]) => void;
|
||||
|
||||
/**
|
||||
* used to sort a node's children
|
||||
* @private
|
||||
|
||||
@@ -161,3 +161,46 @@ var indexedTexts: KnockoutObservable<{ [suffixOrPrefix: string]: string[] }> = t
|
||||
// z: ['baz'],
|
||||
// x: ['qux', 'quux']
|
||||
// }
|
||||
|
||||
|
||||
(() => {
|
||||
var sourceItems: KnockoutObservableArray<number> = ko.observableArray([1, 2, 3, 4, 5]);
|
||||
var asString: KnockoutObservableArray<string>;
|
||||
|
||||
asString = sourceItems.map((x: number) => x.toString());
|
||||
|
||||
asString = sourceItems.map<string>({
|
||||
mapping: (x: number) => x.toString(),
|
||||
});
|
||||
|
||||
asString = sourceItems.map<string>({
|
||||
mapping: (x: number) => x.toString(),
|
||||
disposeItem: (x: string) => console.log('disposing map to', x),
|
||||
});
|
||||
|
||||
asString = sourceItems.map<string>({
|
||||
mappingWithDisposeCallback: (x: number) => ({
|
||||
mappedValue: x.toString(),
|
||||
dispose: () => console.log('disposing map from', x),
|
||||
}),
|
||||
});
|
||||
|
||||
asString = sourceItems.map(x => x.toString());
|
||||
|
||||
asString = sourceItems.map({
|
||||
mapping: x => x.toString(),
|
||||
});
|
||||
|
||||
asString = sourceItems.map<string>({
|
||||
mapping: x => x.toString(),
|
||||
disposeItem: x => console.log('disposing map to', x),
|
||||
});
|
||||
|
||||
asString = sourceItems.map({
|
||||
mappingWithDisposeCallback: x => ({
|
||||
mappedValue: x.toString(),
|
||||
dispose: () => console.log('disposing map from', x),
|
||||
}),
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
+20
-1
@@ -5,8 +5,27 @@
|
||||
|
||||
/// <reference path="../knockout/knockout.d.ts" />
|
||||
|
||||
declare module KnockoutTransformations {
|
||||
interface Mapping<T, TResult> {
|
||||
(value: T): TResult;
|
||||
}
|
||||
interface MappingOption<T, TResult> {
|
||||
mapping: Mapping<T, TResult>;
|
||||
disposeItem?: (item: TResult) => void;
|
||||
}
|
||||
interface MappingWithDisposeCallbackOption<T, TResult> {
|
||||
mappingWithDisposeCallback: (value: T) => {
|
||||
mappedValue: TResult;
|
||||
dispose: () => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
interface KnockoutObservableArrayFunctions<T> {
|
||||
map<TResult>(mapping: (value: T) => TResult): KnockoutObservableArray<TResult>;
|
||||
map<TResult>(mapping: KnockoutTransformations.Mapping<T, TResult>): KnockoutObservableArray<TResult>;
|
||||
map<TResult>(mapping: KnockoutTransformations.MappingOption<T, TResult>): KnockoutObservableArray<TResult>;
|
||||
map<TResult>(mapping: KnockoutTransformations.MappingWithDisposeCallbackOption<T, TResult>): KnockoutObservableArray<TResult>;
|
||||
|
||||
filter(predicate: (value: T) => boolean): KnockoutObservableArray<T>;
|
||||
sortBy(sorter: (value: T, descending: (sorter: any) => any) => any): KnockoutObservableArray<T>;
|
||||
indexBy(indexer: (value: T) => string): KnockoutObservable<{ [index: string]: T[] }>;
|
||||
|
||||
@@ -108,7 +108,6 @@ interface KnockoutValidationGroup {
|
||||
|
||||
interface KnockoutValidationStatic {
|
||||
init(options?: KnockoutValidationConfiguration, force?: boolean): void;
|
||||
configure(options: KnockoutValidationConfiguration): void;
|
||||
reset(): void;
|
||||
|
||||
group(obj: any, options?: any): KnockoutValidationErrors;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/// <reference path="./main-bower-files.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import mainBowerFiles = require("main-bower-files");
|
||||
|
||||
gulp.task("main-bower-files:simple", () => {
|
||||
gulp.src(mainBowerFiles())
|
||||
.pipe(gulp.dest("dist/bower"));
|
||||
});
|
||||
|
||||
gulp.task("main-bower-files:options", () => {
|
||||
var files = mainBowerFiles({
|
||||
debugging: false,
|
||||
env: process.env.NODE_ENV,
|
||||
paths: {
|
||||
bowerDirectory: "path/for/bower_components",
|
||||
bowerrc: "path/for/.bowerrc",
|
||||
bowerJson: "path/for/bower.json"
|
||||
},
|
||||
checkExistence: false,
|
||||
includeDev: false,
|
||||
includeSelf: false,
|
||||
filter: (filepath) => {
|
||||
return filepath.indexOf("search") >= 0;
|
||||
}
|
||||
});
|
||||
|
||||
gulp.src(files, { base: "path/to/bower_components" })
|
||||
.pipe(gulp.dest("dist/bower"));
|
||||
});
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for main-bower-files
|
||||
// Project: https://github.com/ck86/main-bower-files
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "main-bower-files" {
|
||||
|
||||
interface IPaths {
|
||||
bowerDirectory?: string;
|
||||
bowerrc?: string;
|
||||
bowerJson?: string;
|
||||
}
|
||||
|
||||
interface IFilterFunction {
|
||||
(filepath: string): boolean;
|
||||
}
|
||||
|
||||
interface IOptions {
|
||||
debugging?: boolean;
|
||||
main?: string | string[] | Object;
|
||||
env?: string;
|
||||
paths?: IPaths | string;
|
||||
checkExistence?: boolean;
|
||||
includeDev?: boolean | string;
|
||||
includeSelf?: boolean;
|
||||
filter?: RegExp | IFilterFunction | string | string[];
|
||||
}
|
||||
|
||||
function mainBowerFiles(options?: IOptions): string[];
|
||||
|
||||
export = mainBowerFiles;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="./merge-stream.d.ts" />
|
||||
|
||||
import stream = require("stream");
|
||||
import Stream = stream.Readable;
|
||||
import merge = require("merge-stream");
|
||||
|
||||
var stream1 = new Stream();
|
||||
var stream2 = new Stream();
|
||||
|
||||
var merged = merge(stream1, stream2);
|
||||
|
||||
var stream3 = new Stream();
|
||||
merged.add(stream3);
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for merge-stream
|
||||
// Project: https://github.com/grncdr/merge-stream
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "merge-stream" {
|
||||
|
||||
interface IMergedStream extends NodeJS.ReadWriteStream {
|
||||
add: (source: NodeJS.ReadableStream) => IMergedStream;
|
||||
}
|
||||
|
||||
function merge<T extends NodeJS.ReadableStream>(...streams: T[]): IMergedStream;
|
||||
export = merge;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import Polyglot = require("node-polyglot");
|
||||
|
||||
function instantiatePolyglot(): void {
|
||||
var polyglot = new Polyglot();
|
||||
var phrasedPolyglot = new Polyglot({phrases: {"hello": "Hello"}});
|
||||
var localePolyglot = new Polyglot({locale: "fr"});
|
||||
}
|
||||
|
||||
function translate(): void {
|
||||
var polyglot = new Polyglot();
|
||||
|
||||
polyglot.extend({
|
||||
"hello": "Hello",
|
||||
"hello_name": "Hola, %{name}.",
|
||||
"nav": {
|
||||
"sidebar": {
|
||||
"welcome": "Welcome"
|
||||
}
|
||||
},
|
||||
"num_cars": "%{smart_count} car |||| %{smart_count} cars"
|
||||
});
|
||||
|
||||
polyglot.t("hello");
|
||||
polyglot.t("hello_name");
|
||||
polyglot.t("nav.sidebar.welcome");
|
||||
polyglot.t("num_cars", {smart_count: 0});
|
||||
polyglot.t("num_cars", 0);
|
||||
polyglot.t("hello_name", {name: "Spike"});
|
||||
polyglot.t("i_like_to_write_in_language", {
|
||||
_: "I like to write in %{language}.",
|
||||
language: "Javascript"
|
||||
});
|
||||
|
||||
polyglot.replace({
|
||||
"hello": "hey",
|
||||
"nav": {
|
||||
"sidebar": {
|
||||
"welcome": "Greetings"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
polyglot.clear();
|
||||
|
||||
polyglot.locale("fr");
|
||||
polyglot.locale();
|
||||
}
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
// Type definitions for node-polyglot v0.4.1
|
||||
// Project: https://github.com/airbnb/polyglot.js
|
||||
// Definitions by: Tim Jackson-Kiely <https://github.com/timjk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "node-polyglot" {
|
||||
module Polyglot {
|
||||
interface InterpolationOptions {
|
||||
smart_count?: number;
|
||||
_?: string;
|
||||
}
|
||||
|
||||
interface PolyglotOptions {
|
||||
phrases?: any;
|
||||
locale?: string;
|
||||
}
|
||||
}
|
||||
|
||||
class Polyglot {
|
||||
constructor(options?: Polyglot.PolyglotOptions);
|
||||
|
||||
extend(phrases: any): void;
|
||||
|
||||
t(phrase: string): string;
|
||||
|
||||
t(phrase: string, smartCount: number): string;
|
||||
|
||||
t(phrase: string, interpolationOptions: Polyglot.InterpolationOptions): string;
|
||||
|
||||
clear(): void;
|
||||
|
||||
replace(phrases: any): void;
|
||||
|
||||
locale(): string;
|
||||
|
||||
locale(locale: string): void;
|
||||
}
|
||||
|
||||
export = Polyglot;
|
||||
}
|
||||
|
||||
Vendored
+36
-1
@@ -349,7 +349,42 @@ declare module "http" {
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
}
|
||||
export interface Agent { maxSockets: number; sockets: any; requests: any; }
|
||||
|
||||
export interface AgentOptions {
|
||||
/**
|
||||
* Keep sockets around in a pool to be used by other requests in the future. Default = false
|
||||
*/
|
||||
keepAlive?: boolean;
|
||||
/**
|
||||
* When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
|
||||
* Only relevant if keepAlive is set to true.
|
||||
*/
|
||||
keepAliveMsecs?: number;
|
||||
/**
|
||||
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
||||
*/
|
||||
maxSockets?: number;
|
||||
/**
|
||||
* Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
|
||||
*/
|
||||
maxFreeSockets?: number;
|
||||
}
|
||||
|
||||
export class Agent {
|
||||
maxSockets: number;
|
||||
sockets: any;
|
||||
requests: any;
|
||||
|
||||
constructor(opts?: AgentOptions);
|
||||
|
||||
/**
|
||||
* Destroy any sockets that are currently in use by the agent.
|
||||
* It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled,
|
||||
* then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise,
|
||||
* sockets may hang open for quite a long time before the server terminates them.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
export var STATUS_CODES: {
|
||||
[errorCode: number]: string;
|
||||
|
||||
@@ -11,6 +11,7 @@ import http = require("http");
|
||||
import net = require("net");
|
||||
import dgram = require("dgram");
|
||||
import querystring = require('querystring');
|
||||
import path = require("path");
|
||||
|
||||
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
|
||||
|
||||
@@ -154,6 +155,15 @@ module http_tests {
|
||||
var code = 100;
|
||||
var codeMessage = http.STATUS_CODES['400'];
|
||||
var codeMessage = http.STATUS_CODES[400];
|
||||
|
||||
var agent: http.Agent = new http.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 10000,
|
||||
maxSockets: Infinity,
|
||||
maxFreeSockets: 256
|
||||
});
|
||||
|
||||
var agent: http.Agent = http.globalAgent;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@@ -177,3 +187,142 @@ console.log(escaped);
|
||||
var unescaped: string = querystring.unescape(escaped);
|
||||
console.log(unescaped);
|
||||
// http://example.com/product/abcde.html
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// path tests : http://nodejs.org/api/path.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
module path_tests {
|
||||
|
||||
path.normalize('/foo/bar//baz/asdf/quux/..');
|
||||
|
||||
path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
|
||||
// returns
|
||||
//'/foo/bar/baz/asdf'
|
||||
|
||||
try {
|
||||
path.join('foo', {}, 'bar');
|
||||
}
|
||||
catch(error) {
|
||||
|
||||
}
|
||||
|
||||
path.resolve('foo/bar', '/tmp/file/', '..', 'a/../subfile');
|
||||
//Is similar to:
|
||||
//
|
||||
//cd foo/bar
|
||||
//cd /tmp/file/
|
||||
//cd ..
|
||||
// cd a/../subfile
|
||||
//pwd
|
||||
|
||||
path.resolve('/foo/bar', './baz')
|
||||
// returns
|
||||
// '/foo/bar/baz'
|
||||
|
||||
path.resolve('/foo/bar', '/tmp/file/')
|
||||
// returns
|
||||
// '/tmp/file'
|
||||
|
||||
path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif')
|
||||
// if currently in /home/myself/node, it returns
|
||||
// '/home/myself/node/wwwroot/static_files/gif/image.gif'
|
||||
|
||||
path.isAbsolute('/foo/bar') // true
|
||||
path.isAbsolute('/baz/..') // true
|
||||
path.isAbsolute('qux/') // false
|
||||
path.isAbsolute('.') // false
|
||||
|
||||
path.isAbsolute('//server') // true
|
||||
path.isAbsolute('C:/foo/..') // true
|
||||
path.isAbsolute('bar\\baz') // false
|
||||
path.isAbsolute('.') // false
|
||||
|
||||
path.relative('C:\\orandea\\test\\aaa', 'C:\\orandea\\impl\\bbb')
|
||||
// returns
|
||||
// '..\\..\\impl\\bbb'
|
||||
|
||||
path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb')
|
||||
// returns
|
||||
// '../../impl/bbb'
|
||||
|
||||
path.dirname('/foo/bar/baz/asdf/quux')
|
||||
// returns
|
||||
// '/foo/bar/baz/asdf'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html')
|
||||
// returns
|
||||
// 'quux.html'
|
||||
|
||||
path.basename('/foo/bar/baz/asdf/quux.html', '.html')
|
||||
// returns
|
||||
// 'quux'
|
||||
|
||||
path.extname('index.html')
|
||||
// returns
|
||||
// '.html'
|
||||
|
||||
path.extname('index.coffee.md')
|
||||
// returns
|
||||
// '.md'
|
||||
|
||||
path.extname('index.')
|
||||
// returns
|
||||
// '.'
|
||||
|
||||
path.extname('index')
|
||||
// returns
|
||||
// ''
|
||||
|
||||
'foo/bar/baz'.split(path.sep)
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
'foo\\bar\\baz'.split(path.sep)
|
||||
// returns
|
||||
// ['foo', 'bar', 'baz']
|
||||
|
||||
console.log(process.env.PATH)
|
||||
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
|
||||
|
||||
process.env.PATH.split(path.delimiter)
|
||||
// returns
|
||||
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
|
||||
|
||||
console.log(process.env.PATH)
|
||||
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
|
||||
|
||||
process.env.PATH.split(path.delimiter)
|
||||
// returns
|
||||
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
|
||||
|
||||
path.parse('/home/user/dir/file.txt')
|
||||
// returns
|
||||
// {
|
||||
// root : "/",
|
||||
// dir : "/home/user/dir",
|
||||
// base : "file.txt",
|
||||
// ext : ".txt",
|
||||
// name : "file"
|
||||
// }
|
||||
|
||||
path.parse('C:\\path\\dir\\index.html')
|
||||
// returns
|
||||
// {
|
||||
// root : "C:\",
|
||||
// dir : "C:\path\dir",
|
||||
// base : "index.html",
|
||||
// ext : ".html",
|
||||
// name : "index"
|
||||
// }
|
||||
|
||||
path.format({
|
||||
root : "/",
|
||||
dir : "/home/user/dir",
|
||||
base : "file.txt",
|
||||
ext : ".txt",
|
||||
name : "file"
|
||||
});
|
||||
// returns
|
||||
// '/home/user/dir/file.txt'
|
||||
}
|
||||
|
||||
Vendored
+50
-2
@@ -349,7 +349,42 @@ declare module "http" {
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
}
|
||||
export interface Agent { maxSockets: number; sockets: any; requests: any; }
|
||||
|
||||
export interface AgentOptions {
|
||||
/**
|
||||
* Keep sockets around in a pool to be used by other requests in the future. Default = false
|
||||
*/
|
||||
keepAlive?: boolean;
|
||||
/**
|
||||
* When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
|
||||
* Only relevant if keepAlive is set to true.
|
||||
*/
|
||||
keepAliveMsecs?: number;
|
||||
/**
|
||||
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
||||
*/
|
||||
maxSockets?: number;
|
||||
/**
|
||||
* Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256.
|
||||
*/
|
||||
maxFreeSockets?: number;
|
||||
}
|
||||
|
||||
export class Agent {
|
||||
maxSockets: number;
|
||||
sockets: any;
|
||||
requests: any;
|
||||
|
||||
constructor(opts?: AgentOptions);
|
||||
|
||||
/**
|
||||
* Destroy any sockets that are currently in use by the agent.
|
||||
* It is usually not necessary to do this. However, if you are using an agent with KeepAlive enabled,
|
||||
* then it is best to explicitly shut down the agent when you know that it will no longer be used. Otherwise,
|
||||
* sockets may hang open for quite a long time before the server terminates them.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
export var STATUS_CODES: {
|
||||
[errorCode: number]: string;
|
||||
@@ -609,7 +644,7 @@ declare module "child_process" {
|
||||
stderr: stream.Readable;
|
||||
pid: number;
|
||||
kill(signal?: string): void;
|
||||
send(message: any, sendHandle: any): void;
|
||||
send(message: any, sendHandle?: any): void;
|
||||
disconnect(): void;
|
||||
}
|
||||
|
||||
@@ -965,14 +1000,27 @@ declare module "fs" {
|
||||
}
|
||||
|
||||
declare module "path" {
|
||||
|
||||
export interface ParsedPath {
|
||||
root: string;
|
||||
dir: string;
|
||||
base: string;
|
||||
ext: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export function normalize(p: string): string;
|
||||
export function join(...paths: any[]): string;
|
||||
export function resolve(...pathSegments: any[]): string;
|
||||
export function isAbsolute(p: string): boolean;
|
||||
export function relative(from: string, to: string): string;
|
||||
export function dirname(p: string): string;
|
||||
export function basename(p: string, ext?: string): string;
|
||||
export function extname(p: string): string;
|
||||
export var sep: string;
|
||||
export var delimiter: string;
|
||||
export function parse(p: string): ParsedPath;
|
||||
export function format(pP: ParsedPath): string;
|
||||
}
|
||||
|
||||
declare module "string_decoder" {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/// <reference path="png-async.d.ts" />
|
||||
|
||||
import fs = require('fs');
|
||||
import png = require('png-async');
|
||||
|
||||
var devnull = process.platform === 'win32' ? 'nul' : '/dev/null';
|
||||
|
||||
// stream test
|
||||
var img = new png.Image({
|
||||
width: 1,
|
||||
height: 1,
|
||||
fill: true
|
||||
})
|
||||
.pack()
|
||||
.pipe(png.createImage({
|
||||
deflateStrategy: png.EDeflateStrategy.FIXED,
|
||||
filterType: png.EFilterType.Auto
|
||||
})
|
||||
.on('parsed', function () {
|
||||
|
||||
if (this.data[0] !== 0) {
|
||||
throw new Error('invalid data');
|
||||
}
|
||||
|
||||
this.data[0] = 255;
|
||||
this.data[3] = 255;
|
||||
|
||||
this.pack().pipe(fs.createWriteStream(devnull)).on('finish', () => {
|
||||
console.log('done');
|
||||
});
|
||||
})
|
||||
);
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
// Type definitions for png-async
|
||||
// Project: https://github.com/kanreisa/node-png-async
|
||||
// Definitions by: Yuki KAN <https://github.com/kanreisa>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'png-async' {
|
||||
import stream = require('stream');
|
||||
|
||||
export interface IImageOptions {
|
||||
width?: number;
|
||||
height?: number;
|
||||
fill?: boolean;
|
||||
checkCRC?: boolean;
|
||||
deflateChunkSize?: number;
|
||||
deflateLevel?: number;
|
||||
deflateStrategy?: EDeflateStrategy;
|
||||
filterType?: EFilterType;
|
||||
}
|
||||
|
||||
export enum EDeflateStrategy {
|
||||
DEFAULT_STRATEGY = 0,
|
||||
FILTERED = 1,
|
||||
HUFFMAN_ONLY = 2,
|
||||
RLE = 3,
|
||||
FIXED = 4,
|
||||
}
|
||||
|
||||
export enum EFilterType {
|
||||
Auto = -1,
|
||||
None = 0,
|
||||
Sub = 1,
|
||||
Up = 2,
|
||||
Average = 3,
|
||||
Paeth = 4,
|
||||
}
|
||||
|
||||
export function createImage(option?: IImageOptions): Image;
|
||||
|
||||
export class Image extends stream.Duplex {
|
||||
width: number;
|
||||
height: number;
|
||||
gamma: number;
|
||||
data: Buffer;
|
||||
constructor(option?: IImageOptions);
|
||||
pack(): Image;
|
||||
parse(data: Buffer, callback?: (err: Error, image: Image) => void): Image;
|
||||
write(data: any, cb?: any): boolean;
|
||||
end(data?: any): void;
|
||||
bitblt(dst: Image, sx: number, sy: number, w: number, h: number, dx: number, dy: number): Image;
|
||||
|
||||
on(event: string, listener: Function): Image;
|
||||
once(event: string, listener: Function): Image;
|
||||
removeListener(event: string, listener: Function): Image;
|
||||
removeAllListeners(event: string): Image;
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,7 @@ Q.allResolved([])
|
||||
declare var arrayPromise: Q.IPromise<number[]>;
|
||||
declare var stringPromise: Q.IPromise<string>;
|
||||
declare function returnsNumPromise(text: string): Q.Promise<number>;
|
||||
declare function returnsNumPromise(text: string): JQueryPromise<number>;
|
||||
|
||||
Q<number[]>(arrayPromise) // type specification required
|
||||
.then(arr => arr.join(','))
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
These definitions are far from complete.
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for Rappid 1.5
|
||||
// Project: http://jointjs.com/about-rappid
|
||||
// Definitions by: Ewout Van Gossum <https://github.com/DenEwout>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jointjs/jointjs.d.ts" />
|
||||
/// <reference path="../backbone/backbone.d.ts" />
|
||||
|
||||
declare module joint{
|
||||
module ui{
|
||||
interface Handle {
|
||||
name : string;
|
||||
position : string;
|
||||
icon: string;
|
||||
}
|
||||
|
||||
class SelectionView extends Backbone.Model {
|
||||
paper:joint.dia.Paper;
|
||||
graph:joint.dia.Graph;
|
||||
model:Backbone.Collection<joint.dia.Cell>;
|
||||
|
||||
constructor(opt:{
|
||||
paper : joint.dia.Paper;
|
||||
graph : joint.dia.Graph;
|
||||
model : Backbone.Collection<joint.dia.Cell>
|
||||
});
|
||||
|
||||
createSelectionBox(cellView:joint.dia.CellView) : void;
|
||||
destroySelectionBox(cellView:joint.dia.CellView) : void;
|
||||
startSelecting(evt:any) : void;
|
||||
cancelSelection() : void;
|
||||
|
||||
addHandle(handle:Handle) : void;
|
||||
removeHandle(name:string) : void;
|
||||
changeHandle(name:string, handle:Handle) : void;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,3 +135,17 @@ client = rest
|
||||
.wrap(fail)
|
||||
.wrap(knownConfig, { prop: 'value' })
|
||||
.wrap(transformedConfig, { prop: 'value' });
|
||||
|
||||
import xhrClient = require('rest/client/xhr');
|
||||
import nodeClient = require('rest/client/node');
|
||||
import jsonpClient = require('rest/client/jsonp');
|
||||
import xdrClient = require('rest/client/xdr');
|
||||
|
||||
rest.setDefaultClient(xhrClient);
|
||||
rest.setDefaultClient(nodeClient);
|
||||
rest.setDefaultClient(jsonpClient);
|
||||
rest.setDefaultClient(xdrClient);
|
||||
|
||||
var defaultClient: rest.Client = rest.getDefaultClient();
|
||||
|
||||
rest.resetDefaultClient();
|
||||
|
||||
Vendored
+28
@@ -14,6 +14,10 @@ declare module "rest" {
|
||||
function rest(request: rest.Request): rest.ResponsePromise;
|
||||
|
||||
module rest {
|
||||
export function setDefaultClient(client: Client): void;
|
||||
export function getDefaultClient(): Client;
|
||||
export function resetDefaultClient(): void;
|
||||
|
||||
export function wrap<T>(interceptor: Interceptor<T>, config?: T): Client;
|
||||
|
||||
export interface Request {
|
||||
@@ -319,3 +323,27 @@ declare module "rest/mime/registry" {
|
||||
|
||||
export = registry;
|
||||
}
|
||||
|
||||
declare module "rest/client/xhr" {
|
||||
import rest = require("rest");
|
||||
var xhr: rest.Client;
|
||||
export = xhr;
|
||||
}
|
||||
|
||||
declare module "rest/client/node" {
|
||||
import rest = require("rest");
|
||||
var node: rest.Client;
|
||||
export = node;
|
||||
}
|
||||
|
||||
declare module "rest/client/jsonp" {
|
||||
import rest = require("rest");
|
||||
var jsonp: rest.Client;
|
||||
export = jsonp;
|
||||
}
|
||||
|
||||
declare module "rest/client/xdr" {
|
||||
import rest = require("rest");
|
||||
var xdr: rest.Client;
|
||||
export = xdr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference path="./run-sequence.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
import gulp = require("gulp");
|
||||
import tmp = require("run-sequence");
|
||||
var runSequence = tmp.use(gulp);
|
||||
|
||||
gulp.task("run-sequence", callback => {
|
||||
runSequence("task1",
|
||||
["task2", "task3"],
|
||||
"taks4",
|
||||
callback);
|
||||
});
|
||||
|
||||
gulp.task("task1", () => {
|
||||
gulp.src("file1.txt")
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("task2", () => {
|
||||
gulp.src("file2.txt")
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("task3", () => {
|
||||
gulp.src("file3.txt")
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
gulp.task("task4", () => {
|
||||
gulp.src("file4.txt")
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for run-sequence
|
||||
// Project: https://github.com/OverZealous/run-sequence
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
|
||||
declare module "run-sequence" {
|
||||
|
||||
interface IRunSequence {
|
||||
(...streams: (string | string[] | gulp.ITaskCallback)[]): NodeJS.ReadWriteStream;
|
||||
|
||||
use(gulp: gulp.Gulp): IRunSequence;
|
||||
}
|
||||
|
||||
var _tmp: IRunSequence;
|
||||
export = _tmp;
|
||||
}
|
||||
Vendored
+13
-8
@@ -37,19 +37,19 @@ declare module SocketIO {
|
||||
emit(name: string, ...args: any[]): Socket;
|
||||
use(fn: Function): Namespace;
|
||||
|
||||
on(event: 'connection', listener: (socket: Socket) => void): any;
|
||||
on(event: 'connect', listener: (socket: Socket) => void): any;
|
||||
on(event: string, listener: Function): any;
|
||||
on(event: 'connection', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: 'connect', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: string, listener: Function): Namespace;
|
||||
}
|
||||
|
||||
interface Namespace extends NodeJS.EventEmitter {
|
||||
name: string;
|
||||
connected: { [id: string]: Socket };
|
||||
use(fn: Function): Namespace
|
||||
use(fn: Function): Namespace;
|
||||
|
||||
on(event: 'connection', listener: (socket: Socket) => void): any;
|
||||
on(event: 'connect', listener: (socket: Socket) => void): any;
|
||||
on(event: string, listener: Function): any;
|
||||
on(event: 'connection', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: 'connect', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: string, listener: Function): Namespace;
|
||||
}
|
||||
|
||||
interface Socket {
|
||||
@@ -63,8 +63,13 @@ declare module SocketIO {
|
||||
leave(name: string, fn?: Function): Socket;
|
||||
to(room: string): Socket;
|
||||
in(room: string): Socket;
|
||||
send(...args: any[]): Socket;
|
||||
write(...args: any[]): Socket;
|
||||
|
||||
on(event: string, listener: Function): any;
|
||||
on(event: string, listener: Function): Socket;
|
||||
once(event: string, listener: Function): Socket;
|
||||
removeListener(event: string, listener: Function): Socket;
|
||||
removeAllListeners(event: string): Socket;
|
||||
broadcast: Socket;
|
||||
volatile: Socket;
|
||||
connected: boolean;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path="./stream-series.d.ts" />
|
||||
|
||||
import stream = require("stream");
|
||||
import Stream = stream.Duplex;
|
||||
import series = require("stream-series");
|
||||
|
||||
var stream1 = new Stream();
|
||||
var stream2 = new Stream();
|
||||
var stream3 = new Stream();
|
||||
|
||||
var orderedStream = series(stream1, stream3, stream2);
|
||||
console.log(orderedStream.toString());
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for stream-series
|
||||
// Project: https://github.com/rschmukler/stream-series
|
||||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "stream-series" {
|
||||
function series<T extends NodeJS.ReadableStream>(...streams: T[]): NodeJS.ReadWriteStream;
|
||||
export = series;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
///<reference path="tether.d.ts" />
|
||||
|
||||
var yellowBox = document.querySelector(".yellow");
|
||||
var greenBox = document.querySelector(".green");
|
||||
|
||||
new Tether({
|
||||
attachment: "bottom middle",
|
||||
targetAttachment: "top middle",
|
||||
targetModifier: "visible",
|
||||
offset: "-15px 0",
|
||||
targetOffset: "0 0"
|
||||
});
|
||||
|
||||
new Tether({
|
||||
element: yellowBox,
|
||||
target: greenBox,
|
||||
attachment: "top left",
|
||||
optimizations: {
|
||||
gpu: false
|
||||
}
|
||||
});
|
||||
|
||||
new Tether({
|
||||
element: yellowBox,
|
||||
target: greenBox,
|
||||
attachment: "top left",
|
||||
targetAttachment: "bottom left",
|
||||
constraints: [
|
||||
{
|
||||
to: "scrollParent",
|
||||
pin: true
|
||||
},
|
||||
{
|
||||
to: "window",
|
||||
attachment: "together"
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
new Tether({
|
||||
element: yellowBox,
|
||||
target: greenBox,
|
||||
attachment: "middle left",
|
||||
targetAttachment: "middle left",
|
||||
constraints: [
|
||||
{
|
||||
to: "scrollParent",
|
||||
pin: ["top"]
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
Vendored
+50
@@ -0,0 +1,50 @@
|
||||
// Type definitions for Tether v0.6
|
||||
// Project: http://github.hubspot.com/tether/
|
||||
// Definitions by: Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module tether {
|
||||
|
||||
interface TetherStatic {
|
||||
new(options: ITetherOptions): Tether;
|
||||
}
|
||||
|
||||
interface ITetherOptions {
|
||||
attachment?: string;
|
||||
classes?: {[className: string]: boolean};
|
||||
classPrefix?: string;
|
||||
constraints?: ITetherConstraint[];
|
||||
element?: Element | string | any /* JQuery */;
|
||||
enabled?: boolean;
|
||||
offset?: string;
|
||||
optimizations?: any;
|
||||
target?: Element | string | any /* JQuery */;
|
||||
targetAttachment?: string;
|
||||
targetOffset?: string;
|
||||
targetModifier?: string;
|
||||
}
|
||||
|
||||
interface ITetherConstraint {
|
||||
attachment?: string;
|
||||
outOfBoundsClass?: string;
|
||||
pin?: boolean | string[];
|
||||
pinnedClass?: string;
|
||||
to?: string | Element | number[];
|
||||
}
|
||||
|
||||
interface Tether {
|
||||
setOptions(options: ITetherOptions): void;
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
destroy(): void;
|
||||
position(): void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "tether" {
|
||||
export = tether;
|
||||
}
|
||||
|
||||
declare var Tether: tether.TetherStatic;
|
||||
|
||||
Vendored
+1
-1
@@ -5613,7 +5613,7 @@ declare module THREE {
|
||||
constructor(object: Object3D, hex?: number);
|
||||
|
||||
object: Object3D;
|
||||
box: Box3[];
|
||||
box: Box3;
|
||||
|
||||
update(): void;
|
||||
}
|
||||
|
||||
@@ -1,219 +0,0 @@
|
||||
/// <reference path="timezonecomplete-1.10.0.d.ts" />
|
||||
|
||||
import tc = require("timezonecomplete-1.10.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 = 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();
|
||||
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");
|
||||
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);
|
||||
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 = 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());
|
||||
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();
|
||||
dt = dt.startOfDay();
|
||||
|
||||
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));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-1296
File diff suppressed because it is too large
Load Diff
@@ -1,169 +0,0 @@
|
||||
/// <reference path="timezonecomplete-1.2.0.d.ts" />
|
||||
|
||||
import tc = require("timezonecomplete-1.2.0");
|
||||
|
||||
var b: boolean = tc.isLeapYear(2014);
|
||||
var n: number = tc.daysInMonth(2014, 10);
|
||||
var s: string = tc.isoString(2014, 6, 30, 22, 10, 11, 230);
|
||||
|
||||
// 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();
|
||||
|
||||
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.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.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();
|
||||
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()));
|
||||
s = dt.toIsoString();
|
||||
s = dt.toString();
|
||||
s = dt.toUtcString();
|
||||
|
||||
// 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();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-681
@@ -1,681 +0,0 @@
|
||||
// Type definitions for timezonecomplete
|
||||
// Project: https://github.com/SpiritIT/timezonecomplete
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Generated by dts-bundle 0.1.1
|
||||
|
||||
declare module 'timezonecomplete-1.2.0' {
|
||||
/**
|
||||
* @return True iff the given year is a leap year.
|
||||
*/
|
||||
export function isLeapYear(year: number): boolean;
|
||||
/**
|
||||
* @param year The full year
|
||||
* @param month The month 1-12
|
||||
* @return The number of days in the given month
|
||||
*/
|
||||
export function daysInMonth(year: number, month: number): number;
|
||||
/**
|
||||
* Returns an ISO time string. Note that months are 1-12.
|
||||
*/
|
||||
export function isoString(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): string;
|
||||
/**
|
||||
* Time units
|
||||
*/
|
||||
export enum TimeUnit {
|
||||
Second = 0,
|
||||
Minute = 1,
|
||||
Hour = 2,
|
||||
Day = 3,
|
||||
Week = 4,
|
||||
Month = 5,
|
||||
Year = 6,
|
||||
}
|
||||
/**
|
||||
* 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:
|
||||
* one hour is simply represented as 3600000 milliseconds.
|
||||
*/
|
||||
export class Duration {
|
||||
/**
|
||||
* Positive number of milliseconds
|
||||
* Stored positive because otherwise we constantly have to choose
|
||||
* between Math.floor() and Math.ceil()
|
||||
*/
|
||||
/**
|
||||
* Sign: 1 or -1
|
||||
*/
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of hours
|
||||
* @return A duration of n hours
|
||||
*/
|
||||
static hours(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of minutes
|
||||
* @return A duration of n minutes
|
||||
*/
|
||||
static minutes(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of seconds
|
||||
* @return A duration of n seconds
|
||||
*/
|
||||
static seconds(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of milliseconds
|
||||
* @return A duration of n milliseconds
|
||||
*/
|
||||
static milliseconds(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration of 0
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* Construct a time duration from a number of milliseconds
|
||||
*/
|
||||
constructor(milliseconds: number);
|
||||
/**
|
||||
* Construct a time duration from a string in format
|
||||
* [-]h[:m[:s[.n]]] e.g. -01:00:30.501
|
||||
*/
|
||||
constructor(input: string);
|
||||
/**
|
||||
* @return another instance of Duration with the same value.
|
||||
*/
|
||||
clone(): Duration;
|
||||
/**
|
||||
* The entire duration in milliseconds (negative or positive)
|
||||
*/
|
||||
milliseconds(): number;
|
||||
/**
|
||||
* The millisecond part of the duration (always positive)
|
||||
* @return e.g. 400 for a -01:02:03.400 duration
|
||||
*/
|
||||
millisecond(): number;
|
||||
/**
|
||||
* The entire duration in seconds (negative or positive, fractional)
|
||||
* @return e.g. 1.5 for a 1500 milliseconds duration
|
||||
*/
|
||||
seconds(): number;
|
||||
/**
|
||||
* The second part of the duration (always positive)
|
||||
* @return e.g. 3 for a -01:02:03.400 duration
|
||||
*/
|
||||
second(): number;
|
||||
/**
|
||||
* The entire duration in minutes (negative or positive, fractional)
|
||||
* @return e.g. 1.5 for a 90000 milliseconds duration
|
||||
*/
|
||||
minutes(): number;
|
||||
/**
|
||||
* The minute part of the duration (always positive)
|
||||
* @return e.g. 2 for a -01:02:03.400 duration
|
||||
*/
|
||||
minute(): number;
|
||||
/**
|
||||
* The entire duration in hours (negative or positive, fractional)
|
||||
* @return e.g. 1.5 for a 5400000 milliseconds duration
|
||||
*/
|
||||
hours(): number;
|
||||
/**
|
||||
* The hour part of the duration (always positive).
|
||||
* Note that this part can exceed 23 hours, because for
|
||||
* now, we do not have a days() function
|
||||
* @return e.g. 25 for a -25:02:03.400 duration
|
||||
*/
|
||||
wholeHours(): number;
|
||||
/**
|
||||
* Sign
|
||||
* @return "-" if the duration is negative
|
||||
*/
|
||||
sign(): string;
|
||||
/**
|
||||
* @return True iff (this < other)
|
||||
*/
|
||||
lessThan(other: Duration): boolean;
|
||||
/**
|
||||
* @return True iff this and other represent the same time duration
|
||||
*/
|
||||
equals(other: Duration): boolean;
|
||||
/**
|
||||
* @return True iff this > other
|
||||
*/
|
||||
greaterThan(other: Duration): boolean;
|
||||
/**
|
||||
* @return The minimum (most negative) of this and other
|
||||
*/
|
||||
min(other: Duration): Duration;
|
||||
/**
|
||||
* @return The maximum (most positive) of this and other
|
||||
*/
|
||||
max(other: Duration): Duration;
|
||||
/**
|
||||
* @return a new Duration of (this * value)
|
||||
*/
|
||||
multiply(value: number): Duration;
|
||||
/**
|
||||
* Add a duration.
|
||||
* @return a new Duration of (this + value)
|
||||
*/
|
||||
add(value: Duration): Duration;
|
||||
/**
|
||||
* Subtract a duration.
|
||||
* @return a new Duration of (this - value)
|
||||
*/
|
||||
sub(value: Duration): Duration;
|
||||
/**
|
||||
* String in [-]hh:mm:ss.nnn notation. All fields are
|
||||
* always present except the sign.
|
||||
*/
|
||||
toFullString(): string;
|
||||
/**
|
||||
* String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are
|
||||
* added as necessary
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
/**
|
||||
* The type of time zone
|
||||
*/
|
||||
export enum TimeZoneKind {
|
||||
/**
|
||||
* Local time offset as determined by JavaScript Date class.
|
||||
*/
|
||||
Local = 0,
|
||||
/**
|
||||
* Fixed offset from UTC, without DST.
|
||||
*/
|
||||
Offset = 1,
|
||||
/**
|
||||
* IANA timezone managed through Olsen TZ database. Includes
|
||||
* DST if applicable.
|
||||
*/
|
||||
Proper = 2,
|
||||
}
|
||||
/**
|
||||
* Time zone. The object is immutable because it is cached:
|
||||
* requesting a time zone twice yields the very same object.
|
||||
* Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(),
|
||||
* i.e. offset 90 means +01:30.
|
||||
*
|
||||
* Time zones come in three flavors: the local time zone, as calculated by JavaScript Date,
|
||||
* a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST
|
||||
* applied depending on the time zone rules.
|
||||
*/
|
||||
export class TimeZone {
|
||||
/**
|
||||
* The local time zone for a given date. Note that
|
||||
* the time zone varies with the date: amsterdam time for
|
||||
* 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00
|
||||
*/
|
||||
static local(): TimeZone;
|
||||
/**
|
||||
* The UTC time zone.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
static zone(s: string): TimeZone;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* The kind of time zone (Local/Offset/Proper)
|
||||
*/
|
||||
kind(): TimeZoneKind;
|
||||
/**
|
||||
* Equality operator. Maps zero offsets and different names for UTC onto
|
||||
* each other. Other time zones are not mapped onto each other.
|
||||
*/
|
||||
equals(other: TimeZone): boolean;
|
||||
/**
|
||||
* Is this zone equivalent to UTC?
|
||||
*/
|
||||
isUtc(): boolean;
|
||||
/**
|
||||
* Calculate timezone offset from a UTC time.
|
||||
* @param year local full year
|
||||
* @param month local month 1-12 (note this deviates from JavaScript date)
|
||||
* @param day local day of month 1-31
|
||||
* @param hour local hour 0-23
|
||||
* @param minute local minute 0-59
|
||||
* @param second local second 0-59
|
||||
* @param millisecond local millisecond 0-999
|
||||
* @return the offset of this time zone with respect to UTC at the given time.
|
||||
*/
|
||||
offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number;
|
||||
/**
|
||||
* Calculate timezone offset from a zone-local time (NOT a UTC time).
|
||||
* @param year local full year
|
||||
* @param month local month 1-12 (note this deviates from JavaScript date)
|
||||
* @param day local day of month 1-31
|
||||
* @param hour local hour 0-23
|
||||
* @param minute local minute 0-59
|
||||
* @param second local second 0-59
|
||||
* @param millisecond local millisecond 0-999
|
||||
* @return the offset of this time zone with respect to UTC at the given time.
|
||||
*/
|
||||
offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number;
|
||||
/**
|
||||
* Convenience function, takes values from a Javascript Date
|
||||
* Calls offsetForUtc() with the contents of the date
|
||||
* @param date: the date
|
||||
* @param funcs: the set of functions to use: get() or getUTC()
|
||||
*/
|
||||
offsetForUtcDate(date: Date, funcs: DateFunctions): number;
|
||||
/**
|
||||
* Convenience function, takes values from a Javascript Date
|
||||
* Calls offsetForUtc() with the contents of the date
|
||||
* @param date: the date
|
||||
* @param funcs: the set of functions to use: get() or getUTC()
|
||||
*/
|
||||
offsetForZoneDate(date: Date, funcs: DateFunctions): number;
|
||||
/**
|
||||
* The time zone identifier (normalized).
|
||||
* Either "localtime", IANA name, or "+hh:mm" offset.
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Convert an offset number into an offset string
|
||||
* @param offset The offset in minutes from UTC e.g. 90 minutes
|
||||
* @return the offset in ISO notation "+01:30" for +90 minutes
|
||||
*/
|
||||
static offsetToString(offset: number): string;
|
||||
/**
|
||||
* String to offset conversion.
|
||||
* @param s Formats: "-01:00", "-0100", "-01", "Z"
|
||||
* @return offset w.r.t. UTC in minutes
|
||||
*/
|
||||
static stringToOffset(s: string): number;
|
||||
}
|
||||
/**
|
||||
* For testing purposes, we often need to manipulate what the current
|
||||
* time is. This is an interface for a custom time source object
|
||||
* so in tests you can use a custom time source.
|
||||
*/
|
||||
export interface TimeSource {
|
||||
/**
|
||||
* Return the current date+time as a javascript Date object
|
||||
*/
|
||||
now(): Date;
|
||||
}
|
||||
/**
|
||||
* Default time source, returns actual time
|
||||
*/
|
||||
export class RealTimeSource implements TimeSource {
|
||||
now(): Date;
|
||||
}
|
||||
/**
|
||||
* Indicates how a Date object should be interpreted.
|
||||
* Either we can take getYear(), getMonth() etc for our field
|
||||
* values, or we can take getUTCYear() etc to do that.
|
||||
*/
|
||||
export enum DateFunctions {
|
||||
/**
|
||||
* Use the Date.getFullYear(), Date.getMonth(), ... functions.
|
||||
*/
|
||||
Get = 0,
|
||||
/**
|
||||
* Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions.
|
||||
*/
|
||||
GetUTC = 1,
|
||||
}
|
||||
/**
|
||||
* Our very own DateTime class which is time zone-aware
|
||||
* and which can be mocked for testing purposes
|
||||
*/
|
||||
export class DateTime {
|
||||
/**
|
||||
* Actual time source in use. Setting this property allows to
|
||||
* fake time in tests. DateTime.nowLocal() and DateTime.nowUtc()
|
||||
* use this property for obtaining the current time.
|
||||
*/
|
||||
static timeSource: TimeSource;
|
||||
/**
|
||||
* Current date+time in local time (derived from DateTime.timeSource.now()).
|
||||
*/
|
||||
static nowLocal(): DateTime;
|
||||
/**
|
||||
* Current date+time in UTC time (derived from DateTime.timeSource.now()).
|
||||
*/
|
||||
static nowUtc(): DateTime;
|
||||
/**
|
||||
* Current date+time in the given time zone (derived from DateTime.timeSource.now()).
|
||||
* @param timeZone The desired time zone.
|
||||
*/
|
||||
static now(timeZone: TimeZone): DateTime;
|
||||
/**
|
||||
* Constructor. Creates current time in local timezone.
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* Constructor
|
||||
* @param isoString String in ISO 8601 format. Instead of ISO time zone,
|
||||
* it may include a space and then and IANA time zone.
|
||||
* e.g. "2007-04-05T12:30:40.500" (no time zone, naive date)
|
||||
* e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time)
|
||||
* or "2007-04-05T12:30:40.500Z" (UTC)
|
||||
* or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable)
|
||||
* @param timeZone if given, the date in the string is assumed to be in this time zone.
|
||||
* Note that it is NOT CONVERTED to the time zone. Useful
|
||||
* for strings without a time zone
|
||||
*/
|
||||
constructor(isoString: string, timeZone?: TimeZone);
|
||||
/**
|
||||
* Constructor. You provide a date, then you say whether to take the
|
||||
* date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods,
|
||||
* and then you state which time zone that date is in.
|
||||
*
|
||||
* @param date A date object.
|
||||
* @param getters Specifies which set of Date getters contains the date in the given time zone: the
|
||||
* Date.getXxx() methods or the Date.getUTCXxx() methods.
|
||||
* @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates)
|
||||
*/
|
||||
constructor(date: Date, getFuncs: DateFunctions, timeZone?: TimeZone);
|
||||
/**
|
||||
* Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges.
|
||||
* Use the add(duration) or sub(duration) for arithmetic.
|
||||
* @param year The full year (e.g. 2014)
|
||||
* @param month The month [1-12] (note this deviates from JavaScript Date)
|
||||
* @param day The day of the month [1-31]
|
||||
* @param hour The hour of the day [0-24)
|
||||
* @param minute The minute of the hour [0-59]
|
||||
* @param second The second of the minute [0-59]
|
||||
* @param millisecond The millisecond of the second [0-999]
|
||||
* @param timeZone The time zone, or null (for unaware dates)
|
||||
*/
|
||||
constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: TimeZone);
|
||||
/**
|
||||
* Constructor
|
||||
* @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000
|
||||
* @param timeZone the time zone that the timestamp is assumed to be in (usually UTC).
|
||||
*/
|
||||
constructor(unixTimestamp: number, timeZone?: TimeZone);
|
||||
/**
|
||||
* @return a copy of this object
|
||||
*/
|
||||
clone(): DateTime;
|
||||
/**
|
||||
* @return The time zone that the date is in. May be null for unaware dates.
|
||||
*/
|
||||
zone(): TimeZone;
|
||||
/**
|
||||
* @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates.
|
||||
*/
|
||||
offset(): number;
|
||||
/**
|
||||
* @return The full year e.g. 2014
|
||||
*/
|
||||
year(): number;
|
||||
/**
|
||||
* @return The month 1-12 (note this deviates from JavaScript Date)
|
||||
*/
|
||||
month(): number;
|
||||
/**
|
||||
* @return The day of the month 1-31
|
||||
*/
|
||||
day(): number;
|
||||
/**
|
||||
* @return The hour 0-23
|
||||
*/
|
||||
hour(): number;
|
||||
/**
|
||||
* @return the minutes 0-59
|
||||
*/
|
||||
minute(): number;
|
||||
/**
|
||||
* @return the seconds 0-59
|
||||
*/
|
||||
second(): number;
|
||||
/**
|
||||
* @return the milliseconds 0-999
|
||||
*/
|
||||
millisecond(): number;
|
||||
/**
|
||||
* @return Milliseconds since 1970-01-01T00:00:00.000Z
|
||||
*/
|
||||
unixUtcMillis(): number;
|
||||
/**
|
||||
* @return The full year e.g. 2014
|
||||
*/
|
||||
utcYear(): number;
|
||||
/**
|
||||
* @return The UTC month 1-12 (note this deviates from JavaScript Date)
|
||||
*/
|
||||
utcMonth(): number;
|
||||
/**
|
||||
* @return The UTC day of the month 1-31
|
||||
*/
|
||||
utcDay(): number;
|
||||
/**
|
||||
* @return The UTC hour 0-23
|
||||
*/
|
||||
utcHour(): number;
|
||||
/**
|
||||
* @return The UTC minutes 0-59
|
||||
*/
|
||||
utcMinute(): number;
|
||||
/**
|
||||
* @return The UTC seconds 0-59
|
||||
*/
|
||||
utcSecond(): number;
|
||||
/**
|
||||
* @return The UTC milliseconds 0-999
|
||||
*/
|
||||
utcMillisecond(): number;
|
||||
/**
|
||||
* Convert this date to the given time zone (in-place).
|
||||
* Throws if this date does not have a time zone.
|
||||
* @return this (for chaining)
|
||||
*/
|
||||
convert(zone?: TimeZone): DateTime;
|
||||
/**
|
||||
* Returns this date converted to the given time zone.
|
||||
* Unaware dates can only be converted to unaware dates (clone)
|
||||
* For unaware dates, an exception is thrown
|
||||
* @param zone The new time zone. This may be null to create unaware date.
|
||||
* @return The converted date
|
||||
*/
|
||||
toZone(zone?: TimeZone): DateTime;
|
||||
/**
|
||||
* Convert to JavaScript date with the zone time in the getX() methods.
|
||||
* Unless the timezone is local, the Date.getUTCX() methods will NOT be correct.
|
||||
*/
|
||||
toDate(): Date;
|
||||
/**
|
||||
* Add a time duration. Note that this simply adds a number
|
||||
* of milliseconds to UTC and converts back to zone(),
|
||||
* so in the presence of e.g. leap seconds there may be a
|
||||
* shift in the seconds field if you add an hour.
|
||||
* There is not DST handling and no leap second handling.
|
||||
* @return this + duration
|
||||
*/
|
||||
add(duration: Duration): DateTime;
|
||||
/**
|
||||
* Add an amount of time to UTC, taking leap seconds etc into account.
|
||||
* Adding e.g. 1 hour will increment the utcHour() field
|
||||
* date by one. In case of DST changes, the local hour() field
|
||||
* may not increase or increase by 2 hours. So if you add a month, the
|
||||
* local time may vary by an hour. There will not be a shift
|
||||
* in seconds due to leap seconds.
|
||||
*/
|
||||
add(amount: number, unit: TimeUnit): DateTime;
|
||||
/**
|
||||
* Add an amount of time to the zone time, as regularly as possible.
|
||||
* Adding e.g. 1 hour will increment the hour() field of the zone
|
||||
* date by one. In case of DST changes, the utcHour() field may
|
||||
* increase by 1 or increase by 2. Adding a day will leave the time portion
|
||||
* intact. However, adding an hour around a forward DST change adds two hours,
|
||||
* since there is a zone time (2AM in Holland) that does not exist.
|
||||
*/
|
||||
addLocal(amount: number, unit: TimeUnit): DateTime;
|
||||
/**
|
||||
* Same as add(-1*duration);
|
||||
*/
|
||||
sub(duration: Duration): DateTime;
|
||||
/**
|
||||
* Same as add(-1*amount, unit);
|
||||
*/
|
||||
sub(amount: number, unit: TimeUnit): DateTime;
|
||||
/**
|
||||
* Same as addLocal(-1*amount, unit);
|
||||
*/
|
||||
subLocal(amount: number, unit: TimeUnit): DateTime;
|
||||
/**
|
||||
* Time difference between two DateTimes
|
||||
* @return this - other
|
||||
*/
|
||||
diff(other: DateTime): Duration;
|
||||
/**
|
||||
* @return True iff (this < other)
|
||||
*/
|
||||
lessThan(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff (this <= other)
|
||||
*/
|
||||
lessEqual(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff this and other represent the same time in UTC
|
||||
*/
|
||||
equals(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff this and other represent the same time and
|
||||
* have the same zone
|
||||
*/
|
||||
identical(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff this > other
|
||||
*/
|
||||
greaterThan(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff this >= other
|
||||
*/
|
||||
greaterEqual(other: DateTime): boolean;
|
||||
/**
|
||||
* Proper ISO 8601 format string with any IANA zone converted to ISO offset
|
||||
* E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam
|
||||
*/
|
||||
toIsoString(): string;
|
||||
/**
|
||||
* Modified ISO 8601 format string with IANA name if applicable.
|
||||
* E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam"
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Modified ISO 8601 format string in UTC without time zone info
|
||||
*/
|
||||
toUtcString(): string;
|
||||
}
|
||||
/**
|
||||
* Specifies how the period should repeat across the day
|
||||
* during DST changes.
|
||||
*/
|
||||
export enum PeriodDst {
|
||||
/**
|
||||
* Keep repeating in similar intervals measured in UTC,
|
||||
* unaffected by Daylight Saving Time.
|
||||
* E.g. a repetition of one hour will take one real hour
|
||||
* every time, even in a time zone with DST.
|
||||
* Leap seconds, leap days and month length
|
||||
* differences will still make the intervals different.
|
||||
*/
|
||||
RegularIntervals = 0,
|
||||
/**
|
||||
* Ensure that the time at which the intervals occur stay
|
||||
* at the same place in the day, local time. So e.g.
|
||||
* a period of one day, starting at 8:05AM Europe/Amsterdam time
|
||||
* will always start at 8:05 Europe/Amsterdam. This means that
|
||||
* in UTC time, some intervals will be 25 hours and some
|
||||
* 23 hours during DST changes.
|
||||
* Another example: an hourly interval will be hourly in local time,
|
||||
* skipping an hour in UTC for a DST backward change.
|
||||
*/
|
||||
RegularLocalTime = 1,
|
||||
}
|
||||
/**
|
||||
* Convert a PeriodDst to a string: "regular intervals" or "regular local time"
|
||||
*/
|
||||
export function periodDstToString(p: PeriodDst): string;
|
||||
/**
|
||||
* Repeating time period: consists of a starting point and
|
||||
* a time length. This class accounts for leap seconds and leap days.
|
||||
*/
|
||||
export class Period {
|
||||
/**
|
||||
* Constructor
|
||||
* LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour,
|
||||
* then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not.
|
||||
* This is due to the enormous processing power required by these cases. They are not
|
||||
* implemented and you will get an assert.
|
||||
*
|
||||
* @param start The start of the period. If the period is in Months or Years, and
|
||||
* the day is 29 or 30 or 31, the results are maximised to end-of-month.
|
||||
* @param amount The amount of units.
|
||||
* @param unit The unit.
|
||||
* @param dst Specifies how to handle Daylight Saving Time. Not relevant
|
||||
* if the time zone of the start datetime does not have DST.
|
||||
*/
|
||||
constructor(start: DateTime, amount: number, unit: TimeUnit, dst: PeriodDst);
|
||||
/**
|
||||
* The start date
|
||||
*/
|
||||
start(): DateTime;
|
||||
/**
|
||||
* The amount of units
|
||||
*/
|
||||
amount(): number;
|
||||
/**
|
||||
* The unit
|
||||
*/
|
||||
unit(): TimeUnit;
|
||||
/**
|
||||
* The dst handling mode
|
||||
*/
|
||||
dst(): PeriodDst;
|
||||
/**
|
||||
* The first occurrence of the period greater than
|
||||
* the given date. The given date need not be at a period boundary.
|
||||
* Pre: the fromdate and startdate must either both have timezones or not
|
||||
* @param fromDate: the date after which to return the next date
|
||||
* @return the first date matching the period after fromDate, given
|
||||
* in the same zone as the fromDate.
|
||||
*/
|
||||
findFirst(fromDate: DateTime): DateTime;
|
||||
/**
|
||||
* Returns the next timestamp in the period. The given timestamp must
|
||||
* be at a period boundary, otherwise the answer is incorrect.
|
||||
* This function has MUCH better performance than findFirst.
|
||||
* Returns the datetime "count" times away from the given datetime.
|
||||
* @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one.
|
||||
* @param count Optional, must be >= 1 and whole.
|
||||
* @return (prev + count * period), in the same timezone as prev.
|
||||
*/
|
||||
findNext(prev: DateTime, count?: number): DateTime;
|
||||
/**
|
||||
* Returns an ISO duration string
|
||||
* P[n]Y[n]M[n]DT[n]H[n]M[n][.n]S or P[n]W
|
||||
*/
|
||||
toIsoString(): string;
|
||||
/**
|
||||
* A string representation e.g.
|
||||
* "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam keeping regular intervals".
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
/// <reference path="timezonecomplete-1.3.0.d.ts" />
|
||||
|
||||
import tc = require("timezonecomplete-1.3.0");
|
||||
|
||||
var b: boolean = tc.isLeapYear(2014);
|
||||
var n: number = tc.daysInMonth(2014, 10);
|
||||
var s: string = tc.isoString(2014, 6, 30, 22, 10, 11, 230);
|
||||
|
||||
// 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();
|
||||
|
||||
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.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();
|
||||
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()));
|
||||
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();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-702
@@ -1,702 +0,0 @@
|
||||
// Type definitions for timezonecomplete 1.3.0
|
||||
// Project: https://github.com/SpiritIT/timezonecomplete
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Generated by dts-bundle v0.2.0
|
||||
|
||||
declare module 'timezonecomplete-1.3.0' {
|
||||
/**
|
||||
* @return True iff the given year is a leap year.
|
||||
*/
|
||||
export function isLeapYear(year: number): boolean;
|
||||
/**
|
||||
* @param year The full year
|
||||
* @param month The month 1-12
|
||||
* @return The number of days in the given month
|
||||
*/
|
||||
export function daysInMonth(year: number, month: number): number;
|
||||
/**
|
||||
* Returns an ISO time string. Note that months are 1-12.
|
||||
*/
|
||||
export function isoString(year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number): string;
|
||||
/**
|
||||
* Time units
|
||||
*/
|
||||
export enum TimeUnit {
|
||||
Second = 0,
|
||||
Minute = 1,
|
||||
Hour = 2,
|
||||
Day = 3,
|
||||
Week = 4,
|
||||
Month = 5,
|
||||
Year = 6,
|
||||
}
|
||||
/**
|
||||
* 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:
|
||||
* one hour is simply represented as 3600000 milliseconds.
|
||||
*/
|
||||
export class Duration {
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of hours
|
||||
* @return A duration of n hours
|
||||
*/
|
||||
static hours(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of minutes
|
||||
* @return A duration of n minutes
|
||||
*/
|
||||
static minutes(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of seconds
|
||||
* @return A duration of n seconds
|
||||
*/
|
||||
static seconds(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration
|
||||
* @param n Number of milliseconds
|
||||
* @return A duration of n milliseconds
|
||||
*/
|
||||
static milliseconds(n: number): Duration;
|
||||
/**
|
||||
* Construct a time duration of 0
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* Construct a time duration from a number of milliseconds
|
||||
*/
|
||||
constructor(milliseconds: number);
|
||||
/**
|
||||
* Construct a time duration from a string in format
|
||||
* [-]h[:m[:s[.n]]] e.g. -01:00:30.501
|
||||
*/
|
||||
constructor(input: string);
|
||||
/**
|
||||
* @return another instance of Duration with the same value.
|
||||
*/
|
||||
clone(): Duration;
|
||||
/**
|
||||
* The entire duration in milliseconds (negative or positive)
|
||||
*/
|
||||
milliseconds(): number;
|
||||
/**
|
||||
* The millisecond part of the duration (always positive)
|
||||
* @return e.g. 400 for a -01:02:03.400 duration
|
||||
*/
|
||||
millisecond(): number;
|
||||
/**
|
||||
* The entire duration in seconds (negative or positive, fractional)
|
||||
* @return e.g. 1.5 for a 1500 milliseconds duration
|
||||
*/
|
||||
seconds(): number;
|
||||
/**
|
||||
* The second part of the duration (always positive)
|
||||
* @return e.g. 3 for a -01:02:03.400 duration
|
||||
*/
|
||||
second(): number;
|
||||
/**
|
||||
* The entire duration in minutes (negative or positive, fractional)
|
||||
* @return e.g. 1.5 for a 90000 milliseconds duration
|
||||
*/
|
||||
minutes(): number;
|
||||
/**
|
||||
* The minute part of the duration (always positive)
|
||||
* @return e.g. 2 for a -01:02:03.400 duration
|
||||
*/
|
||||
minute(): number;
|
||||
/**
|
||||
* The entire duration in hours (negative or positive, fractional)
|
||||
* @return e.g. 1.5 for a 5400000 milliseconds duration
|
||||
*/
|
||||
hours(): number;
|
||||
/**
|
||||
* The hour part of the duration (always positive).
|
||||
* Note that this part can exceed 23 hours, because for
|
||||
* now, we do not have a days() function
|
||||
* @return e.g. 25 for a -25:02:03.400 duration
|
||||
*/
|
||||
wholeHours(): number;
|
||||
/**
|
||||
* Sign
|
||||
* @return "-" if the duration is negative
|
||||
*/
|
||||
sign(): string;
|
||||
/**
|
||||
* @return True iff (this < other)
|
||||
*/
|
||||
lessThan(other: Duration): boolean;
|
||||
/**
|
||||
* @return True iff this and other represent the same time duration
|
||||
*/
|
||||
equals(other: Duration): boolean;
|
||||
/**
|
||||
* @return True iff this > other
|
||||
*/
|
||||
greaterThan(other: Duration): boolean;
|
||||
/**
|
||||
* @return The minimum (most negative) of this and other
|
||||
*/
|
||||
min(other: Duration): Duration;
|
||||
/**
|
||||
* @return The maximum (most positive) of this and other
|
||||
*/
|
||||
max(other: Duration): Duration;
|
||||
/**
|
||||
* Multiply with a fixed number.
|
||||
* @return a new Duration of (this * value)
|
||||
*/
|
||||
multiply(value: number): Duration;
|
||||
/**
|
||||
* Divide by a fixed number.
|
||||
* @return a new Duration of (this / value)
|
||||
*/
|
||||
divide(value: number): Duration;
|
||||
/**
|
||||
* Add a duration.
|
||||
* @return a new Duration of (this + value)
|
||||
*/
|
||||
add(value: Duration): Duration;
|
||||
/**
|
||||
* Subtract a duration.
|
||||
* @return a new Duration of (this - value)
|
||||
*/
|
||||
sub(value: Duration): Duration;
|
||||
/**
|
||||
* String in [-]hh:mm:ss.nnn notation. All fields are
|
||||
* always present except the sign.
|
||||
*/
|
||||
toFullString(): string;
|
||||
/**
|
||||
* String in [-]hh[:mm[:ss[.nnn]]] notation. Fields are
|
||||
* added as necessary
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
/**
|
||||
* The type of time zone
|
||||
*/
|
||||
export enum TimeZoneKind {
|
||||
/**
|
||||
* Local time offset as determined by JavaScript Date class.
|
||||
*/
|
||||
Local = 0,
|
||||
/**
|
||||
* Fixed offset from UTC, without DST.
|
||||
*/
|
||||
Offset = 1,
|
||||
/**
|
||||
* IANA timezone managed through Olsen TZ database. Includes
|
||||
* DST if applicable.
|
||||
*/
|
||||
Proper = 2,
|
||||
}
|
||||
/**
|
||||
* Time zone. The object is immutable because it is cached:
|
||||
* requesting a time zone twice yields the very same object.
|
||||
* Note that we use time zone offsets inverted w.r.t. JavaScript Date.getTimezoneOffset(),
|
||||
* i.e. offset 90 means +01:30.
|
||||
*
|
||||
* Time zones come in three flavors: the local time zone, as calculated by JavaScript Date,
|
||||
* a fixed offset ("+01:30") without DST, or a IANA timezone ("Europe/Amsterdam") with DST
|
||||
* applied depending on the time zone rules.
|
||||
*/
|
||||
export class TimeZone {
|
||||
/**
|
||||
* The local time zone for a given date. Note that
|
||||
* the time zone varies with the date: amsterdam time for
|
||||
* 2014-01-01 is +01:00 and amsterdam time for 2014-07-01 is +02:00
|
||||
*/
|
||||
static local(): TimeZone;
|
||||
/**
|
||||
* The UTC time zone.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
static zone(s: string): TimeZone;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* The kind of time zone (Local/Offset/Proper)
|
||||
*/
|
||||
kind(): TimeZoneKind;
|
||||
/**
|
||||
* Equality operator. Maps zero offsets and different names for UTC onto
|
||||
* each other. Other time zones are not mapped onto each other.
|
||||
*/
|
||||
equals(other: TimeZone): boolean;
|
||||
/**
|
||||
* Is this zone equivalent to UTC?
|
||||
*/
|
||||
isUtc(): boolean;
|
||||
/**
|
||||
* Calculate timezone offset from a UTC time.
|
||||
* @param year local full year
|
||||
* @param month local month 1-12 (note this deviates from JavaScript date)
|
||||
* @param day local day of month 1-31
|
||||
* @param hour local hour 0-23
|
||||
* @param minute local minute 0-59
|
||||
* @param second local second 0-59
|
||||
* @param millisecond local millisecond 0-999
|
||||
* @return the offset of this time zone with respect to UTC at the given time.
|
||||
*/
|
||||
offsetForUtc(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number;
|
||||
/**
|
||||
* Calculate timezone offset from a zone-local time (NOT a UTC time).
|
||||
* @param year local full year
|
||||
* @param month local month 1-12 (note this deviates from JavaScript date)
|
||||
* @param day local day of month 1-31
|
||||
* @param hour local hour 0-23
|
||||
* @param minute local minute 0-59
|
||||
* @param second local second 0-59
|
||||
* @param millisecond local millisecond 0-999
|
||||
* @return the offset of this time zone with respect to UTC at the given time.
|
||||
*/
|
||||
offsetForZone(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number): number;
|
||||
/**
|
||||
* Convenience function, takes values from a Javascript Date
|
||||
* Calls offsetForUtc() with the contents of the date
|
||||
* @param date: the date
|
||||
* @param funcs: the set of functions to use: get() or getUTC()
|
||||
*/
|
||||
offsetForUtcDate(date: Date, funcs: DateFunctions): number;
|
||||
/**
|
||||
* Convenience function, takes values from a Javascript Date
|
||||
* Calls offsetForUtc() with the contents of the date
|
||||
* @param date: the date
|
||||
* @param funcs: the set of functions to use: get() or getUTC()
|
||||
*/
|
||||
offsetForZoneDate(date: Date, funcs: DateFunctions): number;
|
||||
/**
|
||||
* The time zone identifier (normalized).
|
||||
* Either "localtime", IANA name, or "+hh:mm" offset.
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Convert an offset number into an offset string
|
||||
* @param offset The offset in minutes from UTC e.g. 90 minutes
|
||||
* @return the offset in ISO notation "+01:30" for +90 minutes
|
||||
*/
|
||||
static offsetToString(offset: number): string;
|
||||
/**
|
||||
* String to offset conversion.
|
||||
* @param s Formats: "-01:00", "-0100", "-01", "Z"
|
||||
* @return offset w.r.t. UTC in minutes
|
||||
*/
|
||||
static stringToOffset(s: string): number;
|
||||
}
|
||||
/**
|
||||
* For testing purposes, we often need to manipulate what the current
|
||||
* time is. This is an interface for a custom time source object
|
||||
* so in tests you can use a custom time source.
|
||||
*/
|
||||
export interface TimeSource {
|
||||
/**
|
||||
* Return the current date+time as a javascript Date object
|
||||
*/
|
||||
now(): Date;
|
||||
}
|
||||
/**
|
||||
* Default time source, returns actual time
|
||||
*/
|
||||
export class RealTimeSource implements TimeSource {
|
||||
now(): Date;
|
||||
}
|
||||
/**
|
||||
* Indicates how a Date object should be interpreted.
|
||||
* Either we can take getYear(), getMonth() etc for our field
|
||||
* values, or we can take getUTCYear() etc to do that.
|
||||
*/
|
||||
export enum DateFunctions {
|
||||
/**
|
||||
* Use the Date.getFullYear(), Date.getMonth(), ... functions.
|
||||
*/
|
||||
Get = 0,
|
||||
/**
|
||||
* Use the Date.getUTCFullYear(), Date.getUTCMonth(), ... functions.
|
||||
*/
|
||||
GetUTC = 1,
|
||||
}
|
||||
/**
|
||||
* Day-of-week. Note the enum values correspond to JavaScript day-of-week:
|
||||
* Sunday = 0, Monday = 1 etc
|
||||
*/
|
||||
export enum WeekDay {
|
||||
Sunday = 0,
|
||||
Monday = 1,
|
||||
Tuesday = 2,
|
||||
Wednesday = 3,
|
||||
Thursday = 4,
|
||||
Friday = 5,
|
||||
Saturday = 6,
|
||||
}
|
||||
/**
|
||||
* Our very own DateTime class which is time zone-aware
|
||||
* and which can be mocked for testing purposes
|
||||
*/
|
||||
export class DateTime {
|
||||
/**
|
||||
* Actual time source in use. Setting this property allows to
|
||||
* fake time in tests. DateTime.nowLocal() and DateTime.nowUtc()
|
||||
* use this property for obtaining the current time.
|
||||
*/
|
||||
static timeSource: TimeSource;
|
||||
/**
|
||||
* Current date+time in local time (derived from DateTime.timeSource.now()).
|
||||
*/
|
||||
static nowLocal(): DateTime;
|
||||
/**
|
||||
* Current date+time in UTC time (derived from DateTime.timeSource.now()).
|
||||
*/
|
||||
static nowUtc(): DateTime;
|
||||
/**
|
||||
* Current date+time in the given time zone (derived from DateTime.timeSource.now()).
|
||||
* @param timeZone The desired time zone.
|
||||
*/
|
||||
static now(timeZone: TimeZone): DateTime;
|
||||
/**
|
||||
* Constructor. Creates current time in local timezone.
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* Constructor
|
||||
* @param isoString String in ISO 8601 format. Instead of ISO time zone,
|
||||
* it may include a space and then and IANA time zone.
|
||||
* e.g. "2007-04-05T12:30:40.500" (no time zone, naive date)
|
||||
* e.g. "2007-04-05T12:30:40.500+01:00" (UTC offset without daylight saving time)
|
||||
* or "2007-04-05T12:30:40.500Z" (UTC)
|
||||
* or "2007-04-05T12:30:40.500 Europe/Amsterdam" (IANA time zone, with daylight saving time if applicable)
|
||||
* @param timeZone if given, the date in the string is assumed to be in this time zone.
|
||||
* Note that it is NOT CONVERTED to the time zone. Useful
|
||||
* for strings without a time zone
|
||||
*/
|
||||
constructor(isoString: string, timeZone?: TimeZone);
|
||||
/**
|
||||
* Constructor. You provide a date, then you say whether to take the
|
||||
* date.getYear()/getXxx methods or the date.getUTCYear()/date.getUTCXxx methods,
|
||||
* and then you state which time zone that date is in.
|
||||
*
|
||||
* @param date A date object.
|
||||
* @param getters Specifies which set of Date getters contains the date in the given time zone: the
|
||||
* Date.getXxx() methods or the Date.getUTCXxx() methods.
|
||||
* @param timeZone The time zone that the given date is assumed to be in (may be null for unaware dates)
|
||||
*/
|
||||
constructor(date: Date, getFuncs: DateFunctions, timeZone?: TimeZone);
|
||||
/**
|
||||
* Constructor. Note that unlike JavaScript dates we require fields to be in normal ranges.
|
||||
* Use the add(duration) or sub(duration) for arithmetic.
|
||||
* @param year The full year (e.g. 2014)
|
||||
* @param month The month [1-12] (note this deviates from JavaScript Date)
|
||||
* @param day The day of the month [1-31]
|
||||
* @param hour The hour of the day [0-24)
|
||||
* @param minute The minute of the hour [0-59]
|
||||
* @param second The second of the minute [0-59]
|
||||
* @param millisecond The millisecond of the second [0-999]
|
||||
* @param timeZone The time zone, or null (for unaware dates)
|
||||
*/
|
||||
constructor(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, timeZone?: TimeZone);
|
||||
/**
|
||||
* Constructor
|
||||
* @param unixTimestamp milliseconds since 1970-01-01T00:00:00.000
|
||||
* @param timeZone the time zone that the timestamp is assumed to be in (usually UTC).
|
||||
*/
|
||||
constructor(unixTimestamp: number, timeZone?: TimeZone);
|
||||
/**
|
||||
* @return a copy of this object
|
||||
*/
|
||||
clone(): DateTime;
|
||||
/**
|
||||
* @return The time zone that the date is in. May be null for unaware dates.
|
||||
*/
|
||||
zone(): TimeZone;
|
||||
/**
|
||||
* @return the offset w.r.t. UTC in minutes. Returns 0 for unaware dates and for UTC dates.
|
||||
*/
|
||||
offset(): number;
|
||||
/**
|
||||
* @return The full year e.g. 2014
|
||||
*/
|
||||
year(): number;
|
||||
/**
|
||||
* @return The month 1-12 (note this deviates from JavaScript Date)
|
||||
*/
|
||||
month(): number;
|
||||
/**
|
||||
* @return The day of the month 1-31
|
||||
*/
|
||||
day(): number;
|
||||
/**
|
||||
* @return The hour 0-23
|
||||
*/
|
||||
hour(): number;
|
||||
/**
|
||||
* @return the minutes 0-59
|
||||
*/
|
||||
minute(): number;
|
||||
/**
|
||||
* @return the seconds 0-59
|
||||
*/
|
||||
second(): number;
|
||||
/**
|
||||
* @return the milliseconds 0-999
|
||||
*/
|
||||
millisecond(): number;
|
||||
/**
|
||||
* @return the day-of-week (the enum values correspond to JavaScript
|
||||
* week day numbers)
|
||||
*/
|
||||
weekDay(): WeekDay;
|
||||
/**
|
||||
* @return Milliseconds since 1970-01-01T00:00:00.000Z
|
||||
*/
|
||||
unixUtcMillis(): number;
|
||||
/**
|
||||
* @return The full year e.g. 2014
|
||||
*/
|
||||
utcYear(): number;
|
||||
/**
|
||||
* @return The UTC month 1-12 (note this deviates from JavaScript Date)
|
||||
*/
|
||||
utcMonth(): number;
|
||||
/**
|
||||
* @return The UTC day of the month 1-31
|
||||
*/
|
||||
utcDay(): number;
|
||||
/**
|
||||
* @return The UTC hour 0-23
|
||||
*/
|
||||
utcHour(): number;
|
||||
/**
|
||||
* @return The UTC minutes 0-59
|
||||
*/
|
||||
utcMinute(): number;
|
||||
/**
|
||||
* @return The UTC seconds 0-59
|
||||
*/
|
||||
utcSecond(): number;
|
||||
/**
|
||||
* @return The UTC milliseconds 0-999
|
||||
*/
|
||||
utcMillisecond(): number;
|
||||
/**
|
||||
* @return the UTC day-of-week (the enum values correspond to JavaScript
|
||||
* week day numbers)
|
||||
*/
|
||||
utcWeekDay(): WeekDay;
|
||||
/**
|
||||
* Convert this date to the given time zone (in-place).
|
||||
* Throws if this date does not have a time zone.
|
||||
* @return this (for chaining)
|
||||
*/
|
||||
convert(zone?: TimeZone): DateTime;
|
||||
/**
|
||||
* Returns this date converted to the given time zone.
|
||||
* Unaware dates can only be converted to unaware dates (clone)
|
||||
* For unaware dates, an exception is thrown
|
||||
* @param zone The new time zone. This may be null to create unaware date.
|
||||
* @return The converted date
|
||||
*/
|
||||
toZone(zone?: TimeZone): DateTime;
|
||||
/**
|
||||
* Convert to JavaScript date with the zone time in the getX() methods.
|
||||
* Unless the timezone is local, the Date.getUTCX() methods will NOT be correct.
|
||||
*/
|
||||
toDate(): Date;
|
||||
/**
|
||||
* Add a time duration. Note that this simply adds a number
|
||||
* of milliseconds to UTC and converts back to zone(),
|
||||
* so in the presence of e.g. leap seconds there may be a
|
||||
* shift in the seconds field if you add an hour.
|
||||
* There is not DST handling and no leap second handling.
|
||||
* @return this + duration
|
||||
*/
|
||||
add(duration: Duration): DateTime;
|
||||
/**
|
||||
* Add an amount of time to UTC, taking leap seconds etc into account.
|
||||
* Adding e.g. 1 hour will increment the utcHour() field
|
||||
* date by one. In case of DST changes, the local hour() field
|
||||
* may not increase or increase by 2 hours. So if you add a month, the
|
||||
* local time may vary by an hour. There will not be a shift
|
||||
* in seconds due to leap seconds.
|
||||
*/
|
||||
add(amount: number, unit: TimeUnit): DateTime;
|
||||
/**
|
||||
* Add an amount of time to the zone time, as regularly as possible.
|
||||
* Adding e.g. 1 hour will increment the hour() field of the zone
|
||||
* date by one. In case of DST changes, the utcHour() field may
|
||||
* increase by 1 or increase by 2. Adding a day will leave the time portion
|
||||
* intact. However, adding an hour around a forward DST change adds two hours,
|
||||
* since there is a zone time (2AM in Holland) that does not exist.
|
||||
*/
|
||||
addLocal(amount: number, unit: TimeUnit): DateTime;
|
||||
/**
|
||||
* Same as add(-1*duration);
|
||||
*/
|
||||
sub(duration: Duration): DateTime;
|
||||
/**
|
||||
* Same as add(-1*amount, unit);
|
||||
*/
|
||||
sub(amount: number, unit: TimeUnit): DateTime;
|
||||
/**
|
||||
* Same as addLocal(-1*amount, unit);
|
||||
*/
|
||||
subLocal(amount: number, unit: TimeUnit): DateTime;
|
||||
/**
|
||||
* Time difference between two DateTimes
|
||||
* @return this - other
|
||||
*/
|
||||
diff(other: DateTime): Duration;
|
||||
/**
|
||||
* @return True iff (this < other)
|
||||
*/
|
||||
lessThan(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff (this <= other)
|
||||
*/
|
||||
lessEqual(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff this and other represent the same time in UTC
|
||||
*/
|
||||
equals(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff this and other represent the same time and
|
||||
* have the same zone
|
||||
*/
|
||||
identical(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff this > other
|
||||
*/
|
||||
greaterThan(other: DateTime): boolean;
|
||||
/**
|
||||
* @return True iff this >= other
|
||||
*/
|
||||
greaterEqual(other: DateTime): boolean;
|
||||
/**
|
||||
* Proper ISO 8601 format string with any IANA zone converted to ISO offset
|
||||
* E.g. "2014-01-01T23:15:33+01:00" for Europe/Amsterdam
|
||||
*/
|
||||
toIsoString(): string;
|
||||
/**
|
||||
* Modified ISO 8601 format string with IANA name if applicable.
|
||||
* E.g. "2014-01-01T23:15:33.000 Europe/Amsterdam"
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* Modified ISO 8601 format string in UTC without time zone info
|
||||
*/
|
||||
toUtcString(): string;
|
||||
}
|
||||
/**
|
||||
* Specifies how the period should repeat across the day
|
||||
* during DST changes.
|
||||
*/
|
||||
export enum PeriodDst {
|
||||
/**
|
||||
* Keep repeating in similar intervals measured in UTC,
|
||||
* unaffected by Daylight Saving Time.
|
||||
* E.g. a repetition of one hour will take one real hour
|
||||
* every time, even in a time zone with DST.
|
||||
* Leap seconds, leap days and month length
|
||||
* differences will still make the intervals different.
|
||||
*/
|
||||
RegularIntervals = 0,
|
||||
/**
|
||||
* Ensure that the time at which the intervals occur stay
|
||||
* at the same place in the day, local time. So e.g.
|
||||
* a period of one day, starting at 8:05AM Europe/Amsterdam time
|
||||
* will always start at 8:05 Europe/Amsterdam. This means that
|
||||
* in UTC time, some intervals will be 25 hours and some
|
||||
* 23 hours during DST changes.
|
||||
* Another example: an hourly interval will be hourly in local time,
|
||||
* skipping an hour in UTC for a DST backward change.
|
||||
*/
|
||||
RegularLocalTime = 1,
|
||||
}
|
||||
/**
|
||||
* Convert a PeriodDst to a string: "regular intervals" or "regular local time"
|
||||
*/
|
||||
export function periodDstToString(p: PeriodDst): string;
|
||||
/**
|
||||
* Repeating time period: consists of a starting point and
|
||||
* a time length. This class accounts for leap seconds and leap days.
|
||||
*/
|
||||
export class Period {
|
||||
/**
|
||||
* Constructor
|
||||
* LIMITATION: if dst equals RegularLocalTime, and unit is Second, Minute or Hour,
|
||||
* then the amount must be a factor of 24. So 120 seconds is allowed while 121 seconds is not.
|
||||
* This is due to the enormous processing power required by these cases. They are not
|
||||
* implemented and you will get an assert.
|
||||
*
|
||||
* @param start The start of the period. If the period is in Months or Years, and
|
||||
* the day is 29 or 30 or 31, the results are maximised to end-of-month.
|
||||
* @param amount The amount of units.
|
||||
* @param unit The unit.
|
||||
* @param dst Specifies how to handle Daylight Saving Time. Not relevant
|
||||
* if the time zone of the start datetime does not have DST.
|
||||
*/
|
||||
constructor(start: DateTime, amount: number, unit: TimeUnit, dst: PeriodDst);
|
||||
/**
|
||||
* The start date
|
||||
*/
|
||||
start(): DateTime;
|
||||
/**
|
||||
* The amount of units
|
||||
*/
|
||||
amount(): number;
|
||||
/**
|
||||
* The unit
|
||||
*/
|
||||
unit(): TimeUnit;
|
||||
/**
|
||||
* The dst handling mode
|
||||
*/
|
||||
dst(): PeriodDst;
|
||||
/**
|
||||
* The first occurrence of the period greater than
|
||||
* the given date. The given date need not be at a period boundary.
|
||||
* Pre: the fromdate and startdate must either both have timezones or not
|
||||
* @param fromDate: the date after which to return the next date
|
||||
* @return the first date matching the period after fromDate, given
|
||||
* in the same zone as the fromDate.
|
||||
*/
|
||||
findFirst(fromDate: DateTime): DateTime;
|
||||
/**
|
||||
* Returns the next timestamp in the period. The given timestamp must
|
||||
* be at a period boundary, otherwise the answer is incorrect.
|
||||
* This function has MUCH better performance than findFirst.
|
||||
* Returns the datetime "count" times away from the given datetime.
|
||||
* @param prev Boundary date. Must have a time zone (any time zone) iff the period start date has one.
|
||||
* @param count Optional, must be >= 1 and whole.
|
||||
* @return (prev + count * period), in the same timezone as prev.
|
||||
*/
|
||||
findNext(prev: DateTime, count?: number): DateTime;
|
||||
/**
|
||||
* Returns an ISO duration string
|
||||
* P[n]Y[n]M[n]DT[n]H[n]M[n][.n]S or P[n]W
|
||||
*/
|
||||
toIsoString(): string;
|
||||
/**
|
||||
* A string representation e.g.
|
||||
* "10 years, starting at 2014-03-01T12:00:00 Europe/Amsterdam keeping regular intervals".
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
/// <reference path="timezonecomplete-1.4.6.d.ts" />
|
||||
|
||||
import tc = require("timezonecomplete-1.4.6");
|
||||
|
||||
var b: boolean;
|
||||
var n: number;
|
||||
var s: string;
|
||||
var w: tc.WeekDay;
|
||||
|
||||
b = tc.isLeapYear(2014);
|
||||
n = tc.daysInMonth(2014, 10);
|
||||
n = tc.daysInYear(2014);
|
||||
n = tc.dayOfYear(2014, 1, 2);
|
||||
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);
|
||||
|
||||
// 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();
|
||||
|
||||
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.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();
|
||||
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()));
|
||||
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();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-1004
File diff suppressed because it is too large
Load Diff
@@ -1,195 +0,0 @@
|
||||
/// <reference path="timezonecomplete-1.5.1.d.ts" />
|
||||
|
||||
import tc = require("timezonecomplete-1.5.1");
|
||||
|
||||
var b: boolean;
|
||||
var n: number;
|
||||
var s: string;
|
||||
var w: tc.WeekDay;
|
||||
|
||||
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();
|
||||
|
||||
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()));
|
||||
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();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-1127
File diff suppressed because it is too large
Load Diff
@@ -1,197 +0,0 @@
|
||||
/// <reference path="timezonecomplete-1.6.0.d.ts" />
|
||||
|
||||
import tc = require("timezonecomplete-1.6.0");
|
||||
|
||||
var b: boolean;
|
||||
var n: number;
|
||||
var s: string;
|
||||
var w: tc.WeekDay;
|
||||
|
||||
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();
|
||||
|
||||
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()));
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-1132
File diff suppressed because it is too large
Load Diff
@@ -1,203 +0,0 @@
|
||||
/// <reference path="timezonecomplete-1.8.0.d.ts" />
|
||||
|
||||
import tc = require("timezonecomplete-1.8.0");
|
||||
|
||||
var b: boolean;
|
||||
var n: number;
|
||||
var s: string;
|
||||
var w: tc.WeekDay;
|
||||
|
||||
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();
|
||||
|
||||
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));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-1190
File diff suppressed because it is too large
Load Diff
-1207
File diff suppressed because it is too large
Load Diff
@@ -1,205 +0,0 @@
|
||||
/// <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));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ var ts: tc.TimeSource = tc.DateTime.timeSource;
|
||||
dt = tc.DateTime.nowLocal();
|
||||
dt = tc.DateTime.nowUtc();
|
||||
dt = tc.DateTime.now(tc.TimeZone.local());
|
||||
dt = tc.DateTime.fromExcel(1.5);
|
||||
dt = tc.nowLocal();
|
||||
dt = tc.nowUtc();
|
||||
dt = tc.now(tc.TimeZone.local());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user