mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-10 11:40:16 +08:00
Merge branch 'master' into tsc-1.5.0-alpha
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{*.json,*.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
+2
-9
@@ -28,16 +28,9 @@ _infrastructure/tests/build
|
||||
.idea
|
||||
*.iml
|
||||
*.js.map
|
||||
|
||||
#decimal.js
|
||||
!decimal.js
|
||||
|
||||
#rx.js
|
||||
!rx.js
|
||||
|
||||
#zip.js
|
||||
!zip.js
|
||||
!*.js/
|
||||
|
||||
node_modules
|
||||
|
||||
.sublimets
|
||||
.settings/launch.json
|
||||
|
||||
+17
-3
@@ -16,7 +16,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](angular-growl-v2/angular-growl-v2.d.ts) [Angular Growl 2 v.0.7.3](http://janstevens.github.io/angular-growl-2) by [Tadeusz Hucal](https://github.com/mkp05)
|
||||
* [:link:](angularjs/angular.d.ts) [Angular JS](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar)
|
||||
* [:link:](angularjs/angular-animate.d.ts) [Angular JS (ngAnimate module)](http://angularjs.org) by [Michel Salib](https://github.com/michelsalib), [Adi Dahiya](https://github.com/adidahiya), [Raphael Schweizer](https://github.com/rasch)
|
||||
* [:link:](angularjs/angular-cookies.d.ts) [Angular JS (ngCookies module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar)
|
||||
* [:link:](angularjs/angular-cookies.d.ts) [Angular JS (ngCookies module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar), [Anthony Ciccarello](http://github.com/aciccarello)
|
||||
* [:link:](angularjs/angular-mocks.d.ts) [Angular JS (ngMock, ngMockE2E module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar)
|
||||
* [:link:](angularjs/angular-resource.d.ts) [Angular JS (ngResource module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar), [Michael Jess](http://github.com/miffels)
|
||||
* [:link:](angularjs/angular-route.d.ts) [Angular JS (ngRoute module)](http://angularjs.org) by [Jonathan Park](https://github.com/park9140)
|
||||
@@ -40,6 +40,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](angularfire/angularfire.d.ts) [AngularFire](http://angularfire.com) by [Dénes Harmath](http://github.com/thSoft)
|
||||
* [:link:](angularLocalStorage/angularLocalStorage.d.ts) [AngularLocalStorage](https://github.com/agrublev/angularLocalStorage) by [Horiuchi_H](https://github.com/horiuchi)
|
||||
* [:link:](animation-frame/animation-frame.d.ts) [animation-frame](https://github.com/kof/animation-frame) by [Qinfeng Chen](https://github.com/qinfchen)
|
||||
* [:link:](ansi-styles/ansi-styles.d.ts) [ansi-styles](https://github.com/sindresorhus/ansi-styles) by [bryn austin bellomy](https://github.com/brynbellomy)
|
||||
* [:link:](ansicolors/ansicolors.d.ts) [ansicolors](https://github.com/thlorenz/ansicolors) by [rogierschouten](https://github.com/rogierschouten)
|
||||
* [:link:](any-db/any-db.d.ts) [any-db](https://github.com/grncdr/node-any-db) by [Rogier Schouten](https://github.com/rogierschouten)
|
||||
* [:link:](any-db-transaction/any-db-transaction.d.ts) [any-db-transaction](https://github.com/grncdr/node-any-db-transaction) by [Rogier Schouten](https://github.com/rogierschouten)
|
||||
@@ -109,7 +110,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](camljs/camljs.d.ts) [camljs](http://camljs.codeplex.com) by [Andrey Markeev](http://markeev.com)
|
||||
* [:link:](canvasjs/canvasjs.d.ts) [CanvasJS](http://canvasjs.com) by [Mark Overholt](https://github.com/mover5)
|
||||
* [:link:](casperjs/casperjs.d.ts) [CasperJS](http://casperjs.org) by [Jed Mao](https://github.com/jedmao)
|
||||
* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Hunsaker](https://github.com/jedhunsaker), [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Mao](https://github.com/jedmao), [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](chai-as-promised/chai-as-promised.d.ts) [chai-as-promised](https://github.com/domenic/chai-as-promised) by [jt000](https://github.com/jt000)
|
||||
* [:link:](chai-datetime/chai-datetime.d.ts) [chai-datetime](https://github.com/gaslight/chai-datetime.git) by [Cliff Burger](https://github.com/cliffburger)
|
||||
* [:link:](chai-fuzzy/chai-fuzzy.d.ts) [chai-fuzzy](http://chaijs.com/plugins/chai-fuzzy) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
@@ -131,6 +132,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](cli-color/cli-color.d.ts) [cli-color](https://github.com/medikoo/cli-color) by [Joel Spadin](https://github.com/ChaosinaCan)
|
||||
* [:link:](clone/clone.d.ts) [clone](https://github.com/pvorb/node-clone) by [Kieran Simpson](https://github.com/kierans/DefinitelyTyped)
|
||||
* [:link:](codemirror/codemirror.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [mihailik](https://github.com/mihailik)
|
||||
* [:link:](colorbrewer/colorbrewer.d.ts) [colorbrewer](https://github.com/jeanlauliac/colorbrewer) by [Matt Traynham](https://github.com/mtraynham)
|
||||
* [:link:](colors/colors.d.ts) [Colors.js 0.6.0-1](https://github.com/Marak/colors.js) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](cometd/cometd.d.ts) [CometD](http://cometd.org) by [Derek Cicerone](https://github.com/derekcicerone)
|
||||
* [:link:](commander/commander.d.ts) [commanderjs](https://github.com/visionmedia/commander.js) by [Marcelo Dezem](http://github.com/mdezem), [vvakame](http://github.com/vvakame)
|
||||
@@ -174,6 +176,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](deployJava/deployJava.d.ts) [deployJava.js](https://www.java.com/js/deployJava.txt) by [Cyril Schumacher](https://github.com/cyrilschumacher)
|
||||
* [:link:](detect-indent/detect-indent.d.ts) [detect-indent](https://github.com/sindresorhus/detect-indent) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](devextreme/dx.devextreme.d.ts) [DevExtreme](http://js.devexpress.com) by [DevExpress Inc.](http://devexpress.com)
|
||||
* [:link:](dexie/dexie.d.ts) [Dexie](https://github.com/dfahlander/Dexie.js) by [David Fahlander](http://github.com/dfahlander)
|
||||
* [:link:](dhtmlxgantt/dhtmlxgantt.d.ts) [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) by [Maksim Kozhukh](http://github.com/mkozhukh)
|
||||
* [:link:](dhtmlxscheduler/dhtmlxscheduler.d.ts) [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) by [Maksim Kozhukh](http://github.com/mkozhukh)
|
||||
* [:link:](di-lite/di-lite.d.ts) [di-lite](https://github.com/NickQiZhu/di.js) by [Timothy Morris](https://github.com/dcrusader)
|
||||
@@ -199,6 +202,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](easy-session/easy-session.d.ts) [easy-session](https://github.com/DeadAlready/node-easy-session) by [Karl Düüna](https://github.com/DeadAlready)
|
||||
* [:link:](easy-table/easy-table.d.ts) [easy-table](https://github.com/eldargab/easy-table) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](easystarjs/easystarjs.d.ts) [EasyStar.js](http://easystarjs.com) by [Magnus Gustafsson](https://github.com/borundin)
|
||||
* [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii)
|
||||
* [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000)
|
||||
* [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan)
|
||||
* [:link:](element-resize-event/element-resize-event.d.ts) [element-resize-event](https://github.com/KyleAMathews/element-resize-event) by [Rogier Schouten](https://github.com/rogierschouten)
|
||||
@@ -229,6 +233,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](express-validator/express-validator.d.ts) [express-validator](https://github.com/ctavan/express-validator) by [Nathan Ridley](https://github.com/axefrog), [Jonathan Häberle](http://dreampulse.de)
|
||||
* [:link:](extend/extend.d.ts) [extend](https://www.npmjs.com/package/extend) by [Stefan Steinhart](https://github.com/reppners)
|
||||
* [:link:](extjs/ExtJS.d.ts) [ExtJS](http://www.sencha.com/products/extjs) by [Brian Kotek](https://github.com/brian428)
|
||||
* [:link:](eyes/eyes.d.ts) [eyes](https://github.com/cloudhead/eyes.js) by [bryn austin bellomy](https://github.com/brynbellomy)
|
||||
* [:link:](fabricjs/fabricjs.d.ts) [FabricJS](http://fabricjs.com) by [Oliver Klemencic](https://github.com/oklemencic)
|
||||
* [:link:](fbsdk/fbsdk.d.ts) [Facebook Javascript SDK](https://developers.facebook.com/docs/javascript) by [Joshua Strobl](https://github.com/JoshStrobl)
|
||||
* [:link:](fancybox/fancybox.d.ts) [fancyBox](https://github.com/fancyapps/fancyBox) by [Boris Yankov](https://github.com/borisyankov)
|
||||
@@ -271,6 +276,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](gently/gently.d.ts) [gently](https://www.npmjs.org/package/gently) by [bonnici](https://github.com/bonnici)
|
||||
* [:link:](geojson/geojson.d.ts) [GeoJSON Format Specification](http://geojson.org) by [Jacob Bruun](https://github.com/cobster)
|
||||
* [:link:](giraffe/giraffe.d.ts) [Giraffe](https://github.com/barc/backbone.giraffe) by [Matt McCray](https://github.com/darthapo)
|
||||
* [:link:](gl-matrix/gl-matrix.d.ts) [gl-matrix](https://github.com/toji/gl-matrix) by [Tat](https://github.com/tatchx)
|
||||
* [:link:](gldatepicker/gldatepicker.d.ts) [glDatePicker](http://glad.github.com/glDatePicker) by [Dániel Tar](https://github.com/qcz)
|
||||
* [:link:](glidejs/glidejs.d.ts) [Glide.js](http://glide.jedrzejchalubek.com) by [Milan Jaros](https://github.com/milanjaros)
|
||||
* [:link:](glob/glob.d.ts) [Glob](https://github.com/isaacs/node-glob) by [vvakame](https://github.com/vvakame)
|
||||
@@ -342,6 +348,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](humane/humane.d.ts) [Humane](http://wavded.github.com/humane-js) by [jmvrbanac](https://github.com/jmvrbanac)
|
||||
* [:link:](hypertext-application-language/hypertext-application-language.d.ts) [Hypertext Application Language Draft 6](https://tools.ietf.org/html/draft-kelly-json-hal-06) by [Maks3w](https://github.com/maks3w)
|
||||
* [:link:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT)
|
||||
* [:link:](ng-i18next/ng-i18next.d.ts) [i18next](https://github.com/i18next/ng-i18next) by [Cyril Schumacher](https://github.com/cyrilschumacher)
|
||||
* [:link:](i18next/i18next.d.ts) [i18next](http://i18next.com) by [Maarten Docter](https://github.com/mdocter)
|
||||
* [:link:](iban/iban.d.ts) [iban.js](https://github.com/arhs/iban.js) by [Cyril Schumacher](https://github.com/cyrilschumacher)
|
||||
* [:link:](icheck/icheck.d.ts) [iCheck](http://damirfoy.com/iCheck) by [Dániel Tar](https://github.com/qcz)
|
||||
@@ -476,6 +483,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](jssha/jssha.d.ts) [jsSHA](https://github.com/Caligatio/jsSHA) by [David Li](https://github.com/randombk)
|
||||
* [:link:](jstorage/jstorage.d.ts) [jStorage](http://www.jstorage.info) by [Danil Flores](https://github.com/dflor003)
|
||||
* [:link:](jstree/jstree.d.ts) [jsTree](http://www.jstree.com) by [Adam Pluciński](https://github.com/adaskothebeast)
|
||||
* [:link:](jsuri/jsuri.d.ts) [jsUri](https://github.com/derek-watson/jsUri) by [Chris Charabaruk](http://github.com/coldacid)
|
||||
* [:link:](jszip/jszip.d.ts) [JSZip](http://stuk.github.com/jszip) by [mzeiher](https://github.com/mzeiher)
|
||||
* [:link:](jwplayer/jwplayer.d.ts) [JW Player](http://developer.longtailvideo.com/trac) by [Martin Duparc](https://github.com/martinduparc)
|
||||
* [:link:](jwt-simple/jwt-simple.d.ts) [jwt-simple](https://github.com/hokaccha/node-jwt-simple) by [Ken Fukuyama](https://github.com/kenfdev)
|
||||
@@ -500,6 +508,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](knockout-transformations/knockout-transformations.d.ts) [knockout-transformations](https://github.com/One-com/knockout-transformations) by [John Reilly](https://github.com/johnnyreilly), [Wim Looman](https://github.com/Nemo157)
|
||||
* [:link:](knockout.mapper/knockout.mapper.d.ts) [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) by [Brandon Meyer](https://github.com/BMeyerKC)
|
||||
* [:link:](knockout.mapping/knockout.mapping.d.ts) [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) by [Boris Yankov](https://github.com/borisyankov)
|
||||
* [:link:](knockout.punches/knockout.punches.d.ts) [knockout.punches](https://github.com/mbest/knockout.punches) by [Stephen Lautier](https://github.com/johnnyreilly)
|
||||
* [:link:](knockout.rx/knockout.rx.d.ts) [knockout.rx](https://github.com/Igorbek/knockout.rx) by [Igor Oleinikov](https://github.com/Igorbek)
|
||||
* [:link:](knockstrap/knockstrap.d.ts) [Knockstrap](http://faulknercs.github.io/Knockstrap) by [Adam Pluciński](https://github.com/adaskothebeast)
|
||||
* [:link:](knockout.kogrid/ko-grid.d.ts) [ko-grid](http://knockout-contrib.github.io/KoGrid) by [huer12](https://github.com/huer12)
|
||||
@@ -545,6 +554,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](marked/marked.d.ts) [Marked](https://github.com/chjj/marked) by [William Orr](https://github.com/worr)
|
||||
* [:link:](maskedinput/maskedinput.d.ts) [Masked Input plugin for jQuery](http://digitalbush.com/projects/masked-input-plugin) by [Lokesh Peta](https://github.com/lokeshpeta)
|
||||
* [:link:](mathjax/mathjax.d.ts) [MathJax](https://github.com/mathjax/MathJax) by [Roland Zwaga](https://github.com/rolandzwaga)
|
||||
* [:link:](matter-js/matter-js.d.ts) [Matter.js](https://github.com/liabru/matter-js) by [Ivane Gegia](https://twitter.com/ivanegegia)
|
||||
* [: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)
|
||||
@@ -716,6 +726,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](q-io/Q-io.d.ts) [Q-io](https://github.com/kriskowal/q-io) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](q-retry/q-retry.d.ts) [q-retry](https://github.com/vilic/q-retry) by [VILIC VANE](https://github.com/vilic)
|
||||
* [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade)
|
||||
* [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer)
|
||||
* [:link:](qunit/qunit.d.ts) [QUnit](http://qunitjs.com) by [Diullei Gomes](https://github.com/diullei)
|
||||
* [: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](http://ractivejs.org) by [Han Lin Yap](http://yap.nu)
|
||||
@@ -728,6 +739,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](react/react-addons.d.ts) [ReactWithAddons (external module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com)
|
||||
* [:link:](react/react-addons-global.d.ts) [ReactWithAddons (internal module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com)
|
||||
* [:link:](readdir-stream/readdir-stream.d.ts) [readdir-stream](https://github.com/logicalparadox/readdir-stream) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](recursive-readdir/recursive-readdir.d.ts) [recursive-readdir](https://github.com/jergason/recursive-readdir) by [Elisée Maurer](https://github.com/elisee)
|
||||
* [:link:](redis/redis.d.ts) [redis](https://github.com/mranney/node_redis) by [Carlos Ballesteros Velasco](https://github.com/soywiz), [Peter Harris](https://github.com/CodeAnimal)
|
||||
* [:link:](ref/ref.d.ts) [ref](https://github.com/TooTallNate/ref) by [Paul Loyd](https://github.com/loyd)
|
||||
* [:link:](ref-array/ref-array.d.ts) [ref-array](https://github.com/TooTallNate/ref-array) by [Paul Loyd](https://github.com/loyd)
|
||||
@@ -788,7 +800,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](simple-cw-node/simple-cw-node.d.ts) [simple-cw-node](https://github.com/astronaughts/simple-cw-node) by [vvakame](https://github.com/vvakame)
|
||||
* [:link:](jquery.simplemodal/jquery.simplemodal.d.ts) [SimpleModal](http://www.ericmmartin.com/projects/simplemodal) by [Friedrich von Never](https://github.com/ForNeVeR)
|
||||
* [:link:](sinon/sinon.d.ts) [Sinon](http://sinonjs.org) by [William Sears](https://github.com/mrbigdog2u)
|
||||
* [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid)
|
||||
* [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [Jed Mao](https://github.com/jedmao)
|
||||
* [:link:](sipml/sipml.d.ts) [SIPml5](http://sipml5.org) by [A. Groenenboom](https://github.com/chookies)
|
||||
* [:link:](sjcl/sjcl.d.ts) [sjcl](http://crypto.stanford.edu/sjcl) by [Eugene Chernyshov](https://github.com/Evgenus)
|
||||
* [:link:](slickgrid/SlickGrid.d.ts) [SlickGrid](https://github.com/mleibman/SlickGrid) by [Josh Baldwin](https://github.com/jbaldwin)
|
||||
@@ -879,6 +891,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](twig/twig.d.ts) [twig](https://github.com/justjohn/twig.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz)
|
||||
* [:link:](twitter/twitter.d.ts) [Twitter for Websites](https://dev.twitter.com/web) by [Chitoku](https://github.com/chitoku-k)
|
||||
* [:link:](jquery.bootstrap.wizard/jquery.bootstrap.wizard.d.ts) [twitter-bootstrap-wizard](https://github.com/VinceG/twitter-bootstrap-wizard) by [Blake Niemyjski](https://github.com/niemyjski)
|
||||
* [:link:](twix/twix.d.ts) [twix.js](https://github.com/icambron/twix.js) by [j3ko](https://github.com/j3ko)
|
||||
* [:link:](type-detect/type-detect.d.ts) [type-detect](https://github.com/chaijs/type-detect) by [Bart van der Schoor](https://github.com/Bartvds)
|
||||
* [:link:](type-name/type-name.d.ts) [type-name](https://github.com/twada/type-name) by [OKUNOKENTARO](https://github.com/armorik83)
|
||||
* [:link:](typeahead/typeahead.d.ts) [typeahead.js](http://twitter.github.io/typeahead.js) by [Ivaylo Gochkov](https://github.com/igochkov), [Gidon Junge](https://github.com/gjunge)
|
||||
@@ -902,6 +915,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](vega/vega.d.ts) [Vega](http://trifacta.github.io/vega) by [Tom Crockett](http://github.com/pelotom)
|
||||
* [:link:](velocity-animate/velocity-animate.d.ts) [Velocity](http://velocityjs.org) by [Greg Smith](https://github.com/smrq)
|
||||
* [:link:](vex-js/vex-js.d.ts) [Vex](https://github.com/HubSpot/vex) by [Greg Cohan](https://github.com/gdcohan)
|
||||
* [:link:](victor/victor.d.ts) [Victor.js](http://victorjs.org) by [Ivane Gegia](https://twitter.com/ivanegegia)
|
||||
* [:link:](videojs/videojs.d.ts) [Video.js](https://github.com/zencoder/video-js) by [Vincent Bortone](https://github.com/vbortone)
|
||||
* [:link:](vimeo/froogaloop.d.ts) [Vimeo](http://developer.vimeo.com/player/js-api) by [Daz Wilkin](https://github.com/DazWilkin)
|
||||
* [:link:](vinyl/vinyl.d.ts) [vinyl](https://github.com/wearefractal/vinyl) by [vvakame](https://github.com/vvakame), [jedmao](https://github.com/jedmao)
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/// <reference path="DataStream.js.d.ts" />
|
||||
|
||||
var buf = new ArrayBuffer(100);
|
||||
var ds = new DataStream(buf);
|
||||
ds = new DataStream(buf, 10);
|
||||
ds = new DataStream(buf, 10, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.save('somefile.ext');
|
||||
ds.dynamicSize = true;
|
||||
|
||||
for (var i=0; i<ds.byteLength; i++) {
|
||||
}
|
||||
|
||||
ds.buffer = buf;
|
||||
ds.byteOffset = 10;
|
||||
ds.seek(0);
|
||||
ds.isEof();
|
||||
|
||||
var int32arr: Int32Array;
|
||||
var int16arr: Int16Array;
|
||||
var int8arr: Int8Array;
|
||||
|
||||
var uint32arr: Uint32Array;
|
||||
var uint16arr: Uint16Array;
|
||||
var uint8arr: Uint8Array;
|
||||
|
||||
var float64arr: Float64Array;
|
||||
var float32arr: Float32Array;
|
||||
|
||||
var val: number;
|
||||
var str: string;
|
||||
|
||||
int32arr = ds.mapInt32Array(2);
|
||||
int32arr = ds.mapInt32Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
int16arr = ds.mapInt16Array(2);
|
||||
int16arr = ds.mapInt16Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
int8arr = ds.mapInt8Array(2);
|
||||
|
||||
uint32arr = ds.mapUint32Array(2);
|
||||
uint32arr = ds.mapUint32Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
uint16arr = ds.mapUint16Array(2);
|
||||
uint16arr = ds.mapUint16Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
uint8arr = ds.mapUint8Array(2);
|
||||
|
||||
float64arr = ds.mapFloat64Array(2);
|
||||
float64arr = ds.mapFloat64Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
float32arr = ds.mapFloat32Array(2);
|
||||
float32arr = ds.mapFloat32Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
int32arr = ds.readInt32Array(2);
|
||||
int32arr = ds.readInt32Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
int16arr = ds.readInt16Array(2);
|
||||
int16arr = ds.readInt16Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
int8arr = ds.readInt8Array(2);
|
||||
|
||||
uint32arr = ds.readUint32Array(2);
|
||||
uint32arr = ds.readUint32Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
uint16arr = ds.readUint16Array(2);
|
||||
uint16arr = ds.readUint16Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
uint8arr = ds.readUint8Array(2);
|
||||
|
||||
float64arr = ds.readFloat64Array(2);
|
||||
float64arr = ds.readFloat64Array(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
float32arr = ds.readFloat32Array(2);
|
||||
float32arr = ds.readFloat32Array(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt32Array(new Int32Array([1,2,3]));
|
||||
ds.writeInt32Array(new Int32Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt16Array(new Int16Array([1,2,3]));
|
||||
ds.writeInt16Array(new Int16Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt8Array(new Int8Array([1,2,3]));
|
||||
|
||||
ds.writeUint32Array(new Uint32Array([1,2,3]));
|
||||
ds.writeUint32Array(new Uint32Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeUint16Array(new Uint16Array([1,2,3]));
|
||||
ds.writeUint16Array(new Uint16Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeUint8Array(new Uint8Array([1,2,3]));
|
||||
|
||||
ds.writeFloat64Array(new Float64Array([1,2,3]));
|
||||
ds.writeFloat64Array(new Float64Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeFloat32Array(new Float32Array([1,2,3]));
|
||||
ds.writeFloat32Array(new Float32Array([1,2,3]), DataStream.BIG_ENDIAN);
|
||||
|
||||
val = ds.readInt32();
|
||||
val = ds.readInt32(DataStream.LITTLE_ENDIAN);
|
||||
|
||||
val = ds.readInt16();
|
||||
val = ds.readInt16(DataStream.BIG_ENDIAN);
|
||||
|
||||
val = ds.readInt8();
|
||||
|
||||
val = ds.readUint32();
|
||||
val = ds.readUint32(DataStream.LITTLE_ENDIAN);
|
||||
|
||||
val = ds.readUint16();
|
||||
val = ds.readUint16(DataStream.BIG_ENDIAN);
|
||||
|
||||
val = ds.readUint8();
|
||||
|
||||
val = ds.readFloat64();
|
||||
val = ds.readFloat64(DataStream.LITTLE_ENDIAN);
|
||||
|
||||
val = ds.readFloat32();
|
||||
val = ds.readFloat32(DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt32(1);
|
||||
ds.writeInt32(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeInt16(1);
|
||||
ds.writeInt16(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
ds.writeInt8(1);
|
||||
|
||||
ds.writeUint32(1);
|
||||
ds.writeUint32(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeUint16(1);
|
||||
ds.writeUint16(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
ds.writeUint8(1);
|
||||
|
||||
ds.writeFloat32(1);
|
||||
ds.writeFloat32(2, DataStream.BIG_ENDIAN);
|
||||
|
||||
ds.writeFloat64(1);
|
||||
ds.writeFloat64(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
var embed = [
|
||||
'tag', 'uint32be',
|
||||
'code', 'uint32le',
|
||||
'greet', 'cstring'
|
||||
];
|
||||
|
||||
var def = [
|
||||
'tag', 'cstring:4',
|
||||
'code', 'uint32le',
|
||||
'embed', embed,
|
||||
'length', 'uint16be',
|
||||
'data', ['[]', 'float32be', 'length'],
|
||||
'greet', 'cstring:20',
|
||||
'endNote', 'uint8'
|
||||
];
|
||||
|
||||
var obj = ds.readStruct(def);
|
||||
ds.writeStruct(def, obj);
|
||||
|
||||
str = ds.readUCS2String(2);
|
||||
str = ds.readUCS2String(2, DataStream.LITTLE_ENDIAN);
|
||||
|
||||
ds.writeUCS2String("str");
|
||||
ds.writeUCS2String("str", DataStream.LITTLE_ENDIAN);
|
||||
ds.writeUCS2String("str", DataStream.LITTLE_ENDIAN, 1);
|
||||
|
||||
str = ds.readString(2);
|
||||
str = ds.readString(2, "ASCII");
|
||||
|
||||
ds.writeString("str");
|
||||
ds.writeString("str", "ASCII");
|
||||
ds.writeString("str", "ASCII", 1);
|
||||
|
||||
str = ds.readCString();
|
||||
str = ds.readCString(2);
|
||||
|
||||
ds.writeCString("str");
|
||||
ds.writeCString("str", 1);
|
||||
Vendored
+937
@@ -0,0 +1,937 @@
|
||||
// Type definitions for DataStream.js
|
||||
// Project: https://github.com/kig/DataStream.js
|
||||
// Definitions by: Tat <https://github.com/tatchx/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare class DataStream {
|
||||
|
||||
/**
|
||||
Big-endian const to use as default endianness.
|
||||
*/
|
||||
static BIG_ENDIAN: boolean;
|
||||
|
||||
/**
|
||||
Little-endian const to use as default endianness.
|
||||
*/
|
||||
static LITTLE_ENDIAN: boolean;
|
||||
|
||||
/**
|
||||
DataStream reads scalars, arrays and structs of data from an ArrayBuffer.
|
||||
It's like a file-like DataView on steroids.
|
||||
|
||||
@param {ArrayBuffer} arrayBuffer ArrayBuffer to read from.
|
||||
*/
|
||||
constructor(arrayBuffer: ArrayBuffer);
|
||||
|
||||
/**
|
||||
DataStream reads scalars, arrays and structs of data from an ArrayBuffer.
|
||||
It's like a file-like DataView on steroids.
|
||||
|
||||
@param arrayBuffer ArrayBuffer to read from.
|
||||
@param byteOffset Offset from arrayBuffer beginning for the DataStream.
|
||||
*/
|
||||
constructor(arrayBuffer: ArrayBuffer, byteOffset: number);
|
||||
|
||||
/**
|
||||
DataStream reads scalars, arrays and structs of data from an ArrayBuffer.
|
||||
It's like a file-like DataView on steroids.
|
||||
|
||||
@param arrayBuffer ArrayBuffer to read from.
|
||||
@param byteOffset Offset from arrayBuffer beginning for the DataStream.
|
||||
@param endianness DataStream.BIG_ENDIAN or DataStream.LITTLE_ENDIAN (the default).
|
||||
*/
|
||||
constructor(arrayBuffer: ArrayBuffer, byteOffset: number, endianness: boolean);
|
||||
|
||||
/**
|
||||
Saves the DataStream contents to the given filename.
|
||||
Uses Chrome's anchor download property to initiate download.
|
||||
*
|
||||
@param filename Filename to save as.
|
||||
@return nothing
|
||||
*/
|
||||
save(filename: string): void;
|
||||
|
||||
/**
|
||||
Whether to extend DataStream buffer when trying to write beyond its size.
|
||||
If set, the buffer is reallocated to twice its current size until the
|
||||
requested write fits the buffer.
|
||||
*/
|
||||
dynamicSize: boolean;
|
||||
|
||||
/**
|
||||
Returns the byte length of the DataStream object.
|
||||
*/
|
||||
byteLength: number;
|
||||
|
||||
/**
|
||||
Set/get the backing ArrayBuffer of the DataStream object.
|
||||
The setter updates the DataView to point to the new buffer.
|
||||
*/
|
||||
buffer: ArrayBuffer;
|
||||
|
||||
/**
|
||||
Set/get the byteOffset of the DataStream object.
|
||||
The setter updates the DataView to point to the new byteOffset.
|
||||
*/
|
||||
byteOffset: number;
|
||||
|
||||
/**
|
||||
Set/get the backing DataView of the DataStream object.
|
||||
The setter updates the buffer and byteOffset to point to the DataView values.
|
||||
*/
|
||||
dataView: Object;
|
||||
|
||||
/**
|
||||
Sets the DataStream read/write position to given position.
|
||||
Clamps between 0 and DataStream length.
|
||||
*
|
||||
@param pos Position to seek to.
|
||||
@return nothing
|
||||
*/
|
||||
seek(pos: number): void;
|
||||
|
||||
/**
|
||||
Returns true if the DataStream seek pointer is at the end of buffer and
|
||||
there's no more data to read.
|
||||
*
|
||||
@return true if the seek pointer is at the end of the buffer.
|
||||
*/
|
||||
isEof(): boolean;
|
||||
|
||||
/**
|
||||
Maps an Int32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Int32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt32Array(length: number): Int32Array;
|
||||
|
||||
/**
|
||||
Maps an Int32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Int32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt32Array(length: number, e: boolean): Int32Array;
|
||||
|
||||
/**
|
||||
Maps an Int16Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Int16Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt16Array(length: number): Int16Array;
|
||||
|
||||
/**
|
||||
Maps an Int16Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Int16Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt16Array(length: number, e: boolean): Int16Array;
|
||||
|
||||
/**
|
||||
Maps an Int8Array into the DataStream buffer.
|
||||
*
|
||||
Nice for quickly reading in data.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Int8Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapInt8Array(length: number): Int8Array;
|
||||
|
||||
/**
|
||||
Maps a Uint32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Uint32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint32Array(length: number): Uint32Array;
|
||||
|
||||
/**
|
||||
Maps a Uint32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Uint32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint32Array(length: number, e: boolean): Uint32Array;
|
||||
|
||||
/**
|
||||
Maps a Uint16Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Uint16Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint16Array(length: number): Uint16Array;
|
||||
|
||||
/**
|
||||
Maps a Uint16Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Uint16Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint16Array(length: number, e: boolean): Uint16Array;
|
||||
|
||||
/**
|
||||
Maps a Uint8Array into the DataStream buffer.
|
||||
*
|
||||
Nice for quickly reading in data.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Uint8Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapUint8Array(length: number): Uint8Array;
|
||||
|
||||
/**
|
||||
Maps a Float64Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Float64Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapFloat64Array(length: number): Float64Array;
|
||||
|
||||
/**
|
||||
Maps a Float64Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Float64Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapFloat64Array(length: number, e: boolean): Float64Array;
|
||||
|
||||
/**
|
||||
Maps a Float32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return Float32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapFloat32Array(length: number): Float32Array;
|
||||
|
||||
/**
|
||||
Maps a Float32Array into the DataStream buffer, swizzling it to native
|
||||
endianness in-place. The current offset from the start of the buffer needs to
|
||||
be a multiple of element size, just like with typed array views.
|
||||
*
|
||||
Nice for quickly reading in data. Warning: potentially modifies the buffer
|
||||
contents.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return Float32Array to the DataStream backing buffer.
|
||||
*/
|
||||
mapFloat32Array(length: number, e: boolean): Float32Array;
|
||||
|
||||
/**
|
||||
Reads an Int32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Int32Array.
|
||||
*/
|
||||
readInt32Array(length: number): Int32Array;
|
||||
|
||||
/**
|
||||
Reads an Int32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Int32Array.
|
||||
*/
|
||||
readInt32Array(length: number, e: boolean): Int32Array;
|
||||
|
||||
/**
|
||||
Reads an Int16Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Int16Array.
|
||||
*/
|
||||
readInt16Array(length: number): Int16Array;
|
||||
|
||||
/**
|
||||
Reads an Int16Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Int16Array.
|
||||
*/
|
||||
readInt16Array(length: number, e: boolean): Int16Array;
|
||||
|
||||
/**
|
||||
Reads an Int8Array of desired length from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Int8Array.
|
||||
*/
|
||||
readInt8Array(length: number): Int8Array;
|
||||
|
||||
/**
|
||||
Reads an Uint32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Uint32Array.
|
||||
*/
|
||||
readUint32Array(length: number): Uint32Array;
|
||||
|
||||
/**
|
||||
Reads an Uint32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Uint32Array.
|
||||
*/
|
||||
readUint32Array(length: number, e: boolean): Uint32Array;
|
||||
|
||||
/**
|
||||
Reads an Uint16Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Uint16Array.
|
||||
*/
|
||||
readUint16Array(length: number): Uint16Array;
|
||||
|
||||
/**
|
||||
Reads an Uint16Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Uint16Array.
|
||||
*/
|
||||
readUint16Array(length: number, e: boolean): Uint16Array;
|
||||
|
||||
/**
|
||||
Reads an Uint8Array of desired length from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Uint8Array.
|
||||
*/
|
||||
readUint8Array(length: number): Uint8Array;
|
||||
|
||||
/**
|
||||
Reads a Float64Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Float64Array.
|
||||
*/
|
||||
readFloat64Array(length: number, e: boolean): Float64Array;
|
||||
|
||||
/**
|
||||
Reads a Float64Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Float64Array.
|
||||
*/
|
||||
readFloat64Array(length: number): Float64Array;
|
||||
|
||||
/**
|
||||
Reads a Float32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@param e Endianness of the data to read.
|
||||
@return The read Float32Array.
|
||||
*/
|
||||
readFloat32Array(length: number, e: boolean): Float32Array;
|
||||
|
||||
/**
|
||||
Reads a Float32Array of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length Number of elements to map.
|
||||
@return The read Float32Array.
|
||||
*/
|
||||
readFloat32Array(length: number): Float32Array;
|
||||
|
||||
/**
|
||||
Writes an Int32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeInt32Array(arr: Int32Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an Int32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeInt32Array(arr: Int32Array): void;
|
||||
|
||||
/**
|
||||
Writes an Int16Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeInt16Array(arr: Int16Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an Int16Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeInt16Array(arr: Int16Array): void;
|
||||
|
||||
/**
|
||||
Writes an Int8Array to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeInt8Array(arr: Int8Array): void;
|
||||
|
||||
/**
|
||||
Writes an Uint32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeUint32Array(arr: Uint32Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an Uint32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeUint32Array(arr: Uint32Array): void;
|
||||
|
||||
/**
|
||||
Writes an Uint16Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeUint16Array(arr: Uint16Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an Uint16Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeUint16Array(arr: Uint16Array): void;
|
||||
|
||||
/**
|
||||
Writes an Uint8Array to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeUint8Array(arr: Uint8Array): void;
|
||||
|
||||
/**
|
||||
Writes a Float64Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeFloat64Array(arr: Float64Array): void;
|
||||
|
||||
/**
|
||||
Writes a Float64Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeFloat64Array(arr: Float64Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes a Float32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
*/
|
||||
writeFloat32Array(arr: Float32Array): void;
|
||||
|
||||
/**
|
||||
Writes a Float32Array of specified endianness to the DataStream.
|
||||
*
|
||||
@param arr The array to write.
|
||||
@param e Endianness of the data to write.
|
||||
*/
|
||||
writeFloat32Array(arr: Float32Array, e: boolean): void;
|
||||
|
||||
/**
|
||||
Reads a 32-bit int from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readInt32(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit int from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readInt32(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads a 16-bit int from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readInt16(): number;
|
||||
|
||||
/**
|
||||
Reads a 16-bit int from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readInt16(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads an 8-bit int from the DataStream.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readInt8(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit unsigned int from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readUint32(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit unsigned int from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readUint32(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads a 16-bit unsigned int from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readUint16(): number;
|
||||
|
||||
/**
|
||||
Reads a 16-bit unsigned int from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readUint16(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads an 8-bit unsigned intfrom the DataStream.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readUint8(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit float from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readFloat32(): number;
|
||||
|
||||
/**
|
||||
Reads a 32-bit float from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readFloat32(e: boolean): number;
|
||||
|
||||
/**
|
||||
Reads a 64-bit float from the DataStream with the desired endianness.
|
||||
*
|
||||
@return The read number.
|
||||
*/
|
||||
readFloat64(): number;
|
||||
|
||||
/**
|
||||
Reads a 64-bit float from the DataStream with the desired endianness.
|
||||
*
|
||||
@param e Endianness of the number.
|
||||
@return The read number.
|
||||
*/
|
||||
readFloat64(e: boolean): number;
|
||||
|
||||
/**
|
||||
Writes a 32-bit int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeInt32(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeInt32(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes a 16-bit int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeInt16(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 16-bit int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeInt16(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an 8-bit int to the DataStream.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeInt8(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit undigned int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeUint32(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit undigned int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeUint32(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes a 16-bit undigned int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeUint16(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 16-bit undigned int to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeUint16(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes an 8-bit undigned int to the DataStream.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeUint8(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit float to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeFloat32(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 32-bit float to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeFloat32(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Writes a 64-bit float to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
*/
|
||||
writeFloat64(v: number): void;
|
||||
|
||||
/**
|
||||
Writes a 64-bit float to the DataStream with the desired endianness.
|
||||
*
|
||||
@param v Number to write.
|
||||
@param e Endianness of the number.
|
||||
*/
|
||||
writeFloat64(v: number, e: boolean): void;
|
||||
|
||||
/**
|
||||
Reads a struct of data from the DataStream. The struct is defined as
|
||||
a flat array of [name, type]-pairs. See the example below:
|
||||
*
|
||||
ds.readStruct([
|
||||
'headerTag', 'uint32', // Uint32 in DataStream endianness.
|
||||
'headerTag2', 'uint32be', // Big-endian Uint32.
|
||||
'headerTag3', 'uint32le', // Little-endian Uint32.
|
||||
'array', ['[]', 'uint32', 16], // Uint32Array of length 16.
|
||||
'array2Length', 'uint32',
|
||||
'array2', ['[]', 'uint32', 'array2Length'] // Uint32Array of length array2Length
|
||||
]);
|
||||
*
|
||||
The possible values for the type are as follows:
|
||||
*
|
||||
// Number types
|
||||
// Unsuffixed number types use DataStream endianness.
|
||||
// To explicitly specify endianness, suffix the type with
|
||||
// 'le' for little-endian or 'be' for big-endian,
|
||||
// e.g. 'int32be' for big-endian int32.
|
||||
'uint8' -- 8-bit unsigned int
|
||||
'uint16' -- 16-bit unsigned int
|
||||
'uint32' -- 32-bit unsigned int
|
||||
'int8' -- 8-bit int
|
||||
'int16' -- 16-bit int
|
||||
'int32' -- 32-bit int
|
||||
'float32' -- 32-bit float
|
||||
'float64' -- 64-bit float
|
||||
*
|
||||
// String types
|
||||
'cstring' -- ASCII string terminated by a zero byte.
|
||||
'string:N' -- ASCII string of length N, where N is a literal integer.
|
||||
'string:variableName' -- ASCII string of length $variableName,
|
||||
where 'variableName' is a previously parsed number in the current struct.
|
||||
'string,CHARSET:N' -- String of byteLength N encoded with given CHARSET.
|
||||
'u16string:N' -- UCS-2 string of length N in DataStream endianness.
|
||||
'u16stringle:N' -- UCS-2 string of length N in little-endian.
|
||||
'u16stringbe:N' -- UCS-2 string of length N in big-endian.
|
||||
*
|
||||
// Complex types
|
||||
[name, type, name_2, type_2, ..., name_N, type_N] -- Struct
|
||||
function(dataStream, struct) {} -- Callback function to read and return data.
|
||||
{get: function(dataStream, struct) {},
|
||||
set: function(dataStream, struct) {}}
|
||||
-- Getter/setter functions to read and return data, handy for using the same
|
||||
struct definition for reading and writing structs.
|
||||
['[]', type, length] -- Array of given type and length. The length can be either
|
||||
a number, a string that references a previously-read
|
||||
field, or a callback function(struct, dataStream, type){}.
|
||||
If length is '*', reads in as many elements as it can.
|
||||
*
|
||||
@param structDefinition Struct definition object.
|
||||
@return The read struct. Null if failed to read struct.
|
||||
*/
|
||||
readStruct(structDefinition: any[]): Object;
|
||||
|
||||
/**
|
||||
Writes a struct to the DataStream. Takes a structDefinition that gives the
|
||||
types and a struct object that gives the values. Refer to readStruct for the
|
||||
structure of structDefinition.
|
||||
*
|
||||
@param structDefinition Type definition of the struct.
|
||||
@param struct The struct data object.
|
||||
*/
|
||||
writeStruct(structDefinition: Object, struct: Object): void;
|
||||
|
||||
/**
|
||||
Read UCS-2 string of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length The length of the string to read.
|
||||
@return The read string.
|
||||
*/
|
||||
readUCS2String(length: number): string;
|
||||
|
||||
/**
|
||||
Read UCS-2 string of desired length and endianness from the DataStream.
|
||||
*
|
||||
@param length The length of the string to read.
|
||||
@param endianness The endianness of the string data in the DataStream.
|
||||
@return The read string.
|
||||
*/
|
||||
readUCS2String(length: number, endianness: boolean): string;
|
||||
|
||||
/**
|
||||
Write a UCS-2 string of desired endianness to the DataStream. The
|
||||
lengthOverride argument lets you define the number of characters to write.
|
||||
If the string is shorter than lengthOverride, the extra space is padded with
|
||||
zeroes.
|
||||
*
|
||||
@param str The string to write.
|
||||
*/
|
||||
writeUCS2String(str: string): void;
|
||||
|
||||
/**
|
||||
Write a UCS-2 string of desired endianness to the DataStream. The
|
||||
lengthOverride argument lets you define the number of characters to write.
|
||||
If the string is shorter than lengthOverride, the extra space is padded with
|
||||
zeroes.
|
||||
*
|
||||
@param str The string to write.
|
||||
@param endianness The endianness to use for the written string data.
|
||||
*/
|
||||
writeUCS2String(str: string, endianness: boolean): void;
|
||||
|
||||
/**
|
||||
Write a UCS-2 string of desired endianness to the DataStream. The
|
||||
lengthOverride argument lets you define the number of characters to write.
|
||||
If the string is shorter than lengthOverride, the extra space is padded with
|
||||
zeroes.
|
||||
*
|
||||
@param str The string to write.
|
||||
@param endianness The endianness to use for the written string data.
|
||||
@param lengthOverride The number of characters to write.
|
||||
*/
|
||||
writeUCS2String(str: string, endianness: boolean, lengthOverride: number): void;
|
||||
|
||||
/**
|
||||
Read a string of desired length and encoding from the DataStream.
|
||||
*
|
||||
@param length The length of the string to read in bytes.
|
||||
@return The read string.
|
||||
*/
|
||||
readString(length: number): string;
|
||||
|
||||
/**
|
||||
Read a string of desired length and encoding from the DataStream.
|
||||
*
|
||||
@param length The length of the string to read in bytes.
|
||||
@param encoding The encoding of the string data in the DataStream. Defaults to ASCII.
|
||||
@return The read string.
|
||||
*/
|
||||
readString(length: number, encoding: string): string;
|
||||
|
||||
/**
|
||||
Writes a string of desired length and encoding to the DataStream.
|
||||
*
|
||||
@param s The string to write.
|
||||
*/
|
||||
writeString(s: string): void;
|
||||
|
||||
/**
|
||||
Writes a string of desired length and encoding to the DataStream.
|
||||
*
|
||||
@param s The string to write.
|
||||
@param encoding The encoding for the written string data. Defaults to ASCII.
|
||||
*/
|
||||
writeString(s: string, encoding: string): void;
|
||||
|
||||
/**
|
||||
Writes a string of desired length and encoding to the DataStream.
|
||||
*
|
||||
@param s The string to write.
|
||||
@param encoding The encoding for the written string data. Defaults to ASCII.
|
||||
@param length The number of characters to write.
|
||||
*/
|
||||
writeString(s: string, encoding: string, length: number): void;
|
||||
|
||||
/**
|
||||
Read null-terminated string of desired length from the DataStream. Truncates
|
||||
the returned string so that the null byte is not a part of it.
|
||||
*
|
||||
@return The read string.
|
||||
*/
|
||||
readCString(): string;
|
||||
|
||||
/**
|
||||
Read null-terminated string of desired length from the DataStream. Truncates
|
||||
the returned string so that the null byte is not a part of it.
|
||||
*
|
||||
@param length The length of the string to read.
|
||||
@return The read string.
|
||||
*/
|
||||
readCString(length: number): string;
|
||||
|
||||
/**
|
||||
Writes a null-terminated string to DataStream and zero-pads it to length
|
||||
bytes. If length is not given, writes the string followed by a zero.
|
||||
If string is longer than length, the written part of the string does not have
|
||||
a trailing zero.
|
||||
*
|
||||
@param s The string to write.
|
||||
*/
|
||||
writeCString(s: string): void;
|
||||
|
||||
/**
|
||||
Writes a null-terminated string to DataStream and zero-pads it to length
|
||||
bytes. If length is not given, writes the string followed by a zero.
|
||||
If string is longer than length, the written part of the string does not have
|
||||
a trailing zero.
|
||||
*
|
||||
@param s The string to write.
|
||||
@param length The number of characters to write.
|
||||
*/
|
||||
writeCString(s: string, length: number): void;
|
||||
|
||||
/**
|
||||
Reads an object of type t from the DataStream, passing struct as the thus-far
|
||||
read struct to possible callbacks that refer to it. Used by readStruct for
|
||||
reading in the values, so the type is one of the readStruct types.
|
||||
*
|
||||
@param t Type of the object to read.
|
||||
@return Returns the object on successful read, null on unsuccessful.
|
||||
*/
|
||||
readType(t: Object): Object;
|
||||
|
||||
/**
|
||||
Reads an object of type t from the DataStream, passing struct as the thus-far
|
||||
read struct to possible callbacks that refer to it. Used by readStruct for
|
||||
reading in the values, so the type is one of the readStruct types.
|
||||
*
|
||||
@param t Type of the object to read.
|
||||
@param struct Struct to refer to when resolving length references and for calling callbacks.
|
||||
@return Returns the object on successful read, null on unsuccessful.
|
||||
*/
|
||||
readType(t: Object, struct: Object): Object;
|
||||
|
||||
/**
|
||||
Writes object v of type t to the DataStream.
|
||||
*
|
||||
@param t Type of data to write.
|
||||
@param v Value of data to write.
|
||||
@param struct Struct to pass to write callback functions.
|
||||
*/
|
||||
writeType(t: Object, v: Object, struct: Object): void;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
# DefinitelyTyped [](https://travis-ci.org/borisyankov/DefinitelyTyped)
|
||||
|
||||
[](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
> The repository for *high quality* TypeScript type definitions.
|
||||
|
||||
For more information see the [definitelytyped.org](http://definitelytyped.org) website.
|
||||
|
||||
Vendored
+11
-1
@@ -576,7 +576,7 @@ declare module AceAjax {
|
||||
/**
|
||||
* Returns the current tab size.
|
||||
**/
|
||||
getTabSize(): string;
|
||||
getTabSize(): number;
|
||||
|
||||
/**
|
||||
* Returns `true` if the character at the position is a soft tab.
|
||||
@@ -1034,6 +1034,9 @@ declare module AceAjax {
|
||||
* Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them.
|
||||
**/
|
||||
export interface Editor {
|
||||
|
||||
addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any);
|
||||
addEventListener(ev: string, callback: Function);
|
||||
|
||||
inMultiSelectMode: boolean;
|
||||
|
||||
@@ -1710,6 +1713,13 @@ declare module AceAjax {
|
||||
**/
|
||||
new(renderer: VirtualRenderer, session?: IEditSession): Editor;
|
||||
}
|
||||
|
||||
interface EditorChangeEvent {
|
||||
start: Position;
|
||||
end: Position;
|
||||
action: string; // insert, remove
|
||||
lines: any[];
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
/// PlaceHolder
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/// <reference path='../angularjs/angular.d.ts' />
|
||||
/// <reference path='angular-dynamic-locale.d.ts' />
|
||||
|
||||
var app = angular.module('testModule', ['tmh.dynamicLocale']);
|
||||
app.config((localStorageServiceProvider: angular.dynamicLocale.tmhDynamicLocaleProvider) => {
|
||||
localStorageServiceProvider
|
||||
.localeLocationPattern("app/config/locales/")
|
||||
.useCookieStorage();
|
||||
});
|
||||
|
||||
class LocaleTestController {
|
||||
|
||||
constructor(tmhDynamicLocaleService: angular.dynamicLocale.tmhDynamicLocaleService) {
|
||||
|
||||
var locale = tmhDynamicLocaleService.get();
|
||||
|
||||
var newLocale = "mt"
|
||||
tmhDynamicLocaleService.set(newLocale);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app.controller('TestController', LocaleTestController);
|
||||
@@ -0,0 +1,21 @@
|
||||
// Type definitions for angular-dynamic-locale v0.1.27
|
||||
// Project: https://github.com/lgalfaso/angular-dynamic-locale
|
||||
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module angular.dynamicLocale {
|
||||
|
||||
interface tmhDynamicLocaleService {
|
||||
set(locale: string): void;
|
||||
get(): string;
|
||||
}
|
||||
|
||||
interface tmhDynamicLocaleProvider extends angular.IServiceProvider {
|
||||
localeLocationPattern(location: string): tmhDynamicLocaleProvider;
|
||||
localeLocationPattern(): string;
|
||||
useStorage(storageName: string): void;
|
||||
useCookieStorage(): void;
|
||||
}
|
||||
}
|
||||
@@ -10,35 +10,41 @@ module controllers {
|
||||
|
||||
static $inject = ["$upload"];
|
||||
constructor(
|
||||
private $upload: ng.angularFileUpload.IUploadService
|
||||
private $upload: angular.angularFileUpload.IUploadService
|
||||
) {
|
||||
}
|
||||
|
||||
onFileSelect($files: File[]) {
|
||||
//$files: an array of files selected, each file has name, size, and type.
|
||||
var uploads: ng.IPromise<any>[] = [];
|
||||
// $files: an array of files selected, each file has name, size, and type.
|
||||
for (var i = 0; i < $files.length; i++) {
|
||||
var file = $files[i];
|
||||
uploads.push(this.$upload.upload<any>({
|
||||
url: "/api/upload",
|
||||
method: "POST",
|
||||
data: {
|
||||
extraData: {
|
||||
fileName: file.name, test: "anything"
|
||||
}
|
||||
},
|
||||
file: file
|
||||
this.$upload.upload({
|
||||
url: "/api/upload",
|
||||
method: "POST",
|
||||
data: {
|
||||
extraData: {
|
||||
fileName: file.name,
|
||||
test: "anything"
|
||||
}
|
||||
},
|
||||
file: file
|
||||
})
|
||||
.abort()
|
||||
.xhr((evt: any) => {
|
||||
console.log('xhr');
|
||||
})
|
||||
.progress((evt: any) => {
|
||||
console.log('progress');
|
||||
})
|
||||
.then(success => {
|
||||
// file is uploaded successfully
|
||||
console.log(success.data);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
}));
|
||||
.progress((evt: angular.angularFileUpload.IFileProgressEvent) => {
|
||||
var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10);
|
||||
console.log("upload progress: " + percent + "% for " + evt.config.file.name);
|
||||
})
|
||||
.error((data: any, status: number, response: any, headers: any) => {
|
||||
console.error(data, status, response, headers);
|
||||
})
|
||||
.success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfig) => {
|
||||
// file is uploaded successfully
|
||||
console.log("Success!", data, status, headers, config);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-6
@@ -1,5 +1,5 @@
|
||||
// Type definitions for Angular File Upload 1.6.7
|
||||
// Project: https://github.com/danialfarid/angular-file-upload
|
||||
// Type definitions for Angular File Upload 4.2.1
|
||||
// Project: https://github.com/danialfarid/ng-file-upload
|
||||
// Definitions by: John Reilly <https://github.com/johnnyreilly>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
@@ -9,18 +9,24 @@ declare module angular.angularFileUpload {
|
||||
|
||||
interface IUploadService {
|
||||
|
||||
http<T>(config: ng.IRequestConfig): IUploadPromise<T>;
|
||||
http<T>(config: IRequestConfig): IUploadPromise<T>;
|
||||
upload<T>(config: IFileUploadConfig): IUploadPromise<T>;
|
||||
}
|
||||
|
||||
interface IUploadPromise<T> extends IHttpPromise<T> {
|
||||
|
||||
abort(): IUploadPromise<T>;
|
||||
progress(callback: IHttpPromiseCallback<T>): IUploadPromise<T>;
|
||||
xhr(callback: IHttpPromiseCallback<T>): IUploadPromise<T>;
|
||||
}
|
||||
|
||||
interface IFileUploadConfig extends ng.IRequestConfig {
|
||||
interface IFileUploadConfig extends IRequestConfig {
|
||||
|
||||
file: File;
|
||||
fileName?: string;
|
||||
}
|
||||
}
|
||||
|
||||
interface IFileProgressEvent extends ProgressEvent {
|
||||
|
||||
config: IFileUploadConfig;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="angular-jwt.d.ts" />
|
||||
|
||||
var app = angular.module("angular-jwt-tests", ["angular-jwt"]);
|
||||
|
||||
var $jwtHelper: angular.jwt.IJwtHelper;
|
||||
|
||||
var expToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tLyIsInN1YiI6ImZhY2Vib29rfDEwMTU0Mjg3MDI3NTEwMzAyIiwiYXVkIjoiQlVJSlNXOXg2MHNJSEJ3OEtkOUVtQ2JqOGVESUZ4REMiLCJleHAiOjE0MTIyMzQ3MzAsImlhdCI6MTQxMjE5ODczMH0.7M5sAV50fF1-_h9qVbdSgqAnXVF7mz3I6RjS6JiH0H8';
|
||||
var tokenPayload = $jwtHelper.decodeToken(expToken);
|
||||
var date = $jwtHelper.getTokenExpirationDate(expToken);
|
||||
var bool = $jwtHelper.isTokenExpired(expToken);
|
||||
|
||||
var $jwtInterceptor: angular.jwt.IJwtInterceptor;
|
||||
|
||||
$jwtInterceptor.tokenGetter = () => {
|
||||
return expToken;
|
||||
}
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for angular-jwt 0.0.8
|
||||
// Project: https://github.com/auth0/angular-jwt
|
||||
// Definitions by: Reto Rezzonico <https://github.com/rerezz>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module angular.jwt {
|
||||
|
||||
interface JwtToken {
|
||||
iss: string;
|
||||
sub: string;
|
||||
aud: string;
|
||||
exp: number;
|
||||
nbf: number;
|
||||
iat: number;
|
||||
jti: string;
|
||||
unique_name: string;
|
||||
}
|
||||
|
||||
interface IJwtHelper {
|
||||
decodeToken(token: string): JwtToken;
|
||||
getTokenExpirationDate(token: any): Date;
|
||||
isTokenExpired(token: any, offsetSeconds?: number): boolean;
|
||||
}
|
||||
|
||||
interface IJwtInterceptor {
|
||||
tokenGetter(): string;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -129,7 +129,7 @@ declare module angular.local.storage {
|
||||
* @param value optional
|
||||
* @param key The corresponding key used in local storage
|
||||
*/
|
||||
bind(scope:ng.IScope, property: string, value?: any, key?: string): Function;
|
||||
bind(scope: angular.IScope, property: string, value?: any, key?: string): Function;
|
||||
/**
|
||||
* Return the derive key
|
||||
* Returns String
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/// <reference path='../angularjs/angular.d.ts' />
|
||||
/// <reference path='angular-localForage.d.ts' />
|
||||
|
||||
var app = angular.module('angular-localForage-tests', ['LocalForageModule']);
|
||||
app.config(function (localStorageServiceProvider:angular.localForage.ILocalForageProvider) {
|
||||
|
||||
//TODO
|
||||
});
|
||||
|
||||
var $rootScope:angular.IRootScopeService,
|
||||
$localForage:angular.localForage.ILocalForageService,
|
||||
instanceVersion = 0;
|
||||
|
||||
// create a fresh instance
|
||||
$localForage.clear().then(function () {
|
||||
$localForage = $localForage.createInstance({
|
||||
name: ++instanceVersion
|
||||
});
|
||||
});
|
||||
|
||||
$localForage.getItem('this key is unknown').then(function (value) {
|
||||
|
||||
});
|
||||
|
||||
|
||||
$localForage.setItem('myName', 'Olivier Combe').then(function (data) {
|
||||
|
||||
$localForage.getItem('myName').then(function (data) {
|
||||
});
|
||||
});
|
||||
|
||||
var values = ['Olivier Combe', 'AngularJs', 'Open Source'];
|
||||
|
||||
$localForage.setItem(['myName', 'myPassion', 'myHobbie'], values).then(function (data) {
|
||||
|
||||
$localForage.getItem(['myHobbie', 'myName']).then(function (data) {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$localForage.removeItem('myName').then(function () {
|
||||
|
||||
$localForage.getItem('myName').then(function (data) {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$localForage.removeItem(['myName', 'myPassion']).then(function () {
|
||||
|
||||
$localForage.getItem(['myName', 'myPassion', 'myHobbie']).then(function (data) {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$localForage.pull('myName').then(function (data) {
|
||||
|
||||
$localForage.getItem('myName').then(function (data) {
|
||||
});
|
||||
|
||||
});
|
||||
$localForage.pull(['myName', 'myPassion']).then(function (data) {
|
||||
|
||||
$localForage.getItem(['myName', 'myPassion', 'myHobbie']).then(function (data) {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
$localForage.setItem('myName', 'Olivier Combe').then(function (d) {
|
||||
|
||||
$localForage.getItem('myName').then(function (data) {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
$localForage.setDriver('localStorageWrapper').then(function () {
|
||||
$localForage.setItem('myName', 'Olivier Combe').then(function (d) {
|
||||
$localForage.getItem('myName').then(function (data) {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$localForage.setItem('myArray', [{
|
||||
$$hashKey: '00A',
|
||||
name: 'Olivier Combe'
|
||||
}]).then(function (d) {
|
||||
|
||||
$localForage.getItem('myArray').then(function (data) {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$localForage.setDriver('localStorageWrapper').then(function () {
|
||||
$localForage.setItem('myArray', [{
|
||||
$$hashKey: '00A',
|
||||
name: 'Olivier Combe'
|
||||
}]).then(function (d) {
|
||||
|
||||
$localForage.getItem('myArray').then(function (data) {
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
var aFileParts = ["<a id=\"a\"><b id=\"b\">hey!<\/b><\/a>"];
|
||||
var oMyBlob = new Blob(aFileParts, {"type": "text\/xml"}); // the blob
|
||||
|
||||
$localForage.setItem('myBlob', oMyBlob).then(function (data) {
|
||||
});
|
||||
|
||||
// $localForage.setItem(['myName', 'myPassion', 'myHobbie'], 'value');
|
||||
|
||||
// $localForage.setItem();
|
||||
|
||||
|
||||
$localForage.iterate(function (value, key) {
|
||||
}).then(function (data) {
|
||||
});
|
||||
|
||||
$localForage.iterate(function (value, key) {
|
||||
if (key == 'myPassion') {
|
||||
return value;
|
||||
}
|
||||
}).then(function (data) {
|
||||
});
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
// Type definitions for angular-localForage 1.2.2
|
||||
// Project: https://github.com/ocombe/angular-localForage
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../localForage/localForage.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module angular.localForage {
|
||||
|
||||
interface LocalForageConfig {
|
||||
driver?:string;
|
||||
name?:string | number;
|
||||
version?:number;
|
||||
storeName?:string;
|
||||
description?:string;
|
||||
}
|
||||
|
||||
interface ILocalForageProvider {
|
||||
config(config:LocalForageConfig):void;
|
||||
setNotify(onItemSet:boolean, onItemRemove:boolean):void;
|
||||
}
|
||||
|
||||
interface ILocalForageService {
|
||||
setDriver(driver:string):angular.IPromise<void>;
|
||||
driver<T>():lf.ILocalForage<T>;
|
||||
|
||||
setItem(key:string, value:any):angular.IPromise<void>;
|
||||
setItem(keys:Array<string>, values:Array<any>):angular.IPromise<void>;
|
||||
|
||||
getItem(key:string):angular.IPromise<any>;
|
||||
getItem(keys:Array<string>):angular.IPromise<Array<any>>;
|
||||
|
||||
removeItem(key:string | Array<string>):angular.IPromise<void>;
|
||||
|
||||
pull(key:string):angular.IPromise<any>;
|
||||
pull(keys:Array<string>):angular.IPromise<Array<any>>;
|
||||
|
||||
clear():angular.IPromise<void>;
|
||||
|
||||
key(n:number):angular.IPromise<string>;
|
||||
|
||||
keys():angular.IPromise<string>;
|
||||
|
||||
length():angular.IPromise<number>;
|
||||
|
||||
iterate<T>(iteratorCallback:(value:string | number, key:string)=>T):angular.IPromise<T>;
|
||||
|
||||
bind($scope:ng.IScope, key:string):void;
|
||||
|
||||
bind($scope:ng.IScope, config:{
|
||||
key:string;
|
||||
defaultValue:any;
|
||||
scopeKey:string;
|
||||
name:string;
|
||||
}):void;
|
||||
|
||||
unbind($scope:ng.IScope, key:string, scopeKey?:string):void;
|
||||
|
||||
createInstance(config:LocalForageConfig):ILocalForageService;
|
||||
instance(name:string):ILocalForageService;
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -102,6 +102,7 @@ declare module angular.material {
|
||||
capsule(capsule: boolean): T;
|
||||
theme(theme: string): T;
|
||||
hideDelay(delay: number): T;
|
||||
position(position: string): T;
|
||||
}
|
||||
|
||||
interface MDSimpleToastPreset extends MDToastPreset<MDSimpleToastPreset> {
|
||||
@@ -149,8 +150,8 @@ declare module angular.material {
|
||||
A400?: string;
|
||||
A700?: string;
|
||||
contrastDefaultColor?: string;
|
||||
contrastDarkColors?: string;
|
||||
contrastStrongLightColors?: string;
|
||||
contrastDarkColors?: string|string[];
|
||||
contrastLightColors?: string|string[];
|
||||
}
|
||||
|
||||
interface MDThemeHues {
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
/// <reference path="angular-meteor.d.ts" />
|
||||
|
||||
interface ITodo {
|
||||
_id?: string;
|
||||
name: string;
|
||||
public?: boolean;
|
||||
sticky?: boolean;
|
||||
}
|
||||
|
||||
interface TodoAngularMeteorObject extends ITodo, angular.meteor.AngularMeteorObject<ITodo> {}
|
||||
|
||||
interface CustomScope extends angular.meteor.IScope {
|
||||
sticky: boolean;
|
||||
|
||||
todos: angular.meteor.AngularMeteorCollection<ITodo>;
|
||||
stickyTodos: angular.meteor.AngularMeteorCollection<ITodo>;
|
||||
notAutoTodos: angular.meteor.AngularMeteorCollection<ITodo>;
|
||||
|
||||
todo: ITodo;
|
||||
todoNotAuto: TodoAngularMeteorObject;
|
||||
todoSubscribed: TodoAngularMeteorObject;
|
||||
|
||||
save: (todo: ITodo) => void;
|
||||
saveAll: () =>void;
|
||||
autoSave: (todo: ITodo) => void;
|
||||
remove: (todoId: string) => void;
|
||||
removeAll: () => void;
|
||||
removeAuto: (todo: ITodo) => void;
|
||||
toSticky: (todo: ITodo) => void;
|
||||
}
|
||||
|
||||
var Todos = new Mongo.Collection<ITodo>('todos');
|
||||
|
||||
var app = angular.module('angularMeteorTestApp');
|
||||
|
||||
app.controller("mainCtrl", ['$scope', '$meteor', ($scope: CustomScope, $meteor: angular.meteor.IMeteorService) => {
|
||||
// Bind all the todos to $scope.todos
|
||||
$scope.todos = $meteor.collection(Todos);
|
||||
|
||||
$scope.sticky = true;
|
||||
// Bind all sticky todos to $scope.stickyTodos
|
||||
// Binds the query to $scope.sticky so that if it changes, Meteor will re-run the query and bind it
|
||||
// to $scope.stickyTodos
|
||||
$scope.stickyTodos = $meteor.collection<ITodo>(function(){
|
||||
return Todos.find({sticky: $scope.getReactively('sticky')});
|
||||
});
|
||||
|
||||
// Bind without auto-save all todos to $scope.notAutoTodos
|
||||
$scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos");
|
||||
|
||||
$scope.todoNotAuto = <TodoAngularMeteorObject>$meteor.object(Todos, 'TodoID', false);
|
||||
$scope.todoSubscribed = <TodoAngularMeteorObject>$meteor.object(Todos, 'TodoID').subscribe('todos');
|
||||
$scope.todo = $scope.todoNotAuto.getRawObject();
|
||||
$scope.todoNotAuto.reset();
|
||||
$scope.todoNotAuto.save($scope.todo).then((data) => { return data == 1; });;
|
||||
|
||||
// todo might be an object like this {text: "Learn Angular", sticky: false}
|
||||
// or an array like this:
|
||||
// [{text: "Learn Angular", sticky: false}, {text: "Hello World", sticky: true}]
|
||||
|
||||
$scope.save = function(todo) {
|
||||
$scope.notAutoTodos.save(todo);
|
||||
};
|
||||
|
||||
$scope.saveAll = function() {
|
||||
$scope.notAutoTodos.save();
|
||||
};
|
||||
|
||||
$scope.autoSave = function(todo) {
|
||||
$scope.todos.push(todo);
|
||||
};
|
||||
|
||||
// todoId might be an string like this "WhrnEez5yBRgo4yEm"
|
||||
// or an array like this ["WhrnEez5yBRgo4yEm","gH6Fa4DXA3XxQjXNS"]
|
||||
$scope.remove = function(todoId) {
|
||||
$scope.notAutoTodos.remove(todoId);
|
||||
};
|
||||
|
||||
$scope.removeAll = function() {
|
||||
$scope.notAutoTodos.remove();
|
||||
};
|
||||
|
||||
$scope.removeAuto = function(todo) {
|
||||
$scope.todos.splice( $scope.todos.indexOf(todo), 1 );
|
||||
}
|
||||
|
||||
$scope.toSticky = function(todo) {
|
||||
if (angular.isArray(todo)){
|
||||
angular.forEach(todo, function(object) {
|
||||
object.sticky = true;
|
||||
});
|
||||
} else {
|
||||
todo.sticky = true;
|
||||
}
|
||||
|
||||
$scope.stickyTodos.save(todo);
|
||||
};
|
||||
|
||||
var todoObject = {name:'first todo'};
|
||||
var todosArray = [{name:'second todo'}, {name:'third todo'}];
|
||||
var todoSecondObject = {name:'forth todo'};
|
||||
|
||||
$scope.todos.save(todoObject); // todos equals [{name:'first todo'}]
|
||||
|
||||
$scope.todos.save(todosArray); // todos equals [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}]
|
||||
|
||||
$scope.todos.push(todoSecondObject); // The scope variable equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}]
|
||||
// but the collection still equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}]
|
||||
|
||||
$scope.todos.save(); // Now the collection also equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}]
|
||||
|
||||
$scope.todos.remove('firstTodoId'); // scope and collection equals to [{name:'second todo'}, {name:'third todo'}, {name:'forth todo'}]
|
||||
|
||||
var todoIdsArray = ['secondTodoId', 'thirdTodoId'];
|
||||
$scope.todos.remove(todoIdsArray); // removes everything matches the array of IDs both in scope and in collection
|
||||
|
||||
$scope.todos.pop(); // removes only in scope
|
||||
|
||||
$scope.todos.remove(); // syncs also in Meteor collection
|
||||
|
||||
// Subscribe ->
|
||||
|
||||
$meteor.subscribe('todos').then((subscriptionHandle) => {
|
||||
// Bind all the todos to $scope.todos
|
||||
$scope.todos = $meteor.collection(Todos);
|
||||
|
||||
console.log($scope.todos + ' is ready');
|
||||
|
||||
// You can use the subscription handle to stop the subscription if you want
|
||||
subscriptionHandle.stop();
|
||||
});
|
||||
|
||||
$scope.subscribe('todos').then((subscriptionHandle) => {
|
||||
// Bind all the todos to $scope.books
|
||||
$scope.todos = $meteor.collection(Todos);
|
||||
|
||||
console.log($scope.todos + ' is ready');
|
||||
|
||||
// No need to stop the subscription, it will automatically close on scope destroy
|
||||
});
|
||||
|
||||
$meteor.call<ITodo>('subscribe', $scope.todo._id, $scope.currentUser._id).then((data) => {
|
||||
// Handle success
|
||||
console.log('success subscribing', data.name);
|
||||
}, (err) => {
|
||||
// Handle error
|
||||
console.log('failed', err);
|
||||
});
|
||||
|
||||
if (!$scope.loggingIn) {
|
||||
$meteor.waitForUser();
|
||||
|
||||
$meteor.requireUser();
|
||||
|
||||
$meteor.requireValidUser(user => {
|
||||
return user.username == 'admin';
|
||||
});
|
||||
|
||||
$meteor.loginWithPassword('user', 'password').then(() => {
|
||||
console.log('Login success');
|
||||
}, err => {
|
||||
console.log('Login error - ', err);
|
||||
});
|
||||
|
||||
$meteor.createUser({
|
||||
username:'moma',
|
||||
email:'example@gmail.com',
|
||||
password: 'Bksd@asdf',
|
||||
profile: {expertize: 'Developer'}
|
||||
}).then(() => {
|
||||
console.log('Login success');
|
||||
}, err => {
|
||||
console.log('Login error - ', err);
|
||||
});
|
||||
|
||||
$meteor.changePassword('old', 'new232f3').then(() => {
|
||||
console.log('Change password success');
|
||||
}, err => {
|
||||
console.log('Error changing password - ', err);
|
||||
});
|
||||
|
||||
$meteor.forgotPassword({email: 'sample@gmail.com'}).then(() => {
|
||||
console.log('Success sending forgot password email');
|
||||
}, err => {
|
||||
console.log('Error sending forgot password email - ', err);
|
||||
});
|
||||
|
||||
$meteor.resetPassword('tokenID', 'new232f3').then(() => {
|
||||
console.log('Reset password success');
|
||||
}, err => {
|
||||
console.log('Error resetting password - ', err);
|
||||
});
|
||||
|
||||
$meteor.verifyEmail('tokenID').then(() => {
|
||||
console.log('Success verifying password ');
|
||||
}, err => {
|
||||
console.log('Error verifying password - ', err);
|
||||
});
|
||||
|
||||
$meteor.logout().then(() => {
|
||||
console.log('Logout success');
|
||||
}, err => {
|
||||
console.log('logout error - ', err);
|
||||
});
|
||||
|
||||
$meteor.logoutOtherClients().then(() => {
|
||||
console.log('Logout success');
|
||||
}, err => {
|
||||
console.log('logout error - ', err);
|
||||
});
|
||||
|
||||
var loginWithOptions = {requestPermissions: ['email']};
|
||||
|
||||
$meteor.loginWithFacebook({requestPermissions: ['email']}).then(() => {
|
||||
console.log('Login success');
|
||||
}, err => {
|
||||
console.log('Login error - ', err);
|
||||
});
|
||||
$meteor.loginWithGithub({requestPermissions: ['email']}).then(() => {
|
||||
console.log('Login success');
|
||||
}, err => {
|
||||
console.log('Login error - ', err);
|
||||
});
|
||||
$meteor.loginWithGoogle({requestPermissions: ['email']}).then(() => {
|
||||
console.log('Login success');
|
||||
}, err => {
|
||||
console.log('Login error - ', err);
|
||||
});
|
||||
$meteor.loginWithMeetup({requestPermissions: ['email']}).then(() => {
|
||||
console.log('Login success');
|
||||
}, err => {
|
||||
console.log('Login error - ', err);
|
||||
});
|
||||
$meteor.loginWithTwitter({requestPermissions: ['email']}).then(() => {
|
||||
console.log('Login success');
|
||||
}, err => {
|
||||
console.log('Login error - ', err);
|
||||
});
|
||||
$meteor.loginWithWeibo({requestPermissions: ['email']}).then(() => {
|
||||
console.log('Login success');
|
||||
}, err => {
|
||||
console.log('Login error - ', err);
|
||||
});
|
||||
}
|
||||
|
||||
$meteor.autorun($scope, () => { console.log("Aurorun triggered."); });
|
||||
$meteor.getCollectionByName('collectionName');
|
||||
|
||||
// requires meteor add mdg:camera
|
||||
$meteor.getPicture().then(function(data){
|
||||
$scope['picture'] = data;
|
||||
});
|
||||
|
||||
$meteor.session('counter').bind($scope, 'counter');
|
||||
}]);
|
||||
Vendored
+330
@@ -0,0 +1,330 @@
|
||||
// Type definitions for Angular JS Meteor v0.8.8 (angular.meteor module)
|
||||
// Project: https://github.com/Urigo/angular-meteor
|
||||
// Definitions by: Peter Grman <https://github.com/pgrm>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../meteor/meteor.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module angular.meteor {
|
||||
interface IRootScopeService extends angular.IRootScopeService {
|
||||
/**
|
||||
* The current logged in user and it's data. it is null if the user is not logged in. A reactive data source.
|
||||
*/
|
||||
currentUser: Meteor.User;
|
||||
|
||||
/**
|
||||
* True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress.
|
||||
* A reactive data source. Can be use to display animation while user is logging in.
|
||||
*/
|
||||
loggingIn: boolean;
|
||||
}
|
||||
|
||||
interface IScope extends angular.IScope, IRootScopeService {
|
||||
/**
|
||||
* A method to get a $scope variable and watch it reactivly
|
||||
*
|
||||
* @param scopeVariableName - The name of the scope's variable to bind to
|
||||
* @param [objectEquality=false] - Watch the object equality using angular.equals instead of comparing for reference equality, deeper watch but also slower
|
||||
*/
|
||||
getReactively(scopeVariableName: string, objectEquality?: boolean): ReactiveResult;
|
||||
|
||||
/**
|
||||
* A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready.
|
||||
* Calling $scope.subscribe will automatically stop the subscription when the scope is destroyed.
|
||||
*
|
||||
* @param name - Name of the subscription. Matches the name of the server's publish() call.
|
||||
* @param publisherArguments - Optional arguments passed to publisher function on server.
|
||||
*
|
||||
* @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle.
|
||||
*/
|
||||
subscribe(name: string, ...publisherArguments: any[]): angular.IPromise<Meteor.SubscriptionHandle>;
|
||||
}
|
||||
|
||||
/**
|
||||
* $meteor in angularjs
|
||||
*/
|
||||
interface IMeteorService {
|
||||
/**
|
||||
* A service that wraps the Meteor collections to enable reactivity within AngularJS.
|
||||
*
|
||||
* @param collection - A Meteor Collection or a reactive function to bind to.
|
||||
* - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor.
|
||||
* @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection.
|
||||
* - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection.
|
||||
*/
|
||||
collection<T>(collection: Mongo.Collection<T>|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection<T>;
|
||||
|
||||
/**
|
||||
* A service that wraps the Meteor collections to enable reactivity within AngularJS.
|
||||
*
|
||||
* @param collection - A Meteor Collection or a reactive function to bind to.
|
||||
* - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor.
|
||||
* @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection.
|
||||
* - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection.
|
||||
* @param [updateCollection] - A collection object which will be used for updates (insert, update, delete).
|
||||
*/
|
||||
collection<T, U>(collection: Mongo.Collection<T>|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection<U>): AngularMeteorCollection2<T, U>;
|
||||
|
||||
/**
|
||||
* A service that wraps a Meteor object to enable reactivity within AngularJS.
|
||||
* Finds the first document that matches the selector, as ordered by sort and skip options. Wraps collection.findOne
|
||||
*
|
||||
* @param collection - A Meteor Collection to bind to.
|
||||
* @param selector - A query describing the documents to find or just the ID of the document.
|
||||
* - $meteor.object will find the first document that matches the selector,
|
||||
* - as ordered by sort and skip options, exactly like Meteor's collection.findOne
|
||||
* @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object.
|
||||
* - However if set to false, changes in the client won't be automatically propagated back to the Meteor object.
|
||||
*/
|
||||
object<T>(collection: Mongo.Collection<T>, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject<T>;
|
||||
|
||||
/**
|
||||
* A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready.
|
||||
*
|
||||
* @param name - Name of the subscription. Matches the name of the server's publish() call.
|
||||
* @param publisherArguments - Optional arguments passed to publisher function on server.
|
||||
*
|
||||
* @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle.
|
||||
*/
|
||||
subscribe(name: string, ...publisherArguments: any[]): angular.IPromise<Meteor.SubscriptionHandle>;
|
||||
|
||||
/**
|
||||
* A service service which wraps up Meteor.methods with AngularJS promises.
|
||||
*
|
||||
* @param name - Name of method to invoke
|
||||
* @param methodArguments - Optional method arguments
|
||||
*
|
||||
* @return The promise solves successfully with the return value of the method or return reject with the error from the method.
|
||||
*/
|
||||
call<T>(name: string, ...methodArguments: any[]): angular.IPromise<T>;
|
||||
|
||||
// User Authentication BEGIN ->
|
||||
|
||||
/**
|
||||
* Returns a promise fulfilled with the currentUser when the user subscription is ready.
|
||||
* This is useful when you want to grab the current user before the route is rendered.
|
||||
* If there is no logged in user, it will return null.
|
||||
* See the “Authentication with Routers” section of our tutorial for more information and a full example.
|
||||
*/
|
||||
waitForUser(): angular.IPromise<Meteor.User>;
|
||||
|
||||
/**
|
||||
* Resolves the promise successfully if a user is authenticated and rejects otherwise.
|
||||
* This is useful in cases where you want to require a route to have an authenticated user.
|
||||
* You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page.
|
||||
* See the “Authentication with Routers” section of our tutorial for more information and a full example.
|
||||
*/
|
||||
requireUser(): angular.IPromise<Meteor.User>;
|
||||
|
||||
/**
|
||||
* Resolves the promise successfully if a user is authenticated and the validatorFn returns true; rejects otherwise.
|
||||
* This is useful in cases where you want to require a route to have an authenticated user and do extra validation like the user's role or group.
|
||||
* You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page.
|
||||
* See the “Authentication with Routers” section of our tutorial for more information and a full example.
|
||||
*
|
||||
* The mandatory validator function will be called with the authenticated user as the single param and it's expected to return true in order to resolve.
|
||||
* If it returns a string, the promise will be rejected using said string as the reason.
|
||||
* Any other return (false, null, undefined) will be rejected with the default "FORBIDDEN" reason.
|
||||
*/
|
||||
requireValidUser(validatorFn: (user: Meteor.User) => boolean|string): angular.IPromise<Meteor.User>;
|
||||
|
||||
/**
|
||||
* Log the user in with a password.
|
||||
*
|
||||
* @param user - Either a string interpreted as a username or an email; or an object with a single key: email, username or id.
|
||||
* @param password - The user's password.
|
||||
*/
|
||||
loginWithPassword(user: string|{email: string}|{username: string}|{id: string}, password: string): angular.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Create a new user. More information: http://docs.meteor.com/#/full/accounts_createuser
|
||||
*
|
||||
* @param options.username - A unique name for this user. Either this, or email is required.
|
||||
* @param options.email - The user's email address. Either this, or username is required.
|
||||
* @param options.password - The user's password. This is not sent in plain text over the wire.
|
||||
* @param options.profile - The user's profile, typically including the name field.
|
||||
*/
|
||||
createUser(options: {username?: string; email?: string; password: string; profile?: Object}): angular.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Change the current user's password. Must be logged in.
|
||||
*
|
||||
* @param oldPassword - The user's current password. This is not sent in plain text over the wire.
|
||||
* @param newPassword - A new password for the user. This is not sent in plain text over the wire.
|
||||
*/
|
||||
changePassword(oldPassword: string, newPassword: string): angular.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Request a forgot password email.
|
||||
*
|
||||
* @param options.email - The email address to send a password reset link.
|
||||
*/
|
||||
forgotPassword(options: {email: string}): angular.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Reset the password for a user using a token received in email. Logs the user in afterwards.
|
||||
*
|
||||
* @param token - The token retrieved from the reset password URL.
|
||||
* @param newPassword - A new password for the user. This is not sent in plain text over the wire.
|
||||
*/
|
||||
resetPassword(token: string, newPassword: string): angular.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Marks the user's email address as verified. Logs the user in afterwards.
|
||||
*
|
||||
* @param token - The token retrieved from the reset password URL.
|
||||
*/
|
||||
verifyEmail(token: string): angular.IPromise<void>;
|
||||
|
||||
loginWithFacebook: ILoginWithExternalService;
|
||||
loginWithTwitter: ILoginWithExternalService;
|
||||
loginWithGoogle: ILoginWithExternalService;
|
||||
loginWithGithub: ILoginWithExternalService;
|
||||
loginWithMeetup: ILoginWithExternalService;
|
||||
loginWithWeibo: ILoginWithExternalService;
|
||||
|
||||
/**
|
||||
* Log the user out.
|
||||
*
|
||||
* @return Resolves with no arguments on success, or reject with a Error argument on failure.
|
||||
*/
|
||||
logout(): angular.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Log out other clients logged in as the current user, but does not log out the client that calls this function.
|
||||
* For example, when called in a user's browser, connections in that browser remain logged in,
|
||||
* but any other browsers or DDP clients logged in as that user will be logged out.
|
||||
*
|
||||
* @return Resolves with no arguments on success, or reject with a Error argument on failure.
|
||||
*/
|
||||
logoutOtherClients(): angular.IPromise<void>;
|
||||
|
||||
// <- User Authentication END
|
||||
// $meteorUtils BEGIN ->
|
||||
|
||||
/**
|
||||
* @param scope - The AngularJS scope you use the autorun on.
|
||||
* @param fn - The function that will re-run every time a reactive variable changes inside it.
|
||||
*/
|
||||
autorun(scope: angular.IScope, fn: Function): void;
|
||||
|
||||
/**
|
||||
* @param collectionName - The name of the collection you want to get back
|
||||
*/
|
||||
getCollectionByName<T>(collectionName: string): Mongo.Collection<T>;
|
||||
|
||||
// <- $meteorUtils END
|
||||
// $meteorCamera BEGIN ->
|
||||
|
||||
/**
|
||||
* A helper service for taking pictures across platforms.
|
||||
* Must add mdg:camera package to use! (meteor add mdg:camera)
|
||||
*
|
||||
* @param [options] - options is an optional argument that is an Object with the following possible keys:
|
||||
* @param options.width - An integer that specifies the minimum width of the returned photo.
|
||||
* @param options.height - An integer that specifies the minimum height of the returned photo.
|
||||
* @param options.quality - A number from 0 to 100 specifying the desired quality of JPEG encoding.
|
||||
*
|
||||
* @return The promise solved successfully when the picture is taken with the data as a parameter or rejected with an error as a parameter in case of error.
|
||||
*/
|
||||
getPicture(options?: {width?: number; height?: number; quality?: number}): angular.IPromise<any>;
|
||||
|
||||
// <- $meteorCamera END
|
||||
|
||||
/**
|
||||
* A service that binds a scope variable to a Meteor Session variable.
|
||||
*
|
||||
* @param sessionKey - The name of the session variable
|
||||
* @return An object with a single function bind - to bind to that variable.
|
||||
*/
|
||||
session(sessionKey: string): {
|
||||
/**
|
||||
* @param scope - The scope the document will be bound to.
|
||||
* @param model - The name of the scope's model variable that the document will be bound to.
|
||||
*/
|
||||
bind: (scope: IScope, model: string) => void;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* An object that connects a Meteor Object to an AngularJS scope variable.
|
||||
*
|
||||
* The object contains also all the properties from the generic type T,
|
||||
* unfortunately TypeScript doesn't at the moment allow to extend a generic type (see https://github.com/Microsoft/TypeScript/issues/2225 for details and updates).
|
||||
* For a workaround, you'll need to implement an interface which will merge AngularMeteorObject<T> together with T and cast it, like this:
|
||||
*
|
||||
* interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject<ITodo> { }
|
||||
* var todo = <TodoAngularMeteorObject>$meteor.object(TodoCollection, 'TodoID');
|
||||
*/
|
||||
interface AngularMeteorObject<T> {
|
||||
/**
|
||||
* @param [doc] - The doc to save to the Meteor Object. If nothing is passed, the method saves everything in the AngularMeteorObject as is.
|
||||
* - Unchanged properties will be overridden with their existing values, which may trigger hooks.
|
||||
* - If doc is passed, the method only updates the Meteor Object with the properties passed, and no other changes will be saved.
|
||||
*
|
||||
* @return Returns a promise with an error in case for an error or a number of successful docs changed in case of success.
|
||||
*/
|
||||
save(doc?: T): angular.IPromise<number>;
|
||||
|
||||
/**
|
||||
* Reset the current value of the object to the one in the server.
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
* Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific internal properties removed.
|
||||
* The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON.
|
||||
*/
|
||||
getRawObject(): T;
|
||||
|
||||
/**
|
||||
* A shorten (Syntactic sugar) function for the $meteor.subscribe function.
|
||||
* Takes only one parameter and not returns a promise like $meteor.subscribe does.
|
||||
*
|
||||
* @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service.
|
||||
*/
|
||||
subscribe(subscriptionName:string): AngularMeteorObject<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object that connects a Meteor Collection to an AngularJS scope variable
|
||||
*/
|
||||
interface AngularMeteorCollection<T> extends AngularMeteorCollection2<T, T> { }
|
||||
|
||||
/**
|
||||
* An object that connects a Meteor Collection to an AngularJS scope variable,
|
||||
* but can use a differen type for updates.
|
||||
*/
|
||||
interface AngularMeteorCollection2<T, U> extends Array<T> {
|
||||
/**
|
||||
* @param [docs] - The docs to save to the Meteor Collection.
|
||||
* - If the docs parameter is empty, the method saves everything in the AngularMeteorCollection as is.
|
||||
* - If an object is passed, the method pushes that object into the AngularMeteorCollection.
|
||||
* - If an array is passed, the method pushes all objects in the array into the AngularMeteorCollection.
|
||||
*/
|
||||
save(docs?: U|U[]): void;
|
||||
|
||||
/**
|
||||
* @param [keys] - The keys of the object to remove from the Meteor Collection.
|
||||
* - If nothing is passed, the method removes all the documents from the AngularMeteorCollection.
|
||||
* - If an object is passed, the method removes the object with that key from the AngularMeteorCollection.
|
||||
* - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection.
|
||||
*/
|
||||
remove(keys?: U|string|number|string[]|number[]): void;
|
||||
|
||||
/**
|
||||
* A shorten (Syntactic sugar) function for the $meteor.subscribe function.
|
||||
* Takes only one parameter and not returns a promise like $meteor.subscribe does.
|
||||
*
|
||||
* @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service.
|
||||
*/
|
||||
subscribe(subscriptionName:string): AngularMeteorCollection2<T, U>;
|
||||
}
|
||||
|
||||
interface ILoginWithExternalService {
|
||||
(options: Meteor.LoginWithExternalServiceOptions): angular.IPromise<void>;
|
||||
}
|
||||
|
||||
interface ReactiveResult { }
|
||||
}
|
||||
+13
-12
@@ -564,7 +564,7 @@ declare module protractor {
|
||||
*/
|
||||
element(subLocator: webdriver.Locator): ElementFinder;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Calls to element may be chained to find an array of elements within a parent.
|
||||
*
|
||||
* @alias element(locator).all(locator)
|
||||
@@ -652,7 +652,7 @@ declare module protractor {
|
||||
/**
|
||||
* Override for WebElement.prototype.isElementPresent so that protractor waits
|
||||
* for Angular to settle before making the check.
|
||||
*
|
||||
*
|
||||
* @see ElementFinder.isPresent
|
||||
*
|
||||
* @param {webdriver.Locator} subLocator Locator for element to look for.
|
||||
@@ -879,7 +879,7 @@ declare module protractor {
|
||||
* filteredElements[0].click();
|
||||
* });
|
||||
*
|
||||
* @param {function(ElementFinder, number): webdriver.WebElement.Promise} filterFn
|
||||
* @param {function(ElementFinder, number): webdriver.WebElement.Promise} filterFn
|
||||
* Filter function that will test if an element should be returned.
|
||||
* filterFn can either return a boolean or a promise that resolves to a boolean.
|
||||
* @return {!ElementArrayFinder} A ElementArrayFinder that represents an array
|
||||
@@ -888,11 +888,11 @@ declare module protractor {
|
||||
filter(filterFn: (element: ElementFinder, index: number) => any): ElementArrayFinder;
|
||||
|
||||
/**
|
||||
* Apply a reduce function against an accumulator and every element found
|
||||
* Apply a reduce function against an accumulator and every element found
|
||||
* using the locator (from left-to-right). The reduce function has to reduce
|
||||
* every element into a single value (the accumulator). Returns promise of
|
||||
* the accumulator. The reduce function receives the accumulator, current
|
||||
* ElementFinder, the index, and the entire array of ElementFinders,
|
||||
* every element into a single value (the accumulator). Returns promise of
|
||||
* the accumulator. The reduce function receives the accumulator, current
|
||||
* ElementFinder, the index, and the entire array of ElementFinders,
|
||||
* respectively.
|
||||
*
|
||||
* @alias element.all(locator).reduce(reduceFn)
|
||||
@@ -912,11 +912,11 @@ declare module protractor {
|
||||
*
|
||||
* expect(value).toEqual('First Second Third ');
|
||||
*
|
||||
* @param {function(number, ElementFinder, number, Array.<ElementFinder>)}
|
||||
* @param {function(number, ElementFinder, number, Array.<ElementFinder>)}
|
||||
* reduceFn Reduce function that reduces every element into a single value.
|
||||
* @param {*} initialValue Initial value of the accumulator.
|
||||
* @param {*} initialValue Initial value of the accumulator.
|
||||
* @return {!webdriver.promise.Promise} A promise that resolves to the final
|
||||
* value of the accumulator.
|
||||
* value of the accumulator.
|
||||
*/
|
||||
reduce<T>(reduceFn: (acc: T, element: ElementFinder, index: number, arr: ElementFinder[]) => webdriver.promise.Promise<T>, initialValue: T): webdriver.promise.Promise<T>;
|
||||
reduce<T>(reduceFn: (acc: T, element: ElementFinder, index: number, arr: ElementFinder[]) => T, initialValue: T): webdriver.promise.Promise<T>;
|
||||
@@ -924,7 +924,7 @@ declare module protractor {
|
||||
/**
|
||||
* Represents the ElementArrayFinder as an array of ElementFinders.
|
||||
*
|
||||
* @return {Array.<ElementFinder>} Return a promise, which resolves to a list
|
||||
* @return {Array.<ElementFinder>} Return a promise, which resolves to a list
|
||||
* of ElementFinders specified by the locator.
|
||||
*/
|
||||
asElementFinders_(): ElementFinder[];
|
||||
@@ -1221,6 +1221,7 @@ declare module protractor {
|
||||
|
||||
interface LocatorWithColumn extends webdriver.Locator {
|
||||
column(index: number): webdriver.Locator;
|
||||
column(name: string): webdriver.Locator;
|
||||
}
|
||||
|
||||
interface RepeaterLocator extends LocatorWithColumn {
|
||||
@@ -1299,7 +1300,7 @@ declare module protractor {
|
||||
* expect(element(by.exactBinding('person_phone')).isPresent()).toBe(true);
|
||||
* expect(element(by.exactBinding('person_phone|uppercase')).isPresent()).toBe(true);
|
||||
* expect(element(by.exactBinding('phone')).isPresent()).toBe(false);
|
||||
*
|
||||
*
|
||||
* @param {string} bindingDescriptor
|
||||
* @return {{findElementsOverride: findElementsOverride, toString: Function|string}}
|
||||
*/
|
||||
|
||||
+18
-9
@@ -6,13 +6,7 @@
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module angular.translate {
|
||||
|
||||
interface ITranslatePartialLoaderService {
|
||||
addPart(name: string): ITranslatePartialLoaderService;
|
||||
deletePart(name: string, removeData?: boolean): ITranslatePartialLoaderService;
|
||||
isPartAvailable(name: string): boolean;
|
||||
}
|
||||
|
||||
|
||||
interface ITranslationTable {
|
||||
[key: string]: string;
|
||||
}
|
||||
@@ -26,12 +20,27 @@ declare module angular.translate {
|
||||
set(name: string, value: string): void;
|
||||
}
|
||||
|
||||
interface ISTaticFilesLoaderOptions {
|
||||
interface IStaticFilesLoaderOptions {
|
||||
prefix: string;
|
||||
suffix: string;
|
||||
key?: string;
|
||||
}
|
||||
|
||||
interface IPartialLoader<T> {
|
||||
addPart(name : string, priority? : number) : T;
|
||||
deletePart(name : string) : T;
|
||||
isPartAvailable(name : string) : boolean;
|
||||
}
|
||||
|
||||
interface ITranslatePartialLoaderService extends IPartialLoader<ITranslatePartialLoaderService> {
|
||||
getRegisteredParts() : Array<string>;
|
||||
isPartLoaded(name : string, lang : string) : boolean;
|
||||
}
|
||||
|
||||
interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader<ITranslatePartialLoaderProvider> {
|
||||
setPart(lang : string, part : string, table : ITranslationTable) : ITranslatePartialLoaderProvider;
|
||||
}
|
||||
|
||||
interface ITranslateService {
|
||||
(translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise<string>;
|
||||
(translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>;
|
||||
@@ -78,7 +87,7 @@ declare module angular.translate {
|
||||
storageKey(): string;
|
||||
storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here
|
||||
useUrlLoader(url: string): ITranslateProvider;
|
||||
useStaticFilesLoader(options: ISTaticFilesLoaderOptions): ITranslateProvider;
|
||||
useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider;
|
||||
useLoader(loaderFactory: string, options: any): ITranslateProvider;
|
||||
useLocalStorage(): ITranslateProvider;
|
||||
useCookieStorage(): ITranslateProvider;
|
||||
|
||||
@@ -141,6 +141,7 @@ testApp.controller('TestCtrl', (
|
||||
scope: $scope,
|
||||
template: "<div>i'm a template!</div>",
|
||||
templateUrl: '/templates/modal.html',
|
||||
backdropClass: 'modal-backdrop-test',
|
||||
windowClass: 'modal-test'
|
||||
});
|
||||
|
||||
@@ -227,4 +228,4 @@ interface IModalTestCtrlScope {
|
||||
|
||||
close(): void;
|
||||
dismiss(): void;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-1
@@ -264,6 +264,11 @@ declare module angular.ui.bootstrap {
|
||||
*/
|
||||
keyboard?: boolean;
|
||||
|
||||
/**
|
||||
* additional CSS class(es) to be added to a modal backdrop template
|
||||
*/
|
||||
backdropClass?: string;
|
||||
|
||||
/**
|
||||
* additional CSS class(es) to be added to a modal window template
|
||||
*/
|
||||
@@ -590,7 +595,14 @@ declare module angular.ui.bootstrap {
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
appendtoBody?: boolean;
|
||||
appendToBody?: boolean;
|
||||
|
||||
/**
|
||||
* Determines the default open triggers for tooltips and popovers
|
||||
*
|
||||
* @default 'mouseenter' for tooltip, 'click' for popover
|
||||
*/
|
||||
trigger?: string;
|
||||
}
|
||||
|
||||
interface ITooltipProvider {
|
||||
|
||||
@@ -64,7 +64,16 @@ myApp.config((
|
||||
controller: function ($scope: MyAppScope) {
|
||||
$scope.things = ["A", "Set", "Of", "Things"];
|
||||
}
|
||||
}).state('index', {
|
||||
})
|
||||
.state('list', {
|
||||
parent: 'state3',
|
||||
url: "/list",
|
||||
templateUrl: "partials/state3.list.html",
|
||||
controller: function ($scope: MyAppScope) {
|
||||
$scope.things = ["A", "Set", "Of", "Things"];
|
||||
}
|
||||
})
|
||||
.state('index', {
|
||||
url: "",
|
||||
views: {
|
||||
"viewA": { template: "index.viewA" },
|
||||
|
||||
+10
-3
@@ -30,6 +30,13 @@ declare module angular.ui {
|
||||
* Function (injectable), returns the actual controller function or string.
|
||||
*/
|
||||
controllerProvider?: Function;
|
||||
|
||||
/**
|
||||
* Specifies the parent state of this state
|
||||
*/
|
||||
parent?: string | IState
|
||||
|
||||
|
||||
resolve?: {};
|
||||
/**
|
||||
* A url with optional parameters. When a state is navigated or transitioned to, the $stateParams service will be populated with any parameters that were passed.
|
||||
@@ -64,7 +71,7 @@ declare module angular.ui {
|
||||
reloadOnSearch?: boolean;
|
||||
}
|
||||
|
||||
interface IStateProvider extends ng.IServiceProvider {
|
||||
interface IStateProvider extends angular.IServiceProvider {
|
||||
state(name:string, config:IState): IStateProvider;
|
||||
state(config:IState): IStateProvider;
|
||||
decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
|
||||
@@ -83,7 +90,7 @@ declare module angular.ui {
|
||||
type(name: string, definition: any, definitionFn?: any): any;
|
||||
}
|
||||
|
||||
interface IUrlRouterProvider extends ng.IServiceProvider {
|
||||
interface IUrlRouterProvider extends angular.IServiceProvider {
|
||||
when(whenPath: RegExp, handler: Function): IUrlRouterProvider;
|
||||
when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;
|
||||
when(whenPath: RegExp, toPath: string): IUrlRouterProvider;
|
||||
@@ -145,7 +152,7 @@ declare module angular.ui {
|
||||
*
|
||||
* @param options Options object.
|
||||
*/
|
||||
go(to: string, params?: {}, options?: IStateOptions): ng.IPromise<any>;
|
||||
go(to: string, params?: {}, options?: IStateOptions): angular.IPromise<any>;
|
||||
transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
|
||||
transitionTo(state: string, params?: {}, options?: IStateOptions): void;
|
||||
includes(state: string, params?: {}): boolean;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/// <reference path="angular2.d.ts"/>
|
||||
|
||||
// Use Typescript 1.4 style imports
|
||||
import ng = require("angular2/angular2");
|
||||
|
||||
class Service {
|
||||
|
||||
}
|
||||
class Service2 {
|
||||
|
||||
}
|
||||
|
||||
class Cmp {
|
||||
static annotations: any[];
|
||||
}
|
||||
Cmp.annotations = [
|
||||
ng.Component({
|
||||
selector: 'cmp',
|
||||
injectables: [Service, ng.bind(Service2).toValue(null)]
|
||||
}),
|
||||
ng.View({
|
||||
template: '{{greeting}} world!',
|
||||
directives: [ng.NgFor, ng.NgIf]
|
||||
}),
|
||||
ng.Directive({
|
||||
selector: '[tooltip]',
|
||||
properties: [
|
||||
'text: tooltip'
|
||||
],
|
||||
hostListeners: {
|
||||
'onmouseenter': 'onMouseEnter()',
|
||||
'onmouseleave': 'onMouseLeave()'
|
||||
}
|
||||
})
|
||||
];
|
||||
|
||||
ng.bootstrap(Cmp);
|
||||
Vendored
+4625
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
|
||||
// AngularFireObject
|
||||
{
|
||||
var obj = sync.$asObject();
|
||||
var obj = $FirebaseObject(ref);
|
||||
|
||||
// $id
|
||||
if (obj.$id !== ref.name()) throw "error";
|
||||
@@ -62,8 +62,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
obj.$save();
|
||||
});
|
||||
|
||||
// $inst()
|
||||
if (obj.$inst() !== sync) throw "error";
|
||||
// $ref()
|
||||
if (obj.$ref() !== ref) throw "error";
|
||||
|
||||
// $bindTo()
|
||||
obj.$bindTo($scope, "data").then(function () {
|
||||
@@ -81,8 +81,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
// $destroy()
|
||||
obj.$destroy();
|
||||
|
||||
// $extendFactory()
|
||||
var NewFactory = $FirebaseObject.$extendFactory({
|
||||
// $extend()
|
||||
var NewFactory = $FirebaseObject.$extend({
|
||||
getMyFavoriteColor: function () {
|
||||
return this.favoriteColor + ", no green!"; // obscure Monty Python reference
|
||||
}
|
||||
@@ -92,10 +92,10 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
|
||||
// AngularFireArray
|
||||
{
|
||||
var list = sync.$asArray();
|
||||
var list = $FirebaseArray(ref);
|
||||
|
||||
// $inst()
|
||||
if (list.$inst() !== sync) throw "error";
|
||||
// $ref()
|
||||
if (list.$ref() !== ref) throw "error";
|
||||
|
||||
// $add()
|
||||
list.$add({ foo: "foo value" });
|
||||
@@ -145,8 +145,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
// $destroy()
|
||||
list.$destroy();
|
||||
|
||||
// $extendFactory()
|
||||
var ArrayWithSum = $FirebaseArray.$extendFactory({
|
||||
// $extend()
|
||||
var ArrayWithSum = $FirebaseArray.$extend({
|
||||
sum: function () {
|
||||
var total = 0;
|
||||
angular.forEach(this.$list, function (rec) {
|
||||
@@ -167,30 +167,43 @@ interface AngularFireAuthScope extends ng.IScope {
|
||||
loginObj: AngularFireAuth;
|
||||
}
|
||||
|
||||
myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin",
|
||||
function($scope: AngularFireAuthScope, $firebaseSimpleLogin: AngularFireAuthService) {
|
||||
myapp.controller("MyAuthController", ["$scope", "$firebaseAuth",
|
||||
function($scope: AngularFireAuthScope, $firebaseAuth: AngularFireAuthService) {
|
||||
var dataRef = new Firebase(url);
|
||||
$scope.loginObj = $firebaseSimpleLogin(dataRef);
|
||||
$scope.loginObj.$getCurrentUser().then(_ => {
|
||||
});
|
||||
var email = 'my@email.com';
|
||||
var password = 'mypassword';
|
||||
$scope.loginObj.$login('password', {
|
||||
email: email,
|
||||
password: password
|
||||
}).then(function(user) {
|
||||
console.log('Logged in as: ', user.uid);
|
||||
}, function(error) {
|
||||
console.error('Login failed: ', error);
|
||||
});
|
||||
$scope.loginObj.$logout();
|
||||
$scope.loginObj.$createUser(email, password).then(_ => {
|
||||
});
|
||||
$scope.loginObj.$changePassword(email, password, password).then(_ => {
|
||||
});
|
||||
$scope.loginObj.$removeUser(email, password).then(_ => {
|
||||
});
|
||||
$scope.loginObj.$sendPasswordResetEmail(email).then(_ => {
|
||||
});
|
||||
$scope.loginObj = $firebaseAuth(dataRef);
|
||||
$scope.loginObj.$getAuth();
|
||||
var credentials = {
|
||||
email: 'my@email.com',
|
||||
password: 'mypassword'
|
||||
};
|
||||
var resetPasswordCredentials = {
|
||||
email: 'my@email.com'
|
||||
};
|
||||
var changePasswordCredentials = {
|
||||
email: 'my@email.com',
|
||||
oldPassword: 'mypassword',
|
||||
newPassword: 'mypassword'
|
||||
};
|
||||
var changeUserCredentials = {
|
||||
oldEmail: 'my@email.com',
|
||||
newEmail: 'my@email.com',
|
||||
password: 'mypassword'
|
||||
};
|
||||
$scope.loginObj.$authWithCustomToken("token").then(_ => {});
|
||||
$scope.loginObj.$authAnonymously().then(_ => {});
|
||||
$scope.loginObj.$authWithPassword(credentials).then(_ => {});
|
||||
$scope.loginObj.$authWithOAuthPopup("github").then(_ => {});
|
||||
$scope.loginObj.$authWithOAuthRedirect("google").then(_ => {});
|
||||
$scope.loginObj.$authWithOAuthToken("twitter", "token").then(_ => {});
|
||||
$scope.loginObj.$getAuth();
|
||||
$scope.loginObj.$onAuth(() => {});
|
||||
$scope.loginObj.$unauth();
|
||||
$scope.loginObj.$waitForAuth();
|
||||
$scope.loginObj.$requireAuth();
|
||||
$scope.loginObj.$createUser(credentials).then(_ => {});
|
||||
$scope.loginObj.$removeUser(credentials).then(_ => {});
|
||||
$scope.loginObj.$changeEmail(changeUserCredentials).then(_ => {});
|
||||
$scope.loginObj.$changePassword(changePasswordCredentials).then(_ => {});
|
||||
$scope.loginObj.$resetPassword(resetPasswordCredentials).then(_ => {});
|
||||
}
|
||||
]);
|
||||
]);
|
||||
|
||||
Vendored
+408
-11
@@ -10,6 +10,9 @@ interface AngularFireService {
|
||||
(firebase: Firebase, config?: any): AngularFire;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated. Not possible with AngularFire 1.0+
|
||||
*/
|
||||
interface AngularFire {
|
||||
$asArray(): AngularFireArray;
|
||||
$asObject(): AngularFireObject;
|
||||
@@ -24,39 +27,284 @@ interface AngularFire {
|
||||
$transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<FirebaseDataSnapshot>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and maintains a synchronized object, with 2-way bindings between Angular and Firebase.
|
||||
*/
|
||||
interface AngularFireObject extends AngularFireSimpleObject {
|
||||
$id: string;
|
||||
$priority: number;
|
||||
$value: any;
|
||||
|
||||
/**
|
||||
* Removes all keys from the FirebaseObject and also removes
|
||||
* the remote data from the server.
|
||||
*
|
||||
* @returns a promise which will resolve after the op completes
|
||||
*/
|
||||
|
||||
$remove(): ng.IPromise<Firebase>;
|
||||
/**
|
||||
* Saves all data on the FirebaseObject back to Firebase.
|
||||
* @returns a promise which will resolve after the save is completed.
|
||||
*/
|
||||
$save(): ng.IPromise<Firebase>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asObject() is now cached
|
||||
* locally in the object.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} resolve
|
||||
* @param {Function} reject
|
||||
* @returns a promise which resolves after initial data is downloaded from Firebase
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asObject() is now cached
|
||||
* locally in the object.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} resolve
|
||||
* @param {Function} reject
|
||||
* @returns a promise which resolves after initial data is downloaded from Firebase
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asObject() is now cached
|
||||
* locally in the object.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} resolve
|
||||
* @param {Function} reject
|
||||
* @returns a promise which resolves after initial data is downloaded from Firebase
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
$inst(): AngularFire;
|
||||
|
||||
/**
|
||||
* @returns {Firebase} the original Firebase instance used to create this object.
|
||||
*/
|
||||
$ref(): Firebase;
|
||||
|
||||
/**
|
||||
* Creates a 3-way data sync between this object, the Firebase server, and a
|
||||
* scope variable. This means that any changes made to the scope variable are
|
||||
* pushed to Firebase, and vice versa.
|
||||
*
|
||||
* If scope emits a $destroy event, the binding is automatically severed. Otherwise,
|
||||
* it is possible to unbind the scope variable by using the `unbind` function
|
||||
* passed into the resolve method.
|
||||
*
|
||||
* Can only be bound to one scope variable at a time. If a second is attempted,
|
||||
* the promise will be rejected with an error.
|
||||
*
|
||||
* @param {object} scope
|
||||
* @param {string} varName
|
||||
* @returns a promise which resolves to an unbind method after data is set in scope
|
||||
*/
|
||||
$bindTo(scope: ng.IScope, varName: string): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Listeners passed into this method are notified whenever a new change is received
|
||||
* from the server. Each invocation is sent an object containing
|
||||
* <code>{ type: 'value', key: 'my_firebase_id' }</code>
|
||||
*
|
||||
* This method returns an unbind function that can be used to detach the listener.
|
||||
*
|
||||
* @param {Function} cb
|
||||
* @param {Object} [context]
|
||||
* @returns {Function} invoke to stop observing events
|
||||
*/
|
||||
$watch(callback: Function, context?: any): Function;
|
||||
|
||||
/**
|
||||
* Informs $firebase to stop sending events and clears memory being used
|
||||
* by this object (delete's its local content).
|
||||
*/
|
||||
$destroy(): void;
|
||||
}
|
||||
interface AngularFireObjectService {
|
||||
$extendFactory(ChildClass: Object, methods?: Object): Object;
|
||||
/**
|
||||
* Creates a synchronized object with 2-way bindings between Angular and Firebase.
|
||||
*
|
||||
* @param {Firebase} ref
|
||||
* @returns {FirebaseObject}
|
||||
*/
|
||||
(firebase: Firebase): AngularFireObject;
|
||||
$extend(ChildClass: Object, methods?: Object): Object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and maintains a synchronized list of data. This is a pseudo-read-only array. One should
|
||||
* not call splice(), push(), pop(), et al directly on this array, but should instead use the
|
||||
* $remove and $add methods.
|
||||
*
|
||||
* It is acceptable to .sort() this array, but it is important to use this in conjunction with
|
||||
* $watch(), so that it will be re-sorted any time the server data changes. Examples of this are
|
||||
* included in the $watch documentation.
|
||||
*/
|
||||
interface AngularFireArray extends Array<AngularFireSimpleObject> {
|
||||
/**
|
||||
* Create a new record with a unique ID and add it to the end of the array.
|
||||
* This should be used instead of Array.prototype.push, since those changes will not be
|
||||
* synchronized with the server.
|
||||
*
|
||||
* Any value, including a primitive, can be added in this way. Note that when the record
|
||||
* is created, the primitive value would be stored in $value (records are always objects
|
||||
* by default).
|
||||
*
|
||||
* Returns a future which is resolved when the data has successfully saved to the server.
|
||||
* The resolve callback will be passed a Firebase ref representing the new data element.
|
||||
*
|
||||
* @param data
|
||||
* @returns a promise resolved after data is added
|
||||
*/
|
||||
$add(newData: any): ng.IPromise<Firebase>;
|
||||
|
||||
/**
|
||||
* Pass either an item in the array or the index of an item and it will be saved back
|
||||
* to Firebase. While the array is read-only and its structure should not be changed,
|
||||
* it is okay to modify properties on the objects it contains and then save those back
|
||||
* individually.
|
||||
*
|
||||
* Returns a future which is resolved when the data has successfully saved to the server.
|
||||
* The resolve callback will be passed a Firebase ref representing the saved element.
|
||||
* If passed an invalid index or an object which is not a record in this array,
|
||||
* the promise will be rejected.
|
||||
*
|
||||
* @param {int|object} indexOrItem
|
||||
* @returns a promise resolved after data is saved
|
||||
*/
|
||||
$save(recordOrIndex: any): ng.IPromise<Firebase>;
|
||||
|
||||
/**
|
||||
* Pass either an existing item in this array or the index of that item and it will
|
||||
* be removed both locally and in Firebase. This should be used in place of
|
||||
* Array.prototype.splice for removing items out of the array, as calling splice
|
||||
* will not update the value on the server.
|
||||
*
|
||||
* Returns a future which is resolved when the data has successfully removed from the
|
||||
* server. The resolve callback will be passed a Firebase ref representing the deleted
|
||||
* element. If passed an invalid index or an object which is not a record in this array,
|
||||
* the promise will be rejected.
|
||||
*
|
||||
* @param {int|object} indexOrItem
|
||||
* @returns a promise which resolves after data is removed
|
||||
*/
|
||||
$remove(recordOrIndex: any): ng.IPromise<Firebase>;
|
||||
|
||||
/**
|
||||
* Returns the record for a given Firebase key (record.$id). If the record is not found
|
||||
* then returns null.
|
||||
*
|
||||
* @param {string} key
|
||||
* @returns {Object|null} a record in this array
|
||||
*/
|
||||
$getRecord(key: string): AngularFireSimpleObject;
|
||||
|
||||
/**
|
||||
* Given an item in this array or the index of an item in the array, this returns the
|
||||
* Firebase key (record.$id) for that record. If passed an invalid key or an item which
|
||||
* does not exist in this array, it will return null.
|
||||
*
|
||||
* @param {int|object} indexOrItem
|
||||
* @returns {null|string}
|
||||
*/
|
||||
$keyAt(recordOrIndex: any): string;
|
||||
|
||||
/**
|
||||
* The inverse of $keyAt, this method takes a Firebase key (record.$id) and returns the
|
||||
* index in the array where that record is stored. If the record is not in the array,
|
||||
* this method returns -1.
|
||||
*
|
||||
* @param {String} key
|
||||
* @returns {int} -1 if not found
|
||||
*/
|
||||
$indexFor(key: string): number;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asArray() is now cached
|
||||
* locally in the array.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} [resolve]
|
||||
* @param {Function} [reject]
|
||||
* @returns a promise
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asArray() is now cached
|
||||
* locally in the array.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} [resolve]
|
||||
* @param {Function} [reject]
|
||||
* @returns a promise
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
|
||||
/**
|
||||
* The loaded method is invoked after the initial batch of data arrives from the server.
|
||||
* When this resolves, all data which existed prior to calling $asArray() is now cached
|
||||
* locally in the array.
|
||||
*
|
||||
* As a shortcut is also possible to pass resolve/reject methods directly into this
|
||||
* method just as they would be passed to .then()
|
||||
*
|
||||
* @param {Function} [resolve]
|
||||
* @param {Function} [reject]
|
||||
* @returns a promise
|
||||
*/
|
||||
$loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
$inst(): AngularFire;
|
||||
|
||||
/**
|
||||
* @returns {Firebase} the original Firebase ref used to create this object.
|
||||
*/
|
||||
$ref(): Firebase;
|
||||
|
||||
/**
|
||||
* Listeners passed into this method are notified whenever a new change (add, updated,
|
||||
* move, remove) is received from the server. Each invocation is sent an object
|
||||
* containing <code>{ type: 'child_added|child_updated|child_moved|child_removed',
|
||||
* key: 'key_of_item_affected'}</code>
|
||||
*
|
||||
* Additionally, added and moved events receive a prevChild parameter, containing the
|
||||
* key of the item before this one in the array.
|
||||
*
|
||||
* This method returns a function which can be invoked to stop observing events.
|
||||
*
|
||||
* @param {Function} cb
|
||||
* @param {Object} [context]
|
||||
* @returns {Function} used to stop observing
|
||||
*/
|
||||
$watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function;
|
||||
|
||||
/**
|
||||
* Informs $firebase to stop sending events and clears memory being used
|
||||
* by this array (delete's its local content).
|
||||
*/
|
||||
$destroy(): void;
|
||||
}
|
||||
interface AngularFireArrayService {
|
||||
$extendFactory(ChildClass: Object, methods?: Object): Object;
|
||||
(firebase: Firebase): AngularFireArray;
|
||||
$extend(ChildClass: Object, methods?: Object): Object;
|
||||
}
|
||||
|
||||
interface AngularFireSimpleObject {
|
||||
@@ -72,11 +320,160 @@ interface AngularFireAuthService {
|
||||
}
|
||||
|
||||
interface AngularFireAuth {
|
||||
$getCurrentUser(): ng.IPromise<any>;
|
||||
$login(provider: string, options?: Object): ng.IPromise<any>;
|
||||
$logout(): void;
|
||||
$createUser(email: string, password: string): ng.IPromise<any>;
|
||||
$changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise<any>;
|
||||
$removeUser(email: string, password: string): ng.IPromise<any>;
|
||||
$sendPasswordResetEmail(email: string): ng.IPromise<any>;
|
||||
/**
|
||||
* Authenticates the Firebase reference with a custom authentication token.
|
||||
*
|
||||
* @param {string} authToken An authentication token or a Firebase Secret. A Firebase Secret
|
||||
* should only be used for authenticating a server process and provides full read / write
|
||||
* access to the entire Firebase.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithCustomToken(authToken: string, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference anonymously.
|
||||
*
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authAnonymously(options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference with an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing email and password attributes corresponding
|
||||
* to the user account.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithPassword(credentials: FirebaseCredentials, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference with the OAuth popup flow.
|
||||
*
|
||||
* @param {string} provider The unique string identifying the OAuth provider to authenticate
|
||||
* with, e.g. google.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithOAuthPopup(provider: string, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference with the OAuth redirect flow.
|
||||
*
|
||||
* @param {string} provider The unique string identifying the OAuth provider to authenticate
|
||||
* with, e.g. google.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithOAuthRedirect(provider: string, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Authenticates the Firebase reference with an OAuth token.
|
||||
*
|
||||
* @param {string} provider The unique string identifying the OAuth provider to authenticate
|
||||
* with, e.g. google.
|
||||
* @param {string|Object} credentials Either a string, such as an OAuth 2.0 access token, or an
|
||||
* Object of key / value pairs, such as a set of OAuth 1.0a credentials.
|
||||
* @param {Object} [options] An object containing optional client arguments, such as configuring
|
||||
* session persistence.
|
||||
* @return {Promise<Object>} A promise fulfilled with an object containing authentication data.
|
||||
*/
|
||||
$authWithOAuthToken(provider: string, credentials: Object|string, options?: Object): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Synchronously retrieves the current authentication data.
|
||||
*
|
||||
* @return {Object} The client's authentication data.
|
||||
*/
|
||||
$getAuth(): FirebaseAuthData;
|
||||
|
||||
/**
|
||||
* Asynchronously fires the provided callback with the current authentication data every time
|
||||
* the authentication data changes. It also fires as soon as the authentication data is
|
||||
* retrieved from the server.
|
||||
*
|
||||
* @param {function} callback A callback that fires when the client's authenticate state
|
||||
* changes. If authenticated, the callback will be passed an object containing authentication
|
||||
* data according to the provider used to authenticate. Otherwise, it will be passed null.
|
||||
* @param {string} [context] If provided, this object will be used as this when calling your
|
||||
* callback.
|
||||
* @return {function} A function which can be used to deregister the provided callback.
|
||||
*/
|
||||
$onAuth(callback: Function, context?: any): Function;
|
||||
|
||||
/**
|
||||
* Unauthenticates the Firebase reference.
|
||||
*/
|
||||
$unauth(): void;
|
||||
|
||||
/**
|
||||
* Utility method which can be used in a route's resolve() method to grab the current
|
||||
* authentication data.
|
||||
*
|
||||
* @returns {Promise<Object|null>} A promise fulfilled with the client's current authentication
|
||||
* state, which will be null if the client is not authenticated.
|
||||
*/
|
||||
$waitForAuth(): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Utility method which can be used in a route's resolve() method to require that a route has
|
||||
* a logged in client.
|
||||
*
|
||||
* @returns {Promise<Object>} A promise fulfilled with the client's current authentication
|
||||
* state or rejected if the client is not authenticated.
|
||||
*/
|
||||
$requireAuth(): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Creates a new email/password user. Note that this function only creates the user, if you
|
||||
* wish to log in as the newly created user, call $authWithPassword() after the promise for
|
||||
* this method has been resolved.
|
||||
*
|
||||
* @param {Object} credentials An object containing the email and password of the user to create.
|
||||
* @return {Promise<Object>} A promise fulfilled with the user object, which contains the
|
||||
* uid of the created user.
|
||||
*/
|
||||
$createUser(credentials: FirebaseCredentials): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Removes an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing the email and password of the user to remove.
|
||||
* @return {Promise<>} An empty promise fulfilled once the user is removed.
|
||||
*/
|
||||
$removeUser(credentials: FirebaseCredentials): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Changes the email for an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing the old email, new email, and password of
|
||||
* the user whose email is to change.
|
||||
* @return {Promise<>} An empty promise fulfilled once the email change is complete.
|
||||
*/
|
||||
$changeEmail(credentials: FirebaseChangeEmailCredentials): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Changes the password for an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing the email, old password, and new password of
|
||||
* the user whose password is to change.
|
||||
* @return {Promise<>} An empty promise fulfilled once the password change is complete.
|
||||
*/
|
||||
$changePassword(credentials: FirebaseChangePasswordCredentials): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Sends a password reset email to an email/password user.
|
||||
*
|
||||
* @param {Object} credentials An object containing the email of the user to send a reset
|
||||
* password email to.
|
||||
* @return {Promise<>} An empty promise fulfilled once the reset password email is sent.
|
||||
*/
|
||||
$resetPassword(credentials: FirebaseResetPasswordCredentials): ng.IPromise<any>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/// <reference path="angularjs-toaster.d.ts" />
|
||||
class NgToasterTestController {
|
||||
constructor(public $scope: ng.IScope, public $window: ng.IWindowService, public toaster: ngtoaster.IToasterService) {
|
||||
this.bar = 'Hi';
|
||||
}
|
||||
bar: string;
|
||||
|
||||
pop(): void {
|
||||
this.toaster.success({ title: "title", body: "text1" });
|
||||
this.toaster.error("title", "text2");
|
||||
this.toaster.pop({ type: 'wait', title: "title", body: "text" });
|
||||
this.toaster.pop('success', "title", '<ul><li>Render html</li></ul>', 5000, 'trustedHtml');
|
||||
this.toaster.pop('error', "title", '<ul><li>Render html</li></ul>', null, 'trustedHtml');
|
||||
this.toaster.pop('wait', "title", null, null, 'template');
|
||||
this.toaster.pop('warning', "title", "myTemplate.html", null, 'template');
|
||||
this.toaster.pop('note', "title", "text");
|
||||
this.toaster.pop('success', "title", 'Its address is https://google.com.', 5000, 'trustedHtml', (toaster: ngtoaster.IToast): boolean => {
|
||||
var match = toaster.body.match(/http[s]?:\/\/[^\s]+/);
|
||||
if (match) {
|
||||
this.$window.open(match[0]);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
this.toaster.pop('warning', "Hi ", "{template: 'myTemplateWithData.html', data: 'MyData'}", 15000, 'templateWithData');
|
||||
}
|
||||
|
||||
goToLink(toaster: ngtoaster.IToast): boolean {
|
||||
var match = toaster.body.match(/http[s]?:\/\/[^\s]+/);
|
||||
if (match) {
|
||||
this.$window.open(match[0]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
clear(): void {
|
||||
this.toaster.clear();
|
||||
}
|
||||
}
|
||||
|
||||
angular
|
||||
.module('main', ['ngAnimate', 'toaster'])
|
||||
.controller('myController', NgToasterTestController);
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
// Type definitions for angularjs-toaster v0.4.13
|
||||
// Project: https://github.com/jirikavi/AngularJS-Toaster
|
||||
// Definitions by: Ben Tesser <https://github.com/btesser>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ngtoaster {
|
||||
interface IToasterService {
|
||||
pop(params:IPopParams): void
|
||||
/**
|
||||
* @param {string} type Type of toaster -- 'error', 'info', 'wait', 'success', and 'warning'
|
||||
*/
|
||||
pop(type?:string, title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
|
||||
toasterId?:number, showCloseButton?:boolean): void
|
||||
error(params: IPopParams): void
|
||||
error(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
|
||||
toasterId?:number): void
|
||||
into(params: IPopParams): void
|
||||
info(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
|
||||
toasterId?:number): void
|
||||
wait(params: IPopParams): void
|
||||
wait(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
|
||||
toasterId?:number): void
|
||||
success(params: IPopParams): void
|
||||
success(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
|
||||
toasterId?:number): void
|
||||
warning(params: IPopParams): void
|
||||
warning(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener,
|
||||
toasterId?:number): void
|
||||
clear(): void
|
||||
toast:IToast;
|
||||
}
|
||||
|
||||
interface IToasterEventRegistry {
|
||||
setup(): void
|
||||
subscribeToNewToastEvent(onNewToast:IToastEventListener): void
|
||||
subscribeToClearToastsEvent(onClearToasts:IToastEventListener): void
|
||||
unsubscribeToNewToastEvent(onNewToast:IToastEventListener): void
|
||||
unsubscribeToClearToastsEvent(onClearToasts:IToastEventListener): void
|
||||
}
|
||||
|
||||
interface IPopParams extends IToast{
|
||||
toasterId?: number;
|
||||
}
|
||||
|
||||
interface IToastEventListener {
|
||||
(event:Event, toasterId: number): void;
|
||||
}
|
||||
|
||||
interface IToast {
|
||||
/**
|
||||
* Acceptable types are:
|
||||
* 'error', 'info', 'wait', 'success', and 'warning'
|
||||
*/
|
||||
type?: string;
|
||||
title?: string;
|
||||
body?: string;
|
||||
timeout?: number;
|
||||
bodyOutputType?: string;
|
||||
clickHandler?: EventListener;
|
||||
showCloseButton?: boolean;
|
||||
}
|
||||
|
||||
interface IToasterConfig {
|
||||
/**
|
||||
* limits max number of toasts
|
||||
*/
|
||||
limit?: number;
|
||||
'tap-to-dismiss'?: boolean;
|
||||
'close-button'?: boolean;
|
||||
'newest-on-top'?: boolean;
|
||||
'time-out'?: number;
|
||||
'icon-classes'?: IIconClasses;
|
||||
/**
|
||||
* Options include:
|
||||
* '', 'trustedHtml', 'template', 'templateWithData'
|
||||
*/
|
||||
'body-output-type'?: string;
|
||||
'body-template'?: string;
|
||||
'icon-class'?: string;
|
||||
/**
|
||||
* Options include:
|
||||
* 'toast-top-full-width', 'toast-bottom-full-width', 'toast-center',
|
||||
* 'toast-top-left', 'toast-top-center', 'toast-top-rigt',
|
||||
* 'toast-bottom-left', 'toast-bottom-center', 'toast-bottom-rigt',
|
||||
*/
|
||||
'position-class'?: string;
|
||||
'title-class'?: string;
|
||||
'message-class'?: string;
|
||||
'prevent-duplicates'?: boolean;
|
||||
/**
|
||||
* stop timeout on mouseover and restart timer on mouseout
|
||||
*/
|
||||
'mouseover-timer-stop'?: boolean;
|
||||
}
|
||||
|
||||
interface IIconClasses {
|
||||
error: string;
|
||||
info: string;
|
||||
wait: string;
|
||||
success: string;
|
||||
warning: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "ngtoaster" {
|
||||
export = ngtoaster
|
||||
}
|
||||
Vendored
+10
-10
@@ -19,7 +19,7 @@ declare module angular.animate {
|
||||
// AnimateService
|
||||
// see http://docs.angularjs.org/api/ngAnimate/service/$animate
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateService extends ng.IAnimateService {
|
||||
interface IAnimateService extends angular.IAnimateService {
|
||||
/**
|
||||
* Globally enables / disables animations.
|
||||
*
|
||||
@@ -39,7 +39,7 @@ declare module angular.animate {
|
||||
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): ng.IPromise<void>;
|
||||
animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IPromise<void>;
|
||||
|
||||
/**
|
||||
* Appends the element to the parentElement element that resides in the document and then runs the enter animation.
|
||||
@@ -50,7 +50,7 @@ declare module angular.animate {
|
||||
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): ng.IPromise<void>;
|
||||
enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IPromise<void>;
|
||||
|
||||
/**
|
||||
* Runs the leave animation operation and, upon completion, removes the element from the DOM.
|
||||
@@ -59,7 +59,7 @@ declare module angular.animate {
|
||||
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
leave(element: JQuery, options?: IAnimationOptions): ng.IPromise<void>;
|
||||
leave(element: JQuery, options?: IAnimationOptions): IPromise<void>;
|
||||
|
||||
/**
|
||||
* Fires the move DOM operation. Just before the animation starts, the animate service will either append
|
||||
@@ -71,7 +71,7 @@ declare module angular.animate {
|
||||
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): ng.IPromise<void>;
|
||||
move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IPromise<void>;
|
||||
|
||||
/**
|
||||
* Triggers a custom animation event based off the className variable and then attaches the className
|
||||
@@ -82,7 +82,7 @@ declare module angular.animate {
|
||||
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
addClass(element: JQuery, className: string, options?: IAnimationOptions): ng.IPromise<void>;
|
||||
addClass(element: JQuery, className: string, options?: IAnimationOptions): IPromise<void>;
|
||||
|
||||
/**
|
||||
* Triggers a custom animation event based off the className variable and then removes the CSS class
|
||||
@@ -93,7 +93,7 @@ declare module angular.animate {
|
||||
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
removeClass(element: JQuery, className: string, options?: IAnimationOptions): ng.IPromise<void>;
|
||||
removeClass(element: JQuery, className: string, options?: IAnimationOptions): IPromise<void>;
|
||||
|
||||
/**
|
||||
* Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback
|
||||
@@ -105,12 +105,12 @@ declare module angular.animate {
|
||||
* @param options an optional collection of styles that will be picked up by the CSS transition/animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): ng.IPromise<void>;
|
||||
setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IPromise<void>;
|
||||
|
||||
/**
|
||||
* Cancels the provided animation.
|
||||
*/
|
||||
cancel(animationPromise: ng.IPromise<void>): void;
|
||||
cancel(animationPromise: IPromise<void>): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -124,7 +124,7 @@ declare module angular.animate {
|
||||
* @param name The name of the animation.
|
||||
* @param factory The factory function that will be executed to return the animation object.
|
||||
*/
|
||||
register(name: string, factory: () => ng.IAnimateCallbackObject): void;
|
||||
register(name: string, factory: () => IAnimateCallbackObject): void;
|
||||
|
||||
/**
|
||||
* Gets and/or sets the CSS class expression that is checked when performing an animation.
|
||||
|
||||
Vendored
+5
-2
@@ -39,8 +39,11 @@ declare module angular {
|
||||
dump(obj: any): string;
|
||||
|
||||
// see http://docs.angularjs.org/api/angular.mock.inject
|
||||
inject(...fns: Function[]): any;
|
||||
inject(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
inject: {
|
||||
(...fns: Function[]): any;
|
||||
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
strictDi(val?: boolean): void;
|
||||
}
|
||||
|
||||
// see http://docs.angularjs.org/api/angular.mock.module
|
||||
module(...modules: any[]): any;
|
||||
|
||||
@@ -8,6 +8,7 @@ interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource>
|
||||
///////////////////////////////////////
|
||||
var actionDescriptor: angular.resource.IActionDescriptor;
|
||||
|
||||
actionDescriptor.url = '/api/test-url/'
|
||||
actionDescriptor.headers = { header: 'value' };
|
||||
actionDescriptor.isArray = true;
|
||||
actionDescriptor.method = 'method action';
|
||||
@@ -135,4 +136,11 @@ mod = mod.factory('factory name', resourceServiceFactoryFunction);
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResource
|
||||
///////////////////////////////////////
|
||||
///////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceServiceProvider
|
||||
///////////////////////////////////////
|
||||
var resourceServiceProvider: angular.resource.IResourceServiceProvider;
|
||||
resourceServiceProvider.defaults.stripTrailingSlashes = false;
|
||||
|
||||
Vendored
+9
@@ -21,6 +21,7 @@ declare module angular.resource {
|
||||
stripTrailingSlashes?: boolean;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ResourceService
|
||||
// see http://docs.angularjs.org/api/ngResource.$resource
|
||||
@@ -45,6 +46,7 @@ declare module angular.resource {
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
interface IActionDescriptor {
|
||||
url?: string;
|
||||
method: string;
|
||||
isArray?: boolean;
|
||||
params?: any;
|
||||
@@ -143,6 +145,13 @@ declare module angular.resource {
|
||||
($resource: angular.resource.IResourceService): IResourceClass<T>;
|
||||
<U extends IResourceClass<T>>($resource: angular.resource.IResourceService): U;
|
||||
}
|
||||
|
||||
// IResourceServiceProvider used to configure global settings
|
||||
interface IResourceServiceProvider extends ng.IServiceProvider {
|
||||
|
||||
defaults: IResourceOptions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** extensions to base ng based on using angular-resource */
|
||||
|
||||
@@ -34,3 +34,7 @@ $routeProvider
|
||||
})
|
||||
.otherwise({ redirectTo: '/' })
|
||||
.otherwise({ redirectTo: ($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) => "" });
|
||||
|
||||
|
||||
var current: ng.route.ICurrentRoute;
|
||||
current.locals['test-key'] = 'test-value';
|
||||
|
||||
Vendored
+1
@@ -109,6 +109,7 @@ declare module angular.route {
|
||||
// see http://docs.angularjs.org/api/ng.$route#current
|
||||
interface ICurrentRoute extends IRoute {
|
||||
locals: {
|
||||
[index: string]: any;
|
||||
$scope: IScope;
|
||||
$template: string;
|
||||
};
|
||||
|
||||
Regular → Executable
+30
-1
@@ -201,6 +201,9 @@ mod.constant(My.Namespace);
|
||||
mod.value('name', 23);
|
||||
mod.value('name', "23");
|
||||
mod.value(My.Namespace);
|
||||
mod.decorator('name', function($scope:ng.IScope){ });
|
||||
mod.decorator('name', ['$scope', <any>function($scope: ng.IScope){ }]);
|
||||
|
||||
|
||||
class TestProvider implements ng.IServiceProvider {
|
||||
constructor(private $scope: ng.IScope) {
|
||||
@@ -699,4 +702,30 @@ module locationTests {
|
||||
$location.path() == '/foo/bar'
|
||||
$location.url() == '/foo/bar?x=y'
|
||||
$location.absUrl() == 'http://example.com/#!/foo/bar?x=y'
|
||||
}
|
||||
}
|
||||
|
||||
// NgModelController
|
||||
function NgModelControllerTyping() {
|
||||
var ngModel: angular.INgModelController;
|
||||
var $http: angular.IHttpService;
|
||||
var $q: angular.IQService;
|
||||
|
||||
// See https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$validators
|
||||
ngModel.$validators['validCharacters'] = function(modelValue, viewValue) {
|
||||
var value = modelValue || viewValue;
|
||||
return /[0-9]+/.test(value) &&
|
||||
/[a-z]+/.test(value) &&
|
||||
/[A-Z]+/.test(value) &&
|
||||
/\W+/.test(value);
|
||||
};
|
||||
|
||||
ngModel.$asyncValidators['uniqueUsername'] = function(modelValue, viewValue) {
|
||||
var value = modelValue || viewValue;
|
||||
return $http.get('/api/users/' + value).
|
||||
then(function resolved() {
|
||||
return $q.reject('exists');
|
||||
}, function rejected() {
|
||||
return true;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Vendored
+143
-23
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.3+
|
||||
// Type definitions for Angular JS 1.4+
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -249,6 +249,16 @@ declare module angular {
|
||||
isString(value: any): boolean;
|
||||
isUndefined(value: any): boolean;
|
||||
lowercase(str: string): string;
|
||||
|
||||
/**
|
||||
* Deeply extends the destination object dst by copying own enumerable properties from the src object(s) to dst. You can specify multiple src objects. If you want to preserve original objects, you can do so by passing an empty object as the target: var object = angular.merge({}, object1, object2).
|
||||
*
|
||||
* Unlike extend(), merge() recursively descends into object properties of source objects, performing a deep copy.
|
||||
*
|
||||
* @param dst Destination object.
|
||||
* @param src Source object(s).
|
||||
*/
|
||||
merge(dst: any, ...src: any[]): any;
|
||||
|
||||
/**
|
||||
* The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism.
|
||||
@@ -384,6 +394,14 @@ declare module angular {
|
||||
value(name: string, value: any): IModule;
|
||||
value(object: Object): IModule;
|
||||
|
||||
/**
|
||||
* Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service.
|
||||
* @param name The name of the service to decorate
|
||||
* @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to.
|
||||
*/
|
||||
decorator(name:string, decoratorConstructor: Function): IModule;
|
||||
decorator(name:string, inlineAnnotatedConstructor: any[]): IModule;
|
||||
|
||||
// Properties
|
||||
name: string;
|
||||
requires: string[];
|
||||
@@ -474,6 +492,7 @@ declare module angular {
|
||||
// types do work and it's common to use them.
|
||||
$setViewValue(value: any, trigger?: string): void;
|
||||
$setPristine(): void;
|
||||
$setDirty(): void;
|
||||
$validate(): void;
|
||||
$setTouched(): void;
|
||||
$setUntouched(): void;
|
||||
@@ -505,11 +524,11 @@ declare module angular {
|
||||
}
|
||||
|
||||
interface IModelValidators {
|
||||
[index: string]: (...args: any[]) => boolean;
|
||||
[index: string]: (modelValue: any, viewValue: string) => boolean;
|
||||
}
|
||||
|
||||
interface IAsyncModelValidators {
|
||||
[index: string]: (...args: any[]) => IPromise<boolean>;
|
||||
[index: string]: (modelValue: any, viewValue: string) => IPromise<any>;
|
||||
}
|
||||
|
||||
interface IModelParser {
|
||||
@@ -539,9 +558,29 @@ declare module angular {
|
||||
$applyAsync(exp: string): any;
|
||||
$applyAsync(exp: (scope: IScope) => any): any;
|
||||
|
||||
/**
|
||||
* Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners.
|
||||
*
|
||||
* The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled.
|
||||
*
|
||||
* Any exception emitted from the listeners will be passed onto the $exceptionHandler service.
|
||||
*
|
||||
* @param name Event name to broadcast.
|
||||
* @param args Optional one or more arguments which will be passed onto the event listeners.
|
||||
*/
|
||||
$broadcast(name: string, ...args: any[]): IAngularEvent;
|
||||
$destroy(): void;
|
||||
$digest(): void;
|
||||
/**
|
||||
* Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners.
|
||||
*
|
||||
* The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it.
|
||||
*
|
||||
* Any exception emitted from the listeners will be passed onto the $exceptionHandler service.
|
||||
*
|
||||
* @param name Event name to emit.
|
||||
* @param args Optional one or more arguments which will be passed onto the event listeners.
|
||||
*/
|
||||
$emit(name: string, ...args: any[]): IAngularEvent;
|
||||
|
||||
$eval(): any;
|
||||
@@ -716,17 +755,37 @@ declare module angular {
|
||||
eventFn(element: Node, doneFn: () => void): Function;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// FilterService
|
||||
// see http://docs.angularjs.org/api/ng.$filter
|
||||
// see http://docs.angularjs.org/api/ng.$filterProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* $filter - $filterProvider - service in module ng
|
||||
*
|
||||
* Filters are used for formatting data displayed to the user.
|
||||
*
|
||||
* see https://docs.angularjs.org/api/ng/service/$filter
|
||||
*/
|
||||
interface IFilterService {
|
||||
/**
|
||||
* Usage:
|
||||
* $filter(name);
|
||||
*
|
||||
* @param name Name of the filter function to retrieve
|
||||
*/
|
||||
(name: string): Function;
|
||||
}
|
||||
|
||||
/**
|
||||
* $filterProvider - $filter - provider in module ng
|
||||
*
|
||||
* Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function.
|
||||
*
|
||||
* see https://docs.angularjs.org/api/ng/provider/$filterProvider
|
||||
*/
|
||||
interface IFilterProvider extends IServiceProvider {
|
||||
register(name: string, filterFactory: Function): IServiceProvider;
|
||||
/**
|
||||
* register(name);
|
||||
*
|
||||
* @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx).
|
||||
*/
|
||||
register(name: string | {}): IServiceProvider;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -1012,37 +1071,98 @@ declare module angular {
|
||||
disableAutoScrolling(): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// CacheFactoryService
|
||||
// see http://docs.angularjs.org/api/ng.$cacheFactory
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* $cacheFactory - service in module ng
|
||||
*
|
||||
* Factory that constructs Cache objects and gives access to them.
|
||||
*
|
||||
* see https://docs.angularjs.org/api/ng/service/$cacheFactory
|
||||
*/
|
||||
interface ICacheFactoryService {
|
||||
// Lets not foce the optionsMap to have the capacity member. Even though
|
||||
// it's the ONLY option considered by the implementation today, a consumer
|
||||
// might find it useful to associate some other options to the cache object.
|
||||
//(cacheId: string, optionsMap?: { capacity: number; }): CacheObject;
|
||||
(cacheId: string, optionsMap?: { capacity: number; }): ICacheObject;
|
||||
/**
|
||||
* Factory that constructs Cache objects and gives access to them.
|
||||
*
|
||||
* @param cacheId Name or id of the newly created cache.
|
||||
* @param optionsMap Options object that specifies the cache behavior. Properties:
|
||||
*
|
||||
* capacity — turns the cache into LRU cache.
|
||||
*/
|
||||
(cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject;
|
||||
|
||||
// Methods bellow are not documented
|
||||
/**
|
||||
* Get information about all the caches that have been created.
|
||||
* @returns key-value map of cacheId to the result of calling cache#info
|
||||
*/
|
||||
info(): any;
|
||||
|
||||
/**
|
||||
* Get access to a cache object by the cacheId used when it was created.
|
||||
*
|
||||
* @param cacheId Name or id of a cache to access.
|
||||
*/
|
||||
get(cacheId: string): ICacheObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* $cacheFactory.Cache - type in module ng
|
||||
*
|
||||
* A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data.
|
||||
*
|
||||
* see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache
|
||||
*/
|
||||
interface ICacheObject {
|
||||
/**
|
||||
* Retrieve information regarding a particular Cache.
|
||||
*/
|
||||
info(): {
|
||||
/**
|
||||
* the id of the cache instance
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* the number of entries kept in the cache instance
|
||||
*/
|
||||
size: number;
|
||||
|
||||
// Not garanteed to have, since it's a non-mandatory option
|
||||
//capacity: number;
|
||||
//...: any additional properties from the options object when creating the cache.
|
||||
};
|
||||
|
||||
/**
|
||||
* Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set.
|
||||
*
|
||||
* It will not insert undefined values into the cache.
|
||||
*
|
||||
* @param key the key under which the cached data is stored.
|
||||
* @param value the value to store alongside the key. If it is undefined, the key will not be stored.
|
||||
*/
|
||||
put<T>(key: string, value?: T): T;
|
||||
|
||||
/**
|
||||
* Retrieves named data stored in the Cache object.
|
||||
*
|
||||
* @param key the key of the data to be retrieved
|
||||
*/
|
||||
get(key: string): any;
|
||||
|
||||
/**
|
||||
* Removes an entry from the Cache object.
|
||||
*
|
||||
* @param key the key of the entry to be removed
|
||||
*/
|
||||
remove(key: string): void;
|
||||
|
||||
/**
|
||||
* Clears the cache object of any entries.
|
||||
*/
|
||||
removeAll(): void;
|
||||
|
||||
/**
|
||||
* Destroys the Cache object entirely, removing it from the $cacheFactory set.
|
||||
*/
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// CompileService
|
||||
// see http://docs.angularjs.org/api/ng.$compile
|
||||
@@ -1468,7 +1588,7 @@ declare module angular {
|
||||
compile?: IDirectiveCompileFn;
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
bindToController?: boolean;
|
||||
bindToController?: boolean|Object;
|
||||
link?: IDirectiveLinkFn | IDirectivePrePost;
|
||||
name?: string;
|
||||
priority?: number;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
///<reference path='applicationinsights.d.ts' />
|
||||
import appInsights = require("applicationinsights");
|
||||
|
||||
// basic use
|
||||
appInsights.setup("<instrumentation_key>").start();
|
||||
|
||||
// basic use with auto-collection configuration
|
||||
appInsights.setup("<instrumentation_key>")
|
||||
.setAutoCollectRequests(false)
|
||||
.setAutoCollectPerformance(false)
|
||||
.setAutoCollectExceptions(false)
|
||||
// no telemetry will be sent until .start() is called
|
||||
// this prevents any of the auto-collectors from initializing
|
||||
.enableVerboseLogging()
|
||||
.start();
|
||||
|
||||
appInsights.client.trackEvent("custom event", {customProperty: "custom property value"});
|
||||
appInsights.client.trackException(new Error("handled exceptions can be logged with this method"));
|
||||
appInsights.client.trackMetric("custom metric", 3);
|
||||
appInsights.client.trackTrace("trace message");
|
||||
|
||||
// assign common properties to all telemetry
|
||||
appInsights.client.commonProperties = {
|
||||
environment: "dev"
|
||||
};
|
||||
+429
@@ -0,0 +1,429 @@
|
||||
// Type definitions for Application Insights v0.15.1
|
||||
// Project: https://github.com/Microsoft/ApplicationInsights-node.js
|
||||
// Definitions by: Scott Southwood <https://github.com/scsouthw/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface AutoCollectConsole {
|
||||
enable(isEnabled: boolean): void;
|
||||
isInitialized(): boolean;
|
||||
}
|
||||
|
||||
interface AutoCollectExceptions {
|
||||
isInitialized(): boolean;
|
||||
enable(isEnabled:boolean): void;
|
||||
}
|
||||
|
||||
interface AutoCollectPerformance {
|
||||
enable(isEnabled: boolean): void;
|
||||
isInitialized(): boolean;
|
||||
}
|
||||
|
||||
interface AutoCollectRequests {
|
||||
enable(isEnabled: boolean): void;
|
||||
isInitialized(): boolean;
|
||||
}
|
||||
|
||||
|
||||
declare module ContractsModule {
|
||||
enum DataPointType {
|
||||
Measurement = 0,
|
||||
Aggregation = 1,
|
||||
}
|
||||
enum DependencyKind {
|
||||
SQL = 0,
|
||||
Http = 1,
|
||||
Other = 2,
|
||||
}
|
||||
enum DependencySourceType {
|
||||
Undefined = 0,
|
||||
Aic = 1,
|
||||
Apmc = 2,
|
||||
}
|
||||
enum SessionState {
|
||||
Start = 0,
|
||||
End = 1,
|
||||
}
|
||||
enum SeverityLevel {
|
||||
Verbose = 0,
|
||||
Information = 1,
|
||||
Warning = 2,
|
||||
Error = 3,
|
||||
Critical = 4,
|
||||
}
|
||||
interface ContextTagKeys {
|
||||
applicationVersion: string;
|
||||
applicationBuild: string;
|
||||
deviceId: string;
|
||||
deviceIp: string;
|
||||
deviceLanguage: string;
|
||||
deviceLocale: string;
|
||||
deviceModel: string;
|
||||
deviceNetwork: string;
|
||||
deviceOEMName: string;
|
||||
deviceOS: string;
|
||||
deviceOSVersion: string;
|
||||
deviceRoleInstance: string;
|
||||
deviceRoleName: string;
|
||||
deviceScreenResolution: string;
|
||||
deviceType: string;
|
||||
deviceMachineName: string;
|
||||
locationIp: string;
|
||||
operationId: string;
|
||||
operationName: string;
|
||||
operationParentId: string;
|
||||
operationRootId: string;
|
||||
operationSyntheticSource: string;
|
||||
operationIsSynthetic: string;
|
||||
sessionId: string;
|
||||
sessionIsFirst: string;
|
||||
sessionIsNew: string;
|
||||
userAccountAcquisitionDate: string;
|
||||
userAccountId: string;
|
||||
userAgent: string;
|
||||
userId: string;
|
||||
userStoreRegion: string;
|
||||
sampleRate: string;
|
||||
internalSdkVersion: string;
|
||||
internalAgentVersion: string;
|
||||
}
|
||||
interface Domain {
|
||||
ver: number;
|
||||
properties: any;
|
||||
}
|
||||
interface Data<TDomain extends ContractsModule.Domain> {
|
||||
baseType: string;
|
||||
baseData: TDomain;
|
||||
}
|
||||
interface Envelope {
|
||||
ver: number;
|
||||
name: string;
|
||||
time: string;
|
||||
sampleRate: number;
|
||||
seq: string;
|
||||
iKey: string;
|
||||
flags: number;
|
||||
deviceId: string;
|
||||
os: string;
|
||||
osVer: string;
|
||||
appId: string;
|
||||
appVer: string;
|
||||
userId: string;
|
||||
tags: {
|
||||
[key: string]: string;
|
||||
};
|
||||
data: Data<Domain>;
|
||||
}
|
||||
interface EventData extends ContractsModule.Domain {
|
||||
ver: number;
|
||||
name: string;
|
||||
properties: any;
|
||||
measurements: any;
|
||||
}
|
||||
interface MessageData extends ContractsModule.Domain {
|
||||
ver: number;
|
||||
message: string;
|
||||
severityLevel: ContractsModule.SeverityLevel;
|
||||
properties: any;
|
||||
}
|
||||
interface ExceptionData extends ContractsModule.Domain {
|
||||
ver: number;
|
||||
handledAt: string;
|
||||
exceptions: ExceptionDetails[];
|
||||
severityLevel: ContractsModule.SeverityLevel;
|
||||
problemId: string;
|
||||
crashThreadId: number;
|
||||
properties: any;
|
||||
measurements: any;
|
||||
}
|
||||
interface StackFrame {
|
||||
level: number;
|
||||
method: string;
|
||||
assembly: string;
|
||||
fileName: string;
|
||||
line: number;
|
||||
}
|
||||
interface ExceptionDetails {
|
||||
id: number;
|
||||
outerId: number;
|
||||
typeName: string;
|
||||
message: string;
|
||||
hasFullStack: boolean;
|
||||
stack: string;
|
||||
parsedStack: StackFrame[];
|
||||
}
|
||||
interface DataPoint {
|
||||
name: string;
|
||||
kind: ContractsModule.DataPointType;
|
||||
value: number;
|
||||
count: number;
|
||||
min: number;
|
||||
max: number;
|
||||
stdDev: number;
|
||||
}
|
||||
interface MetricData extends ContractsModule.Domain {
|
||||
ver: number;
|
||||
metrics: DataPoint[];
|
||||
properties: any;
|
||||
}
|
||||
interface PageViewData extends ContractsModule.EventData {
|
||||
ver: number;
|
||||
url: string;
|
||||
name: string;
|
||||
duration: string;
|
||||
properties: any;
|
||||
measurements: any;
|
||||
}
|
||||
interface PageViewPerfData extends ContractsModule.PageViewData {
|
||||
ver: number;
|
||||
url: string;
|
||||
perfTotal: string;
|
||||
name: string;
|
||||
duration: string;
|
||||
networkConnect: string;
|
||||
sentRequest: string;
|
||||
receivedResponse: string;
|
||||
domProcessing: string;
|
||||
properties: any;
|
||||
measurements: any;
|
||||
}
|
||||
interface RemoteDependencyData extends ContractsModule.Domain {
|
||||
ver: number;
|
||||
name: string;
|
||||
kind: ContractsModule.DataPointType;
|
||||
value: number;
|
||||
count: number;
|
||||
min: number;
|
||||
max: number;
|
||||
stdDev: number;
|
||||
dependencyKind: ContractsModule.DependencyKind;
|
||||
success: boolean;
|
||||
async: boolean;
|
||||
dependencySource: ContractsModule.DependencySourceType;
|
||||
commandName: string;
|
||||
dependencyTypeName: string;
|
||||
properties: any;
|
||||
}
|
||||
interface AjaxCallData extends ContractsModule.PageViewData {
|
||||
ver: number;
|
||||
url: string;
|
||||
ajaxUrl: string;
|
||||
name: string;
|
||||
duration: string;
|
||||
requestSize: number;
|
||||
responseSize: number;
|
||||
timeToFirstByte: string;
|
||||
timeToLastByte: string;
|
||||
callbackDuration: string;
|
||||
responseCode: string;
|
||||
success: boolean;
|
||||
properties: any;
|
||||
measurements: any;
|
||||
}
|
||||
interface RequestData extends ContractsModule.Domain {
|
||||
ver: number;
|
||||
id: string;
|
||||
name: string;
|
||||
startTime: string;
|
||||
duration: string;
|
||||
responseCode: string;
|
||||
success: boolean;
|
||||
httpMethod: string;
|
||||
url: string;
|
||||
properties: any;
|
||||
measurements: any;
|
||||
}
|
||||
interface SessionStateData extends ContractsModule.Domain {
|
||||
ver: number;
|
||||
state: ContractsModule.SessionState;
|
||||
}
|
||||
interface PerformanceCounterData extends ContractsModule.Domain {
|
||||
ver: number;
|
||||
categoryName: string;
|
||||
counterName: string;
|
||||
instanceName: string;
|
||||
kind: DataPointType;
|
||||
count: number;
|
||||
min: number;
|
||||
max: number;
|
||||
stdDev: number;
|
||||
value: number;
|
||||
properties: any;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface Channel {
|
||||
constructor(isDisabled: () => boolean, getBatchSize: () => number, getBatchIntervalMs: () => number, sender: Sender): Channel;
|
||||
/**
|
||||
* Add a telemetry item to the send buffer
|
||||
*/
|
||||
send(envelope: ContractsModule.Envelope): void;
|
||||
handleCrash(envelope: ContractsModule.Envelope): void;
|
||||
/**
|
||||
* Immediately send buffered data
|
||||
*/
|
||||
triggerSend(isNodeCrashing?: boolean): void;
|
||||
}
|
||||
|
||||
interface Client {
|
||||
config: Config;
|
||||
context: Context;
|
||||
commonProperties: {
|
||||
[key: string]: string;
|
||||
};
|
||||
channel: Channel;
|
||||
/**
|
||||
* Constructs a new client of the client
|
||||
* @param iKey the instrumentation key to use (read from environment variable if not specified)
|
||||
*/
|
||||
constructor(iKey?: string): Client;
|
||||
/**
|
||||
* Log a user action or other occurrence.
|
||||
* @param name A string to identify this event in the portal.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
trackEvent(name: string, properties?: {
|
||||
[key: string]: string;
|
||||
}, measurements?: {
|
||||
[key: string]: number;
|
||||
}): void;
|
||||
/**
|
||||
* Log a trace message
|
||||
* @param message A string to identify this event in the portal.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
*/
|
||||
trackTrace(message: string, severityLevel?: ContractsModule.SeverityLevel, properties?: {
|
||||
[key: string]: string;
|
||||
}): void;
|
||||
/**
|
||||
* Log an exception you have caught.
|
||||
* @param exception An Error from a catch clause, or the string error message.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
trackException(exception: Error, properties?: {
|
||||
[key: string]: string;
|
||||
}): void;
|
||||
/**
|
||||
* Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
|
||||
* To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
|
||||
* telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals.
|
||||
* @param name A string that identifies the metric.
|
||||
* @param value The value of the metric
|
||||
*/
|
||||
trackMetric(name: string, value: number): void;
|
||||
trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: {
|
||||
[key: string]: string;
|
||||
}): void;
|
||||
/**
|
||||
* Immediately send all queued telemetry.
|
||||
*/
|
||||
sendPendingData(): void;
|
||||
getEnvelope(data: ContractsModule.Data<ContractsModule.Domain>, tagOverrides?: {
|
||||
[key: string]: string;
|
||||
}): ContractsModule.Envelope;
|
||||
/**
|
||||
* Generic track method for all telemetry types
|
||||
* @param data the telemetry to send
|
||||
* @param tagOverrides the context tags to use for this telemetry which overwrite default context values
|
||||
*/
|
||||
track(data: ContractsModule.Data<ContractsModule.Domain>, tagOverrides?: {
|
||||
[key: string]: string;
|
||||
}): void;
|
||||
}
|
||||
|
||||
interface Config {
|
||||
instrumentationKey: string;
|
||||
sessionRenewalMs: number;
|
||||
sessionExpirationMs: number;
|
||||
endpointUrl: string;
|
||||
maxBatchSize: number;
|
||||
maxBatchIntervalMs: number;
|
||||
disableAppInsights: boolean;
|
||||
constructor(instrumentationKey?: string): Config;
|
||||
}
|
||||
|
||||
interface Context {
|
||||
keys: ContractsModule.ContextTagKeys;
|
||||
tags: {
|
||||
[key: string]: string;
|
||||
};
|
||||
constructor(packageJsonPath?: string): Context;
|
||||
}
|
||||
|
||||
interface Sender {
|
||||
constructor(getUrl: () => string, onSuccess?: (response: string) => void, onError?: (error: Error) => void): Sender;
|
||||
send(payload: any/* Buffer */): void;
|
||||
saveOnCrash(payload: string): void;
|
||||
/**
|
||||
* enable caching events locally on error
|
||||
*/
|
||||
enableCacheOnError(): void;
|
||||
/**
|
||||
* disable caching events locally on error
|
||||
*/
|
||||
disableCacheOnError(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The singleton meta interface for the default client of the client. This interface is used to setup/start and configure
|
||||
* the auto-collection behavior of the application insights module.
|
||||
*/
|
||||
declare class ApplicationInsights {
|
||||
static client: Client;
|
||||
private static _isConsole;
|
||||
private static _isExceptions;
|
||||
private static _isPerformance;
|
||||
private static _isRequests;
|
||||
private static _console;
|
||||
private static _exceptions;
|
||||
private static _performance;
|
||||
private static _requests;
|
||||
private static _isStarted;
|
||||
/**
|
||||
* Initializes the default client of the client and sets the default configuration
|
||||
* @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be
|
||||
* read from the environment variable APPINSIGHTS_INSTRUMENTATION_KEY
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setup(instrumentationKey?: string): typeof ApplicationInsights;
|
||||
/**
|
||||
* Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static start(): typeof ApplicationInsights;
|
||||
/**
|
||||
* Sets the state of console tracking (enabled by default)
|
||||
* @param value if true console activity will be sent to Application Insights
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setAutoCollectConsole(value: boolean): typeof ApplicationInsights;
|
||||
/**
|
||||
* Sets the state of exception tracking (enabled by default)
|
||||
* @param value if true uncaught exceptions will be sent to Application Insights
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setAutoCollectExceptions(value: boolean): typeof ApplicationInsights;
|
||||
/**
|
||||
* Sets the state of performance tracking (enabled by default)
|
||||
* @param value if true performance counters will be collected every second and sent to Application Insights
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setAutoCollectPerformance(value: boolean): typeof ApplicationInsights;
|
||||
/**
|
||||
* Sets the state of request tracking (enabled by default)
|
||||
* @param value if true requests will be sent to Application Insights
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static setAutoCollectRequests(value: boolean): typeof ApplicationInsights;
|
||||
/**
|
||||
* Enables verbose debug logging
|
||||
* @returns {ApplicationInsights} this interface
|
||||
*/
|
||||
static enableVerboseLogging(): typeof ApplicationInsights;
|
||||
}
|
||||
|
||||
declare module "applicationinsights" {
|
||||
export = ApplicationInsights;
|
||||
}
|
||||
Vendored
+12
-2
@@ -1,16 +1,23 @@
|
||||
// Type definitions for Async 0.9.2
|
||||
// Project: https://github.com/caolan/async
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Arseniy Maximov <https://github.com/kern0>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Dictionary<T> { [key: string]: T; }
|
||||
|
||||
// Common interface between Arrays and Array-like objects
|
||||
interface List<T> {
|
||||
[index: number]: T;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface ErrorCallback { (err?: Error): void; }
|
||||
interface AsyncResultCallback<T> { (err: Error, result: T): void; }
|
||||
interface AsyncResultArrayCallback<T> { (err: Error, results: T[]): void; }
|
||||
interface AsyncResultObjectCallback<T> { (err: Error, results: Dictionary<T>): void; }
|
||||
|
||||
interface AsyncIterator<T> { (item: T, callback: ErrorCallback): void; }
|
||||
interface AsyncForEachOfIterator<T> { (item: T, index: number, callback: ErrorCallback): void; }
|
||||
interface AsyncResultIterator<T, R> { (item: T, callback: AsyncResultCallback<R>): void; }
|
||||
interface AsyncMemoIterator<T, R> { (memo: R, item: T, callback: AsyncResultCallback<R>): void; }
|
||||
|
||||
@@ -61,6 +68,9 @@ interface Async {
|
||||
each<T>(arr: T[], iterator: AsyncIterator<T>, callback: ErrorCallback): void;
|
||||
eachSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback: ErrorCallback): void;
|
||||
eachLimit<T>(arr: T[], limit: number, iterator: AsyncIterator<T>, callback: ErrorCallback): void;
|
||||
forEachOf<T>(obj: List<T>, iterator: AsyncForEachOfIterator<T>, callback: ErrorCallback): void;
|
||||
forEachOfSeries<T>(obj: List<T>, iterator: AsyncForEachOfIterator<T>, callback: ErrorCallback): void;
|
||||
forEachOfLimit<T>(obj: List<T>, limit: number, iterator: AsyncForEachOfIterator<T>, callback: ErrorCallback): void;
|
||||
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback: AsyncResultArrayCallback<R>): any;
|
||||
mapSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback: AsyncResultArrayCallback<R>): any;
|
||||
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback: AsyncResultArrayCallback<R>): any;
|
||||
@@ -96,7 +106,7 @@ interface Async {
|
||||
doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void;
|
||||
until(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void;
|
||||
doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void;
|
||||
waterfall(tasks: Function[], callback?: AsyncResultArrayCallback<any>): void;
|
||||
waterfall(tasks: Function[], callback?: (err: any, ...arguments: any[]) => void): void;
|
||||
queue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncQueue<T>;
|
||||
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
|
||||
auto(tasks: any, callback?: AsyncResultArrayCallback<any>): void;
|
||||
|
||||
Vendored
+5
-5
@@ -591,7 +591,7 @@ declare module AtomCore {
|
||||
getTextInRange(range:any):any;
|
||||
getLineCount():number;
|
||||
getBuffer():TextBuffer.ITextBuffer;
|
||||
getUri():string;
|
||||
getURI():string;
|
||||
isBufferRowBlank(bufferRow:any):boolean;
|
||||
isBufferRowCommented(bufferRow:any):void;
|
||||
nextNonBlankBufferRow(bufferRow:any):void;
|
||||
@@ -886,8 +886,8 @@ declare module AtomCore {
|
||||
saveItem(item:any, nextAction:Function):void;
|
||||
saveItemAs(item:any, nextAction:Function):void;
|
||||
saveItems():any[];
|
||||
itemForUri(uri:any):any;
|
||||
activateItemForUri(uri:any):any;
|
||||
itemForURI(uri:any):any;
|
||||
activateItemForURI(uri:any):any;
|
||||
copyActiveItem():void;
|
||||
splitLeft(params:any):IPane;
|
||||
splitRight(params:any):IPane;
|
||||
@@ -978,7 +978,7 @@ declare module AtomCore {
|
||||
open(uri:string, options:any):Q.Promise<View>;
|
||||
openLicense():void;
|
||||
openSync(uri:string, options:any):any;
|
||||
openUriInPane(uri:string, pane:any, options:any):Q.Promise<View>;
|
||||
openURIInPane(uri:string, pane:any, options:any):Q.Promise<View>;
|
||||
reopenItemSync():any;
|
||||
registerOpener(opener:(urlToOpen:string)=>any):void;
|
||||
unregisterOpener(opener:Function):void;
|
||||
@@ -988,7 +988,7 @@ declare module AtomCore {
|
||||
saveAll():void;
|
||||
activateNextPane():any;
|
||||
activatePreviousPane():any;
|
||||
paneForUri: (uri:string) => IPane;
|
||||
paneForURI: (uri:string) => IPane;
|
||||
saveActivePaneItem():any;
|
||||
saveActivePaneItemAs():any;
|
||||
destroyActivePaneItem():any;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="autoprefixer-core.d.ts" />
|
||||
import autoprefixer = require("autoprefixer-core");
|
||||
|
||||
var css: string;
|
||||
|
||||
var prefixed = autoprefixer.process(css).css;
|
||||
|
||||
var processor = autoprefixer({ browsers: ['> 1%', 'IE 7'], cascade: false });
|
||||
console.log(processor.info());
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for Autoprefixer Core 5.1.11
|
||||
// Project: https://github.com/postcss/autoprefixer-core
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "autoprefixer-core" {
|
||||
interface Config {
|
||||
browsers?: string[];
|
||||
cascade?: boolean;
|
||||
remove?: boolean;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
from?: string;
|
||||
to?: string;
|
||||
safe?: boolean;
|
||||
map?: {
|
||||
inline?: boolean;
|
||||
prev?: string | Object;
|
||||
}
|
||||
}
|
||||
|
||||
interface Result {
|
||||
css: string;
|
||||
map: string;
|
||||
opts: Options;
|
||||
}
|
||||
|
||||
interface Processor {
|
||||
postcss: any;
|
||||
info(): string;
|
||||
process(css: string, opts?: Options): Result;
|
||||
}
|
||||
|
||||
interface Exports {
|
||||
(config: Config): Processor;
|
||||
postcss: any;
|
||||
info(): string;
|
||||
process(css: string, opts?: Options): Result;
|
||||
}
|
||||
|
||||
var exports: Exports;
|
||||
export = exports;
|
||||
}
|
||||
+1
-1
@@ -52,7 +52,7 @@ declare module Backbone {
|
||||
|
||||
type PageableGetPageOptions = CollectionFetchOptions|Silenceable;
|
||||
|
||||
class PageableCollection<TModel extends Model> extends Collection<Model>{
|
||||
class PageableCollection<TModel extends Model> extends Collection<TModel>{
|
||||
|
||||
fullCollection: Collection<TModel>;
|
||||
mode: string;
|
||||
|
||||
Vendored
+1
-3
@@ -169,9 +169,7 @@ declare module Backbone {
|
||||
**/
|
||||
private static extend(properties: any, classProperties?: any): any;
|
||||
|
||||
// TODO: this really has to be typeof TModel
|
||||
//model: typeof TModel;
|
||||
model: { new(): TModel; }; // workaround
|
||||
model: new (...args:any[]) => TModel;
|
||||
models: TModel[];
|
||||
length: number;
|
||||
|
||||
|
||||
Vendored
+87
-46
@@ -8,12 +8,12 @@
|
||||
declare module Backgrid {
|
||||
|
||||
interface GridOptions {
|
||||
columns: Column[];
|
||||
collection: Backbone.Collection<Backbone.Model>;
|
||||
header: Header;
|
||||
body: Body;
|
||||
row: Row;
|
||||
footer: Footer;
|
||||
columns: Column[];
|
||||
collection: Backbone.Collection<Backbone.Model>;
|
||||
header: Header;
|
||||
body: Body;
|
||||
row: Row;
|
||||
footer: Footer;
|
||||
}
|
||||
|
||||
class Header extends Backbone.View<Backbone.Model> {
|
||||
@@ -21,65 +21,106 @@ declare module Backgrid {
|
||||
|
||||
class Footer extends Backbone.View<Backbone.Model> {
|
||||
}
|
||||
|
||||
|
||||
class Row extends Backbone.View<Backbone.Model> {
|
||||
}
|
||||
|
||||
class Command {
|
||||
cancel();
|
||||
moveDown();
|
||||
moveLeft();
|
||||
moveRight();
|
||||
moveUp();
|
||||
passThru();
|
||||
save();
|
||||
moveUp(): boolean;
|
||||
moveDown(): boolean;
|
||||
moveLeft(): boolean;
|
||||
moveRight(): boolean;
|
||||
save(): boolean;
|
||||
cancel(): boolean;
|
||||
passThru(): boolean;
|
||||
}
|
||||
|
||||
class CellFormatter {
|
||||
fromRaw(rawData: any, model: Backbone.Model);
|
||||
toRaw(formattedData: any, model: Backbone.Model);
|
||||
}
|
||||
|
||||
class NumberFormatter extends CellFormatter {}
|
||||
|
||||
class PercentFormatter extends NumberFormatter {}
|
||||
|
||||
class DateTimeFormatter extends CellFormatter {}
|
||||
|
||||
class StringFormatter extends CellFormatter {}
|
||||
|
||||
class EmailFormatter extends CellFormatter {}
|
||||
|
||||
class SelectFormatter extends CellFormatter {}
|
||||
|
||||
class CellEditor extends Backbone.View<Backbone.Model>{
|
||||
initialize(options?: any);
|
||||
postRender(model: Backbone.Model, column: Backbone.Model);
|
||||
}
|
||||
|
||||
class InputCellEditor extends CellEditor {
|
||||
render();
|
||||
saveOrCancel(event: any);
|
||||
}
|
||||
|
||||
class Cell extends Backbone.View<Backbone.Model>{
|
||||
tagName: string;
|
||||
formatter: CellFormatter;
|
||||
editor: InputCellEditor;
|
||||
enterEditMode();
|
||||
renderError();
|
||||
exitEditMode();
|
||||
remove();
|
||||
}
|
||||
|
||||
class StringCell extends Cell {
|
||||
}
|
||||
|
||||
interface ColumnAttr {
|
||||
name: string;
|
||||
cell: string;
|
||||
headerCell: string;
|
||||
label: string;
|
||||
sortable: boolean;
|
||||
editable: boolean;
|
||||
renderable: boolean;
|
||||
formater: string;
|
||||
name: string;
|
||||
cell: string;
|
||||
headerCell: string;
|
||||
label: string;
|
||||
sortable: boolean;
|
||||
editable: boolean;
|
||||
renderable: boolean;
|
||||
formater: string;
|
||||
}
|
||||
|
||||
class Column extends Backbone.Model {
|
||||
initialize(options?: any);
|
||||
initialize(options?: any);
|
||||
}
|
||||
|
||||
class Body extends Backbone.View<Backbone.Model> {
|
||||
tagName: string;
|
||||
tagName: string;
|
||||
|
||||
initialize(options?: any);
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
moveToNextCell(model: Backbone.Model, cell: Column, command: Command);
|
||||
refresh(): Body;
|
||||
remove(): Body;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render(): Body;
|
||||
initialize(options?: any);
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
moveToNextCell(model: Backbone.Model, cell: Column, command: Command);
|
||||
refresh(): Body;
|
||||
remove(): Body;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render(): Body;
|
||||
}
|
||||
|
||||
class Grid extends Backbone.View<Backbone.Model> {
|
||||
body: Backgrid.Body;
|
||||
className: string;
|
||||
footer: any;
|
||||
header: any;
|
||||
tagName: string;
|
||||
body: Backgrid.Body;
|
||||
className: string;
|
||||
footer: any;
|
||||
header: any;
|
||||
tagName: string;
|
||||
|
||||
initialize(options: any);
|
||||
getSelectedModels(): Backbone.Model[];
|
||||
insertColumn(...options: any[]): Grid;
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
remove():Grid;
|
||||
removeColumn(...options: any[]): Grid;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render():Grid;
|
||||
initialize(options: any);
|
||||
getSelectedModels(): Backbone.Model[];
|
||||
insertColumn(...options: any[]): Grid;
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
remove(): Grid;
|
||||
removeColumn(...options: any[]): Grid;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render(): Grid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare module "backgrid" {
|
||||
export = Backgrid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,322 @@
|
||||
/// <reference path="blocks.d.ts" />
|
||||
|
||||
function test_blocks_methods() {
|
||||
var extended: Object;
|
||||
blocks.extend(extended, new Object());
|
||||
|
||||
blocks.each([3, 1, 4], function(value, index, collection) {
|
||||
// value is the current item (3, 1 and 4)
|
||||
// index is the current index (0, 1 and 2)
|
||||
// collection points to the array passed to the function - [3, 1, 4]
|
||||
});
|
||||
|
||||
blocks.eachRight([3, 1, 4], function(value, index, collection) {
|
||||
// value is the current item (4, 1 and 3)
|
||||
// index is the current index (2, 1 and 0)
|
||||
// collection points to the array passed to the function - [3, 1, 4]
|
||||
});
|
||||
|
||||
blocks.isArray([1, 2, 3]);
|
||||
// -> true
|
||||
|
||||
function calculate() {
|
||||
blocks.isArray(arguments);
|
||||
// -> false
|
||||
}
|
||||
|
||||
function max(collection: any, callback: any) {
|
||||
callback = callback || blocks.noop;
|
||||
}
|
||||
|
||||
blocks.type('a string');
|
||||
// -> string
|
||||
|
||||
blocks.type(314);
|
||||
// -> number
|
||||
|
||||
blocks.type([]);
|
||||
// -> array
|
||||
|
||||
blocks.type({});
|
||||
// -> object
|
||||
|
||||
blocks.type(blocks.noop);
|
||||
// -> function
|
||||
|
||||
blocks.type(new RegExp(''));
|
||||
// -> regexp
|
||||
|
||||
blocks.type(undefined);
|
||||
// -> undefined
|
||||
|
||||
blocks.type(null);
|
||||
// -> null
|
||||
|
||||
blocks.is([], 'array');
|
||||
// -> true
|
||||
|
||||
blocks.is(function() { }, 'object');
|
||||
// -> false
|
||||
|
||||
blocks.has({
|
||||
price: undefined
|
||||
}, 'price');
|
||||
// -> true
|
||||
|
||||
blocks.has({
|
||||
price: 314
|
||||
}, 'ratio');
|
||||
// -> false
|
||||
|
||||
blocks.unwrap(blocks.observable(314));
|
||||
// -> 314
|
||||
|
||||
blocks.unwrap(blocks([3, 1, 4]));
|
||||
// -> [3, 1, 4]
|
||||
|
||||
blocks.unwrap('a string or any other value will not be changed');
|
||||
// -> 'a string or any other value will not be changed'
|
||||
|
||||
blocks.toArray(3);
|
||||
// -> [3]
|
||||
|
||||
blocks.toArray([3, 1, 4]);
|
||||
// -> [3, 1, 4]
|
||||
|
||||
blocks.toUnit(230);
|
||||
// -> 230px
|
||||
|
||||
blocks.toUnit(230, '%');
|
||||
// -> 230%
|
||||
|
||||
blocks.toUnit('60px', '%');
|
||||
// -> 60%
|
||||
|
||||
var array = [3, 1, 4];
|
||||
var cloned = blocks.clone(array);
|
||||
// -> [3, 1, 4]
|
||||
var areEqual = array == cloned;
|
||||
// -> false
|
||||
|
||||
blocks.isElement(document.body);
|
||||
// -> true
|
||||
|
||||
blocks.isElement({});
|
||||
// -> false
|
||||
|
||||
blocks.isBoolean(true);
|
||||
// -> true
|
||||
|
||||
blocks.isBoolean(new Boolean(false));
|
||||
// -> true
|
||||
|
||||
blocks.isBoolean(1);
|
||||
// -> false
|
||||
|
||||
blocks.isPlainObject({ property: true });
|
||||
// -> true
|
||||
|
||||
blocks.isPlainObject(new Object());
|
||||
// -> true
|
||||
|
||||
var car = new Object();
|
||||
|
||||
blocks.isPlainObject(car);
|
||||
// -> false
|
||||
|
||||
var alert = blocks.bind(() => {
|
||||
alert(this);
|
||||
}, 'Hello bind method!');
|
||||
|
||||
alert();
|
||||
// -> alerts 'Hello bind method'
|
||||
|
||||
var alertAll = blocks.bind((firstName: string, lastName: string) => {
|
||||
alert('My name is ' + firstName + ' ' + lastName);
|
||||
}, null, 'John', 'Doe');
|
||||
|
||||
alertAll();
|
||||
// -> alerts 'My name is John Doe'
|
||||
|
||||
blocks.equals([3, 4], [3, 4]);
|
||||
// -> true
|
||||
|
||||
blocks.equals({ value: 7 }, { value: 7, result: 1 });
|
||||
// -> false
|
||||
|
||||
blocks.query({
|
||||
message: 'Hello World!'
|
||||
});
|
||||
|
||||
blocks.query({
|
||||
items: ['John', 'Alf', 'Mega'],
|
||||
alertIndex: (e: any) => {
|
||||
alert('Clicked an item with index:' + blocks.context(e.target).$index);
|
||||
}
|
||||
});
|
||||
|
||||
blocks.query({
|
||||
items: [1, 2, 3],
|
||||
alertValue: (e: any) => {
|
||||
alert('Clicked the value: ' + blocks.dataItem(e.target));
|
||||
}
|
||||
});
|
||||
|
||||
blocks.isObservable(blocks.observable(3));
|
||||
// -> true
|
||||
|
||||
blocks.isObservable(3);
|
||||
// -> false
|
||||
|
||||
blocks.unwrapObservable(blocks.observable(304));
|
||||
// -> 304
|
||||
|
||||
blocks.unwrapObservable(305);
|
||||
// -> 305
|
||||
}
|
||||
|
||||
function test_observable_array() {
|
||||
// creates an observable array with [1, 2, 3] as values
|
||||
var items = blocks.observable([1, 2, 3]);
|
||||
|
||||
// removes the previous values and fills the observable array with [5, 6, 7] values
|
||||
items.reset([5, 6, 7])
|
||||
|
||||
// results in observable array with [1, 2, 3, 4] values
|
||||
items.add(4);
|
||||
|
||||
// results in observable array with [1, 2, 3, 4, 5, 6] values
|
||||
items.addMany([4, 5, 6]);
|
||||
|
||||
var items = blocks.observable([4, 2, 3, 1]);
|
||||
|
||||
// results in observable array with [1, 2, 3, 4] values
|
||||
items.swap(0, 3);
|
||||
|
||||
var items = blocks.observable([1, 4, 2, 3, 5]);
|
||||
|
||||
// results in observable array with [1, 2, 3, 4, 5] values
|
||||
items.move(1, 4);
|
||||
}
|
||||
|
||||
function test_Property() {
|
||||
var App = blocks.Application();
|
||||
|
||||
var User = App.Model({
|
||||
username: App.Property({
|
||||
defaultValue: 'John Doe'
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function test_Model() {
|
||||
var App = blocks.Application();
|
||||
|
||||
var User = App.Model({
|
||||
firstName: App.Property({
|
||||
required: true,
|
||||
validateOnChange: true
|
||||
}),
|
||||
|
||||
lastName: App.Property({
|
||||
required: true,
|
||||
validateOnChange: true
|
||||
}),
|
||||
|
||||
fullName: App.Property({
|
||||
value: function() {
|
||||
return this.firstName() + ' ' + this.lastName();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
App.View('Profile', {
|
||||
user: User({
|
||||
firstName: 'John',
|
||||
lastName: 'Doe'
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function test_Collection() {
|
||||
var App = blocks.Application();
|
||||
|
||||
var User = App.Model({
|
||||
firstName: App.Property({
|
||||
required: true,
|
||||
validateOnChange: true
|
||||
}),
|
||||
|
||||
lastName: App.Property({
|
||||
required: true,
|
||||
validateOnChange: true
|
||||
}),
|
||||
|
||||
fullName: App.Property({
|
||||
value: function() {
|
||||
return this.firstName() + ' ' + this.lastName();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
var Users = App.Collection(User, {
|
||||
count: App.Property({
|
||||
value: () => {
|
||||
return this().length;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
App.View('Profiles', {
|
||||
users: Users([{
|
||||
firstName: 'John',
|
||||
lastName: 'Doe'
|
||||
}, {
|
||||
firstName: 'Johna',
|
||||
lastName: 'Doa'
|
||||
}])
|
||||
});
|
||||
}
|
||||
|
||||
function test_View() {
|
||||
var App = blocks.Application();
|
||||
|
||||
App.View('Clicker', {
|
||||
handleClick: () => {
|
||||
alert('Clicky! Click!');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
App.View('Statistics', {
|
||||
init: () => {
|
||||
this.loadRemoteData();
|
||||
},
|
||||
|
||||
loadRemoteData: () => {
|
||||
// ...stuff...
|
||||
}
|
||||
});
|
||||
|
||||
App.View('ContactUs', {
|
||||
options: {
|
||||
route: 'contactus'
|
||||
},
|
||||
|
||||
routed: () => {
|
||||
alert('Navigated to ContactUs page!')
|
||||
}
|
||||
});
|
||||
|
||||
App.View('ContactUs', {
|
||||
options: {
|
||||
route: 'contactus'
|
||||
}
|
||||
});
|
||||
|
||||
App.View('Navigation', {
|
||||
navigateToContactUs: () => {
|
||||
this.route('contactus')
|
||||
}
|
||||
});
|
||||
}
|
||||
Vendored
+731
@@ -0,0 +1,731 @@
|
||||
// Type definitions for jsblocks v0.3.0
|
||||
// Project: http://jsblocks.com/
|
||||
// Definitions by: Krzysztof Śmigiel <https://github.com/ksmigiel>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/////////////////////////////////////////
|
||||
// blocks methods
|
||||
/////////////////////////////////////////
|
||||
|
||||
interface BlocksStatic {
|
||||
(obj: any): any;
|
||||
|
||||
/**
|
||||
* Performs a query operation on the DOM. Executes all data-query attributes
|
||||
* and renders the html result to the specified HTMLElement if not specified
|
||||
* uses document.body by default.
|
||||
*
|
||||
* @param model The model that will be used to query the DOM.
|
||||
*/
|
||||
query(model: any): void;
|
||||
/**
|
||||
* @param model The model that will be used to query the DOM.
|
||||
* @param element Optional element on which to execute the query.
|
||||
*/
|
||||
query(model: any, element: HTMLElement): void;
|
||||
|
||||
/**
|
||||
* Copies properties from all provided objects into the first object parameter
|
||||
*/
|
||||
extend(obj: Object, ...objects: any[]): void;
|
||||
|
||||
/**
|
||||
* Iterates over the collection
|
||||
*
|
||||
* @param collection The array or object to iterate over
|
||||
* @param callback The callback that will be executed for each element in the collection
|
||||
* @param thisArg Optional this context for the callback
|
||||
*/
|
||||
each(collection: any, callback: (value: any, index: any, collection: any) => void, thisArg?: any): void;
|
||||
|
||||
/**
|
||||
* Iterates over the collection from end to start
|
||||
*
|
||||
* @param collection The array or object to iterate over
|
||||
* @param callback The callback that will be executed for each element in the collection
|
||||
* @param thisArg Optional this context for the callback
|
||||
*/
|
||||
eachRight(collection: any, callback: (value: any, index: any, collection: any) => void, thisArg?: any): void;
|
||||
|
||||
/**
|
||||
* Determines if a value is an array.
|
||||
* Returns false for array like objects (for example arguments object).
|
||||
*
|
||||
* @param value The value to check if it is an array
|
||||
*/
|
||||
isArray(value: any): boolean;
|
||||
|
||||
/**
|
||||
* Represents a dummy empty function
|
||||
*/
|
||||
noop(): Function;
|
||||
|
||||
/**
|
||||
* Determines the true type of an object.
|
||||
* Returns the type of the value as a string.
|
||||
*
|
||||
* @param value The value for which to determine its type
|
||||
*/
|
||||
type(value: any): string;
|
||||
|
||||
/**
|
||||
* Determines if a specific value is the specified type
|
||||
*
|
||||
* @param value The value
|
||||
* @param type The type
|
||||
*/
|
||||
is(value: any, type: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks if a variable has the specified property. Uses hasOwnProperty internally
|
||||
*
|
||||
* @param obj The object to call hasOwnPrototype for
|
||||
* @param key The key to check if exists in the object
|
||||
*/
|
||||
has(obj: any, key: string): boolean;
|
||||
|
||||
/**
|
||||
* Unwraps a jsblocks value to its raw representation.
|
||||
* Unwraps blocks.observable() and blocks() values
|
||||
*
|
||||
* @param value The value that will be unwrapped
|
||||
*/
|
||||
unwrap(value: any): any;
|
||||
|
||||
/**
|
||||
* Converts a value to an array. Arguments object is converted to array and primitive values
|
||||
* are wrapped in an array.
|
||||
* Does nothing when value is already an array
|
||||
*
|
||||
* @param value The value to be converted to an array
|
||||
*/
|
||||
toArray(value: any): any[];
|
||||
|
||||
/**
|
||||
* Converts an integer or string to a unit. If the value could not be parsed to a number it is not converted
|
||||
*
|
||||
* @param value The value to be converted to the specified unit
|
||||
*/
|
||||
toUnit(value: any): any;
|
||||
/**
|
||||
* @param value The value to be converted to the specified unit
|
||||
* @param unit Optionally provide a unit to convert to. Default value is 'px'
|
||||
*/
|
||||
toUnit(value: any, unit: string): any;
|
||||
|
||||
/**
|
||||
* Clones value. If deepClone is set to true the value will be cloned recursively
|
||||
*
|
||||
* @param value Value/object to be cloned
|
||||
*/
|
||||
clone(value: any): any;
|
||||
/**
|
||||
* @param value Value/object to be cloned
|
||||
* @param deepClone By default false
|
||||
*/
|
||||
clone(value: any, deepClone: boolean): any;
|
||||
|
||||
/**
|
||||
* Determines if the specified value is a HTML elements collection.
|
||||
* Returns whether the value is elements collection.
|
||||
*
|
||||
* @param value The value to check if it is elements collection
|
||||
*/
|
||||
isElements(value: any): boolean;
|
||||
|
||||
/**
|
||||
* Determines if the specified value is a HTML element.
|
||||
* Returns whether the value is a HTML element.
|
||||
*
|
||||
* @param value The value to check if it is a HTML element
|
||||
*/
|
||||
isElement(value: any): boolean;
|
||||
|
||||
/**
|
||||
* Determines if a the specified value is a boolean.
|
||||
* Whether the value is a boolean or not.
|
||||
*
|
||||
* @param value The value to be checked if it is a boolean
|
||||
*/
|
||||
isBoolean(value: any): boolean;
|
||||
|
||||
/**
|
||||
* Determines if the specified value is an object.
|
||||
* Returns whether the value is an object.
|
||||
*
|
||||
* @param obj The value to check for if it is an object
|
||||
*/
|
||||
isObject(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Determines if a value is a object created using {} or new Object.
|
||||
* Whether the value is a plain object or not.
|
||||
*
|
||||
* @param obj The value that will be checked
|
||||
*/
|
||||
isPlainObject(obj: any): boolean;
|
||||
|
||||
/**
|
||||
* Changes the this binding to a function and optionally passes additional parameters to the function.
|
||||
* Returns the newly created function having the new this binding and optional arguments.
|
||||
*
|
||||
* @param func The function for which to change the this binding and optionally add arguments
|
||||
* @param thisArg The new this binding context value
|
||||
* @param args Optional arguments that will be passed to the function
|
||||
*/
|
||||
bind(func: Function, thisArg: any, ...args: any[]): Function;
|
||||
|
||||
/**
|
||||
* Determines if two values are deeply equal. Set deepEqual to false to stop recusively equality checking
|
||||
*
|
||||
* @param a The first object to be campared
|
||||
* @param b The second object to be compared
|
||||
*/
|
||||
equals(a: any, b: any): boolean;
|
||||
/**
|
||||
* @param a The first object to be campared
|
||||
* @param b The second object to be compared
|
||||
* @param deepEqual Determines if the equality check will recursively check all child properties
|
||||
*/
|
||||
equals(a: any, b: any, deepEqual: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Gets the context for a particular element. Searches all parents until it finds the context.
|
||||
*
|
||||
* @param element The element from which to search for a context
|
||||
*
|
||||
*/
|
||||
context(element: any): any;
|
||||
|
||||
/**
|
||||
* Gets the associated dataItem for a particlar element. Searches all parents until it finds the context
|
||||
*
|
||||
* @param element The element from which to search for a dataItem
|
||||
*/
|
||||
dataItem(element: any): any;
|
||||
|
||||
/**
|
||||
* Determines if particular value is an blocks.observable
|
||||
*
|
||||
* @param value The value to check if the value is observable
|
||||
*/
|
||||
isObservable(value: any): boolean;
|
||||
|
||||
/**
|
||||
* Gets the raw value of an observable or returns the value if the specified object is not an observable
|
||||
*
|
||||
* @param value The value that could be any object observable or not
|
||||
*/
|
||||
unwrapObservable(value: any): any;
|
||||
|
||||
route(route: string): BlocksStatic;
|
||||
|
||||
optional(param: string): BlocksStatic;
|
||||
optional(param: string, defaultValue: any): BlocksStatic;
|
||||
|
||||
range(start: number, end: number): BlocksStatic;
|
||||
|
||||
/**
|
||||
* Creates the server which will automatically handle server-side rendering.
|
||||
*/
|
||||
server(): { express(): any };
|
||||
/**
|
||||
* @param options Overrides default jsblocks options
|
||||
*/
|
||||
server(options: Server): { express(): any };
|
||||
|
||||
/**
|
||||
* Make observable property. You can specify initial value in parentheses.
|
||||
*/
|
||||
observable(): BlocksObservable;
|
||||
observable(value: any[]): BlocksArray;
|
||||
observable(value: any): BlocksObservable;
|
||||
|
||||
/**
|
||||
* Use blocks.Application and its MVC(Model-View-Collection) structure to create better architecture and maintainability for your application.
|
||||
*/
|
||||
Application(): App;
|
||||
Application(options: { history: string }): App;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// blocks observable
|
||||
/////////////////////////////////////////
|
||||
|
||||
interface BlocksObservable extends Extendable<BlocksObservable> {
|
||||
(arg: any): BlocksObservable;
|
||||
|
||||
/**
|
||||
* Updates all elements, expressions and dependencies where the observable is used
|
||||
*/
|
||||
update(): BlocksObservable;
|
||||
|
||||
/**
|
||||
* If event in prototype is not defined use this function instead.
|
||||
*
|
||||
* @param event Name of the event to raise
|
||||
* @param trigger Function to be called when event is fired
|
||||
*/
|
||||
on(event: string, trigger: Function): BlocksObservable;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// blocks array
|
||||
/////////////////////////////////////////
|
||||
|
||||
interface BlocksArray extends BlocksObservable {
|
||||
|
||||
/**
|
||||
* Updates all elements, expressions and dependencies where the observable is used
|
||||
*/
|
||||
update(): BlocksArray;
|
||||
|
||||
/**
|
||||
* Extends the current observable with particular functionality depending on the parameters specified.
|
||||
* If the method is called without arguments and jsvalue framework is included the observable will be
|
||||
* extended with the methods available in jsvalue for the current type.
|
||||
*
|
||||
* @param options Optional options
|
||||
*/
|
||||
extend(...options: any[]): BlocksArray;
|
||||
/**
|
||||
* @param name Name of the extender
|
||||
* @param options Optional options
|
||||
*/
|
||||
extend(name: string, ...options: any[]): BlocksArray;
|
||||
|
||||
/**
|
||||
* Removes all items from the collection and replaces them with the new value provided.
|
||||
* The value could be Array, observable array or jsvalue.Array
|
||||
*
|
||||
* @param value The new value that will be populated
|
||||
*/
|
||||
reset(value: any[]): BlocksArray;
|
||||
|
||||
/**
|
||||
* Adds values to the end of the observable array
|
||||
*
|
||||
* @param value The values that will be added to the end of the array
|
||||
*/
|
||||
add(value: any): BlocksArray;
|
||||
/**
|
||||
* @param value The values that will be added to the end of the array
|
||||
* @param index Optional index specifying where to insert the value
|
||||
*/
|
||||
add(value: any, index: number): BlocksArray;
|
||||
|
||||
/**
|
||||
* Adds the values from the provided array(s) to the end of the collection
|
||||
*
|
||||
* @param value The array that will be added to the end of the array
|
||||
*/
|
||||
addMany(value: any[]): BlocksArray;
|
||||
/**
|
||||
* @param value The array that will be added to the end of the array
|
||||
* @param index Optional position where the array of values to be inserted
|
||||
*/
|
||||
addMany(value: any[], index: number): BlocksArray;
|
||||
|
||||
/**
|
||||
* Swaps two values in the observable array. Note: Faster than removing the items and adding them at the locations
|
||||
*
|
||||
* @param indexA The first index that points to the index in the array that will be swapped
|
||||
* @param indexB The second index that points to the index in the array that will be swapped
|
||||
*/
|
||||
swap(indexA: number, indexB: number): BlocksArray;
|
||||
|
||||
/**
|
||||
* Moves an item from one location to another in the array. Note: Faster than removing the item and adding it at the location
|
||||
*
|
||||
* @param sourceIndex The index pointing to the item that will be moved
|
||||
* @param targetIndex The index where the item will be moved to
|
||||
*/
|
||||
move(sourceIndex: number, targetIndex: number): BlocksArray;
|
||||
|
||||
/**
|
||||
* Removes an item from the observable array
|
||||
*
|
||||
* @param value The value that will be removed or a callback function which returns true or false to determine if the value should be removed
|
||||
*/
|
||||
remove(value: any): BlocksArray;
|
||||
/**
|
||||
* @param value The value that will be removed or a callback function which returns true or false to determine if the value should be removed
|
||||
* @param thisArg Optional this context for the callback
|
||||
*/
|
||||
remove(value: any, thisArg: Function): BlocksArray;
|
||||
|
||||
/**
|
||||
* Removes an item at the specified index
|
||||
*
|
||||
* @param index The index location of the item that will be removed
|
||||
*/
|
||||
removeAt(index: number): BlocksArray;
|
||||
/**
|
||||
* @param index The index location of the item that will be removed
|
||||
* @param count Optional parameter that if specified will remove the next items starting from the specified index
|
||||
*/
|
||||
removeAt(index: number, count: number): BlocksArray;
|
||||
|
||||
/**
|
||||
* Removes all items from the observable array and optionally filter which items to be removed by providing a callback
|
||||
*/
|
||||
removeAll(): BlocksArray;
|
||||
/**
|
||||
* @param callback Optional callback function which filters which items to be removed. Returning a truthy value will remove the item and vice versa
|
||||
*/
|
||||
removeAll(callback: Function): BlocksArray;
|
||||
/**
|
||||
* @param callback Optional callback function which filters which items to be removed. Returning a truthy value will remove the item and vice versa
|
||||
* @param thisArg Optional this context for the callback function
|
||||
*/
|
||||
removeAll(callback: Function, thisArg: any): BlocksArray;
|
||||
|
||||
/**
|
||||
* The concat() method is used to join two or more arrays
|
||||
*
|
||||
* @param arrays The arrays to be joined
|
||||
*/
|
||||
concat(...arrays: any[]): any[]
|
||||
|
||||
/**
|
||||
* The slice() method returns the selected elements in an array, as a new array object
|
||||
*
|
||||
* @param start An integer that specifies where to start the selection (The first element has an index of 0)
|
||||
*/
|
||||
slice(start: number): any[];
|
||||
/**
|
||||
* @param start An integer that specifies where to start the selection (The first element has an index of 0)
|
||||
* @param end An integer that specifies where to end the selection. If omitted, all elements from the start position and to the end of the array will be selected.
|
||||
* Use negative numbers to select from the end of an array
|
||||
*/
|
||||
slice(start: number, end: number): any[];
|
||||
|
||||
/**
|
||||
* The join() method joins the elements of an array into a string, and returns the string
|
||||
*/
|
||||
join(): string;
|
||||
/**
|
||||
* @param separator The separator to be used. If omitted, the elements are separated with a comma
|
||||
*/
|
||||
join(seperator: string): string;
|
||||
|
||||
/**
|
||||
* The pop() method removes the last element of a observable array, and returns that element
|
||||
*/
|
||||
pop(): any;
|
||||
|
||||
/**
|
||||
* The push() method adds new items to the end of the observable array, and returns the new length
|
||||
*
|
||||
* @param values The item(s) to add to the observable array
|
||||
*/
|
||||
push(...values: any[]): number;
|
||||
|
||||
/**
|
||||
* Reverses the order of the elements in the observable array
|
||||
*/
|
||||
reverse(): any[];
|
||||
|
||||
/**
|
||||
* Removes the first element of a observable array, and returns that element
|
||||
*/
|
||||
shift(): any
|
||||
|
||||
/**
|
||||
* Sorts the elements of an array
|
||||
*/
|
||||
sort(): any[];
|
||||
/**
|
||||
* @param sortfunction A function that defines the sort order
|
||||
*/
|
||||
sort(sortfunction: Function): any[];
|
||||
|
||||
/**
|
||||
* Adds and/or removes elements from the observable array
|
||||
* Returns A new array containing the removed items, if any.
|
||||
*
|
||||
* @param index An integer that specifies at what position to add/remove items. Use negative values to specify the position from the end of the array.
|
||||
* @param howMany The number of items to be removed. If set to 0, no items will be removed.
|
||||
* @param items The new item(s) to be added to the array.
|
||||
*/
|
||||
splice(index: number, howMany: number, ...items: any[]): any[];
|
||||
|
||||
/**
|
||||
* The unshift() method adds new items to the beginning of an array, and returns the new length.
|
||||
*
|
||||
* @param items
|
||||
*/
|
||||
unshift(...items: any[]): number;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// blocks MVC App
|
||||
/////////////////////////////////////////
|
||||
|
||||
interface App extends Extendable<App> {
|
||||
|
||||
/**
|
||||
* Creates an application property for a Model.
|
||||
*/
|
||||
Property(): any;
|
||||
/**
|
||||
* @param options Configuration options for property
|
||||
*/
|
||||
Property(options: PropertyPrototype): any;
|
||||
|
||||
/**
|
||||
* Defines a view that will be part of the Application.
|
||||
*
|
||||
* @param name The name of the View you are creating
|
||||
* @param prototype The object that will represent the View
|
||||
*/
|
||||
View(name: string, prototype: ViewPrototype): any;
|
||||
/**
|
||||
* Defines a view that will be part of the Application.
|
||||
*
|
||||
* @param parentViewName Provide this parameter only if you are creating nested views. This is the name of the parent View
|
||||
* @param name The name of the View you are creating
|
||||
* @param prototype The object that will represent the View
|
||||
*/
|
||||
View(parentViewName: string, name: string, prototype: ViewPrototype): any;
|
||||
|
||||
/**
|
||||
* Creates a new Model
|
||||
*
|
||||
* @param prototype The Model object properties that will be created
|
||||
*/
|
||||
Model(prototype: ModelPrototype): Model;
|
||||
|
||||
/**
|
||||
* Creates a new Collection
|
||||
*
|
||||
* @param prototype The Collection object properties that will be created.
|
||||
*/
|
||||
Collection(prototype: CollectionPrototype): Collection;
|
||||
Collection(model: Model, prototype: CollectionPrototype): Collection;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// App.Property
|
||||
/////////////////////////////////////////
|
||||
|
||||
interface PropertyPrototype {
|
||||
defaultValue?: any;
|
||||
isObservable?: boolean;
|
||||
field?: string;
|
||||
value?: any;
|
||||
validateOnChange?: boolean;
|
||||
maxErrors?: number;
|
||||
validateInitially?: boolean
|
||||
|
||||
// Validators
|
||||
required?: Validator;
|
||||
minlength?: Validator;
|
||||
maxlength?: Validator;
|
||||
min?: Validator;
|
||||
max?: Validator;
|
||||
email?: Validator;
|
||||
url?: Validator;
|
||||
date?: Validator;
|
||||
creditcard?: Validator;
|
||||
regexp?: Validator;
|
||||
number?: Validator;
|
||||
digits?: Validator;
|
||||
letters?: Validator;
|
||||
equals?: Validator;
|
||||
}
|
||||
|
||||
interface Validator { }
|
||||
|
||||
/////////////////////////////////////////
|
||||
// App.View
|
||||
/////////////////////////////////////////
|
||||
|
||||
interface ViewPrototype {
|
||||
parentView?: any;
|
||||
|
||||
/**
|
||||
* Routes to a specific URL and actives the appropriate views associated with the URL
|
||||
*
|
||||
* @param name Name of the route
|
||||
*/
|
||||
route?(name: string): ViewPrototype;
|
||||
|
||||
|
||||
/**
|
||||
* Determines if the view is visible
|
||||
*/
|
||||
isActive?(): boolean;
|
||||
|
||||
/**
|
||||
* Override the init method to perform actions when the View is first created and shown on the page
|
||||
*/
|
||||
init?: Function;
|
||||
|
||||
/**
|
||||
* Override the routed method to perform actions when the View have routing and routing mechanism actives it.
|
||||
*/
|
||||
routed?: Function;
|
||||
|
||||
navigateTo?: Function;
|
||||
|
||||
/**
|
||||
* Override the ready method to perform actions when the DOM is ready and
|
||||
* all data-query have been executed.
|
||||
*/
|
||||
ready?: Function;
|
||||
|
||||
options?: {
|
||||
route?: any;
|
||||
url?: string
|
||||
};
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// App.Model
|
||||
/////////////////////////////////////////
|
||||
|
||||
interface Model {
|
||||
(): Model;
|
||||
(props: Object): Model;
|
||||
|
||||
/**
|
||||
* Fires a request to the server to populate the Model based on the read URL specified
|
||||
*/
|
||||
read(): Model;
|
||||
/**
|
||||
* @param params The parameters Object that will be used to populate the Model from the specified options.read URL. If the URL does not contain parameters
|
||||
*/
|
||||
read(params: Object): Model;
|
||||
|
||||
/**
|
||||
* Synchronizes the changes with the server by sending requests to the provided URL's
|
||||
*/
|
||||
sync(): Model;
|
||||
}
|
||||
|
||||
interface ModelPrototype {
|
||||
|
||||
/**
|
||||
* Override the init method to perform actions on creation for each Model instance
|
||||
*/
|
||||
init?: Function;
|
||||
|
||||
/**
|
||||
* Validates all observable properties that have validation and returns true if all values are valid otherwise returns false
|
||||
*/
|
||||
validate?(): boolean;
|
||||
|
||||
/**
|
||||
* Extracts the raw(non observable) dataItem object values from the Model
|
||||
*/
|
||||
dataItem?(): Object;
|
||||
|
||||
/**
|
||||
* Applies new properties to the Model by providing an Object
|
||||
*
|
||||
* @param dataItem The object from which the new values will be applied
|
||||
*/
|
||||
reset?(dataItem: ModelPrototype): ModelPrototype;
|
||||
|
||||
/**
|
||||
* Determines whether the instance is new. If true when syncing the item will send for insertion instead of updating it.
|
||||
* The check is determined by the idAttr value specified in the options. If idAttr is not specified the item will always be considered new.
|
||||
*
|
||||
*/
|
||||
isNew?(): boolean;
|
||||
|
||||
options?: {
|
||||
idAttr?: string;
|
||||
baseUrl?: string;
|
||||
read?: { url?: string };
|
||||
create?: { url?: string };
|
||||
destroy?: { url?: string };
|
||||
update?: { url?: string };
|
||||
};
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
// App.Collection
|
||||
/////////////////////////////////////////
|
||||
|
||||
interface Collection extends Extendable<Collection> {
|
||||
(): Collection;
|
||||
(props: Object[]): Collection;
|
||||
|
||||
/**
|
||||
* Fires a request to the server to populate the Model based on the read URL specified
|
||||
*/
|
||||
read(): Collection;
|
||||
/**
|
||||
* @param params The parameters Object that will be used to populate the Collection from the specified options.read URL. If the URL does not contain parameters
|
||||
*/
|
||||
read(params: Object): Collection;
|
||||
|
||||
/**
|
||||
* Clear all changes made to the collection
|
||||
*/
|
||||
clearChanges(): Collection;
|
||||
|
||||
/**
|
||||
* Performs an ajax request for all create, update and delete operations in order to sync them with a database.
|
||||
*/
|
||||
sync(): Collection;
|
||||
|
||||
update(id: number, newValues: Object): Collection;
|
||||
}
|
||||
|
||||
interface CollectionPrototype {
|
||||
options?: {
|
||||
read?: { url?: string };
|
||||
create?: { url?: string };
|
||||
destroy?: { url?: string };
|
||||
update?: { url?: string };
|
||||
};
|
||||
}
|
||||
|
||||
interface Extendable<T> {
|
||||
|
||||
/**
|
||||
* Extends the current observable with particular functionality depending on the parameters specified.
|
||||
* If the method is called without arguments and jsvalue framework is included the observable will be
|
||||
* extended with the methods available in jsvalue for the current type.
|
||||
*
|
||||
* @param name Name of the extender
|
||||
* @param options Optional options
|
||||
*/
|
||||
extend(name?: string, ...options: any[]): T;
|
||||
extend(arg: any): T;
|
||||
}
|
||||
|
||||
interface Server {
|
||||
|
||||
/**
|
||||
* The port at which your application will be run
|
||||
*/
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* The folder where your application files like .html; .js and .css are going to be.
|
||||
* The value is passed to express.static() middleware.
|
||||
*/
|
||||
static?: string;
|
||||
|
||||
/**
|
||||
* Caches pages result instead of executing them each time.
|
||||
* Disabling cache could impact performance.
|
||||
*/
|
||||
cache?: boolean;
|
||||
|
||||
/**
|
||||
* Provide an express middleware function or an array of middleware functions.
|
||||
* Use: [compression(); bodyParser()]
|
||||
*/
|
||||
use?: any;
|
||||
}
|
||||
|
||||
declare var blocks: BlocksStatic;
|
||||
|
||||
declare module "blocks" {
|
||||
export = blocks;
|
||||
}
|
||||
@@ -219,6 +219,11 @@ barProm = fooProm.then((value: Foo) => {
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = barProm.then((value: Bar) => {
|
||||
if (value) return value;
|
||||
var b:Bar;
|
||||
return Promise.resolve(b);
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
Vendored
+4
-8
@@ -26,10 +26,8 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
/**
|
||||
* Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
|
||||
*/
|
||||
then<U>(onFulfill: (value: R) => Promise.Thenable<U>, onReject: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => Promise.Thenable<U>, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => U, onReject: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill?: (value: R) => U, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => U|Promise.Thenable<U>, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
@@ -633,10 +631,8 @@ declare module Promise {
|
||||
export function OperationalError(): OperationalError;
|
||||
|
||||
export interface Thenable<R> {
|
||||
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected?: (error: any) => U): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U|Thenable<U>, onRejected?: (error: any) => U): Thenable<U>;
|
||||
}
|
||||
|
||||
export interface Resolver<R> {
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="bootstrap-slider.d.ts" />
|
||||
|
||||
$(function() {
|
||||
// examples from http://seiyria.github.io/bootstrap-slider/
|
||||
|
||||
$('#ex1').slider({
|
||||
formatter: function(value) {
|
||||
return 'Current value: ' + value;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex2").slider({});
|
||||
|
||||
var RGBChange = function() {
|
||||
$('#RGB').css('background', 'rgb('+r.getValue()+','+g.getValue()+','+b.getValue()+')')
|
||||
};
|
||||
|
||||
var r = $('#R').slider()
|
||||
.on('slide', RGBChange)
|
||||
.data('slider');
|
||||
var g = $('#G').slider()
|
||||
.on('slide', RGBChange)
|
||||
.data('slider');
|
||||
var b = $('#B').slider()
|
||||
.on('slide', RGBChange)
|
||||
.data('slider');
|
||||
|
||||
|
||||
|
||||
$("#ex4").slider({
|
||||
reversed : true
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex5").slider();
|
||||
|
||||
$("#destroyEx5Slider").click(function() {
|
||||
$("#ex5").slider('destroy');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex6").slider();
|
||||
$("#ex6").on("slide", function(slideEvt) {
|
||||
$("#ex6SliderVal").text(<number>slideEvt.value);
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex7").slider();
|
||||
|
||||
$("#ex7-enabled").click(function() {
|
||||
if(this.checked) {
|
||||
// With JQuery
|
||||
$("#ex7").slider("enable");
|
||||
}
|
||||
else {
|
||||
// With JQuery
|
||||
$("#ex7").slider("disable");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex8").slider({
|
||||
tooltip: 'always'
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex9").slider({
|
||||
precision: 2,
|
||||
value: 8.115 // Slider will instantiate showing 8.12 due to specified precision
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex11").slider({step: 20000, min: 0, max: 200000});
|
||||
|
||||
|
||||
|
||||
$("#ex12a").slider({ id: "slider12a", min: 0, max: 10, value: 5 });
|
||||
$("#ex12b").slider({ id: "slider12b", min: 0, max: 10, range: true, value: [3, 7] });
|
||||
$("#ex12c").slider({ id: "slider12c", min: 0, max: 10, range: true, value: [3, 7] });
|
||||
|
||||
|
||||
|
||||
$("#ex13").slider({
|
||||
ticks: [0, 100, 200, 300, 400],
|
||||
ticks_labels: ['$0', '$100', '$200', '$300', '$400'],
|
||||
ticks_snap_bounds: 30
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex14").slider({
|
||||
ticks: [0, 100, 200, 300, 400],
|
||||
ticks_positions: [0, 30, 60, 70, 90, 100],
|
||||
ticks_labels: ['$0', '$100', '$200', '$300', '$400'],
|
||||
ticks_snap_bounds: 30
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex15").slider({
|
||||
min: 1000,
|
||||
max: 10000000,
|
||||
scale: 'logarithmic',
|
||||
step: 10
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#ex16a").slider({ min: 0, max: 10, value: 0, focus: true });
|
||||
$("#ex16b").slider({ min: 0, max: 10, value: [0, 10], focus: true });
|
||||
});
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
// Type definitions for bootstrap-slider.js 4.8.3
|
||||
// Project: https://github.com/seiyria/bootstrap-slider
|
||||
// Definitions by: Daniel Beckwith <https://github.com/dbeckwith>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface SliderOptions {
|
||||
/**
|
||||
* Default: ''
|
||||
* set the id of the slider element when it's created
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* Default: 0
|
||||
* minimum possible value
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* Default: 10
|
||||
* maximum possible value
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* Default: 1
|
||||
* increment step
|
||||
*/
|
||||
step?: number;
|
||||
/**
|
||||
* Default: number of digits after the decimal of step value
|
||||
* The number of digits shown after the decimal. Defaults to the number of digits after the decimal of step value.
|
||||
*/
|
||||
precision?: number;
|
||||
/**
|
||||
* Default: 'horizontal'
|
||||
* set the orientation. Accepts 'vertical' or 'horizontal'
|
||||
*/
|
||||
orientation?: number;
|
||||
/**
|
||||
* Default: 5
|
||||
* initial value. Use array to have a range slider.
|
||||
*/
|
||||
value?: number|number[];
|
||||
/**
|
||||
* Default: false
|
||||
* make range slider. Optional if initial value is an array. If initial value is scalar, max will be used for second value.
|
||||
*/
|
||||
range?: boolean;
|
||||
/**
|
||||
* Default: 'before'
|
||||
* selection placement. Accepts: 'before', 'after' or 'none'. In case of a range slider, the selection will be placed between the handles
|
||||
*/
|
||||
selection?: string;
|
||||
/**
|
||||
* Default: 'show'
|
||||
* whether to show the tooltip on drag, hide the tooltip, or always show the tooltip. Accepts: 'show', 'hide', or 'always'
|
||||
*/
|
||||
tooltip?: string;
|
||||
/**
|
||||
* Default: false
|
||||
* if false show one tootip if true show two tooltips one for each handler
|
||||
*/
|
||||
tooltip_split?: boolean;
|
||||
/**
|
||||
* Default: 'round'
|
||||
* handle shape. Accepts: 'round', 'square', 'triangle' or 'custom'
|
||||
*/
|
||||
handle?: string;
|
||||
/**
|
||||
* Default: false
|
||||
* whether or not the slider should be reversed
|
||||
*/
|
||||
reversed?: boolean;
|
||||
/**
|
||||
* Default: true
|
||||
* whether or not the slider is initially enabled
|
||||
*/
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* Default: returns the plain value
|
||||
* formatter callback. Return the value wanted to be displayed in the tooltip
|
||||
* @param val the current value to display
|
||||
*/
|
||||
formatter?(val:number): string;
|
||||
/**
|
||||
* Default: false
|
||||
* The natural order is used for the arrow keys. Arrow up select the upper slider value for vertical sliders, arrow right the righter slider value for a horizontal slider - no matter if the slider was reversed or not. By default the arrow keys are oriented by arrow up/right to the higher slider value, arrow down/left to the lower slider value.
|
||||
*/
|
||||
natural_arrow_keys?: boolean;
|
||||
/**
|
||||
* Default: [ ]
|
||||
* Used to define the values of ticks. Tick marks are indicators to denote special values in the range. This option overwrites min and max options.
|
||||
*/
|
||||
ticks?: number[];
|
||||
/**
|
||||
* Default: [ ]
|
||||
* Defines the positions of the tick values in percentages. The first value should alwasy be 0, the last value should always be 100 percent.
|
||||
*/
|
||||
ticks_positions?: number[];
|
||||
/**
|
||||
* Default: [ ]
|
||||
* Defines the labels below the tick marks. Accepts HTML input.
|
||||
*/
|
||||
ticks_labels?: string[];
|
||||
/**
|
||||
* Default: 0
|
||||
* Used to define the snap bounds of a tick. Snaps to the tick if value is within these bounds.
|
||||
*/
|
||||
ticks_snap_bounds?: number;
|
||||
/**
|
||||
* Default: 'linear'
|
||||
* Set to 'logarithmic' to use a logarithmic scale.
|
||||
*/
|
||||
scale?: string;
|
||||
/**
|
||||
* Default: false
|
||||
* Focus the appropriate slider handle after a value change.
|
||||
*/
|
||||
focus?: boolean;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Creates a slider from the current element.
|
||||
* @param options
|
||||
*/
|
||||
slider(options?:SliderOptions): JQuery;
|
||||
slider(methodName:string, ...args:any[]): JQuery;
|
||||
}
|
||||
|
||||
interface ChangeValue {
|
||||
oldValue: number;
|
||||
newValue: number;
|
||||
}
|
||||
|
||||
interface JQueryEventObject {
|
||||
value: number|ChangeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is actually not used when using the jQuery version of bootstrap-slider
|
||||
* The method documentation is still here thouh.
|
||||
* When using jQuery, slider methods like setValue(3, true) have to be called like $slider.slider('setValue', 3, true)
|
||||
*/
|
||||
interface Slider extends JQuery {
|
||||
/**
|
||||
* Get the current value from the slider
|
||||
*/
|
||||
getValue(): number;
|
||||
/**
|
||||
* Set a new value for the slider. If optional triggerSlideEvent parameter is true, 'slide' events will be triggered. If optional triggerChangeEvent parameter is true, 'change' events will be triggered.
|
||||
* @param newValue
|
||||
* @param triggerSlideEvent
|
||||
* @param triggerChangeEvent
|
||||
*/
|
||||
setValue(newValue:number, triggerSlideEvent?:boolean, triggerChangeEvent?:boolean): void;
|
||||
/**
|
||||
* Properly clean up and remove the slider instance
|
||||
*/
|
||||
destroy(): void;
|
||||
/**
|
||||
* Disables the slider and prevents the user from changing the value
|
||||
*/
|
||||
disable(): void;
|
||||
/**
|
||||
* Enables the slider
|
||||
*/
|
||||
enable(): void;
|
||||
/**
|
||||
* Returns true if enabled, false if disabled
|
||||
*/
|
||||
isEnabled(): boolean;
|
||||
/**
|
||||
* Updates the slider's attributes
|
||||
* @param attribute
|
||||
* @param value
|
||||
*/
|
||||
setAttribute(attribute:string, value:any): void;
|
||||
/**
|
||||
* Get the slider's attributes
|
||||
* @param attribute
|
||||
*/
|
||||
getAttribute(attribute:string): any;
|
||||
/**
|
||||
* Refreshes the current slider
|
||||
*/
|
||||
refresh(): void;
|
||||
/**
|
||||
* Renders the tooltip again, after initialization. Useful in situations when the slider and tooltip are initially hidden.
|
||||
*/
|
||||
relayout(): void;
|
||||
on: {
|
||||
(eventType:string, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider;
|
||||
(eventType:string, data:any, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider;
|
||||
(eventType:string, selector:string, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider;
|
||||
(eventType:string, selector:string, data:any, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider;
|
||||
(eventType:{ [key: string]: any; }, selector?:string, data?:any): Slider;
|
||||
(eventType:{ [key: string]: any; }, data?:any): Slider;
|
||||
}
|
||||
}
|
||||
@@ -70,3 +70,13 @@ evt.on("init", function () {
|
||||
});
|
||||
|
||||
browserSync(config);
|
||||
|
||||
var bs = browserSync.create();
|
||||
|
||||
bs.init({
|
||||
server: "./app"
|
||||
});
|
||||
|
||||
bs.reload();
|
||||
|
||||
|
||||
|
||||
Vendored
+102
-85
@@ -3,96 +3,113 @@
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../chokidar/chokidar.d.ts"/>
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "browser-sync" {
|
||||
import chokidar = require("chokidar");
|
||||
import fs = require("fs");
|
||||
import http = require("http");
|
||||
|
||||
function BrowserSync(config?: BrowserSync.Options, callback?: (err: Error, bs: Object) => any): void;
|
||||
|
||||
module BrowserSync {
|
||||
export function reload(): void;
|
||||
export function reload(file: string): void;
|
||||
export function reload(files: string[]): void;
|
||||
export function reload(options: {stream: boolean}): NodeJS.ReadWriteStream;
|
||||
|
||||
export function notify(message: string, timeout?: number): void;
|
||||
|
||||
export function exit(): void;
|
||||
|
||||
export var active: boolean;
|
||||
|
||||
export var emitter: NodeJS.EventEmitter;
|
||||
|
||||
interface Options {
|
||||
files?: string | string[];
|
||||
watchOptions?: GazeOptions;
|
||||
server?: ServerOptions;
|
||||
proxy?: string | boolean;
|
||||
port?: number;
|
||||
https?: boolean;
|
||||
ghostMode?: GhostOptions | boolean;
|
||||
logLevel?: string;
|
||||
logPrefix?: string;
|
||||
logConnections?: boolean;
|
||||
logFileChanges?: boolean;
|
||||
logSnippet?: boolean;
|
||||
snippetOptions?: SnippetOptions;
|
||||
tunnel?: string | boolean;
|
||||
online?: boolean;
|
||||
open?: string | boolean;
|
||||
browser?: string | string[];
|
||||
xip?: boolean;
|
||||
notify?: boolean;
|
||||
scrollProportionally?: boolean;
|
||||
scrollThrottle?: number;
|
||||
reloadDelay?: number;
|
||||
injectChanges?: boolean;
|
||||
startPath?: string;
|
||||
minify?: boolean;
|
||||
host?: string;
|
||||
codeSync?: boolean;
|
||||
timestamps?: boolean;
|
||||
scriptPath?: (path: string) => string;
|
||||
socket?: SocketOptions;
|
||||
}
|
||||
|
||||
interface GazeOptions {
|
||||
interval?: number;
|
||||
debounceDelay?: number;
|
||||
mode?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
baseDir?: string | string[];
|
||||
directory?: boolean;
|
||||
index?: string;
|
||||
routes?: {[path: string]: string};
|
||||
middleware?: MiddlewareHandler[];
|
||||
}
|
||||
|
||||
interface MiddlewareHandler {
|
||||
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
|
||||
}
|
||||
|
||||
interface GhostOptions {
|
||||
clicks?: boolean;
|
||||
scroll?: boolean;
|
||||
forms?: boolean;
|
||||
}
|
||||
|
||||
interface SnippetOptions {
|
||||
ignorePaths?: string;
|
||||
rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any};
|
||||
}
|
||||
|
||||
interface SocketOptions {
|
||||
path?: string;
|
||||
clientPath?: string;
|
||||
namespace?: string;
|
||||
}
|
||||
interface Options {
|
||||
files?: string | string[];
|
||||
watchOptions?: GazeOptions;
|
||||
server?: ServerOptions;
|
||||
proxy?: string | boolean;
|
||||
port?: number;
|
||||
https?: boolean;
|
||||
ghostMode?: GhostOptions | boolean;
|
||||
logLevel?: string;
|
||||
logPrefix?: string;
|
||||
logConnections?: boolean;
|
||||
logFileChanges?: boolean;
|
||||
logSnippet?: boolean;
|
||||
snippetOptions?: SnippetOptions;
|
||||
rewriteRules?: boolean | RewriteRules[];
|
||||
tunnel?: string | boolean;
|
||||
online?: boolean;
|
||||
open?: string | boolean;
|
||||
browser?: string | string[];
|
||||
xip?: boolean;
|
||||
notify?: boolean;
|
||||
scrollProportionally?: boolean;
|
||||
scrollThrottle?: number;
|
||||
reloadDelay?: number;
|
||||
reloadDebounce?: number;
|
||||
plugins?: any[];
|
||||
injectChanges?: boolean;
|
||||
startPath?: string;
|
||||
minify?: boolean;
|
||||
host?: string;
|
||||
codeSync?: boolean;
|
||||
timestamps?: boolean;
|
||||
scriptPath?: (path: string) => string;
|
||||
socket?: SocketOptions;
|
||||
}
|
||||
|
||||
export = BrowserSync;
|
||||
interface GazeOptions {
|
||||
interval?: number;
|
||||
debounceDelay?: number;
|
||||
mode?: string;
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
interface ServerOptions {
|
||||
baseDir?: string | string[];
|
||||
directory?: boolean;
|
||||
index?: string;
|
||||
routes?: {[path: string]: string};
|
||||
middleware?: MiddlewareHandler[];
|
||||
}
|
||||
|
||||
interface MiddlewareHandler {
|
||||
(req: http.ServerRequest, res: http.ServerResponse, next: Function): any;
|
||||
}
|
||||
|
||||
interface GhostOptions {
|
||||
clicks?: boolean;
|
||||
scroll?: boolean;
|
||||
forms?: boolean;
|
||||
}
|
||||
|
||||
interface SnippetOptions {
|
||||
ignorePaths?: string;
|
||||
rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any};
|
||||
}
|
||||
|
||||
interface SocketOptions {
|
||||
path?: string;
|
||||
clientPath?: string;
|
||||
namespace?: string;
|
||||
}
|
||||
|
||||
interface RewriteRules {
|
||||
match: RegExp;
|
||||
fn: (match: string) => string;
|
||||
}
|
||||
|
||||
interface BrowserSync {
|
||||
init(config?: Options, callback?: (err: Error, bs: Object) => any): void;
|
||||
reload(): void;
|
||||
reload(file: string): void;
|
||||
reload(files: string[]): void;
|
||||
reload(options: {stream: boolean}): NodeJS.ReadWriteStream;
|
||||
notify(message: string, timeout?: number): void;
|
||||
exit(): void;
|
||||
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any): NodeJS.EventEmitter;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
emitter: NodeJS.EventEmitter;
|
||||
active: boolean;
|
||||
paused: boolean;
|
||||
}
|
||||
|
||||
interface Exports extends BrowserSync {
|
||||
create(): BrowserSync;
|
||||
(config?: Options, callback?: (err: Error, bs: Object) => any): void;
|
||||
}
|
||||
|
||||
var browserSync: Exports;
|
||||
|
||||
export = browserSync;
|
||||
}
|
||||
|
||||
+19
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for bunyan-prettystream
|
||||
// Type definitions for bunyan-prettystream 0.1.3
|
||||
// Project: https://www.npmjs.com/package/bunyan-prettystream
|
||||
// Definitions by: Jason Swearingen <https://github.com/jasonswearingen/>
|
||||
// Definitions by: Jason Swearingen <https://github.com/jasonswearingen/>, Vadim Macagon <https://github.com/enlight/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
@@ -8,7 +8,23 @@
|
||||
declare module "bunyan-prettystream" {
|
||||
import stream = require("stream");
|
||||
class PrettyStream extends stream.Writable {
|
||||
public pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
/**
|
||||
* @param options.mode Output format, can be either `long`, `short`, or `dev`,
|
||||
* defaults to `long`.
|
||||
* @param options.useColor Indicates whether or not output should be colored,
|
||||
* defaults to `true`.
|
||||
*/
|
||||
constructor(options?: { mode?: string; useColor?: boolean });
|
||||
|
||||
/**
|
||||
* Pipes data from this stream to another.
|
||||
*
|
||||
* @param destination Stream to write data to.
|
||||
* @param options.end Indicates whether `end()` should be called on the `destination`
|
||||
* stream when this stream emits `end`, defaults to `true`.
|
||||
* @return The `destination` stream.
|
||||
*/
|
||||
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
|
||||
}
|
||||
export = PrettyStream;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
/// <reference path="chai-as-promised.d.ts" />
|
||||
|
||||
import chai = require('chai');
|
||||
@@ -6,9 +5,11 @@ import chaiAsPromised = require('chai-as-promised');
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
|
||||
// ReSharper disable WrongExpressionStatement
|
||||
var promise: any;
|
||||
chai.expect(promise).to.eventually.equal(3);
|
||||
chai.expect(promise).to.become(3);
|
||||
chai.expect(promise).to.be.fulfilled;
|
||||
chai.expect(promise).to.be.rejected;
|
||||
chai.expect(promise).to.be.rejectedWith(Error);
|
||||
chai.expect(promise).to.notify(() => console.log('done'));
|
||||
|
||||
+11
-10
@@ -6,21 +6,22 @@
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
|
||||
declare module 'chai-as-promised' {
|
||||
import chai = require('chai');
|
||||
|
||||
function chaiAsPromised(chai: any, utils: any): void;
|
||||
|
||||
export = chaiAsPromised;
|
||||
}
|
||||
|
||||
declare module chai {
|
||||
declare module Chai {
|
||||
|
||||
interface Assertion {
|
||||
become(expected: any): Assertion;
|
||||
fulfilled: Assertion;
|
||||
rejected: Assertion;
|
||||
rejectedWith(expected: any): Assertion;
|
||||
notify(fn: Function): Assertion;
|
||||
}
|
||||
|
||||
interface LanguageChains {
|
||||
become(expected: any): Expect;
|
||||
eventually: Expect;
|
||||
rejected: Expect;
|
||||
rejectedWith(expected: any): Expect;
|
||||
notify(fn: Function): Expect;
|
||||
eventually: Assertion;
|
||||
}
|
||||
|
||||
interface Assert {
|
||||
@@ -32,4 +33,4 @@ declare module chai {
|
||||
isRejected(promise: any, expected: any, message?: string): void;
|
||||
isRejected(promise: any, match: RegExp, message?: string): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
/// <reference path="chai-datetime.d.ts" />
|
||||
|
||||
import chai = require('chai');
|
||||
import chaiDateTime = require('chai-datetime');
|
||||
|
||||
chai.use(chaiDateTime);
|
||||
var expect = chai.expect;
|
||||
var assert = chai.assert;
|
||||
|
||||
function test_equalTime(){
|
||||
var date: Date = new Date(2014, 1, 1);
|
||||
expect(date).to.be.equalTime(date);
|
||||
date.should.be.equalTime(date);
|
||||
expect(date).to.equalTime(date);
|
||||
date.should.equalTime(date);
|
||||
assert.equalTime(date, date);
|
||||
}
|
||||
|
||||
@@ -34,14 +37,14 @@ function test_equalDate(){
|
||||
|
||||
function test_beforeDate(){
|
||||
var date: Date = new Date(2014, 1, 1);
|
||||
expect(date).to.beforeDate(date);
|
||||
date.should.beforeDate(date);
|
||||
expect(date).to.be.beforeDate(date);
|
||||
date.should.be.beforeDate(date);
|
||||
assert.beforeDate(date, date);
|
||||
}
|
||||
|
||||
function test_afterDate(){
|
||||
var date: Date = new Date(2014, 1, 1);
|
||||
expect(date).to.afterDate(date);
|
||||
date.should.afterDate(date);
|
||||
expect(date).to.be.afterDate(date);
|
||||
date.should.be.afterDate(date);
|
||||
assert.afterDate(date, date);
|
||||
}
|
||||
|
||||
Vendored
+29
-26
@@ -5,35 +5,38 @@
|
||||
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
|
||||
declare module chai {
|
||||
declare module Chai {
|
||||
|
||||
interface Expect {
|
||||
afterDate(date: Date): boolean;
|
||||
beforeDate(date: Date): boolean;
|
||||
equalDate(date: Date): boolean;
|
||||
interface Assertion {
|
||||
afterDate(date: Date): Assertion;
|
||||
beforeDate(date: Date): Assertion;
|
||||
equalDate(date: Date): Assertion;
|
||||
afterTime(date: Date): Assertion;
|
||||
beforeTime(date: Date): Assertion;
|
||||
equalTime(date: Date): Assertion;
|
||||
}
|
||||
|
||||
afterTime(date: Date): boolean;
|
||||
beforeTime(date: Date): boolean;
|
||||
equalTime(date: Date): boolean;
|
||||
}
|
||||
|
||||
interface Assert {
|
||||
equalTime(val: Date, exp: Date, msg?: string): boolean;
|
||||
notEqualTime(val: Date, exp: Date, msg?: string): boolean;
|
||||
beforeTime(val: Date, exp: Date, msg?: string): boolean;
|
||||
notBeforeTime(val: Date, exp: Date, msg?: string): boolean;
|
||||
afterTime(val: Date, exp: Date, msg?: string): boolean;
|
||||
notAfterTime(val: Date, exp: Date, msg?: string): boolean;
|
||||
|
||||
equalDate(val: Date, exp: Date, msg?: string): boolean;
|
||||
notEqualDate(val: Date, exp: Date, msg?: string): boolean;
|
||||
beforeDate(val: Date, exp: Date, msg?: string): boolean;
|
||||
notBeforeDate(val: Date, exp: Date, msg?: string): boolean;
|
||||
afterDate(val: Date, exp: Date, msg?: string): boolean;
|
||||
notAfterDate(val: Date, exp: Date, msg?: string): boolean;
|
||||
}
|
||||
interface Assert {
|
||||
equalTime(val: Date, exp: Date, msg?: string): void;
|
||||
notEqualTime(val: Date, exp: Date, msg?: string): void;
|
||||
beforeTime(val: Date, exp: Date, msg?: string): void;
|
||||
notBeforeTime(val: Date, exp: Date, msg?: string): void;
|
||||
afterTime(val: Date, exp: Date, msg?: string): void;
|
||||
notAfterTime(val: Date, exp: Date, msg?: string): void;
|
||||
equalDate(val: Date, exp: Date, msg?: string): void;
|
||||
notEqualDate(val: Date, exp: Date, msg?: string): void;
|
||||
beforeDate(val: Date, exp: Date, msg?: string): void;
|
||||
notBeforeDate(val: Date, exp: Date, msg?: string): void;
|
||||
afterDate(val: Date, exp: Date, msg?: string): void;
|
||||
notAfterDate(val: Date, exp: Date, msg?: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
interface Date {
|
||||
should: chai.Expect;
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
|
||||
declare module "chai-datetime" {
|
||||
function chaiDateTime(chai: any, utils: any): void;
|
||||
export = chaiDateTime;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/// <reference path="chai-fuzzy.d.ts" />
|
||||
|
||||
// tests taken from http://chaijs.com/plugins/chai-fuzzy
|
||||
|
||||
import chai = require('chai');
|
||||
import chaiFuzzy = require('chai-fuzzy');
|
||||
|
||||
chai.use(chaiFuzzy);
|
||||
var expect = chai.expect;
|
||||
var assert = chai.assert;
|
||||
|
||||
/**
|
||||
* compare object attributes and values rather than checking to see if they're the same reference
|
||||
*/
|
||||
function like() {
|
||||
var subject = { a: 'a' };
|
||||
|
||||
expect(subject).to.be.like({ a: 'a' });
|
||||
expect(subject).not.to.be.like({ x: 'x' });
|
||||
expect(subject).not.to.be.like({ a: 'a', b: 'b' });
|
||||
|
||||
assert.like(subject, { a: 'a' });
|
||||
assert.notLike(subject, { x: 'x' });
|
||||
assert.notLike(subject, { a: 'a', b: 'b' });
|
||||
|
||||
var subject2 = ['a'];
|
||||
|
||||
expect(subject2).to.be.like(['a']);
|
||||
expect(subject2).not.to.be.like(['x']);
|
||||
expect(subject2).not.to.be.like(['a', 'b']);
|
||||
|
||||
assert.like(subject2, ['a']);
|
||||
assert.notLike(subject2, ['x']);
|
||||
assert.notLike(subject2, ['a', 'b']);
|
||||
}
|
||||
Vendored
+67
-8
@@ -5,13 +5,72 @@
|
||||
|
||||
///<reference path="../chai/chai.d.ts" />
|
||||
|
||||
declare module chai {
|
||||
interface Assert {
|
||||
like(act:any, exp:any, msg?:string);
|
||||
notLike(act:any, exp:any, msg?:string);
|
||||
containOneLike(act:any, exp:any, msg?:string);
|
||||
notContainOneLike(act:any, exp:any, msg?:string);
|
||||
jsonOf(act:any, exp:any, msg?:string);
|
||||
notJsonOf(act:any, exp:any, msg?:string);
|
||||
declare module Chai {
|
||||
|
||||
interface Assertion {
|
||||
/**
|
||||
* Compare object attributes and values rather than checking to see if
|
||||
* they're the same reference.
|
||||
*/
|
||||
like(expected: any, message?: string): Assertion;
|
||||
/**
|
||||
* Compare object attributes and values rather than checking to see if
|
||||
* they're the same reference.
|
||||
*/
|
||||
notLike(expected: any, message?: string): Assertion;
|
||||
/**
|
||||
* Check the first level of the container for a value like the one provided.
|
||||
*/
|
||||
containOneLike(expected: any, message?: string): Assertion;
|
||||
/**
|
||||
* Check the first level of the container for a value like the one provided.
|
||||
*/
|
||||
notContainOneLike(expected: any, message?: string): Assertion;
|
||||
/**
|
||||
* Check that the given javascript object is like the JSON-ified expected
|
||||
* value. Useful for checking stringification and parsing of an object.
|
||||
*/
|
||||
jsonOf(expected: any, message?: string): Assertion;
|
||||
/**
|
||||
* Check that the given javascript object is like the JSON-ified expected
|
||||
* value. Useful for checking stringification and parsing of an object.
|
||||
*/
|
||||
notJsonOf(expected: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
export interface Assert {
|
||||
/**
|
||||
* Compare object attributes and values rather than checking to see if
|
||||
* they're the same reference.
|
||||
*/
|
||||
like(actual: any, expected: any, message?: string): void;
|
||||
/**
|
||||
* Compare object attributes and values rather than checking to see if
|
||||
* they're the same reference.
|
||||
*/
|
||||
notLike(actual: any, expected: any, message?: string): void;
|
||||
/**
|
||||
* Check the first level of the container for a value like the one provided.
|
||||
*/
|
||||
containOneLike(actual: any, expected: any, message?: string): void;
|
||||
/**
|
||||
* Check the first level of the container for a value like the one provided.
|
||||
*/
|
||||
notContainOneLike(actual: any, expected: any, message?: string): void;
|
||||
/**
|
||||
* Check that the given javascript object is like the JSON-ified expected
|
||||
* value. Useful for checking stringification and parsing of an object.
|
||||
*/
|
||||
jsonOf(actual: any, expected: any, message?: string): void;
|
||||
/**
|
||||
* Check that the given javascript object is like the JSON-ified expected
|
||||
* value. Useful for checking stringification and parsing of an object.
|
||||
*/
|
||||
notJsonOf(actual: any, expected: any, message?: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "chai-fuzzy" {
|
||||
function chaiFuzzy(chai: any, utils: any): void;
|
||||
export = chaiFuzzy;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/// <reference path="../when/when.d.ts" />
|
||||
/// <reference path="./chai-http.d.ts" />
|
||||
/// <reference path="chai-http.d.ts" />
|
||||
|
||||
import fs = require('fs');
|
||||
import http = require('http');
|
||||
import chai = require('chai');
|
||||
import chaiHttp = require('chai-http');
|
||||
import ChaiHttp = require('chai-http');
|
||||
import when = require('when');
|
||||
|
||||
chai.use(chaiHttp);
|
||||
chai.use(ChaiHttp);
|
||||
|
||||
// ReSharper disable WrongExpressionStatement
|
||||
|
||||
// Add promise support if this does not exist natively.
|
||||
if (!global.Promise) {
|
||||
chai.request.addPromises(when.promise);
|
||||
}
|
||||
|
||||
|
||||
var app: http.Server;
|
||||
|
||||
chai.request(app).get('/');
|
||||
@@ -41,13 +42,12 @@ chai.request(app)
|
||||
|
||||
chai.request(app)
|
||||
.get('/search')
|
||||
.query('name', 'foo')
|
||||
.query('limit', '10');
|
||||
.query({name: 'foo', limit: 10});
|
||||
|
||||
chai.request(app)
|
||||
.put('/user/me')
|
||||
.send({ passsword: '123', confirmPassword: '123' })
|
||||
.end((err: any, res: chaiHttp.Response) => {
|
||||
.end((err: any, res: ChaiHttp.Response) => {
|
||||
chai.expect(err).to.be.null;
|
||||
chai.expect(res).to.have.status(200);
|
||||
});
|
||||
@@ -55,7 +55,7 @@ chai.request(app)
|
||||
chai.request(app)
|
||||
.put('/user/me')
|
||||
.send({ passsword: '123', confirmPassword: '123' })
|
||||
.then((res: chaiHttp.Response) => chai.expect(res).to.have.status(200))
|
||||
.then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200))
|
||||
.catch((err: any) => { throw err; });
|
||||
|
||||
var agent = chai.request.agent(app);
|
||||
@@ -63,17 +63,17 @@ var agent = chai.request.agent(app);
|
||||
agent
|
||||
.post('/session')
|
||||
.send({ username: 'me', password: '123' })
|
||||
.then((res: chaiHttp.Response) => {
|
||||
.then((res: ChaiHttp.Response) => {
|
||||
chai.expect(res).to.have.cookie('sessionid');
|
||||
// The `agent` now has the sessionid cookie saved, and will send it
|
||||
// back to the server in the next request:
|
||||
return agent.get('/user/me')
|
||||
.then((res: chaiHttp.Response) => chai.expect(res).to.have.status(200));
|
||||
.then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200));
|
||||
});
|
||||
|
||||
function test1() {
|
||||
var req = chai.request(app).get('/');
|
||||
req.then((res: chaiHttp.Response) => {
|
||||
req.then((res: ChaiHttp.Response) => {
|
||||
chai.expect(res).to.have.status(200);
|
||||
chai.expect(res).to.have.header('content-type', 'text/plain');
|
||||
chai.expect(res).to.have.header('content-type', /^text/);
|
||||
@@ -99,5 +99,4 @@ function test1() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
when(chai.request(app).get('/')).done(() => console.log('success'), () => console.log('failure'));
|
||||
|
||||
Vendored
+27
-30
@@ -6,27 +6,38 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
|
||||
declare module chai {
|
||||
export function request(server: any): chaiHttp.Agent;
|
||||
declare module Chai {
|
||||
|
||||
export module request {
|
||||
export function agent(server: any): chaiHttp.Agent;
|
||||
export function addPromises(promiseConstructor: chaiHttp.PromiseConstructor): void;
|
||||
interface ChaiStatic {
|
||||
request: ChaiHttpRequest;
|
||||
}
|
||||
|
||||
interface Assertions extends chaiHttp.Assertions {
|
||||
interface ChaiHttpRequest {
|
||||
(server: any): ChaiHttp.Agent;
|
||||
agent(server: any): ChaiHttp.Agent;
|
||||
addPromises(promiseConstructor: any): void;
|
||||
}
|
||||
|
||||
interface TypeComparison extends chaiHttp.TypeComparison {
|
||||
interface Assertion {
|
||||
status(code: number): Assertion;
|
||||
header(key: string, value?: string): Assertion;
|
||||
header(key: string, value?: RegExp): Assertion;
|
||||
headers: Assertion;
|
||||
json: Assertion;
|
||||
text: Assertion;
|
||||
html: Assertion;
|
||||
redirect: Assertion;
|
||||
redirectTo(location: string): Assertion;
|
||||
param(key: string, value?: string): Assertion;
|
||||
cookie(key: string, value?: string): Assertion;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
ip: Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
declare function chaiHttp(chai: any, utils: any): void;
|
||||
declare module chaiHttp {
|
||||
interface PromiseConstructor {
|
||||
<T>(resolver: (resolve: (value: T) => void, reject: (reason: any) => void) => void): Promise<T>;
|
||||
}
|
||||
|
||||
declare module ChaiHttp {
|
||||
interface Promise<T> {
|
||||
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Promise<U>;
|
||||
}
|
||||
@@ -38,10 +49,9 @@ declare module chaiHttp {
|
||||
}
|
||||
|
||||
interface Request extends FinishedRequest {
|
||||
attach(field: string, file: string, filename: string): Request;
|
||||
attach(field: string, file: Buffer, filename: string): Request;
|
||||
attach(field: string, file: string|Buffer, filename: string): Request;
|
||||
set(field: string, val: string): Request;
|
||||
query(key: string, value: string): Request;
|
||||
query(params: Object): Request;
|
||||
send(data: Object): Request;
|
||||
auth(user: string, name: string): Request;
|
||||
field(name: string, val: string): Request;
|
||||
@@ -63,25 +73,12 @@ declare module chaiHttp {
|
||||
patch(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
}
|
||||
|
||||
interface Assertions {
|
||||
status(code: number): any;
|
||||
header(key: string, value?: string): any;
|
||||
header(key: string, value?: RegExp): any;
|
||||
headers: any;
|
||||
json: any;
|
||||
// text: any;
|
||||
// html: any;
|
||||
redirect: any;
|
||||
redirectTo(location: string): any;
|
||||
param(key: string, value?: string): any;
|
||||
cookie(key: string, value?: string): any;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
ip: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "chai-http" {
|
||||
function chaiHttp(chai: any, utils: any): void;
|
||||
export = chaiHttp;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
/// <reference path="chai-jquery.d.ts" />
|
||||
|
||||
// tests taken from https://github.com/chaijs/chai-jquery
|
||||
|
||||
declare var $;
|
||||
declare var $: ChaiJQueryStatic;
|
||||
import chai = require('chai');
|
||||
var expect = chai.expect;
|
||||
|
||||
function test_attr() {
|
||||
@@ -19,7 +19,7 @@ function test_css() {
|
||||
function test_data() {
|
||||
expect($('#foo')).to.have.data('toggle');
|
||||
expect($('#foo')).to.have.css('toggle', 'true');
|
||||
expect($('body')).to.have.css('font-family').match(/sans-serif/);
|
||||
expect($('body')).to.have.css('font-family').and.match(/sans-serif/);
|
||||
}
|
||||
|
||||
function test_class() {
|
||||
@@ -88,4 +88,4 @@ function test_be_selector() {
|
||||
function test_have_selector() {
|
||||
$('body').should.have('h1');
|
||||
expect($('#foo')).to.have('div');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Vendored
+2570
-27
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
||||
/// <reference path="chai-subset.d.ts" />
|
||||
|
||||
import chai = require('chai');
|
||||
import chaiSubset = require('chai-subset');
|
||||
|
||||
chai.use(chaiSubset);
|
||||
var expect = chai.expect;
|
||||
var assert = chai.assert;
|
||||
|
||||
function test_containSubset() {
|
||||
var obj: Object = {
|
||||
a: 'b',
|
||||
c: 'd',
|
||||
e: {
|
||||
foo: 'bar',
|
||||
baz: {
|
||||
qux: 'quux'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(obj).to.containSubset({
|
||||
a: 'b',
|
||||
e: {
|
||||
baz: {
|
||||
qux: 'quux'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
obj.should.containSubset({ a: 'b' });
|
||||
}
|
||||
|
||||
function test_notContainSubset() {
|
||||
var obj: Object = {
|
||||
a: 'b',
|
||||
c: 'd',
|
||||
e: {
|
||||
foo: 'bar',
|
||||
baz: {
|
||||
qux: 'quux'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(obj).to.not.containSubset({ g: 'whatever' });
|
||||
obj.should.not.containSubset({ g: 'whatever' });
|
||||
}
|
||||
|
||||
function test_arrayContainSubset() {
|
||||
var list: Array<Object> = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
|
||||
|
||||
expect(list).to.containSubset([{a:'a', b: 'b'}]);
|
||||
list.should.containSubset([{a:'a', b: 'b'}]);
|
||||
}
|
||||
|
||||
function test_arrayNotContainSubset() {
|
||||
var list: Array<Object> = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
|
||||
|
||||
expect(list).not.to.containSubset([{a:'a', b: 'bd'}]);
|
||||
list.should.not.containSubset([{a:'a', b: 'bd'}]);
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for chai-subset 1.0.0
|
||||
// Project: https://github.com/e-conomic/chai-subset
|
||||
// Definitions by: Sam Noedel <https://github.com/delta62/>, Andrew Brown <https://github.com/AGBrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
|
||||
declare module Chai {
|
||||
interface Assertion {
|
||||
containSubset(obj: Object): Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "chai-subset" {
|
||||
function chaiSubset(chai: any, utils: any): void;
|
||||
export = chaiSubset;
|
||||
}
|
||||
+1072
-725
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
|
||||
Vendored
+181
-159
@@ -1,67 +1,67 @@
|
||||
// Type definitions for chai 2.0.0
|
||||
// Project: http://chaijs.com/
|
||||
// Definitions by: Jed Hunsaker <https://github.com/jedhunsaker/>, Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao/>,
|
||||
// Bart van der Schoor <https://github.com/Bartvds>,
|
||||
// Andrew Brown <https://github.com/AGBrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module chai {
|
||||
export class AssertionError {
|
||||
constructor(message: string, _props?: any, ssf?: Function);
|
||||
name: string;
|
||||
message: string;
|
||||
showDiff: boolean;
|
||||
stack: string;
|
||||
declare module Chai {
|
||||
|
||||
interface ChaiStatic {
|
||||
expect: ExpectStatic;
|
||||
should(): Should;
|
||||
/**
|
||||
* Provides a way to extend the internals of Chai
|
||||
*/
|
||||
use(fn: (chai: any, utils: any) => void): any;
|
||||
assert: AssertStatic;
|
||||
config: Config;
|
||||
}
|
||||
|
||||
export function expect(target: any, message?: string): Expect;
|
||||
|
||||
export var assert: Assert;
|
||||
export var config: Config;
|
||||
|
||||
export interface Config {
|
||||
includeStack: boolean;
|
||||
export interface ExpectStatic extends AssertionStatic {
|
||||
}
|
||||
|
||||
// Provides a way to extend the internals of Chai
|
||||
function use(fn: (chai: any, utils: any) => void): any;
|
||||
|
||||
interface ExpectStatic {
|
||||
(target: any): Expect;
|
||||
export interface AssertStatic extends Assert {
|
||||
}
|
||||
|
||||
interface Assertions {
|
||||
attr(name: string, value?: string): any;
|
||||
css(name: string, value?: string): any;
|
||||
data(name: string, value?: string): any;
|
||||
class(className: string): any;
|
||||
id(id: string): any;
|
||||
html(html: string): any;
|
||||
text(text: string): any;
|
||||
value(value: string): any;
|
||||
visible: any;
|
||||
hidden: any;
|
||||
selected: any;
|
||||
checked: any;
|
||||
disabled: any;
|
||||
empty: any;
|
||||
exist: any;
|
||||
export interface AssertionStatic {
|
||||
(target: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Expect extends LanguageChains, NumericComparison, TypeComparison, Assertions {
|
||||
not: Expect;
|
||||
interface ShouldAssertion {
|
||||
equal(value1: any, value2: any, message?: string): void;
|
||||
Throw: ShouldThrow;
|
||||
throw: ShouldThrow;
|
||||
exist(value: any, message?: string): void;
|
||||
}
|
||||
|
||||
interface Should extends ShouldAssertion {
|
||||
not: ShouldAssertion;
|
||||
fail(actual: any, expected: any, message?: string, operator?: string): void;
|
||||
}
|
||||
|
||||
interface ShouldThrow {
|
||||
(actual: Function): void;
|
||||
(actual: Function, expected: string|RegExp, message?: string): void;
|
||||
(actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void;
|
||||
}
|
||||
|
||||
interface Assertion extends LanguageChains, NumericComparison, TypeComparison {
|
||||
not: Assertion;
|
||||
deep: Deep;
|
||||
a: TypeComparison;
|
||||
an: TypeComparison;
|
||||
include: Include;
|
||||
contain: Include;
|
||||
ok: Expect;
|
||||
true: Expect;
|
||||
false: Expect;
|
||||
null: Expect;
|
||||
undefined: Expect;
|
||||
exist: Expect;
|
||||
empty: Expect;
|
||||
arguments: Expect;
|
||||
Arguments: Expect;
|
||||
ok: Assertion;
|
||||
true: Assertion;
|
||||
false: Assertion;
|
||||
null: Assertion;
|
||||
undefined: Assertion;
|
||||
exist: Assertion;
|
||||
empty: Assertion;
|
||||
arguments: Assertion;
|
||||
Arguments: Assertion;
|
||||
equal: Equal;
|
||||
equals: Equal;
|
||||
eq: Equal;
|
||||
@@ -72,34 +72,34 @@ declare module chai {
|
||||
haveOwnProperty: OwnProperty;
|
||||
length: Length;
|
||||
lengthOf: Length;
|
||||
match(RegularExpression: RegExp, message?: string): Expect;
|
||||
string(string: string, message?: string): Expect;
|
||||
match(regexp: RegExp|string, message?: string): Assertion;
|
||||
string(string: string, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
key(string: string): Expect;
|
||||
key(string: string): Assertion;
|
||||
throw: Throw;
|
||||
throws: Throw;
|
||||
Throw: Throw;
|
||||
respondTo(method: string, message?: string): Expect;
|
||||
itself: Expect;
|
||||
satisfy(matcher: Function, message?: string): Expect;
|
||||
closeTo(expected: number, delta: number, message?: string): Expect;
|
||||
respondTo(method: string, message?: string): Assertion;
|
||||
itself: Assertion;
|
||||
satisfy(matcher: Function, message?: string): Assertion;
|
||||
closeTo(expected: number, delta: number, message?: string): Assertion;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface LanguageChains {
|
||||
to: Expect;
|
||||
be: Expect;
|
||||
been: Expect;
|
||||
is: Expect;
|
||||
that: Expect;
|
||||
which: Expect;
|
||||
and: Expect;
|
||||
have: Expect;
|
||||
has: Expect;
|
||||
with: Expect;
|
||||
at: Expect;
|
||||
of: Expect;
|
||||
same: Expect;
|
||||
to: Assertion;
|
||||
be: Assertion;
|
||||
been: Assertion;
|
||||
is: Assertion;
|
||||
that: Assertion;
|
||||
which: Assertion;
|
||||
and: Assertion;
|
||||
has: Assertion;
|
||||
have: Assertion;
|
||||
with: Assertion;
|
||||
at: Assertion;
|
||||
of: Assertion;
|
||||
same: Assertion;
|
||||
}
|
||||
|
||||
interface NumericComparison {
|
||||
@@ -113,21 +113,21 @@ declare module chai {
|
||||
lessThan: NumberComparer;
|
||||
most: NumberComparer;
|
||||
lte: NumberComparer;
|
||||
within(start: number, finish: number, message?: string): Expect;
|
||||
within(start: number, finish: number, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface NumberComparer {
|
||||
(value: number, message?: string): Expect;
|
||||
(value: number, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
(type: string, message?: string): Expect;
|
||||
(type: string, message?: string): Assertion;
|
||||
instanceof: InstanceOf;
|
||||
instanceOf: InstanceOf;
|
||||
}
|
||||
|
||||
interface InstanceOf {
|
||||
(constructor: Object, message?: string): Expect;
|
||||
(constructor: Object, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Deep {
|
||||
@@ -137,150 +137,172 @@ declare module chai {
|
||||
}
|
||||
|
||||
interface Equal {
|
||||
(value: any, message?: string): Expect;
|
||||
(value: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Property {
|
||||
(name: string, value?: any, message?: string): Expect;
|
||||
(name: string, value?: any, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface OwnProperty {
|
||||
(name: string, message?: string): Expect;
|
||||
(name: string, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Length extends LanguageChains, NumericComparison {
|
||||
(length: number, message?: string): Expect;
|
||||
(length: number, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Include {
|
||||
(value: Object, message?: string): Expect;
|
||||
(value: string, message?: string): Expect;
|
||||
(value: number, message?: string): Expect;
|
||||
(value: Object, message?: string): Assertion;
|
||||
(value: string, message?: string): Assertion;
|
||||
(value: number, message?: string): Assertion;
|
||||
keys: Keys;
|
||||
members: Members;
|
||||
}
|
||||
|
||||
interface Keys {
|
||||
(...keys: string[]): Expect;
|
||||
(keys: any[]): Expect;
|
||||
}
|
||||
|
||||
interface Members {
|
||||
(set: any[], message?: string): Expect;
|
||||
(...keys: string[]): Assertion;
|
||||
(keys: any[]): Assertion;
|
||||
}
|
||||
|
||||
interface Throw {
|
||||
(): Expect;
|
||||
(expected: string, message?: string): Expect;
|
||||
(expected: RegExp, message?: string): Expect;
|
||||
(constructor: Error, expected?: string, message?: string): Expect;
|
||||
(constructor: Error, expected?: RegExp, message?: string): Expect;
|
||||
(constructor: Function, expected?: string, message?: string): Expect;
|
||||
(constructor: Function, expected?: RegExp, message?: string): Expect;
|
||||
(): Assertion;
|
||||
(expected: string, message?: string): Assertion;
|
||||
(expected: RegExp, message?: string): Assertion;
|
||||
(constructor: Error, expected?: string, message?: string): Assertion;
|
||||
(constructor: Error, expected?: RegExp, message?: string): Assertion;
|
||||
(constructor: Function, expected?: string, message?: string): Assertion;
|
||||
(constructor: Function, expected?: RegExp, message?: string): Assertion;
|
||||
}
|
||||
|
||||
interface Members {
|
||||
(set: any[], message?: string): Assertion;
|
||||
}
|
||||
|
||||
export interface Assert {
|
||||
(express: any, msg?: string):void;
|
||||
/**
|
||||
* @param expression Expression to test for truthiness.
|
||||
* @param message Message to display on error.
|
||||
*/
|
||||
(expression: any, message?: string): void;
|
||||
|
||||
fail(actual?: any, expected?: any, msg?: string, operator?: string):void;
|
||||
fail(actual?: any, expected?: any, msg?: string, operator?: string): void;
|
||||
|
||||
ok(val: any, msg?: string):void;
|
||||
notOk(val: any, msg?: string):void;
|
||||
ok(val: any, msg?: string): void;
|
||||
notOk(val: any, msg?: string): void;
|
||||
|
||||
equal(act: any, exp: any, msg?: string):void;
|
||||
notEqual(act: any, exp: any, msg?: string):void;
|
||||
equal(act: any, exp: any, msg?: string): void;
|
||||
notEqual(act: any, exp: any, msg?: string): void;
|
||||
|
||||
strictEqual(act: any, exp: any, msg?: string):void;
|
||||
notStrictEqual(act: any, exp: any, msg?: string):void;
|
||||
strictEqual(act: any, exp: any, msg?: string): void;
|
||||
notStrictEqual(act: any, exp: any, msg?: string): void;
|
||||
|
||||
deepEqual(act: any, exp: any, msg?: string):void;
|
||||
notDeepEqual(act: any, exp: any, msg?: string):void;
|
||||
deepEqual(act: any, exp: any, msg?: string): void;
|
||||
notDeepEqual(act: any, exp: any, msg?: string): void;
|
||||
|
||||
isTrue(val: any, msg?: string):void;
|
||||
isFalse(val: any, msg?: string):void;
|
||||
isTrue(val: any, msg?: string): void;
|
||||
isFalse(val: any, msg?: string): void;
|
||||
|
||||
isNull(val: any, msg?: string):void;
|
||||
isNotNull(val: any, msg?: string):void;
|
||||
isNull(val: any, msg?: string): void;
|
||||
isNotNull(val: any, msg?: string): void;
|
||||
|
||||
isUndefined(val: any, msg?: string):void;
|
||||
isDefined(val: any, msg?: string):void;
|
||||
isUndefined(val: any, msg?: string): void;
|
||||
isDefined(val: any, msg?: string): void;
|
||||
|
||||
isFunction(val: any, msg?: string):void;
|
||||
isNotFunction(val: any, msg?: string):void;
|
||||
isFunction(val: any, msg?: string): void;
|
||||
isNotFunction(val: any, msg?: string): void;
|
||||
|
||||
isObject(val: any, msg?: string):void;
|
||||
isNotObject(val: any, msg?: string):void;
|
||||
isObject(val: any, msg?: string): void;
|
||||
isNotObject(val: any, msg?: string): void;
|
||||
|
||||
isArray(val: any, msg?: string):void;
|
||||
isNotArray(val: any, msg?: string):void;
|
||||
isArray(val: any, msg?: string): void;
|
||||
isNotArray(val: any, msg?: string): void;
|
||||
|
||||
isString(val: any, msg?: string):void;
|
||||
isNotString(val: any, msg?: string):void;
|
||||
isString(val: any, msg?: string): void;
|
||||
isNotString(val: any, msg?: string): void;
|
||||
|
||||
isNumber(val: any, msg?: string):void;
|
||||
isNotNumber(val: any, msg?: string):void;
|
||||
isNumber(val: any, msg?: string): void;
|
||||
isNotNumber(val: any, msg?: string): void;
|
||||
|
||||
isBoolean(val: any, msg?: string):void;
|
||||
isNotBoolean(val: any, msg?: string):void;
|
||||
isBoolean(val: any, msg?: string): void;
|
||||
isNotBoolean(val: any, msg?: string): void;
|
||||
|
||||
typeOf(val: any, type: string, msg?: string):void;
|
||||
notTypeOf(val: any, type: string, msg?: string):void;
|
||||
typeOf(val: any, type: string, msg?: string): void;
|
||||
notTypeOf(val: any, type: string, msg?: string): void;
|
||||
|
||||
instanceOf(val: any, type: Function, msg?: string):void;
|
||||
notInstanceOf(val: any, type: Function, msg?: string):void;
|
||||
instanceOf(val: any, type: Function, msg?: string): void;
|
||||
notInstanceOf(val: any, type: Function, msg?: string): void;
|
||||
|
||||
include(exp: string, inc: any, msg?: string):void;
|
||||
include(exp: any[], inc: any, msg?: string):void;
|
||||
include(exp: string, inc: any, msg?: string): void;
|
||||
include(exp: any[], inc: any, msg?: string): void;
|
||||
|
||||
notInclude(exp: string, inc: any, msg?: string):void;
|
||||
notInclude(exp: any[], inc: any, msg?: string):void;
|
||||
notInclude(exp: string, inc: any, msg?: string): void;
|
||||
notInclude(exp: any[], inc: any, msg?: string): void;
|
||||
|
||||
match(exp: any, re: RegExp, msg?: string):void;
|
||||
notMatch(exp: any, re: RegExp, msg?: string):void;
|
||||
match(exp: any, re: RegExp, msg?: string): void;
|
||||
notMatch(exp: any, re: RegExp, msg?: string): void;
|
||||
|
||||
property(obj: Object, prop: string, msg?: string):void;
|
||||
notProperty(obj: Object, prop: string, msg?: string):void;
|
||||
deepProperty(obj: Object, prop: string, msg?: string):void;
|
||||
notDeepProperty(obj: Object, prop: string, msg?: string):void;
|
||||
property(obj: Object, prop: string, msg?: string): void;
|
||||
notProperty(obj: Object, prop: string, msg?: string): void;
|
||||
deepProperty(obj: Object, prop: string, msg?: string): void;
|
||||
notDeepProperty(obj: Object, prop: string, msg?: string): void;
|
||||
|
||||
propertyVal(obj: Object, prop: string, val: any, msg?: string):void;
|
||||
propertyNotVal(obj: Object, prop: string, val: any, msg?: string):void;
|
||||
propertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
|
||||
deepPropertyVal(obj: Object, prop: string, val: any, msg?: string):void;
|
||||
deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string):void;
|
||||
deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void;
|
||||
|
||||
lengthOf(exp: any, len: number, msg?: string):void;
|
||||
lengthOf(exp: any, len: number, msg?: string): void;
|
||||
//alias frenzy
|
||||
throw(fn: Function, msg?: string):void;
|
||||
throw(fn: Function, regExp: RegExp):void;
|
||||
throw(fn: Function, errType: Function, msg?: string):void;
|
||||
throw(fn: Function, errType: Function, regExp: RegExp):void;
|
||||
throw(fn: Function, msg?: string): void;
|
||||
throw(fn: Function, regExp: RegExp): void;
|
||||
throw(fn: Function, errType: Function, msg?: string): void;
|
||||
throw(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
throws(fn: Function, msg?: string):void;
|
||||
throws(fn: Function, regExp: RegExp):void;
|
||||
throws(fn: Function, errType: Function, msg?: string):void;
|
||||
throws(fn: Function, errType: Function, regExp: RegExp):void;
|
||||
throws(fn: Function, msg?: string): void;
|
||||
throws(fn: Function, regExp: RegExp): void;
|
||||
throws(fn: Function, errType: Function, msg?: string): void;
|
||||
throws(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
Throw(fn: Function, msg?: string):void;
|
||||
Throw(fn: Function, regExp: RegExp):void;
|
||||
Throw(fn: Function, errType: Function, msg?: string):void;
|
||||
Throw(fn: Function, errType: Function, regExp: RegExp):void;
|
||||
Throw(fn: Function, msg?: string): void;
|
||||
Throw(fn: Function, regExp: RegExp): void;
|
||||
Throw(fn: Function, errType: Function, msg?: string): void;
|
||||
Throw(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
doesNotThrow(fn: Function, msg?: string):void;
|
||||
doesNotThrow(fn: Function, regExp: RegExp):void;
|
||||
doesNotThrow(fn: Function, errType: Function, msg?: string):void;
|
||||
doesNotThrow(fn: Function, errType: Function, regExp: RegExp):void;
|
||||
doesNotThrow(fn: Function, msg?: string): void;
|
||||
doesNotThrow(fn: Function, regExp: RegExp): void;
|
||||
doesNotThrow(fn: Function, errType: Function, msg?: string): void;
|
||||
doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void;
|
||||
|
||||
operator(val: any, operator: string, val2: any, msg?: string):void;
|
||||
closeTo(act: number, exp: number, delta: number, msg?: string):void;
|
||||
operator(val: any, operator: string, val2: any, msg?: string): void;
|
||||
closeTo(act: number, exp: number, delta: number, msg?: string): void;
|
||||
|
||||
sameMembers(set1: any[], set2: any[], msg?: string):void;
|
||||
includeMembers(set1: any[], set2: any[], msg?: string):void;
|
||||
sameMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
includeMembers(set1: any[], set2: any[], msg?: string): void;
|
||||
|
||||
ifError(val: any, msg?: string):void;
|
||||
ifError(val: any, msg?: string): void;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
includeStack: boolean;
|
||||
}
|
||||
|
||||
export class AssertionError {
|
||||
constructor(message: string, _props?: any, ssf?: Function);
|
||||
name: string;
|
||||
message: string;
|
||||
showDiff: boolean;
|
||||
stack: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare var chai: Chai.ChaiStatic;
|
||||
|
||||
declare module "chai" {
|
||||
export = chai;
|
||||
}
|
||||
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -18,7 +18,7 @@ interface ChosenOptions {
|
||||
placeholder_text_single?: string;
|
||||
search_contains?: boolean;
|
||||
single_backstroke_delete?: boolean;
|
||||
width?: number;
|
||||
width?: number|string;
|
||||
display_disabled_options?: boolean;
|
||||
display_selected_options?: boolean;
|
||||
include_group_label_in_selected?: boolean;
|
||||
|
||||
@@ -28,6 +28,14 @@ var currentWindow: cwindow.AppWindow = chrome.app.window.current();
|
||||
var otherWindow: cwindow.AppWindow = chrome.app.window.get('some-string');
|
||||
var allWindows: cwindow.AppWindow[] = chrome.app.window.getAll();
|
||||
|
||||
// listening to window events
|
||||
currentWindow.onBoundsChanged.addListener(function () { return; });
|
||||
currentWindow.onClosed.addListener(function () { return; });
|
||||
currentWindow.onFullscreened.addListener(function () { return; });
|
||||
currentWindow.onMaximized.addListener(function () { return; });
|
||||
currentWindow.onMinimized.addListener(function () { return; });
|
||||
currentWindow.onRestored.addListener(function () { return; });
|
||||
|
||||
// check platform capabilities
|
||||
var visibleEverywhere: boolean = chrome.app.window.canSetVisibleOnAllWorkspaces();
|
||||
|
||||
|
||||
Vendored
+6
@@ -122,6 +122,12 @@ declare module chrome.app.window {
|
||||
id: string;
|
||||
innerBounds: Bounds;
|
||||
outerBounds: Bounds;
|
||||
onBoundsChanged: WindowEvent;
|
||||
onClosed: WindowEvent;
|
||||
onFullscreened: WindowEvent;
|
||||
onMaximized: WindowEvent;
|
||||
onMinimized: WindowEvent;
|
||||
onRestored: WindowEvent;
|
||||
}
|
||||
|
||||
export function create(url: string, options?: CreateWindowOptions, callback?: (created_window: AppWindow) => void): void;
|
||||
|
||||
+337
-90
@@ -106,13 +106,14 @@ declare module chrome.cast {
|
||||
}
|
||||
|
||||
/**
|
||||
* @const {!Array.<number>}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/
|
||||
* @const {!Array<number>}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.VERSION
|
||||
*/
|
||||
var VERSION: Array<number>;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.isAvailable
|
||||
*/
|
||||
var isAvailable: boolean;
|
||||
|
||||
@@ -169,7 +170,7 @@ declare module chrome.cast {
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!Array.<chrome.cast.Receiver>} receivers
|
||||
* @param {!Array<chrome.cast.Receiver>} receivers
|
||||
* @param {function()} successCallback
|
||||
* @param {function(chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
@@ -188,13 +189,13 @@ declare module chrome.cast {
|
||||
receiver: chrome.cast.Receiver,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
)
|
||||
): void
|
||||
|
||||
interface ApiConfig {
|
||||
/**
|
||||
* @param {!chrome.cast.SessionRequest} sessionRequest
|
||||
* @param {function(!chrome.cast.Session)} sessionListener
|
||||
* @param {function(!chrome.cast.ReceiverAvailability,Array.<Object>)}
|
||||
* @param {function(!chrome.cast.ReceiverAvailability,Array<Object>)}
|
||||
* receiverListener
|
||||
* @param {chrome.cast.AutoJoinPolicy=} opt_autoJoinPolicy
|
||||
* @param {chrome.cast.DefaultActionPolicy=} opt_defaultActionPolicy
|
||||
@@ -206,8 +207,8 @@ declare module chrome.cast {
|
||||
sessionListener: (session: chrome.cast.Session) => void,
|
||||
receiverListener: (receiverAvailability: chrome.cast.ReceiverAvailability) => void,
|
||||
autoJoinPolicy?: chrome.cast.AutoJoinPolicy,
|
||||
defaultActionPolicy: chrome.cast.DefaultActionPolicy
|
||||
);
|
||||
defaultActionPolicy?: chrome.cast.DefaultActionPolicy
|
||||
):ApiConfig;
|
||||
|
||||
sessionRequest: chrome.cast.SessionRequest;
|
||||
sessionListener: (session: chrome.cast.Session) => void;
|
||||
@@ -216,19 +217,19 @@ declare module chrome.cast {
|
||||
defaultActionPolicy: chrome.cast.DefaultActionPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.ErrorCode} code
|
||||
* @param {string=} opt_description
|
||||
* @param {Object=} opt_details
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Error
|
||||
*/
|
||||
interface Error {
|
||||
/**
|
||||
* @param {!chrome.cast.ErrorCode} code
|
||||
* @param {string=} opt_description
|
||||
* @param {Object=} opt_details
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Error
|
||||
*/
|
||||
new(
|
||||
code: chrome.cast.ErrorCode,
|
||||
description?: string,
|
||||
details?: Object
|
||||
);
|
||||
):Error;
|
||||
|
||||
code: chrome.cast.ErrorCode;
|
||||
description?: string;
|
||||
@@ -244,7 +245,7 @@ declare module chrome.cast {
|
||||
*/
|
||||
new(
|
||||
url: string
|
||||
);
|
||||
):Image;
|
||||
|
||||
url: string;
|
||||
height?: number;
|
||||
@@ -252,10 +253,14 @@ declare module chrome.cast {
|
||||
}
|
||||
|
||||
interface SenderApplication {
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.SenderPlatform} platform
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SenderApplication
|
||||
*/
|
||||
new(
|
||||
platform: chrome.cast.SenderPlatform
|
||||
);
|
||||
):SenderApplication;
|
||||
|
||||
platform: chrome.cast.SenderPlatform;
|
||||
url?: string;
|
||||
@@ -265,7 +270,7 @@ declare module chrome.cast {
|
||||
interface SessionRequest {
|
||||
/**
|
||||
* @param {string} appId
|
||||
* @param {!Array.<chrome.cast.Capability>=} opt_capabilities
|
||||
* @param {!Array<chrome.cast.Capability>=} opt_capabilities
|
||||
* @param {number=} opt_timeout
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.SessionRequest
|
||||
@@ -274,7 +279,7 @@ declare module chrome.cast {
|
||||
appId: string,
|
||||
capabilities?: Array<chrome.cast.Capability>,
|
||||
timeout?: number
|
||||
);
|
||||
):SessionRequest;
|
||||
|
||||
appId: string;
|
||||
capabilities: Array<chrome.cast.Capability>;
|
||||
@@ -287,7 +292,7 @@ declare module chrome.cast {
|
||||
* @param {string} sessionId
|
||||
* @param {string} appId
|
||||
* @param {string} displayName
|
||||
* @param {!Array.<chrome.cast.Image>} appImages
|
||||
* @param {!Array<chrome.cast.Image>} appImages
|
||||
* @param {!chrome.cast.Receiver} receiver
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Session
|
||||
@@ -298,7 +303,7 @@ declare module chrome.cast {
|
||||
displayName: string,
|
||||
appImages: Array<chrome.cast.Image>,
|
||||
receiver: chrome.cast.Receiver
|
||||
);
|
||||
):Session;
|
||||
|
||||
sessionId: string;
|
||||
appId: string;
|
||||
@@ -319,7 +324,7 @@ declare module chrome.cast {
|
||||
newLevel: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
)
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {boolean} muted
|
||||
@@ -330,7 +335,7 @@ declare module chrome.cast {
|
||||
muted: boolean,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
)
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {function()} successCallback
|
||||
@@ -339,7 +344,7 @@ declare module chrome.cast {
|
||||
leave(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
)
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {function()} successCallback
|
||||
@@ -348,7 +353,7 @@ declare module chrome.cast {
|
||||
stop(
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
)
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {string} namespace
|
||||
@@ -361,21 +366,21 @@ declare module chrome.cast {
|
||||
message: string,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
)
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
addUpdateListener(
|
||||
listener: (boolean) => void
|
||||
)
|
||||
listener: (isAlive:boolean) => void
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
removeUpdateListener(
|
||||
listener: (boolean) => void
|
||||
)
|
||||
listener: (isAlive:boolean) => void
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {string} namespace
|
||||
@@ -383,8 +388,8 @@ declare module chrome.cast {
|
||||
*/
|
||||
addMessageListener(
|
||||
namespace: string,
|
||||
listener: (string, string) => void
|
||||
)
|
||||
listener: (namespace: string, message: string) => void
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {string} namespace
|
||||
@@ -392,22 +397,22 @@ declare module chrome.cast {
|
||||
*/
|
||||
removeMessageListener(
|
||||
namespace: string,
|
||||
listener: (string, string) => void
|
||||
)
|
||||
listener: (namespace:string, message:string) => void
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {function(!chrome.cast.media.Media)} listener
|
||||
*/
|
||||
addMediaListener(
|
||||
listener: (media: chrome.cast.media.Media) => void
|
||||
)
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {function(!chrome.cast.media.Media)} listener
|
||||
*/
|
||||
removeMediaListener(
|
||||
listener: (media: chrome.cast.media.Media) => void
|
||||
)
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.LoadRequest} loadRequest
|
||||
@@ -418,14 +423,25 @@ declare module chrome.cast {
|
||||
loadRequest: chrome.cast.media.LoadRequest,
|
||||
successCallback: (media: chrome.cast.media.Media) => void,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
)
|
||||
):void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.QueueLoadRequest} queueLoadRequest
|
||||
* @param {function(!chrome.cast.media.Media)} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueLoad(
|
||||
queueLoadRequest: chrome.cast.media.QueueLoadRequest,
|
||||
successCallback: (media: chrome.cast.media.Media) => void,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
):void
|
||||
}
|
||||
|
||||
interface Receiver {
|
||||
/**
|
||||
* @param {string} label
|
||||
* @param {string} friendlyName
|
||||
* @param {Array.<chrome.cast.Capability>=} opt_capabilities
|
||||
* @param {Array<chrome.cast.Capability>=} opt_capabilities
|
||||
* @param {chrome.cast.Volume=} opt_volume
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.Receiver
|
||||
@@ -435,7 +451,7 @@ declare module chrome.cast {
|
||||
friendlyName: string,
|
||||
capabilities?: Array<chrome.cast.Capability>,
|
||||
volume?: chrome.cast.Volume
|
||||
);
|
||||
):Receiver;
|
||||
|
||||
label: string;
|
||||
friendlyName: string;
|
||||
@@ -448,14 +464,14 @@ declare module chrome.cast {
|
||||
interface ReceiverDisplayStatus {
|
||||
/**
|
||||
* @param {string} statusText
|
||||
* @param {!Array.<chrome.cast.Image>} appImages
|
||||
* @param {!Array<chrome.cast.Image>} appImages
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.ReceiverDisplayStatus
|
||||
*/
|
||||
new(
|
||||
statusText: string,
|
||||
appImages: Array<chrome.cast.Image>
|
||||
);
|
||||
):ReceiverDisplayStatus;
|
||||
|
||||
statusText: string;
|
||||
appImages: Array<chrome.cast.Image>;
|
||||
@@ -471,7 +487,7 @@ declare module chrome.cast {
|
||||
new(
|
||||
level?: number,
|
||||
muted?: boolean
|
||||
);
|
||||
):Volume;
|
||||
|
||||
level?: number;
|
||||
muted?: boolean;
|
||||
@@ -479,6 +495,9 @@ declare module chrome.cast {
|
||||
}
|
||||
|
||||
declare module chrome.cast.media {
|
||||
|
||||
var DEFAULT_MEDIA_RECEIVER_APP_ID: string;
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MediaCommand
|
||||
@@ -542,7 +561,111 @@ declare module chrome.cast.media {
|
||||
FINISHED: string;
|
||||
ERROR: string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media#.RepeatMode
|
||||
*/
|
||||
interface RepeatMode {
|
||||
OFF:string;
|
||||
ALL:string;
|
||||
SINGLE:string;
|
||||
ALL_AND_SHUFFLE:string;
|
||||
}
|
||||
|
||||
interface QueueItem {
|
||||
/**
|
||||
* @param {!chrome.cast.media.MediaInfo} mediaInfo
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueItem
|
||||
*/
|
||||
new(
|
||||
mediaInfo: chrome.cast.media.MediaInfo
|
||||
):QueueItem;
|
||||
|
||||
activeTrackIds: Array<Number>;
|
||||
autoplay: boolean;
|
||||
customData: Object;
|
||||
itemId: number;
|
||||
media: chrome.cast.media.MediaInfo;
|
||||
preloadTime: number;
|
||||
startTime: number;
|
||||
}
|
||||
|
||||
interface QueueLoadRequest {
|
||||
/**
|
||||
* @param {!Array<chrome.cast.media.QueueItem>} items
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueLoadRequest
|
||||
*/
|
||||
new(
|
||||
items: Array<chrome.cast.media.QueueItem>
|
||||
):QueueLoadRequest;
|
||||
|
||||
customData: Object;
|
||||
items: Array<chrome.cast.media.QueueItem>;
|
||||
repeatMode: chrome.cast.media.RepeatMode;
|
||||
startIndex: number;
|
||||
}
|
||||
|
||||
interface QueueInsertItemsRequest {
|
||||
/**
|
||||
* @param {!Array<chrome.cast.media.QueueItem>}
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueInsertItemsRequest
|
||||
*/
|
||||
new(
|
||||
itemsToInsert: Array<chrome.cast.media.QueueItem>
|
||||
):QueueInsertItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
insertBefore:number;
|
||||
items: Array<chrome.cast.media.QueueItem>;
|
||||
}
|
||||
|
||||
interface QueueRemoveItemsRequest {
|
||||
/**
|
||||
* @param {!Array<number>}
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueRemoveItemsRequest
|
||||
*/
|
||||
new(
|
||||
itemIdsToRemove: Array<number>
|
||||
):QueueRemoveItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
itemIds: Array<number>;
|
||||
}
|
||||
|
||||
interface QueueReorderItemsRequest {
|
||||
/**
|
||||
* @param {!Array<number>}
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueReorderItemsRequest
|
||||
*/
|
||||
new(
|
||||
itemIdsToReorder: Array<number>
|
||||
):QueueReorderItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
insertBefore: number;
|
||||
itemIds: Array<number>;
|
||||
}
|
||||
|
||||
interface QueueUpdateItemsRequest {
|
||||
/**
|
||||
* @param {!Array<chrome.cast.media.QueueItem>}
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.QueueUpdateItemsRequest
|
||||
*/
|
||||
new(
|
||||
itemsToUpdate: Array<chrome.cast.media.QueueItem>
|
||||
):QueueUpdateItemsRequest;
|
||||
|
||||
customData: Object;
|
||||
item: Array<chrome.cast.media.QueueItem>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TrackType
|
||||
@@ -617,7 +740,7 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GetStatusRequest
|
||||
*/
|
||||
new();
|
||||
new():GetStatusRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -627,7 +750,7 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PauseRequest
|
||||
*/
|
||||
new();
|
||||
new():PauseRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -637,7 +760,7 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PlayRequest
|
||||
*/
|
||||
new();
|
||||
new():PlayRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -647,7 +770,7 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.SeekRequest
|
||||
*/
|
||||
new();
|
||||
new():SeekRequest;
|
||||
|
||||
currentTime: number;
|
||||
resumeState: chrome.cast.media.ResumeState;
|
||||
@@ -659,7 +782,7 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.StopRequest
|
||||
*/
|
||||
new();
|
||||
new():StopRequest;
|
||||
|
||||
customData: Object;
|
||||
}
|
||||
@@ -672,7 +795,7 @@ declare module chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
volume: chrome.cast.Volume
|
||||
);
|
||||
):VolumeRequest;
|
||||
|
||||
volume: chrome.cast.Volume;
|
||||
customData: Object;
|
||||
@@ -686,7 +809,7 @@ declare module chrome.cast.media {
|
||||
*/
|
||||
new(
|
||||
mediaInfo: chrome.cast.media.MediaInfo
|
||||
);
|
||||
):LoadRequest;
|
||||
|
||||
activeTrackIds: Array<number>;
|
||||
autoplay: boolean;
|
||||
@@ -697,7 +820,7 @@ declare module chrome.cast.media {
|
||||
|
||||
interface EditTracksInfoRequest {
|
||||
/**
|
||||
* @param {Array.<number>=} opt_activeTrackIds
|
||||
* @param {Array<number>=} opt_activeTrackIds
|
||||
* @param {chrome.cast.media.TextTrackStyle=} opt_textTrackStyle
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.EditTracksInfoRequest
|
||||
@@ -705,7 +828,7 @@ declare module chrome.cast.media {
|
||||
new(
|
||||
activeTrackIds?: Array<number>,
|
||||
textTrackStyle?: chrome.cast.media.TextTrackStyle
|
||||
);
|
||||
):EditTracksInfoRequest;
|
||||
|
||||
activeTrackIds: Array<number>;
|
||||
textTrackStyle: chrome.cast.media.TextTrackStyle;
|
||||
@@ -716,17 +839,17 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.GenericMediaMetadata
|
||||
*/
|
||||
new();
|
||||
new():GenericMediaMetadata;
|
||||
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
images: Array<chrome.cast.Image>;
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
releaseDate: string;
|
||||
|
||||
// Deprecated
|
||||
type: chrome.cast.media.MetadataType;
|
||||
/** @deprecated. Use releaseDate instead. */
|
||||
releaseYear: number;
|
||||
subtitle: string;
|
||||
title: string;
|
||||
/** @deprecated. Use metadataType instead. */
|
||||
type: chrome.cast.media.MetadataType;
|
||||
}
|
||||
|
||||
interface MovieMediaMetadata {
|
||||
@@ -734,18 +857,18 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MovieMediaMetadata
|
||||
*/
|
||||
new();
|
||||
|
||||
new():MovieMediaMetadata;
|
||||
|
||||
images: Array<chrome.cast.Image>;
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
releaseDate: string;
|
||||
/** @deprecated. Use releaseDate instead. */
|
||||
releaseYear: number;
|
||||
subtitle: string;
|
||||
title: string;
|
||||
studio: string;
|
||||
subtitle: string;
|
||||
images: Array<chrome.cast.Image>;
|
||||
releaseDate: string;
|
||||
|
||||
// Deprecated
|
||||
/** @deprecated. Use metadataType instead. */
|
||||
type: chrome.cast.media.MetadataType;
|
||||
releaseYear: number;
|
||||
}
|
||||
|
||||
interface TvShowMediaMetadata {
|
||||
@@ -753,7 +876,7 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TvShowMediaMetadata
|
||||
*/
|
||||
new();
|
||||
new(): TvShowMediaMetadata;
|
||||
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
seriesTitle: string;
|
||||
@@ -763,11 +886,15 @@ declare module chrome.cast.media {
|
||||
images: Array<chrome.cast.Image>;
|
||||
originalAirdate: string;
|
||||
|
||||
// Deprecated
|
||||
/** @deprecated. Use metadataType instead. */
|
||||
type: chrome.cast.media.MetadataType;
|
||||
/** @deprecated. Use title instead. */
|
||||
episodeTitle: string;
|
||||
/** @deprecated. Use season instead. */
|
||||
seasonNumber: number;
|
||||
/** @deprecated. Use episode instead. */
|
||||
episodeNumber: number;
|
||||
/** @deprecated. Use originalAirdate instead. */
|
||||
releaseYear: number;
|
||||
}
|
||||
|
||||
@@ -776,7 +903,7 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.MusicTrackMediaMetadata
|
||||
*/
|
||||
new();
|
||||
new(): MusicTrackMediaMetadata;
|
||||
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
albumName: string;
|
||||
@@ -790,9 +917,11 @@ declare module chrome.cast.media {
|
||||
images: Array<chrome.cast.Image>;
|
||||
releaseDate: string;
|
||||
|
||||
// Deprecated
|
||||
/** @deprecated. Use metadataType instead. */
|
||||
type: chrome.cast.media.MetadataType;
|
||||
/** @deprecated. Use artist instead. */
|
||||
artistName: string;
|
||||
/** @deprecated. Use releaseDate instead. */
|
||||
releaseYear: number;
|
||||
}
|
||||
|
||||
@@ -801,7 +930,7 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.PhotoMediaMetadata
|
||||
*/
|
||||
new();
|
||||
new(): PhotoMediaMetadata;
|
||||
|
||||
metadataType: chrome.cast.media.MetadataType;
|
||||
title: string;
|
||||
@@ -814,7 +943,7 @@ declare module chrome.cast.media {
|
||||
height: number;
|
||||
creationDateTime: string;
|
||||
|
||||
// Deprecated
|
||||
/** @deprecated. Use metadataType instead. */
|
||||
type: chrome.cast.media.MetadataType;
|
||||
}
|
||||
|
||||
@@ -828,7 +957,7 @@ declare module chrome.cast.media {
|
||||
new(
|
||||
contentId: string,
|
||||
contentType: string
|
||||
);
|
||||
): MediaInfo;
|
||||
|
||||
contentId: string;
|
||||
streamType: chrome.cast.media.StreamType;
|
||||
@@ -850,20 +979,25 @@ declare module chrome.cast.media {
|
||||
new(
|
||||
sessionId: string,
|
||||
mediaSessionId: number
|
||||
);
|
||||
): Media;
|
||||
|
||||
sessionId: string;
|
||||
mediaSessionId: number;
|
||||
activeTrackIds: Array<number>;
|
||||
currentItemId: number;
|
||||
customData: Object;
|
||||
idleReason: chrome.cast.media.IdleReason;
|
||||
items: Array<chrome.cast.media.QueueItem>;
|
||||
loadingItemId: number;
|
||||
media: chrome.cast.media.MediaInfo;
|
||||
mediaSessionId: number;
|
||||
playbackRate: number;
|
||||
playerState: chrome.cast.media.PlayerState;
|
||||
preloadedItemId: number;
|
||||
repeatMode: chrome.cast.media.RepeatMode;
|
||||
sessionId: string;
|
||||
supportedMediaCommands: Array<chrome.cast.media.MediaCommand>;
|
||||
volume: chrome.cast.Volume;
|
||||
idleReason: chrome.cast.media.IdleReason;
|
||||
activeTrackIds: Array<number>;
|
||||
customData: Object;
|
||||
|
||||
// Deprecated
|
||||
|
||||
/** @deprecated. Use getEstimatedTime instead */
|
||||
currentTime: number;
|
||||
|
||||
/**
|
||||
@@ -955,22 +1089,130 @@ declare module chrome.cast.media {
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
addUpdateListener(
|
||||
listener: (boolean) => void
|
||||
)
|
||||
listener: (isAlive:boolean) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function(boolean)} listener
|
||||
*/
|
||||
removeUpdateListener(
|
||||
listener: (boolean) => void
|
||||
)
|
||||
listener: (isAlive:boolean) => void
|
||||
): void
|
||||
|
||||
// Deprecated
|
||||
/**
|
||||
* @return {number}
|
||||
* @suppress {deprecated} Uses currentTime member to compute estimated time.
|
||||
*/
|
||||
getEstimatedTime(): number
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.QueueItem} item
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueAppendItem (
|
||||
item: chrome.cast.media.QueueItem,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.QueueInsertItemsRequest} queueInsertItemsRequest
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueInsertItems (
|
||||
queueInsertItemsRequest: chrome.cast.media.QueueInsertItemsRequest,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!number} itemId
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueJumpToItem (
|
||||
itemId: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!number} itemId
|
||||
* @param {!number} newIndex
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueMoveItemToNewIndex (
|
||||
itemId: number,
|
||||
newIndex: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueNext (
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queuePrev (
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!number} itemId
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueRemoveItem (
|
||||
itemId: number,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.QueueReorderItemsRequest} queueReorderItemsRequest
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueReorderItems (
|
||||
queueReorderItemsRequest: chrome.cast.media.QueueReorderItemsRequest,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.RepeatMode} repeatMode
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueSetRepeatMode (
|
||||
repeatMode: chrome.cast.media.RepeatMode,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {!chrome.cast.media.QueueUpdateItemsRequest} queueUpdateItemsRequest
|
||||
* @param {function()} successCallback
|
||||
* @param {function(!chrome.cast.Error)} errorCallback
|
||||
*/
|
||||
queueUpdateItems (
|
||||
queueUpdateItemsRequest: chrome.cast.media.QueueUpdateItemsRequest,
|
||||
successCallback: Function,
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
}
|
||||
|
||||
interface Track {
|
||||
@@ -983,7 +1225,7 @@ declare module chrome.cast.media {
|
||||
new(
|
||||
trackId: number,
|
||||
trackType: chrome.cast.media.TrackType
|
||||
);
|
||||
): Track;
|
||||
|
||||
trackId: number;
|
||||
trackContentId: string;
|
||||
@@ -1000,7 +1242,7 @@ declare module chrome.cast.media {
|
||||
* @constructor
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast.media.TextTrackStyle
|
||||
*/
|
||||
new();
|
||||
new(): TextTrackStyle;
|
||||
|
||||
foregroundColor: string;
|
||||
backgroundColor: string;
|
||||
@@ -1030,4 +1272,9 @@ declare module chrome.cast.media.timeout {
|
||||
var stop: number;
|
||||
var setVolume: number;
|
||||
var editTracksInfo: number;
|
||||
var queueInsert: number;
|
||||
var queueLoad: number;
|
||||
var queueRemove: number;
|
||||
var queueReorder: number;
|
||||
var queueUpdate: number;
|
||||
}
|
||||
Vendored
+32
@@ -43,6 +43,37 @@ declare module chrome.alarms {
|
||||
var onAlarm: AlarmEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the chrome.browser API to interact with the Chrome browser associated with
|
||||
* the current application and Chrome profile.
|
||||
*/
|
||||
declare module chrome.browser {
|
||||
interface Options {
|
||||
/**
|
||||
* The URL to navigate to when the new tab is initially opened.
|
||||
*/
|
||||
url:string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a new tab in a browser window associated with the current application
|
||||
* and Chrome profile. If no browser window for the Chrome profile is opened,
|
||||
* a new one is opened prior to creating the new tab.
|
||||
* @param options Configures how the tab should be opened.
|
||||
* @param callback Called when the tab was successfully
|
||||
* created, or failed to be created. If failed, runtime.lastError will be set.
|
||||
*/
|
||||
export function openTab (options: Options, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Opens a new tab in a browser window associated with the current application
|
||||
* and Chrome profile. If no browser window for the Chrome profile is opened,
|
||||
* a new one is opened prior to creating the new tab. Since Chrome 42 only.
|
||||
* @param options Configures how the tab should be opened.
|
||||
*/
|
||||
export function openTab (options: Options): void;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Bookmarks
|
||||
////////////////////
|
||||
@@ -1051,6 +1082,7 @@ declare module chrome.history {
|
||||
////////////////////
|
||||
declare module chrome.identity {
|
||||
var getAuthToken: (options: any, cb: (token: {}) => void) => void;
|
||||
var launchWebAuthFlow: (options: any, cb: (redirect_url: string) => void) => void;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
//String rule with param:
|
||||
//match '/news/123' passing "123" as param to handler
|
||||
var route1 = crossroads.addRoute('/news/{id}', function(id){
|
||||
var route1 = crossroads.addRoute('/news/{id}', function(id: any){
|
||||
console.log(id);
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ route2.matched.add(console.log, console);
|
||||
//RegExp rule:
|
||||
//match '/lorem/ipsum' passing "ipsum" as param to handler
|
||||
//note the capturing group around segment
|
||||
var route3 = crossroads.addRoute(/^\/lorem\/([a-z]+)$/, function(id){
|
||||
var route3 = crossroads.addRoute(/^\/lorem\/([a-z]+)$/, function(id: any){
|
||||
console.log(id);
|
||||
});
|
||||
|
||||
@@ -29,13 +29,13 @@ route4.matched.add(console.log, console);
|
||||
|
||||
//Query String:
|
||||
//match 'foo.php?lorem=ipsum&dolor=amet'
|
||||
crossroads.addRoute('foo.php{?query}', function(query){
|
||||
crossroads.addRoute('foo.php{?query}', function(query: any){
|
||||
// query strings are decoded into objects
|
||||
console.log('lorem '+ query.lorem +' dolor sit '+ query.dolor);
|
||||
});
|
||||
|
||||
var sectionRoute = crossroads.addRoute('/{section}/{id}');
|
||||
function onSectionMatch(section, id){
|
||||
function onSectionMatch(section: any, id: any){
|
||||
console.log(section +' - '+ id);
|
||||
}
|
||||
sectionRoute.matched.add(onSectionMatch);
|
||||
@@ -46,21 +46,21 @@ crossroads.parse('/news/123');
|
||||
crossroads.parse('/news/123', ["lorem", "ipsum"]);
|
||||
|
||||
var route1 = crossroads.addRoute('/news/{id}');
|
||||
crossroads.bypassed.add(function(request){
|
||||
crossroads.bypassed.add(function(request: any){
|
||||
console.log(request);
|
||||
});
|
||||
//won't match any route, triggering `bypassed` Signal
|
||||
crossroads.parse('/foo');
|
||||
|
||||
|
||||
crossroads.routed.add(function(request, data){
|
||||
crossroads.routed.add(function(request: any, data: any){
|
||||
console.log(request);
|
||||
console.log(data.route +' - '+ data.params +' - '+ data.isFirst);
|
||||
});
|
||||
crossroads.parse('/news/123'); //match `route1`, triggering `routed` Signal
|
||||
|
||||
var otherRouter = crossroads.create();
|
||||
otherRouter.addRoute('/news/{id}', function(id){
|
||||
otherRouter.addRoute('/news/{id}', function(id: any){
|
||||
console.log(id);
|
||||
});
|
||||
otherRouter.parse('/news/123');
|
||||
@@ -70,36 +70,36 @@ crossroads.bypassed.add(otherRouter.parse, otherRouter);
|
||||
// same effect as calling: `crossroads.pipe(otherRouter)`
|
||||
|
||||
crossroads.normalizeFn = crossroads.NORM_AS_OBJECT;
|
||||
crossroads.addRoute('/{foo}/{bar}', function(vals){
|
||||
crossroads.addRoute('/{foo}/{bar}', function(vals: any){
|
||||
//can access captured values as object properties
|
||||
console.log(vals.foo +' - '+ vals.bar);
|
||||
});
|
||||
crossroads.parse('/lorem/ipsum');
|
||||
|
||||
crossroads.normalizeFn = crossroads.NORM_AS_ARRAY;
|
||||
crossroads.addRoute('/{foo}/{bar}', function(vals){
|
||||
crossroads.addRoute('/{foo}/{bar}', function(vals: any){
|
||||
//can access captured values as Array items
|
||||
console.log(vals[0] +' - '+ vals[1]);
|
||||
});
|
||||
crossroads.parse('/dolor/amet');
|
||||
|
||||
crossroads.normalizeFn = function(request, vals){
|
||||
crossroads.normalizeFn = function(request: any, vals: any){
|
||||
//make sure first argument is always "news"
|
||||
return ['news', vals.id];
|
||||
};
|
||||
crossroads.addRoute('/{cat}/{id}', function(cat, id){
|
||||
crossroads.addRoute('/{cat}/{id}', function(cat: any, id: any){
|
||||
console.log(cat +' - '+ id);
|
||||
});
|
||||
crossroads.parse('/article/123');
|
||||
|
||||
crossroads.shouldTypecast = true; //default = false
|
||||
crossroads.addRoute('/news/{id}', function(id){
|
||||
crossroads.addRoute('/news/{id}', function(id: any){
|
||||
console.log(id); // 12 (remove trailing zeroes since it's typecasted)
|
||||
});
|
||||
crossroads.parse('/news/00012');
|
||||
|
||||
crossroads.shouldTypecast = false; //default = false
|
||||
crossroads.addRoute('/news/{id}', function(id){
|
||||
crossroads.addRoute('/news/{id}', function(id: any){
|
||||
console.log(id); // "00012" (keep trailing zeroes)
|
||||
});
|
||||
crossroads.parse('/news/00012');
|
||||
@@ -122,10 +122,10 @@ sectionRouter.unpipe(navRouter);
|
||||
sectionRouter.parse('bar');
|
||||
|
||||
var route1 = crossroads.addRoute('/news/{id}');
|
||||
route1.matched.add(function(id){
|
||||
route1.matched.add(function(id: any){
|
||||
console.log('handler 1: '+ id);
|
||||
});
|
||||
route1.matched.add(function(id){
|
||||
route1.matched.add(function(id: any){
|
||||
console.log('handler 2: '+ id);
|
||||
});
|
||||
crossroads.parse('/news/123'); //will trigger both handlers of `route1`
|
||||
@@ -145,7 +145,7 @@ route1.rules = {
|
||||
* @param {object} valuesObj Values of all pattern segments.
|
||||
* @return {boolean} If segment value is valid.
|
||||
*/
|
||||
id : function(value, request, valuesObj){
|
||||
id : function(value: any, request: string, valuesObj: any): boolean{
|
||||
if(isNaN(value)){
|
||||
return false;
|
||||
}else{
|
||||
@@ -165,7 +165,7 @@ route1.rules = {
|
||||
* Note that request will be typecasted if value is a boolean
|
||||
* or number and crossroads.shouldTypecast = true (default = false).
|
||||
*/
|
||||
request_ : function(request){
|
||||
request_ : function(request: any){
|
||||
return (request != '123');
|
||||
},
|
||||
|
||||
@@ -177,7 +177,7 @@ route1.rules = {
|
||||
* also a property `request_`.
|
||||
* @return {array} Array containing parameters.
|
||||
*/
|
||||
normalize_ : function(request, vals){
|
||||
normalize_ : function(request: any, vals: any): Array<any> {
|
||||
//ignore "date" since it isn't important for the application
|
||||
return [vals.section, vals.id];
|
||||
}
|
||||
@@ -196,7 +196,7 @@ var route1 = crossroads.addRoute(/([\-\w]+)\/([\-\w]+)\/([\-\w]+)/);
|
||||
route1.rules = {
|
||||
'0' : ['blog', 'news', '123'],
|
||||
'1' : /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/,
|
||||
'2' : function(value, request, valuesObj){
|
||||
'2' : function(value: any, request: any, valuesObj: any){
|
||||
return ! isNaN(value);
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+7
-7
@@ -28,7 +28,7 @@ declare module CrossroadsJs {
|
||||
/**
|
||||
* Remove route from crossroads and destroy it, releasing memory.
|
||||
*/
|
||||
dispose();
|
||||
dispose(): void;
|
||||
|
||||
/**
|
||||
* Test if Route matches against request. Return true if request validate against route rules and pattern.
|
||||
@@ -70,12 +70,12 @@ declare module CrossroadsJs {
|
||||
*
|
||||
* @param route Reference to the Route object returned by crossroads.addRoute().
|
||||
*/
|
||||
removeRoute(route: Route);
|
||||
removeRoute(route: Route): void;
|
||||
|
||||
/**
|
||||
* Remove all routes from crossroads collection.
|
||||
*/
|
||||
removeAllRoutes();
|
||||
removeAllRoutes(): void;
|
||||
|
||||
/**
|
||||
* Parse a string input and dispatch matched Signal of the first Route that matches the request.
|
||||
@@ -83,7 +83,7 @@ declare module CrossroadsJs {
|
||||
* @param request String that should be evaluated and matched against Routes to define which Route handlers should be executed and which parameters should be passed to the handlers.
|
||||
* @param defaultargs Array containing values passed to matched/routed/bypassed signals as first arguments. Useful for node.js in case you need to access the request and response objects.
|
||||
*/
|
||||
parse(request: string, ...defaultArgs: any[]);
|
||||
parse(request: string, ...defaultArgs: any[]): void;
|
||||
|
||||
/**
|
||||
* Get number of Routes contained on the crossroads collection.
|
||||
@@ -133,7 +133,7 @@ declare module CrossroadsJs {
|
||||
/**
|
||||
* Resets the Router internal state. Will clear reference to previously matched routes (so they won't dispatch switched signal when matching a new route) and reset last request.
|
||||
*/
|
||||
resetState();
|
||||
resetState(): void;
|
||||
|
||||
/**
|
||||
* Sets if Router should care about previous state, so multiple crossroads.parse() calls passing same argument would not trigger the routed, matched and bypassed signals.
|
||||
@@ -143,12 +143,12 @@ declare module CrossroadsJs {
|
||||
/**
|
||||
* Pipe routers, so all crossroads.parse() calls will be forwarded to the other router as well.
|
||||
*/
|
||||
pipe(router: CrossRoadsStatic);
|
||||
pipe(router: CrossRoadsStatic): void;
|
||||
|
||||
/**
|
||||
* "Ceci n'est pas une pipe"
|
||||
*/
|
||||
unpipe(router: CrossRoadsStatic);
|
||||
unpipe(router: CrossRoadsStatic): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
|
||||
|
||||
var fill = d3.scale.category20();
|
||||
var fill = d3.scale.category20<number>();
|
||||
d3.layout.cloud().size([300, 300])
|
||||
.words([
|
||||
"Hello", "world", "normally", "you", "want", "more", "words",
|
||||
@@ -40,4 +40,4 @@
|
||||
return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")";
|
||||
})
|
||||
.text(function(d:ICompTextSize) { return d.text; });
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+69
-33
@@ -5,41 +5,77 @@
|
||||
|
||||
/// <reference path="../d3/d3.d.ts" />
|
||||
|
||||
declare module D3 {
|
||||
export module Layout {
|
||||
export interface IRotate {
|
||||
(number:number) : CloudLayout;
|
||||
(number:()=>number) : CloudLayout;
|
||||
declare module d3 {
|
||||
module layout {
|
||||
export function cloud(): Cloud<cloud.Word>;
|
||||
export function cloud<T extends cloud.Word>(): Cloud<T>;
|
||||
|
||||
module cloud {
|
||||
interface Word {
|
||||
text?: string;
|
||||
font?: string;
|
||||
style?: string;
|
||||
weight?: string | number;
|
||||
rotate?: number;
|
||||
size?: number;
|
||||
padding?: number;
|
||||
x?: number;
|
||||
y?: number;
|
||||
}
|
||||
}
|
||||
|
||||
interface Cloud<T extends cloud.Word> {
|
||||
start(): Cloud<T>;
|
||||
stop(): Cloud<T>;
|
||||
|
||||
timeInterval(): number;
|
||||
timeInterval(interval: number): Cloud<T>;
|
||||
|
||||
export interface CloudLayout {
|
||||
(layers: any[], index?: number): any[];
|
||||
values(accessor?: (d: any) => any): CloudLayout;
|
||||
offset(offset: string): CloudLayout;
|
||||
size: {
|
||||
/**
|
||||
* Gets the available layout size
|
||||
*/
|
||||
(): Array<number>;
|
||||
/**
|
||||
* Sets the available layout size
|
||||
*/
|
||||
(size: Array<number>): CloudLayout;
|
||||
};
|
||||
words: (inputArray: Array<any>) => CloudLayout;
|
||||
rotate:IRotate;
|
||||
padding: (number:number) => CloudLayout;
|
||||
font: (string:string) => CloudLayout;
|
||||
fontSize(fctn: (d: any) => number): CloudLayout;
|
||||
on: (eventname: string, callee: (words: any[]) => void) => CloudLayout;
|
||||
start: () => CloudLayout;
|
||||
words(): T[];
|
||||
words(words: T[]): Cloud<T>;
|
||||
|
||||
size(): [number, number];
|
||||
size(size: [number, number]): Cloud<T>;
|
||||
|
||||
font(): (datum: T, index: number) => string;
|
||||
font(font: string): Cloud<T>;
|
||||
font(font: (datum: T, index: number) => string): Cloud<T>;
|
||||
|
||||
fontStyle(): (datum: T, index: number) => string;
|
||||
fontStyle(style: string): Cloud<T>;
|
||||
fontStyle(style: (datum: T, index: number) => string): Cloud<T>;
|
||||
|
||||
fontWeight(): (datum: T, index: number) => string | number;
|
||||
fontWeight(weight: string | number): Cloud<T>;
|
||||
fontWeight(weight: (datum: T, index: number) => string | number): Cloud<T>;
|
||||
|
||||
rotate(): (datum: T, index: number) => number;
|
||||
rotate(rotate: number): Cloud<T>;
|
||||
rotate(rotate: (datum: T, index: number) => number): Cloud<T>;
|
||||
|
||||
text(): (datum: T, index: number) => string;
|
||||
text(text: string): Cloud<T>;
|
||||
text(text: (datum: T, index: number) => string): Cloud<T>;
|
||||
|
||||
spiral(): (size: number) => (t: number) => [number, number];
|
||||
spiral(name: string): Cloud<T>;
|
||||
spiral(spiral: (size: number) => (t: number) => [number, number]): Cloud<T>;
|
||||
|
||||
fontSize(): (datum: T, index: number) => number;
|
||||
fontSize(size: number): Cloud<T>;
|
||||
fontSize(size: (datum: T, index: number) => number): Cloud<T>;
|
||||
|
||||
padding(): (datum: T, index: number) => number;
|
||||
padding(padding: number): Cloud<T>;
|
||||
padding(padding: (datum: T, index: number) => number): Cloud<T>;
|
||||
|
||||
on(type: "word", listener: (word: T) => void): Cloud<T>;
|
||||
on(type: "end", listener: (tags: T[], bounds: { x: number; y: number }[]) => void): Cloud<T>;
|
||||
on(type: string, listener: (...args: any[]) => void): Cloud<T>;
|
||||
|
||||
on(type: "word"): (word: T) => void;
|
||||
on(type: "end"): (tags: T[], bounds: { x: number; y: number }[]) => void;
|
||||
on(type: string): (...args: any[]) => void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export interface Layout {
|
||||
cloud(): CloudLayout;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+395
-388
File diff suppressed because it is too large
Load Diff
Vendored
+3172
-3368
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@ function superformula() {
|
||||
.attr("width", 960)
|
||||
.attr("height", 500);
|
||||
|
||||
var small = d3.superformula()
|
||||
var small = d3.superformula<string>()
|
||||
.type(function (d) { return d; } )
|
||||
.size(size);
|
||||
|
||||
@@ -37,4 +37,4 @@ function superformula() {
|
||||
.attr("class", "big")
|
||||
.attr("transform", "translate(450,250)")
|
||||
.attr("d", big);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+28
-29
@@ -1,38 +1,37 @@
|
||||
/// <reference path="../d3.d.ts" />
|
||||
|
||||
declare module d3 {
|
||||
export function superformula<T>(): Superformula<T>;
|
||||
|
||||
declare module D3 {
|
||||
interface SuperformulaPath
|
||||
{
|
||||
superformulaPath(params: number[], n: number, diameter: number): Superformula;
|
||||
module superformula {
|
||||
interface Type {
|
||||
m: number;
|
||||
n1: number;
|
||||
n2: number;
|
||||
n3: number;
|
||||
a: number;
|
||||
b: number;
|
||||
}
|
||||
}
|
||||
|
||||
interface Superformula<T> {
|
||||
(datum: T, index: number): string;
|
||||
|
||||
interface SuperformulaType
|
||||
{
|
||||
(any: any): any;//hans
|
||||
m: number;
|
||||
n1: number;
|
||||
n2: number;
|
||||
n3: number;
|
||||
a: number;
|
||||
b: number;
|
||||
type(): (datum: T, index: number) => string;
|
||||
type(type: string): Superformula<T>;
|
||||
type(type: (datum: T, index: number) => string): Superformula<T>;
|
||||
|
||||
size(): (datum: T, index: number) => number;
|
||||
size(size: number): Superformula<T>;
|
||||
size(size: (datum: T, index: number) => number): Superformula<T>;
|
||||
|
||||
segments(): (datum: T, index: number) => number;
|
||||
segments(segments: number): Superformula<T>;
|
||||
segments(segments: (datum: T, index: number) => number): Superformula<T>;
|
||||
|
||||
param(name: string): number;
|
||||
param(name: string, value: number): Superformula<T>;
|
||||
}
|
||||
|
||||
interface Superformula
|
||||
{
|
||||
(): any;
|
||||
type(any: any): any;
|
||||
param(name: string, value: number): Superformula;
|
||||
size(x: number): Superformula;
|
||||
segments(x: number): Superformula;
|
||||
}
|
||||
|
||||
|
||||
interface Base extends Selectors
|
||||
{
|
||||
superformula: Superformula;
|
||||
superformulaPath: SuperformulaPath;
|
||||
superformulaTypes: SuperformulaType[];
|
||||
}
|
||||
export var superformulaTypes: string[];
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -24,7 +24,7 @@ declare module Dagre {
|
||||
|
||||
interface Render {
|
||||
new (): Render;
|
||||
(selection: D3.Selection, g: Dagre.Graph): void;
|
||||
(selection: d3.Selection<any>, g: Dagre.Graph): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,3 +157,19 @@ var FizzyText = function () {
|
||||
|
||||
update();
|
||||
}
|
||||
// ------------ 11. Object Literal Tests
|
||||
() => {
|
||||
var obj = {a:1,b:1};
|
||||
var gui = new dat.GUI();
|
||||
var controller = gui.add(obj, 'maxSize', 0, 10);
|
||||
|
||||
controller.onChange(function (value) {
|
||||
// Fires on every change, drag, keypress, etc.
|
||||
});
|
||||
|
||||
controller.onFinishChange(function (value) {
|
||||
// Fires when a controller loses focus.
|
||||
alert("The new value is " + value);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -47,8 +47,8 @@ export interface ILegendwidget {
|
||||
legend: (l:ILegendwidget) => T;
|
||||
chartID: () => number;
|
||||
options: (o:Object)=>void ;
|
||||
select: (selector: D3.Selection) => D3.Selection;
|
||||
selectAll: (selector: D3.Selection) => D3.Selection;
|
||||
select: (selector: d3.Selection<any>) => d3.Selection<any>;
|
||||
selectAll: (selector: d3.Selection<any>) => d3.Selection<any>;
|
||||
}
|
||||
|
||||
export interface IEvents {
|
||||
@@ -85,8 +85,8 @@ export interface ILegendwidget {
|
||||
x: IGetSet<any, T>;
|
||||
y: IGetSet<any, T>;
|
||||
elasticY: IGetSet<boolean, T>;
|
||||
xAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
yAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
xAxis: IGetSet<d3.svg.Axis, T>;
|
||||
yAxis: IGetSet<d3.svg.Axis, T>;
|
||||
yAxisPadding: IGetSet<number, T>;
|
||||
xAxisPadding: IGetSet<number, T>;
|
||||
renderHorizontalGridLines: IGetSet<boolean, T>;
|
||||
|
||||
Vendored
+50
-33
@@ -20,6 +20,21 @@ declare module DC {
|
||||
(t: T, r?: R): V;
|
||||
}
|
||||
|
||||
export interface IGetSetComputed<T, R, V> {
|
||||
(): R;
|
||||
(t: T): V;
|
||||
}
|
||||
|
||||
export interface Scale<T> {
|
||||
(x: any): T;
|
||||
|
||||
domain(values: any[]): Scale<T>;
|
||||
domain(): any[];
|
||||
|
||||
range(values: T[]): Scale<T>;
|
||||
range(): T[];
|
||||
}
|
||||
|
||||
export interface Accessor<T, V> {
|
||||
(datum: T, index?: number): V;
|
||||
}
|
||||
@@ -86,7 +101,7 @@ declare module DC {
|
||||
clamp(n: number, min: number, max: number): number;
|
||||
uniqueId(): number;
|
||||
nameToId(name: string): string;
|
||||
appendOrSelect(parent: D3.Selection, selector: string, tag: any): D3.Selection;
|
||||
appendOrSelect(parent: d3.Selection<any>, selector: string, tag: any): d3.Selection<any>;
|
||||
safeNumber(n: any): number;
|
||||
}
|
||||
|
||||
@@ -108,15 +123,15 @@ declare module DC {
|
||||
minWidth: IGetSet<number, T>;
|
||||
minHeight: IGetSet<number, T>;
|
||||
dimension: IGetSet<any, T>;
|
||||
data: IGetSet<(group: any) => Array<any>, T>;
|
||||
data: IGetSetComputed<(group: any) => Array<any>, Array<any>, T>;
|
||||
group: IGetSet<any, T>;
|
||||
ordering: IGetSet<Accessor<any, any>, T>;
|
||||
filterAll(): void;
|
||||
select(selector: D3.Selection|string): D3.Selection;
|
||||
selectAll(selector: D3.Selection|string): D3.Selection;
|
||||
anchor(anchor: BaseMixin<any>|D3.Selection|string, chartGroup?: string): D3.Selection;
|
||||
select(selector: d3.Selection<any>|string): d3.Selection<any>;
|
||||
selectAll(selector: d3.Selection<any>|string): d3.Selection<any>;
|
||||
anchor(anchor: BaseMixin<any>|d3.Selection<any>|string, chartGroup?: string): d3.Selection<any>;
|
||||
anchorName(): string;
|
||||
svg: IGetSet<D3.Selection, D3.Selection>;
|
||||
svg: IGetSet<d3.Selection<any>, d3.Selection<any>>;
|
||||
resetSvg(): void;
|
||||
filterPrinter: IGetSet<(filters: Array<any>) => string, T>;
|
||||
turnOnControls(): void;
|
||||
@@ -160,9 +175,9 @@ declare module DC {
|
||||
}
|
||||
|
||||
export interface ColorMixin<T> {
|
||||
colors: IGetSet<D3.Scale.GenericScale<any>|Array<string>, T>;
|
||||
colors: IGetSet<Array<string> | Scale<string | d3.Color>, T>;
|
||||
ordinalColors(r: Array<string>): void;
|
||||
linearColors(r: Array<number>): void;
|
||||
linearColors(r: Array<string>): void;
|
||||
colorAccessor: IGetSet<Accessor<any, string>, T>;
|
||||
colorDomain: IGetSet<Array<any>, T>;
|
||||
calculateColorDomain(): void;
|
||||
@@ -170,16 +185,16 @@ declare module DC {
|
||||
colorCalculator: IGetSet<Accessor<any, string>, T>;
|
||||
}
|
||||
|
||||
export interface CoordinateGridMixin<T> extends BaseMixin<T>, MarginMixin<T>, BaseMixin<T> {
|
||||
export interface CoordinateGridMixin<T> extends BaseMixin<T>, MarginMixin<T>, ColorMixin<T> {
|
||||
rangeChart: IGetSet<BaseMixin<any>, T>;
|
||||
zoomScale: IGetSet<Array<any>, T>;
|
||||
zoomOutRestrict: IGetSet<boolean, T>;
|
||||
g: IGetSet<D3.Selection, T>;
|
||||
g: IGetSet<d3.Selection<any>, T>;
|
||||
mouseZoomable: IGetSet<boolean, T>;
|
||||
chartBodyG(): D3.Selection;
|
||||
x: IGetSet<D3.Scale.GenericScale<any>, T>;
|
||||
chartBodyG(): d3.Selection<any>;
|
||||
x: IGetSet<(n: any) => any, T>;
|
||||
xUnits: IGetSet<UnitFunction, T>;
|
||||
xAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
xAxis: IGetSet<d3.svg.Axis, T>;
|
||||
elasticX: IGetSet<boolean, T>;
|
||||
xAxisPadding: IGetSet<number, T>;
|
||||
xUnitCount(): number;
|
||||
@@ -187,8 +202,8 @@ declare module DC {
|
||||
isOrdinal(): boolean;
|
||||
xAxisLabel: IBiGetSet<string, number, T>;
|
||||
yAxisLabel: IBiGetSet<string, number, T>;
|
||||
y: IGetSet<D3.Scale.GenericQuantitativeScale<any>, T>;
|
||||
yAxis: IGetSet<D3.Svg.Axis, T>;
|
||||
y: IGetSet<Scale<number>, T>;
|
||||
yAxis: IGetSet<d3.svg.Axis, T>;
|
||||
elasticY: IGetSet<boolean, T>;
|
||||
renderHorizontalGridLines: IGetSet<boolean, T>;
|
||||
renderVerticalGridLines: IGetSet<boolean, T>;
|
||||
@@ -209,7 +224,7 @@ declare module DC {
|
||||
hideStack(name: string): void;
|
||||
showStack(name: string): void;
|
||||
// title(stackName: string, titleFn: Accessor<any, T>);
|
||||
stackLayout: IGetSet<D3.Layout.StackLayout, T>;
|
||||
stackLayout: IGetSet<d3.layout.Stack<any[], any>, T>;
|
||||
}
|
||||
|
||||
export interface CapMixin<T> {
|
||||
@@ -219,7 +234,7 @@ declare module DC {
|
||||
}
|
||||
|
||||
export interface BubbleMixin<T> extends ColorMixin<T> {
|
||||
r: IGetSet<D3.Scale.GenericQuantitativeScale<any>, T>;
|
||||
r: IGetSet<Scale<number>, T>;
|
||||
radiusValueAccessor: IGetSet<Accessor<any, number>, T>;
|
||||
minRadiusWithLabel: IGetSet<number, T>;
|
||||
maxBubbleRelativeSize: IGetSet<number, T>;
|
||||
@@ -287,19 +302,21 @@ declare module DC {
|
||||
elasticRadius: IGetSet<boolean, BubbleChart>;
|
||||
}
|
||||
|
||||
export interface CompositeChart extends CoordinateGridMixin<CompositeChart> {
|
||||
useRightAxisGridLines: IGetSet<boolean, CompositeChart>;
|
||||
childOptions: IGetSet<any, CompositeChart>;
|
||||
rightYAxisLabel: IGetSet<string, CompositeChart>;
|
||||
compose: IGetSet<Array<BaseMixin<any>>, CompositeChart>;
|
||||
export interface ICompositeChart<T> extends CoordinateGridMixin<T> {
|
||||
useRightAxisGridLines: IGetSet<boolean, ICompositeChart<T>>;
|
||||
childOptions: IGetSet<any, ICompositeChart<T>>;
|
||||
rightYAxisLabel: IGetSet<string, ICompositeChart<T>>;
|
||||
compose: IGetSet<Array<BaseMixin<any>>, ICompositeChart<T>>;
|
||||
children(): Array<BaseMixin<any>>;
|
||||
shareColors: IGetSet<boolean, CompositeChart>;
|
||||
shareTitle: IGetSet<boolean, CompositeChart>;
|
||||
rightY: IGetSet<D3.Scale.GenericQuantitativeScale<any>, CompositeChart>;
|
||||
rightYAxis: IGetSet<D3.Svg.Axis, CompositeChart>;
|
||||
shareColors: IGetSet<boolean, ICompositeChart<T>>;
|
||||
shareTitle: IGetSet<boolean, ICompositeChart<T>>;
|
||||
rightY: IGetSet<(n: any) => any, ICompositeChart<T>>;
|
||||
rightYAxis: IGetSet<d3.svg.Axis, ICompositeChart<T>>;
|
||||
}
|
||||
|
||||
export interface SeriesChart extends CompositeChart {
|
||||
export interface CompositeChart extends ICompositeChart<CompositeChart> {}
|
||||
|
||||
export interface SeriesChart extends ICompositeChart<SeriesChart> {
|
||||
chart: IGetSet<(c: any) => BaseMixin<any>, SeriesChart>;
|
||||
seriesAccessor: IGetSet<Accessor<any, any>, SeriesChart>;
|
||||
seriesSort: IGetSet<(a: any, b: any) => number, SeriesChart>;
|
||||
@@ -314,9 +331,9 @@ declare module DC {
|
||||
|
||||
export interface GeoChoroplethChart extends ColorMixin<GeoChoroplethChart>, BaseMixin<GeoChoroplethChart> {
|
||||
overlayGeoJson(json: any, name: string, keyAccessor: Accessor<any, any>): void;
|
||||
projection: IGetSet<D3.Geo.Projection, GeoChoroplethChart>;
|
||||
projection: IGetSet<d3.geo.Projection, GeoChoroplethChart>;
|
||||
geoJsons(): Array<GeoChoroplethLayer>;
|
||||
geoPath(): D3.Geo.Path;
|
||||
geoPath(): d3.geo.Path;
|
||||
removeGeoJson(name: string): void;
|
||||
}
|
||||
|
||||
@@ -325,9 +342,9 @@ declare module DC {
|
||||
}
|
||||
|
||||
export interface RowChart extends CapMixin<RowChart>, MarginMixin<RowChart>, ColorMixin<RowChart>, BaseMixin<RowChart> {
|
||||
x: IGetSet<D3.Scale.GenericQuantitativeScale<any>, RowChart>;
|
||||
x: IGetSet<Scale<number>, RowChart>;
|
||||
renderTitleLabel: IGetSet<boolean, RowChart>;
|
||||
xAxis: IGetSet<D3.Svg.Axis, RowChart>;
|
||||
xAxis: IGetSet<d3.svg.Axis, RowChart>;
|
||||
fixedBarHeight: IGetSet<number, RowChart>;
|
||||
gap: IGetSet<number, RowChart>;
|
||||
elasticX: IGetSet<boolean, RowChart>;
|
||||
@@ -338,7 +355,7 @@ declare module DC {
|
||||
|
||||
export interface ScatterPlot extends CoordinateGridMixin<ScatterPlot> {
|
||||
existenceAccessor: IGetSet<Accessor<any, boolean>, ScatterPlot>;
|
||||
symbol: IGetSet<D3.Svg.Symbol, ScatterPlot>;
|
||||
symbol: IGetSet<d3.svg.Symbol<any>, ScatterPlot>;
|
||||
symbolSize: IGetSet<number, ScatterPlot>;
|
||||
highlightedSize: IGetSet<number, ScatterPlot>;
|
||||
hiddenSize: IGetSet<number, ScatterPlot>;
|
||||
@@ -392,7 +409,7 @@ declare module DC {
|
||||
renderAll(group?: string): void;
|
||||
redrawAll(group?: string): void;
|
||||
disableTransitions: boolean;
|
||||
transition(selections: D3.Selection, duration: number, callback: (s: D3.Selection) => void): void;
|
||||
transition(selections: d3.Selection<any>, duration: number, callback: (s: d3.Selection<any>) => void): void;
|
||||
|
||||
units: Units;
|
||||
events: Events;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/// <reference path="dx.chartjs-14.1.d.ts" />
|
||||
|
||||
module Test {
|
||||
$("<div/>").appendTo(document.body).dxChart({
|
||||
size: {
|
||||
width: 600,
|
||||
height: 400
|
||||
},
|
||||
title: {
|
||||
text: 'Chart in jQuery mode',
|
||||
font: { color: 'rgb(0, 128, 128)!important' }
|
||||
},
|
||||
argumentAxis: {
|
||||
categories: ['January', 'February', 'March', 'April', 'May', 'June']
|
||||
},
|
||||
dataSource: [
|
||||
{ arg: 'January', v1: 10, v2: 20, v3: 24 },
|
||||
{ arg: 'February', v1: 5, v2: 35, v3: 43 },
|
||||
{ arg: 'March', v1: 50, v2: 10, v3: 80 },
|
||||
{ arg: 'April', v1: 9, v2: 79, v3: 39 },
|
||||
{ arg: 'May', v1: 100, v2: 42, v3: 22 },
|
||||
{ arg: 'June', v1: 95, v2: 11, v3: 41 }
|
||||
],
|
||||
series: [{ valueField: 'v1' }, { valueField: 'v2' }, { valueField: 'v3' }]
|
||||
});
|
||||
}
|
||||
Vendored
-1865
File diff suppressed because it is too large
Load Diff
@@ -1,258 +0,0 @@
|
||||
/// <reference path="dx.phonejs-14.1.d.ts" />
|
||||
|
||||
module Test {
|
||||
var url = "http://some-json-service.net/data.json";
|
||||
var dsFromUrl = new DevExpress.data.DataSource(url);
|
||||
|
||||
var dsFromObject = new DevExpress.data.DataSource({
|
||||
load: function (loadOptions?: DevExpress.data.LoadOptions) {
|
||||
return $.ajax(url);
|
||||
}
|
||||
});
|
||||
|
||||
var application:DevExpress.framework.html.HtmlApplication = new DevExpress.framework.html.HtmlApplication({
|
||||
namespace: "global",
|
||||
defaultLayout: "slideout",
|
||||
navigation: [
|
||||
{ id: "first", title: "Home", action: "#home" },
|
||||
{ id: "second", title: "About", action: "#about" }
|
||||
]
|
||||
});
|
||||
application.router.register(":view/:id", { view: "home", id: undefined });
|
||||
application.navigate();
|
||||
|
||||
$("div").appendTo(document.body).dxMap({
|
||||
location: [40.749825, -73.987963],
|
||||
zoom: 13,
|
||||
provider: "googleStatic",
|
||||
controls: true,
|
||||
routes: [
|
||||
{
|
||||
weight: 4,
|
||||
opacity: 0.75,
|
||||
color: "red",
|
||||
mode: "walking",
|
||||
locations: [
|
||||
[40.737102, -73.990318],
|
||||
[40.749825, -73.987963],
|
||||
[40.75, -73.98],
|
||||
[40.755823, -73.986397]
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
$("div").appendTo(document.body).dxTabs({
|
||||
itemClickAction: function (e: any) {
|
||||
console.log(e.itemData.text);
|
||||
},
|
||||
items: [
|
||||
{ text: "user" },
|
||||
{ text: "analytics" },
|
||||
{ text: "customers" },
|
||||
{ text: "search" },
|
||||
{ text: "favorites" }
|
||||
]
|
||||
});
|
||||
|
||||
$("div").appendTo(document.body).dxList({
|
||||
scrollByContent: true,
|
||||
items: ["item1", "item2", "item3"],
|
||||
itemHoldAction: function (e: any) { console.log("itemHold"); },
|
||||
itemClickAction: function (e: any) { console.log("itemClick"); },
|
||||
itemSwipeAction: function (e: any) { console.log("itemSwipe " + e.direction); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxToast({
|
||||
type: 'error',
|
||||
message: 'Sample error message'
|
||||
});
|
||||
$("div").appendTo(document.body).dxPopup({
|
||||
closeButton: true,
|
||||
title: "Popup title"
|
||||
});
|
||||
$("div").appendTo(document.body).dxPivot({
|
||||
items: [
|
||||
{ title: "all", text: "all" },
|
||||
{ title: "unread", text: "unread" },
|
||||
{ title: "favorites", text: "favorites" }
|
||||
],
|
||||
itemSelectAction: function (e: Object) { console.log("itemSelectAction"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxLookup({
|
||||
items: [
|
||||
{ id: 1, caption: "red" },
|
||||
{ id: 3, caption: "blue" },
|
||||
{ id: 6, caption: "white" },
|
||||
{ id: 2, caption: "green" },
|
||||
{ id: 4, caption: "yellow" },
|
||||
{ id: 5, caption: "orange" },
|
||||
{ id: 7, caption: "purple" }
|
||||
],
|
||||
valueExpr: 'id',
|
||||
displayExpr: 'caption',
|
||||
itemRender: function (item: any) {
|
||||
return "Text is: " + item.caption;
|
||||
}
|
||||
});
|
||||
$("div").appendTo(document.body).dxSlider({
|
||||
min: 50,
|
||||
value: 75,
|
||||
max: 100,
|
||||
disabled: false
|
||||
});
|
||||
$("div").appendTo(document.body).dxNavBar({
|
||||
items: [
|
||||
{ text: "user", icon: "user" },
|
||||
{ text: "find", icon: "find", disabled: false },
|
||||
{ text: "favorites", icon: "favorites" },
|
||||
{ text: "about", icon: "info" },
|
||||
{ text: "home", icon: "home" },
|
||||
{ text: "URI", icon: "tips" }
|
||||
],
|
||||
itemClickAction: function (e: any) { console.log(e.itemData.text); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxSwitch({
|
||||
value: false,
|
||||
onText: 'LongName',
|
||||
offText: 'Short',
|
||||
width: "100%",
|
||||
visible: true
|
||||
});
|
||||
$("div").appendTo(document.body).dxButton({
|
||||
text: "Click me",
|
||||
icon: 'add',
|
||||
clickAction: function () { console.log("clicked"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxOverlay({
|
||||
visible: false,
|
||||
closeOnOutsideClick: true,
|
||||
contentReadyAction: function () {
|
||||
$("#hideButton").dxButton({
|
||||
text: "Hide",
|
||||
clickAction: function () { $("#overlay").data("dxOverlay").option("visible", false); }
|
||||
});
|
||||
}
|
||||
});
|
||||
$("div").appendTo(document.body).dxDateBox({
|
||||
value: new Date(),
|
||||
format: "datetime"
|
||||
});
|
||||
$("div").appendTo(document.body).dxPopover({
|
||||
width: '300',
|
||||
height: 'auto',
|
||||
visible: true,
|
||||
target: '.dx-button'
|
||||
});
|
||||
$("div").appendTo(document.body).dxTextBox({
|
||||
value: "Text",
|
||||
placeholder: "Placeholder",
|
||||
mode: "email",
|
||||
maxLength: 20,
|
||||
readOnly: false,
|
||||
changeAction: function (e:Object) { console.log("value changed"); },
|
||||
valueUpdateAction: function (e:Object) { console.log("value updated"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxToolbar({
|
||||
items: [
|
||||
{ align: 'left', widget: 'button', options: { type: 'back', text: 'Back', clickAction: function (e:Object) { console.log("back clicked"); } } },
|
||||
{ align: 'center', widget: 'button', options: { text: 'button', clickAction: function (e:Object) { console.log("button clicked"); } } },
|
||||
{ align: 'center', widget: 'button', options: { icon: 'plus', text: 'add', clickAction: function (e:Object) { console.log("plus clicked"); } } },
|
||||
{ align: 'right', widget: 'button', options: { icon: 'find', clickAction: function (e:Object) { console.log("find clicked"); } }, useMenu: false },
|
||||
{ text: 'Products', isMenu: true }
|
||||
]
|
||||
});
|
||||
$("div").appendTo(document.body).dxTileView({
|
||||
items: [
|
||||
{ text: "item1", widthRatio: 1.7, heightRatio: 1.7 },
|
||||
{ text: "item2", widthRatio: 0.2, heightRatio: 0.2 },
|
||||
{ text: "item3", widthRatio: 2, heightRatio: 2 }
|
||||
],
|
||||
listHeight: 500,
|
||||
itemRender: function (item: any) { return "Text is: " + item.text; },
|
||||
itemClickAction: function () { console.log("itemClick"); },
|
||||
baseItemWidth: 100,
|
||||
baseItemHeight: 100,
|
||||
itemMargin: 20
|
||||
});
|
||||
$("div").appendTo(document.body).dxPanorama({
|
||||
title: "my panorama",
|
||||
items: [
|
||||
{ header: "first", text: "first item" },
|
||||
{ text: "second item" },
|
||||
{ text: "third" },
|
||||
{ text: "fourth" }
|
||||
],
|
||||
selectedIndex: 0,
|
||||
backgroundImage: { width: 89, height: 50 },
|
||||
itemSelectAction: function () { console.log("item selected"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxCheckBox({
|
||||
checked: false,
|
||||
disabled: false,
|
||||
clickAction: function (e:Object) { console.log("clicked"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxTextArea({
|
||||
value: 'Disabled',
|
||||
disabled: true,
|
||||
placeholder: "Placeholder"
|
||||
});
|
||||
$("div").appendTo(document.body).dxLoadPanel({
|
||||
message: 'Please wait ...',
|
||||
showIndicator: true,
|
||||
visible: true
|
||||
});
|
||||
$("div").appendTo(document.body).dxNumberBox({
|
||||
value: 100,
|
||||
min: 0,
|
||||
max: 200
|
||||
});
|
||||
$("div").appendTo(document.body).dxSelectBox({
|
||||
value: 2,
|
||||
dataSource: new DevExpress.data.DataSource([1, 2, 2, 3])
|
||||
});
|
||||
$("div").appendTo(document.body).dxScrollable({
|
||||
useNative: false,
|
||||
startAction: function (e:Object) { console.log("start"); },
|
||||
endAction: function (e:Object) { console.log("end"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxRadioGroup({
|
||||
items: [{ text: "0" }, { text: "1" }, { text: "2" }],
|
||||
name: "Sample",
|
||||
selectedIndex: -1
|
||||
});
|
||||
$("div").appendTo(document.body).dxScrollView({
|
||||
pullDownAction: function (e:Object) { console.log("pulling down"); },
|
||||
reachBottomAction: function (e:Object) { console.log("bottom reached"); },
|
||||
disabled: false
|
||||
});
|
||||
$("div").appendTo(document.body).dxActionSheet({
|
||||
title: 'Select action',
|
||||
items: [
|
||||
{ text: "Reply", clickAction: function () { console.log("Reply"); } },
|
||||
{ text: "Forward", clickAction: function () { console.log("Forward"); } },
|
||||
{ text: "Delete", clickAction: function () { console.log("Delete"); }, type: "danger" },
|
||||
{ text: "Save Image", clickAction: function () { console.log("Save Image"); }, disabled: true }
|
||||
],
|
||||
showTitle: true,
|
||||
disabled: false,
|
||||
target: '#button'
|
||||
});
|
||||
$("div").appendTo(document.body).dxRangeSlider({
|
||||
start: 30,
|
||||
end: 70,
|
||||
min: 0,
|
||||
max: 100,
|
||||
step: 1
|
||||
});
|
||||
$("div").appendTo(document.body).dxAutocomplete({
|
||||
value: "Ivan",
|
||||
dataSource: new DevExpress.data.DataSource(["Ivan", "Svyatoslav", "Alexander", "Nikolay", "Dmitry", "Afanasiy", "John", "Nash", "Stacy", "Izabella", "Margarita", "Anna"]),
|
||||
placeholder: "Type name, please",
|
||||
maxItemsCount: 3,
|
||||
minSearchLength: 2,
|
||||
searchTimeout: 1000
|
||||
});
|
||||
$("div").appendTo(document.body).dxDropDownMenu({
|
||||
items: ["Item 1", "Item 2", "Item 3"],
|
||||
itemTemplate: 'itemWithIcon'
|
||||
});
|
||||
}
|
||||
Vendored
-1507
File diff suppressed because it is too large
Load Diff
@@ -1,93 +0,0 @@
|
||||
/// <reference path="dx.webappjs-14.1.d.ts" />
|
||||
|
||||
module Test {
|
||||
$('<div/>').appendTo(document.body)
|
||||
.dxDataGrid({
|
||||
allowColumnResizing: true,
|
||||
allowColumnReordering: true,
|
||||
cellClick: (clickedCell: Object) => { },
|
||||
rowClick: (clickedRow: Object) => { },
|
||||
columnChooser: {
|
||||
enabled: true,
|
||||
height: 180,
|
||||
width: 400,
|
||||
emptyPanelText: 'A place to hide the columns'
|
||||
},
|
||||
columnAutoWidth: true,
|
||||
columns: [
|
||||
'author', 'title', 'year', 'genre', 'format',
|
||||
{ dataField: 'price', visible: false },
|
||||
{ dataField: 'length', visible: false }
|
||||
],
|
||||
dataSource: new DevExpress.data.DataSource({
|
||||
store: {
|
||||
type: 'array',
|
||||
data: [
|
||||
{ id: 1, title: "The Catcher in the Rye", author: "J. D. Salinger", year: 1951, genre: "Bildungsroman", format: "paperback" },
|
||||
{ id: 2, title: "The Hitchhiker's Guide to the Galaxy", author: "D. Adams", year: 1979, genre: "Comedy, sci-fi", format: "hardcover" },
|
||||
{ id: 3, title: "Fahrenheit 451", author: "R. Bradbury", year: 1953, genre: "Dystopian novel", format: "paperback" },
|
||||
{ id: 4, title: "Nineteen Eighty-Four", author: "G. Orwell", year: 1949, genre: "Dystopian novel, political fiction", format: "hardcover" },
|
||||
{ id: 5, title: "Crime and Punishment", author: "F. Dostoyevsky", year: 1866, genre: "Philosophical novel", format: "paperback" }
|
||||
],
|
||||
key: "id"
|
||||
}
|
||||
}),
|
||||
customizeColumns: (columns: Array<Object>) => { },
|
||||
dataErrorOccurred: (error: Error) => { },
|
||||
disabled: false,
|
||||
editing: {
|
||||
editMode: 'batch',
|
||||
editEnabled: true,
|
||||
insertEnabled: true,
|
||||
removeEnabled: true
|
||||
},
|
||||
filterRow: {
|
||||
visible: true,
|
||||
showOperationChooser: false
|
||||
},
|
||||
groupPanel: {
|
||||
visible: true
|
||||
},
|
||||
grouping: {
|
||||
autoExpandAll: false
|
||||
},
|
||||
height: () => {
|
||||
return 200;
|
||||
},
|
||||
hoverStateEnabled: true,
|
||||
loadPanel: {
|
||||
height: 150,
|
||||
width: 400,
|
||||
text: 'Data is loading...'
|
||||
},
|
||||
noDataText: "It isn't the data you're looking for",
|
||||
pager: {
|
||||
showPageSizeSelector: true,
|
||||
allowedPageSizes: [3, 5, 8]
|
||||
},
|
||||
paging: {
|
||||
pageSize: 8,
|
||||
pageIndex: 19
|
||||
},
|
||||
rowAlternationEnabled: true,
|
||||
rowPrepared: (rowElement: JQuery, rowInfo: Object) => { },
|
||||
rtlEnabled: false,
|
||||
scrolling: { mode: 'infinite' },
|
||||
searchPanel: {
|
||||
visible: true,
|
||||
width: 250
|
||||
},
|
||||
selectedRowKeys: [1, 2, 4],
|
||||
selection: {
|
||||
mode: 'multiple',
|
||||
allowSelectAll: false
|
||||
},
|
||||
showColumnHeaders: true,
|
||||
showColumnLines: true,
|
||||
showRowLines: true,
|
||||
sorting: { mode: 'multiple' },
|
||||
visible: true,
|
||||
width: () => { return 400; },
|
||||
wordWrapEnabled: true
|
||||
});
|
||||
}
|
||||
-1648
File diff suppressed because it is too large
Load Diff
Vendored
+1302
-569
File diff suppressed because it is too large
Load Diff
Vendored
+5
-5
@@ -34291,7 +34291,7 @@ declare module dijit {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
byId(id: String): any;
|
||||
byId(id: String): dijit._WidgetBase;
|
||||
/**
|
||||
* A synthetic clone of array.every acting explicitly on this WidgetSet
|
||||
*
|
||||
@@ -105714,14 +105714,14 @@ declare module dijit {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
byId(id: String): String;
|
||||
byId(id: String): dijit._WidgetBase;
|
||||
/**
|
||||
* Find a widget by it's id.
|
||||
* If passed a widget then just returns the widget.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
byId(id: dijit._WidgetBase): String;
|
||||
byId(id: dijit._WidgetBase): dijit._WidgetBase;
|
||||
/**
|
||||
* Returns the widget corresponding to the given DOMNode
|
||||
*
|
||||
@@ -105956,14 +105956,14 @@ declare module dijit {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
byId(id: String): String;
|
||||
byId(id: String): dijit._WidgetBase;
|
||||
/**
|
||||
* Find a widget by it's id.
|
||||
* If passed a widget then just returns the widget.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
byId(id: dijit._WidgetBase): String;
|
||||
byId(id: dijit._WidgetBase): dijit._WidgetBase;
|
||||
/**
|
||||
* Returns the widget corresponding to the given DOMNode
|
||||
*
|
||||
|
||||
Vendored
+43
-39
@@ -927,7 +927,7 @@ declare module dojo {
|
||||
*
|
||||
*
|
||||
*/
|
||||
class __Promise extends dojo.promise.Promise {
|
||||
class __Promise implements dojo.promise.Promise<any> {
|
||||
constructor();
|
||||
/**
|
||||
* A promise resolving to an object representing
|
||||
@@ -988,7 +988,7 @@ declare module dojo {
|
||||
* @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error.
|
||||
* @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update.
|
||||
*/
|
||||
then(callback?: Function, errback?: Function, progback?: Function): dojo.promise.Promise;
|
||||
then(callback?: Function, errback?: Function, progback?: Function): dojo.promise.Promise<any>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -996,11 +996,11 @@ declare module dojo {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
trace(): dojo.promise.Promise;
|
||||
trace(): dojo.promise.Promise<any>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
traceRejected(): dojo.promise.Promise;
|
||||
traceRejected(): dojo.promise.Promise<any>;
|
||||
}
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/request/default.html
|
||||
@@ -1590,7 +1590,7 @@ declare module dojo {
|
||||
* @param listener
|
||||
* @param dontFix
|
||||
*/
|
||||
once(target: any, type: any, listener: any, dontFix: any): any;
|
||||
once(target: any, type: any, listener: any, dontFix?: any): any;
|
||||
/**
|
||||
*
|
||||
* @param target
|
||||
@@ -1783,7 +1783,7 @@ declare module dojo {
|
||||
* @param errback OptionalCallback to be invoked when the promise is rejected.
|
||||
* @param progback OptionalCallback to be invoked when the promise emits a progress update.
|
||||
*/
|
||||
interface when{(valueOrPromise: any, callback?: Function, errback?: Function, progback?: Function): void}
|
||||
interface when { <T, U>(value: T|dojo.promise.Promise<T>, callback: dojo.promise.Callback<T, U>, errback?: any, progback?: any): U|dojo.promise.Promise<U> }
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/DeferredList.html
|
||||
*
|
||||
@@ -1822,7 +1822,7 @@ declare module dojo {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
"promise": dojo.promise.Promise;
|
||||
"promise": dojo.promise.Promise<any>;
|
||||
/**
|
||||
* Inform the deferred it may cancel its asynchronous operation.
|
||||
* Inform the deferred it may cancel its asynchronous operation.
|
||||
@@ -1863,7 +1863,7 @@ declare module dojo {
|
||||
* @param update The progress update. Passed to progbacks.
|
||||
* @param strict OptionalIf strict, will throw an error if the deferred has alreadybeen fulfilled and consequently no progress can be emitted.
|
||||
*/
|
||||
progress(update: any, strict: boolean): dojo.promise.Promise;
|
||||
progress(update: any, strict: boolean): dojo.promise.Promise<any>;
|
||||
/**
|
||||
* Reject the deferred.
|
||||
* Reject the deferred, putting it in an error state.
|
||||
@@ -1879,7 +1879,7 @@ declare module dojo {
|
||||
* @param value The result of the deferred. Passed to callbacks.
|
||||
* @param strict OptionalIf strict, will throw an error if the deferred has alreadybeen fulfilled and consequently cannot be resolved.
|
||||
*/
|
||||
resolve(value: any, strict?: boolean): dojo.promise.Promise;
|
||||
resolve(value: any, strict?: boolean): dojo.promise.Promise<any>;
|
||||
/**
|
||||
* Add new callbacks to the deferred.
|
||||
* Add new callbacks to the deferred. Callbacks can be added
|
||||
@@ -1889,7 +1889,7 @@ declare module dojo {
|
||||
* @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error.
|
||||
* @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update.
|
||||
*/
|
||||
then(callback: Function, errback: Function, progback: Function): dojo.promise.Promise;
|
||||
then(callback: Function, errback: Function, progback: Function): dojo.promise.Promise<any>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -3098,7 +3098,7 @@ declare module dojo {
|
||||
*/
|
||||
class Stateful {
|
||||
constructor();
|
||||
inherited: {(arguments: IArguments): any};
|
||||
inherited: {(args: IArguments): any};
|
||||
/**
|
||||
* Get a property on a Stateful instance.
|
||||
* Get a named property on a Stateful object. The property may
|
||||
@@ -4873,7 +4873,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
every(arr: any[], callback: Function, thisObject: Object): boolean;
|
||||
every(arr: any[], callback: Function, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not every item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -4887,7 +4887,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
every(arr: String, callback: Function, thisObject: Object): boolean;
|
||||
every(arr: String, callback: Function, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not every item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -4901,7 +4901,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
every(arr: any[], callback: String, thisObject: Object): boolean;
|
||||
every(arr: any[], callback: String, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not every item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -4915,7 +4915,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
every(arr: String, callback: String, thisObject: Object): boolean;
|
||||
every(arr: String, callback: String, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Returns a new Array with those items from arr that match the
|
||||
* condition implemented by callback.
|
||||
@@ -4929,7 +4929,7 @@ declare module dojo {
|
||||
* @param callback a function that is invoked with three arguments (item,index, array). The return of this function is expected tobe a boolean which determines whether the passed-in itemwill be included in the returned array.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
filter(arr: any[], callback: Function, thisObject: Object): any[];
|
||||
filter(arr: any[], callback: Function, thisObject?: Object): any[];
|
||||
/**
|
||||
* Returns a new Array with those items from arr that match the
|
||||
* condition implemented by callback.
|
||||
@@ -4943,7 +4943,7 @@ declare module dojo {
|
||||
* @param callback a function that is invoked with three arguments (item,index, array). The return of this function is expected tobe a boolean which determines whether the passed-in itemwill be included in the returned array.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
filter(arr: any[], callback: String, thisObject: Object): any[];
|
||||
filter(arr: any[], callback: String, thisObject?: Object): any[];
|
||||
/**
|
||||
* for every item in arr, callback is invoked. Return values are ignored.
|
||||
* If you want to break out of the loop, consider using array.every() or array.some().
|
||||
@@ -5020,7 +5020,7 @@ declare module dojo {
|
||||
* @param fromIndex Optional
|
||||
* @param findLast OptionalMakes indexOf() work like lastIndexOf(). Used internally; not meant for external usage.
|
||||
*/
|
||||
indexOf(arr: any[], value: Object, fromIndex: number, findLast: boolean): number;
|
||||
indexOf(arr: any[], value: Object, fromIndex?: number, findLast?: boolean): number;
|
||||
/**
|
||||
* locates the last index of the provided value in the passed
|
||||
* array. If the value is not found, -1 is returned.
|
||||
@@ -5036,7 +5036,7 @@ declare module dojo {
|
||||
* @param value
|
||||
* @param fromIndex Optional
|
||||
*/
|
||||
lastIndexOf(arr: any, value: any, fromIndex: number): number;
|
||||
lastIndexOf(arr: any, value: any, fromIndex?: number): number;
|
||||
/**
|
||||
* applies callback to each element of arr and returns
|
||||
* an Array with the results
|
||||
@@ -5110,7 +5110,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
some(arr: any[], callback: Function, thisObject: Object): boolean;
|
||||
some(arr: any[], callback: Function, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not any item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -5124,7 +5124,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
some(arr: String, callback: Function, thisObject: Object): boolean;
|
||||
some(arr: String, callback: Function, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not any item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -5138,7 +5138,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
some(arr: any[], callback: String, thisObject: Object): boolean;
|
||||
some(arr: any[], callback: String, thisObject?: Object): boolean;
|
||||
/**
|
||||
* Determines whether or not any item in arr satisfies the
|
||||
* condition implemented by callback.
|
||||
@@ -5152,7 +5152,7 @@ declare module dojo {
|
||||
* @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met.
|
||||
* @param thisObject Optionalmay be used to scope the call to callback
|
||||
*/
|
||||
some(arr: String, callback: String, thisObject: Object): boolean;
|
||||
some(arr: String, callback: String, thisObject?: Object): boolean;
|
||||
}
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/_base/connect.html
|
||||
@@ -9119,7 +9119,7 @@ declare module dojo {
|
||||
* @param errback OptionalCallback to be invoked when the promise is rejected.
|
||||
* @param progback OptionalCallback to be invoked when the promise emits a progress update.
|
||||
*/
|
||||
when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise;
|
||||
when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise<any>;
|
||||
/**
|
||||
* signal fired by impending window destruction. You may use
|
||||
* dojo.addOnWIndowUnload() or dojo.connect() to this method to perform
|
||||
@@ -16050,7 +16050,7 @@ declare module dojo {
|
||||
*
|
||||
* @param objectOrArray OptionalThe promise will be fulfilled with a list of results if invoked with anarray, or an object of results when passed an object (using the samekeys). If passed neither an object or array it is resolved with anundefined value.
|
||||
*/
|
||||
interface all{(objectOrArray?: Object): void}
|
||||
interface all{<T>(value: Promise<T>[]): Promise<T[]>}
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/all.html
|
||||
*
|
||||
@@ -16063,7 +16063,7 @@ declare module dojo {
|
||||
*
|
||||
* @param objectOrArray OptionalThe promise will be fulfilled with a list of results if invoked with anarray, or an object of results when passed an object (using the samekeys). If passed neither an object or array it is resolved with anundefined value.
|
||||
*/
|
||||
interface all{(objectOrArray?: any[]): void}
|
||||
interface all{(value: Object): Promise<any>}
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/first.html
|
||||
*
|
||||
@@ -16107,6 +16107,11 @@ declare module dojo {
|
||||
* @param Deferred
|
||||
*/
|
||||
interface instrumentation{(Deferred: any): void}
|
||||
|
||||
interface Callback<T, U> {
|
||||
(arg: T): U|Promise<U>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/Promise.html
|
||||
*
|
||||
@@ -16115,15 +16120,14 @@ declare module dojo {
|
||||
* instances of this class.
|
||||
*
|
||||
*/
|
||||
class Promise {
|
||||
constructor();
|
||||
interface Promise<T> {
|
||||
/**
|
||||
* Add a callback to be invoked when the promise is resolved
|
||||
* or rejected.
|
||||
*
|
||||
* @param callbackOrErrback OptionalA function that is used both as a callback and errback.
|
||||
*/
|
||||
always(callbackOrErrback: Function): any;
|
||||
always<U>(callbackOrErrback: Callback<any, U>): Promise<U>;
|
||||
/**
|
||||
* Inform the deferred it may cancel its asynchronous operation.
|
||||
* Inform the deferred it may cancel its asynchronous operation.
|
||||
@@ -16160,7 +16164,7 @@ declare module dojo {
|
||||
*
|
||||
* @param errback OptionalCallback to be invoked when the promise is rejected.
|
||||
*/
|
||||
otherwise(errback: Function): any;
|
||||
otherwise<U>(errback: Callback<any, U>): Promise<U>;
|
||||
/**
|
||||
* Add new callbacks to the promise.
|
||||
* Add new callbacks to the deferred. Callbacks can be added
|
||||
@@ -16170,7 +16174,7 @@ declare module dojo {
|
||||
* @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error.
|
||||
* @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update.
|
||||
*/
|
||||
then(callback: Function, errback?: Function, progback?: Function): dojo.promise.Promise;
|
||||
then<U>(callback: Callback<T, U>, errback?: Callback<any, U>, progback?: Callback<any, U>): Promise<U>;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -16184,7 +16188,7 @@ declare module dojo {
|
||||
* to handle traces.
|
||||
*
|
||||
*/
|
||||
trace(): dojo.promise.Promise;
|
||||
trace(): Promise<T>;
|
||||
/**
|
||||
* Trace rejection of the promise.
|
||||
* Tracing allows you to transparently log progress,
|
||||
@@ -16194,7 +16198,7 @@ declare module dojo {
|
||||
* to handle traces.
|
||||
*
|
||||
*/
|
||||
traceRejected(): dojo.promise.Promise;
|
||||
traceRejected(): Promise<T>;
|
||||
}
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/tracer.html
|
||||
@@ -17467,7 +17471,7 @@ declare module dojo {
|
||||
*
|
||||
* @param results The result set as an array, or a promise for an array.
|
||||
*/
|
||||
interface QueryResults{(results: dojo.promise.Promise): void}
|
||||
interface QueryResults{(results: dojo.promise.Promise<any>): void}
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/store/util/SimpleQueryEngine.html
|
||||
*
|
||||
@@ -20456,7 +20460,7 @@ declare module dojo {
|
||||
* @param value the number to be formatted
|
||||
* @param options OptionalAn object with the following properties:pattern (String, optional): override formatting patternwith this string. Default value is based on locale. Overriding this property will defeatlocalization. Literal characters in patterns are not supported.type (String, optional): choose a format type based on the locale from the following:decimal, scientific (not yet supported), percent, currency. decimal by default.places (Number, optional): fixed number of decimal places to show. This overrides anyinformation in the provided pattern.round (Number, optional): 5 rounds to nearest .5; 0 rounds to nearest whole (default). -1means do not round.locale (String, optional): override the locale used to determine formatting rulesfractional (Boolean, optional): If false, show no decimal places, overriding places and pattern settings.
|
||||
*/
|
||||
format(value: number, options: Object): any;
|
||||
format(value: number, options?: Object): any;
|
||||
/**
|
||||
* Convert a properly formatted string to a primitive Number, using
|
||||
* locale-specific settings.
|
||||
@@ -20782,7 +20786,7 @@ declare module dojo {
|
||||
* @param root OptionalA default starting root node from which to start the parsing. Can beomitted, defaulting to the entire document. If omitted, the optionsobject can be passed in this place. If the options object has arootNode member, that is used.
|
||||
* @param options a kwArgs options object, see parse() for details
|
||||
*/
|
||||
scan(root: HTMLElement, options: Object): dojo.promise.Promise;
|
||||
scan(root: HTMLElement, options: Object): dojo.promise.Promise<any>;
|
||||
}
|
||||
/**
|
||||
* Permalink: http://dojotoolkit.org/api/1.9/dojo/regexp.html
|
||||
@@ -24419,7 +24423,7 @@ declare module dojo {
|
||||
* @param errback OptionalCallback to be invoked when the promise is rejected.
|
||||
* @param progback OptionalCallback to be invoked when the promise emits a progress update.
|
||||
*/
|
||||
when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise;
|
||||
when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise<any>;
|
||||
/**
|
||||
* signal fired by impending window destruction. You may use
|
||||
* dojo.addOnWIndowUnload() or dojo.connect() to this method to perform
|
||||
@@ -28268,8 +28272,8 @@ declare module "dojo/promise/tracer" {
|
||||
export=exp;
|
||||
}
|
||||
declare module "dojo/promise/Promise" {
|
||||
var exp: typeof dojo.promise.Promise
|
||||
export=exp;
|
||||
interface Promise<T> extends dojo.promise.Promise<T> { }
|
||||
export = Promise;
|
||||
}
|
||||
declare module "dojo/rpc/JsonpService" {
|
||||
var exp: typeof dojo.rpc.JsonpService
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/// <reference path="dymo-label-framework.d.ts" />
|
||||
|
||||
var f = dymo.label.framework;
|
||||
|
||||
// Test checkEnvironment
|
||||
var env = f.checkEnvironment();
|
||||
|
||||
env.errorDetails = "";
|
||||
env.isBrowserSupported = true;
|
||||
env.isFrameworkInstalled = true;
|
||||
|
||||
// Test getPrinters
|
||||
var printers = f.getPrinters();
|
||||
|
||||
// Test PrinterInfo properties
|
||||
printers.forEach((value) =>{
|
||||
value.isAutoCutSupported = true;
|
||||
value.isConnected = true;
|
||||
value.isLocal = true;
|
||||
value.isTwinTurbo = true;
|
||||
value.modelName = "";
|
||||
value.name = "";
|
||||
});
|
||||
|
||||
var testcolor:dymo.label.framework.Color = { alpha: 255, red: 0, green: 0, blue: 0};
|
||||
|
||||
// Test createLabelRenderParamsXml
|
||||
var renderParamsXml: string = f.createLabelRenderParamsXml({
|
||||
flowDirection: f.FlowDirection.LeftToRight,
|
||||
labelColor: testcolor,
|
||||
pngUseDisplayResolution: true,
|
||||
shadowColor: testcolor,
|
||||
shadowDepth: 0
|
||||
});
|
||||
f.createLabelRenderParamsXml({}).charAt(0); // string, all optional params
|
||||
|
||||
// Test renderLabel
|
||||
f.renderLabel("", renderParamsXml, printers[0].name);
|
||||
|
||||
// Test openLabelXml
|
||||
var label = f.openLabelXml("");
|
||||
|
||||
// Test ILabel methods
|
||||
label.getAddressBarcodePosition(0) == f.AddressBarcodePosition.AboveAddress; // enum
|
||||
label.getAddressObjectCount().toFixed(); // number
|
||||
label.getAddressText(0).charAt(0); // string
|
||||
label.getLabelXml().charAt(0); // string
|
||||
label.getObjectNames()[0].charAt(0); // string[]
|
||||
label.getObjectText("").charAt(0); // string
|
||||
label.print("", "", "");
|
||||
label.printAndPollStatus("", "", "", (printJob, printJobStatusInfo) => {
|
||||
// Test PrintJob
|
||||
printJob.getStatus((printJobStatusInfoA) => {
|
||||
// Test PrintJobStatusInfo
|
||||
printJobStatusInfoA.status.toFixed(); // number
|
||||
printJobStatusInfoA.statusMessage.charAt(0); // string
|
||||
});
|
||||
// Test callback (must return boolean)
|
||||
return true;
|
||||
}, 0);
|
||||
label.render("", "").charAt(0); // string
|
||||
// Test chainable "set" methods
|
||||
label.setAddressBarcodePosition(0, dymo.label.framework.AddressBarcodePosition.AboveAddress)
|
||||
.setAddressText(0, "")
|
||||
.setObjectText("", "")
|
||||
.setAddressText(1, "");
|
||||
|
||||
// Test LabelSetBuilder
|
||||
var lsb = new f.LabelSetBuilder();
|
||||
var lsbRec = lsb.addRecord();
|
||||
lsb.toString().charAt(0); // string
|
||||
lsb.getRecords().pop(); // array
|
||||
lsb.getRecords()[0].setText("", ""); // array of ILabelSetRecord
|
||||
|
||||
// Test chainable ILabelSetRecord methods.
|
||||
lsbRec.setBase64Image("", "").setText("", "").setTextMarkup("", "").setText("", "");
|
||||
|
||||
// Test static toXml
|
||||
f.LabelSetBuilder.toXml(lsb.getRecords());
|
||||
|
||||
// Test printLabel
|
||||
f.printLabel("", "", "", "");
|
||||
|
||||
// Test printLabel2
|
||||
f.printLabel2("", "", "", "").getStatus((pjsi) => {
|
||||
pjsi.status.toFixed();
|
||||
pjsi.statusMessage.charAt(0);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Test createLabelWriterPrintParamsXml
|
||||
var clwppxp: dymo.label.framework.CreateLabelWriterPrintParamsXmlParams = {
|
||||
copies: 0, // number
|
||||
flowDirection: dymo.label.framework.FlowDirection.LeftToRight, // enum
|
||||
jobTitle: "", // string
|
||||
printQuality: dymo.label.framework.LabelWriterPrintQuality.BarcodeAndGraphics, // enum
|
||||
twinTurboRoll: dymo.label.framework.TwinTurboRoll.Left // enum
|
||||
}
|
||||
f.createLabelWriterPrintParamsXml(clwppxp).charAt(0); // string
|
||||
f.createLabelWriterPrintParamsXml({}).charAt(0) // all optional params
|
||||
|
||||
// Test createTapePrintParamsXml
|
||||
var ctppxp: dymo.label.framework.CreateTapePrintParamsXmlParams = {
|
||||
copies: 0, // number
|
||||
flowDirection: dymo.label.framework.FlowDirection.RightToLeft, // enum
|
||||
alignment: dymo.label.framework.TapeAlignment.Left, // enum
|
||||
cutMode: dymo.label.framework.TapeCutMode.ChainMarks, // enum
|
||||
jobTitle: "" // string
|
||||
}
|
||||
f.createTapePrintParamsXml(ctppxp).charAt(0); // string
|
||||
f.createTapePrintParamsXml({}).charAt(0); // all optional params
|
||||
|
||||
// Test VERSION
|
||||
f.VERSION.charAt(0); // string
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user