mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
@@ -33,3 +33,4 @@ _infrastructure/tests/build
|
||||
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;
|
||||
}
|
||||
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
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ 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>;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ declare module angular.angularFileUpload {
|
||||
progress(callback: IHttpPromiseCallback<T>): IUploadPromise<T>;
|
||||
}
|
||||
|
||||
interface IFileUploadConfig extends ng.IRequestConfig {
|
||||
interface IFileUploadConfig extends IRequestConfig {
|
||||
|
||||
file: File;
|
||||
fileName?: 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;
|
||||
}
|
||||
}
|
||||
+1
@@ -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> {
|
||||
|
||||
@@ -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 { }
|
||||
}
|
||||
+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;
|
||||
|
||||
+3
-3
@@ -64,7 +64,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 +83,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 +145,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,28 @@
|
||||
/// <reference path="angular2.d.ts"/>
|
||||
|
||||
// Use Typescript 1.4 style imports
|
||||
import ng = require("angular2/angular2");
|
||||
import di = require("angular2/di");
|
||||
|
||||
class Service {
|
||||
|
||||
}
|
||||
class Service2 {
|
||||
|
||||
}
|
||||
|
||||
class Cmp {
|
||||
static annotations: any[];
|
||||
}
|
||||
Cmp.annotations = [
|
||||
ng.Component({
|
||||
selector: 'cmp',
|
||||
injectables: [Service, di.bind(Service2).toValue(null)]
|
||||
}),
|
||||
ng.View({
|
||||
template: '{{greeting}} world!',
|
||||
directives: [ng.For, ng.If]
|
||||
})
|
||||
];
|
||||
|
||||
ng.bootstrap(Cmp);
|
||||
Vendored
+622
@@ -0,0 +1,622 @@
|
||||
// Type definitions for Angular v2.0.0-alpha.22
|
||||
// Project: http://angular.io/
|
||||
// Definitions by: angular team <https://github.com/angular/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/******************
|
||||
* This is a minimal type definition for the Angular2 quickstart.
|
||||
* We plan to publish a complete definition soon.
|
||||
******************/
|
||||
|
||||
interface List<T> extends Array<T> {}
|
||||
interface Type {}
|
||||
|
||||
interface _ComponentArg {
|
||||
/**
|
||||
* The CSS selector that triggers the instantiation of a directive.
|
||||
*
|
||||
* Angular only allows directives to trigger on CSS selectors that do not cross element boundaries.
|
||||
*
|
||||
* `selector` may be declared as one of the following:
|
||||
*
|
||||
* - `element-name`: select by element name.
|
||||
* - `.class`: select by class name.
|
||||
* - `[attribute]`: select by attribute name.
|
||||
* - `[attribute=value]`: select by attribute name and value.
|
||||
* - `:not(sub_selector)`: select only if the element does not match the `sub_selector`.
|
||||
* - `selector1, selector2`: select if either `selector1` or `selector2` matches.
|
||||
*
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Suppose we have a directive with an `input[type=text]` selector.
|
||||
*
|
||||
* And the following HTML:
|
||||
*
|
||||
* ```html
|
||||
* <form>
|
||||
* <input type="text">
|
||||
* <input type="radio">
|
||||
* <form>
|
||||
* ```
|
||||
*
|
||||
* The directive would only be instantiated on the `<input type="text">` element.
|
||||
*
|
||||
*/
|
||||
selector: string;
|
||||
|
||||
/**
|
||||
* Enumerates the set of properties that accept data binding for a directive.
|
||||
*
|
||||
* The `properties` property defines a set of `directiveProperty` to `bindingProperty`
|
||||
* key-value pairs:
|
||||
*
|
||||
* - `directiveProperty` specifies the component property where the value is written.
|
||||
* - `bindingProperty` specifies the DOM property where the value is read from.
|
||||
*
|
||||
* You can include a {@link Pipe} when specifying a `bindingProperty` to allow for data transformation and structural
|
||||
* change detection of the value. These pipes will be evaluated in the context of this component.
|
||||
*
|
||||
*
|
||||
* ## Syntax
|
||||
*
|
||||
* ```
|
||||
* @Directive({
|
||||
* properties: {
|
||||
* 'directiveProperty1': 'bindingProperty1',
|
||||
* 'directiveProperty2': 'bindingProperty2 | pipe1 | ...',
|
||||
* ...
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* ## Basic Property Binding
|
||||
*
|
||||
* We can easily build a simple `Tooltip` directive that exposes a `tooltip` property, which can be used in templates
|
||||
* with standard Angular syntax. For example:
|
||||
*
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: '[tooltip]',
|
||||
* properties: {
|
||||
* 'text': 'tooltip'
|
||||
* }
|
||||
* })
|
||||
* class Tooltip {
|
||||
* set text(text) {
|
||||
* // This will get called every time the 'tooltip' binding changes with the new value.
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* We can then bind to the `tooltip' property as either an expression (`someExpression`) or as a string literal, as
|
||||
* shown in the HTML template below:
|
||||
*
|
||||
* ```html
|
||||
* <div [tooltip]="someExpression">...</div>
|
||||
* <div tooltip="Some Text">...</div>
|
||||
* ```
|
||||
*
|
||||
* Whenever the `someExpression` expression changes, the `properties` declaration instructs
|
||||
* Angular to update the `Tooltip`'s `text` property.
|
||||
*
|
||||
*
|
||||
*
|
||||
* ## Bindings With Pipes
|
||||
*
|
||||
* You can also use pipes when writing binding definitions for a directive.
|
||||
*
|
||||
* For example, we could write a binding that updates the directive on structural changes, rather than on reference
|
||||
* changes, as normally occurs in change detection.
|
||||
*
|
||||
* See {@link Pipe} and {@link keyValDiff} documentation for more details.
|
||||
*
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: '[class-set]',
|
||||
* properties: {
|
||||
* 'classChanges': 'classSet | keyValDiff'
|
||||
* }
|
||||
* })
|
||||
* class ClassSet {
|
||||
* set classChanges(changes:KeyValueChanges) {
|
||||
* // This will get called every time the `class-set` expressions changes its structure.
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* The template that this directive is used in may also contain its own pipes. For example:
|
||||
*
|
||||
* ```html
|
||||
* <div [class-set]="someExpression | somePipe">
|
||||
* ```
|
||||
*
|
||||
* In this case, the two pipes compose as if they were inlined: `someExpression | somePipe | keyValDiff`.
|
||||
*
|
||||
*/
|
||||
properties?: Object;
|
||||
|
||||
/**
|
||||
* Specifies which DOM hostListeners a directive listens to.
|
||||
*
|
||||
* The `hostListeners` property defines a set of `event` to `method` key-value pairs:
|
||||
*
|
||||
* - `event1`: the DOM event that the directive listens to.
|
||||
* - `statement`: the statement to execute when the event occurs.
|
||||
* If the evalutation of the statement returns `false`, then `preventDefault`is applied on the DOM event.
|
||||
*
|
||||
* To listen to global events, a target must be added to the event name.
|
||||
* The target can be `window`, `document` or `body`.
|
||||
*
|
||||
* When writing a directive event binding, you can also refer to the following local variables:
|
||||
* - `$event`: Current event object which triggered the event.
|
||||
* - `$target`: The source of the event. This will be either a DOM element or an Angular directive.
|
||||
* (will be implemented in later release)
|
||||
*
|
||||
*
|
||||
* ## Syntax
|
||||
*
|
||||
* ```
|
||||
* @Directive({
|
||||
* hostListeners: {
|
||||
* 'event1': 'onMethod1(arguments)',
|
||||
* 'target:event2': 'onMethod2(arguments)',
|
||||
* ...
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* ## Basic Event Binding:
|
||||
*
|
||||
* Suppose you want to write a directive that triggers on `change` events in the DOM and on `resize` events in window.
|
||||
* You would define the event binding as follows:
|
||||
*
|
||||
* ```
|
||||
* @Directive({
|
||||
* selector: 'input',
|
||||
* hostListeners: {
|
||||
* 'change': 'onChange($event)',
|
||||
* 'window:resize': 'onResize($event)'
|
||||
* }
|
||||
* })
|
||||
* class InputDirective {
|
||||
* onChange(event:Event) {
|
||||
* }
|
||||
* onResize(event:Event) {
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Here the `onChange` method of `InputDirective` is invoked whenever the DOM element fires the 'change' event.
|
||||
*
|
||||
*/
|
||||
hostListeners?: Object;
|
||||
|
||||
/**
|
||||
* Defines the set of injectable objects that are visible to a Component and its children.
|
||||
*
|
||||
* The `injectables` defined in the Component annotation allow you to configure a set of bindings for the component's
|
||||
* injector.
|
||||
*
|
||||
* When a component is instantiated, Angular creates a new child Injector, which is configured with the bindings in
|
||||
* the Component `injectables` annotation. The injectable objects then become available for injection to the component
|
||||
* itself and any of the directives in the component's template, i.e. they are not available to the directives which
|
||||
* are children in the component's light DOM.
|
||||
*
|
||||
*
|
||||
* The syntax for configuring the `injectables` injectable is identical to {@link Injector} injectable configuration.
|
||||
* See {@link Injector} for additional detail.
|
||||
*
|
||||
*
|
||||
* ## Simple Example
|
||||
*
|
||||
* Here is an example of a class that can be injected:
|
||||
*
|
||||
* ```
|
||||
* class Greeter {
|
||||
* greet(name:string) {
|
||||
* return 'Hello ' + name + '!';
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'greet',
|
||||
* injectables: [
|
||||
* Greeter
|
||||
* ]
|
||||
* })
|
||||
* @View({
|
||||
* template: `{{greeter.greet('world')}}!`,
|
||||
* directives: Child
|
||||
* })
|
||||
* class HelloWorld {
|
||||
* greeter:Greeter;
|
||||
*
|
||||
* constructor(greeter:Greeter) {
|
||||
* this.greeter = greeter;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
injectables?: List<any>;
|
||||
|
||||
/**
|
||||
* Specifies a set of lifecycle hostListeners in which the directive participates.
|
||||
*
|
||||
* See {@link onChange}, {@link onDestroy}, {@link onAllChangesDone} for details.
|
||||
*/
|
||||
lifecycle?: List<any>;
|
||||
|
||||
/**
|
||||
* Defines the used change detection strategy.
|
||||
*
|
||||
* When a component is instantiated, Angular creates a change detector, which is responsible for propagating
|
||||
* the component's bindings.
|
||||
*
|
||||
* The `changeDetection` property defines, whether the change detection will be checked every time or only when the component
|
||||
* tells it to do so.
|
||||
*/
|
||||
changeDetection?: string;
|
||||
}
|
||||
|
||||
interface _ViewArg {
|
||||
/**
|
||||
* Specifies a template URL for an angular component.
|
||||
*
|
||||
* NOTE: either `templateUrl` or `template` should be used, but not both.
|
||||
*/
|
||||
templateUrl?: string;
|
||||
|
||||
/**
|
||||
* Specifies an inline template for an angular component.
|
||||
*
|
||||
* NOTE: either `templateUrl` or `template` should be used, but not both.
|
||||
*/
|
||||
template?: string;
|
||||
|
||||
/**
|
||||
* Specifies a list of directives that can be used within a template.
|
||||
*
|
||||
* Directives must be listed explicitly to provide proper component encapsulation.
|
||||
*/
|
||||
directives?: List<Type>;
|
||||
}
|
||||
|
||||
declare module "angular2/angular2" {
|
||||
/**
|
||||
* Bootstrapping for Angular applications.
|
||||
*
|
||||
* You instantiate an Angular application by explicitly specifying a component to use as the root component for your
|
||||
* application via the `bootstrap()` method.
|
||||
*
|
||||
* ## Simple Example
|
||||
*
|
||||
* Assuming this `index.html`:
|
||||
*
|
||||
* ```html
|
||||
* <html>
|
||||
* <!-- load Angular script tags here. -->
|
||||
* <body>
|
||||
* <my-app>loading...</my-app>
|
||||
* </body>
|
||||
* </html>
|
||||
* ```
|
||||
*
|
||||
* An application is bootstrapped inside an existing browser DOM, typically `index.html`. Unlike Angular 1, Angular 2
|
||||
* does not compile/process bindings in `index.html`. This is mainly for security reasons, as well as architectural
|
||||
* changes in Angular 2. This means that `index.html` can safely be processed using server-side technologies such as
|
||||
* bindings. Bindings can thus use double-curly `{{ syntax }}` without collision from Angular 2 component double-curly
|
||||
* `{{ syntax }}`.
|
||||
*
|
||||
* We can use this script code:
|
||||
*
|
||||
* ```
|
||||
* @Component({
|
||||
* selector: 'my-app'
|
||||
* })
|
||||
* @View({
|
||||
* template: 'Hello {{ name }}!'
|
||||
* })
|
||||
* class MyApp {
|
||||
* name:string;
|
||||
*
|
||||
* constructor() {
|
||||
* this.name = 'World';
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* main() {
|
||||
* return bootstrap(MyApp);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* When the app developer invokes `bootstrap()` with the root component `MyApp` as its argument, Angular performs the
|
||||
* following tasks:
|
||||
*
|
||||
* 1. It uses the component's `selector` property to locate the DOM element which needs to be upgraded into
|
||||
* the angular component.
|
||||
* 2. It creates a new child injector (from the platform injector) and configures the injector with the component's
|
||||
* `injectables`. Optionally, you can also override the injector configuration for an app by invoking
|
||||
* `bootstrap` with the `componentInjectableBindings` argument.
|
||||
* 3. It creates a new `Zone` and connects it to the angular application's change detection domain instance.
|
||||
* 4. It creates a shadow DOM on the selected component's host element and loads the template into it.
|
||||
* 5. It instantiates the specified component.
|
||||
* 6. Finally, Angular performs change detection to apply the initial data bindings for the application.
|
||||
*
|
||||
*
|
||||
* ## Instantiating Multiple Applications on a Single Page
|
||||
*
|
||||
* There are two ways to do this.
|
||||
*
|
||||
*
|
||||
* ### Isolated Applications
|
||||
*
|
||||
* Angular creates a new application each time that the `bootstrap()` method is invoked. When multiple applications
|
||||
* are created for a page, Angular treats each application as independent within an isolated change detection and
|
||||
* `Zone` domain. If you need to share data between applications, use the strategy described in the next
|
||||
* section, "Applications That Share Change Detection."
|
||||
*
|
||||
*
|
||||
* ### Applications That Share Change Detection
|
||||
*
|
||||
* If you need to bootstrap multiple applications that share common data, the applications must share a common
|
||||
* change detection and zone. To do that, create a meta-component that lists the application components in its template.
|
||||
* By only invoking the `bootstrap()` method once, with the meta-component as its argument, you ensure that only a
|
||||
* single change detection zone is created and therefore data can be shared across the applications.
|
||||
*
|
||||
*
|
||||
* ## Platform Injector
|
||||
*
|
||||
* When working within a browser window, there are many singleton resources: cookies, title, location, and others.
|
||||
* Angular services that represent these resources must likewise be shared across all Angular applications that
|
||||
* occupy the same browser window. For this reason, Angular creates exactly one global platform injector which stores
|
||||
* all shared services, and each angular application injector has the platform injector as its parent.
|
||||
*
|
||||
* Each application has its own private injector as well. When there are multiple applications on a page, Angular treats
|
||||
* each application injector's services as private to that application.
|
||||
*
|
||||
*
|
||||
* # API
|
||||
* - `appComponentType`: The root component which should act as the application. This is a reference to a `Type`
|
||||
* which is annotated with `@Component(...)`.
|
||||
* - `componentInjectableBindings`: An additional set of bindings that can be added to `injectables` for the
|
||||
* {@link Component} to override default injection behavior.
|
||||
* - `errorReporter`: `function(exception:any, stackTrace:string)` a default error reporter for unhandled exceptions.
|
||||
*
|
||||
* Returns a `Promise` with the application`s private {@link Injector}.
|
||||
*
|
||||
*/
|
||||
function bootstrap(appComponentType: any): void;
|
||||
|
||||
/**
|
||||
* Declare reusable UI building blocks for an application.
|
||||
*
|
||||
* Each Angular component requires a single `@Component` and at least one `@View` annotation. The `@Component`
|
||||
* annotation specifies when a component is instantiated, and which properties and hostListeners it binds to.
|
||||
*
|
||||
* When a component is instantiated, Angular
|
||||
* - creates a shadow DOM for the component.
|
||||
* - loads the selected template into the shadow DOM.
|
||||
* - creates a child {@link Injector} which is configured with the `injectables` for the {@link Component}.
|
||||
*
|
||||
* All template expressions and statements are then evaluated against the component instance.
|
||||
*
|
||||
* For details on the `@View` annotation, see {@link View}.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* ```
|
||||
* @Component({
|
||||
* selector: 'greet'
|
||||
* })
|
||||
* @View({
|
||||
* template: 'Hello {{name}}!'
|
||||
* })
|
||||
* class Greet {
|
||||
* name: string;
|
||||
*
|
||||
* constructor() {
|
||||
* this.name = 'World';
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* Dynamically loading a component at runtime:
|
||||
*
|
||||
* Regular Angular components are statically resolved. Dynamic components allows to resolve a component at runtime
|
||||
* instead by providing a placeholder into which a regular Angular component can be dynamically loaded. Once loaded,
|
||||
* the dynamically-loaded component becomes permanent and cannot be changed.
|
||||
* Dynamic components are declared just like components, but without a `@View` annotation.
|
||||
*
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Here we have `DynamicComp` which acts as the placeholder for `HelloCmp`. At runtime, the dynamic component
|
||||
* `DynamicComp` requests loading of the `HelloCmp` component.
|
||||
*
|
||||
* There is nothing special about `HelloCmp`, which is a regular Angular component. It can also be used in other static
|
||||
* locations.
|
||||
*
|
||||
* ```
|
||||
* @Component({
|
||||
* selector: 'dynamic-comp'
|
||||
* })
|
||||
* class DynamicComp {
|
||||
* helloCmp:HelloCmp;
|
||||
* constructor(loader:DynamicComponentLoader, location:ElementRef) {
|
||||
* loader.load(HelloCmp, location).then((helloCmp) => {
|
||||
* this.helloCmp = helloCmp;
|
||||
* });
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @Component({
|
||||
* selector: 'hello-cmp'
|
||||
* })
|
||||
* @View({
|
||||
* template: "{{greeting}}"
|
||||
* })
|
||||
* class HelloCmp {
|
||||
* greeting:string;
|
||||
* constructor() {
|
||||
* this.greeting = "hello";
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
function Component(arg: _ComponentArg): (target: any) => any;
|
||||
|
||||
/**
|
||||
* Declares the available HTML templates for an application.
|
||||
*
|
||||
* Each angular component requires a single `@Component` and at least one `@View` annotation. The @View
|
||||
* annotation specifies the HTML template to use, and lists the directives that are active within the template.
|
||||
*
|
||||
* When a component is instantiated, the template is loaded into the component's shadow root, and the
|
||||
* expressions and statements in the template are evaluated against the component.
|
||||
*
|
||||
* For details on the `@Component` annotation, see {@link Component}.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* ```
|
||||
* @Component({
|
||||
* selector: 'greet'
|
||||
* })
|
||||
* @View({
|
||||
* template: 'Hello {{name}}!',
|
||||
* directives: [GreetUser, Bold]
|
||||
* })
|
||||
* class Greet {
|
||||
* name: string;
|
||||
*
|
||||
* constructor() {
|
||||
* this.name = 'World';
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
function View(arg: _ViewArg): (target: any) => any;
|
||||
|
||||
/**
|
||||
* The `For` directive instantiates a template once per item from an iterable. The context for each
|
||||
* instantiated template inherits from the outer context with the given loop variable set to the
|
||||
* current item from the iterable.
|
||||
*
|
||||
* It is possible to alias the `index` to a local variable that will be set to the current loop
|
||||
* iteration in the template context.
|
||||
*
|
||||
* When the contents of the iterator changes, `For` makes the corresponding changes to the DOM:
|
||||
*
|
||||
* * When an item is added, a new instance of the template is added to the DOM.
|
||||
* * When an item is removed, its template instance is removed from the DOM.
|
||||
* * When items are reordered, their respective templates are reordered in the DOM.
|
||||
*
|
||||
* # Example
|
||||
*
|
||||
* ```
|
||||
* <ul>
|
||||
* <li *for="#error of errors; #i = index">
|
||||
* Error {{i}} of {{errors.length}}: {{error.message}}
|
||||
* </li>
|
||||
* </ul>
|
||||
* ```
|
||||
*
|
||||
* # Syntax
|
||||
*
|
||||
* - `<li *for="#item of items; #i = index">...</li>`
|
||||
* - `<li template="for #item of items; #i=index">...</li>`
|
||||
* - `<template [for]="#item" [of]="items" #i="index"><li>...</li></template>`
|
||||
*
|
||||
*/
|
||||
function For(): void;
|
||||
|
||||
/**
|
||||
* Removes or recreates a portion of the DOM tree based on an {expression}.
|
||||
*
|
||||
* If the expression assigned to `if` evaluates to a false value then the element is removed from the
|
||||
* DOM, otherwise a clone of the element is reinserted into the DOM.
|
||||
*
|
||||
* # Example:
|
||||
*
|
||||
* ```
|
||||
* <div *if="errorCount > 0" class="error">
|
||||
* <!-- Error message displayed when the errorCount property on the current context is greater than 0. -->
|
||||
* {{errorCount}} errors detected
|
||||
* </div>
|
||||
* ```
|
||||
*
|
||||
* # Syntax
|
||||
*
|
||||
* - `<div *if="condition">...</div>`
|
||||
* - `<div template="if condition">...</div>`
|
||||
* - `<template [if]="condition"><div>...</div></template>`
|
||||
*
|
||||
*/
|
||||
function If(): void;
|
||||
|
||||
/**
|
||||
* The `NonBindable` directive tells Angular not to compile or bind the contents of the current
|
||||
* DOM element. This is useful if the element contains what appears to be Angular directives and
|
||||
* bindings but which should be ignored by Angular. This could be the case if you have a site that
|
||||
* displays snippets of code, for instance.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```
|
||||
* <div>Normal: {{1 + 2}}</div> // output "Normal: 3"
|
||||
* <div non-bindable>Ignored: {{1 + 2}}</div> // output "Ignored: {{1 + 2}}"
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
function NonBindable(): void;
|
||||
|
||||
/**
|
||||
* The `Switch` directive is used to conditionally swap DOM structure on your template based on a
|
||||
* scope expression.
|
||||
* Elements within `Switch` but without `SwitchWhen` or `SwitchDefault` directives will be
|
||||
* preserved at the location as specified in the template.
|
||||
*
|
||||
* `Switch` simply chooses nested elements and makes them visible based on which element matches
|
||||
* the value obtained from the evaluated expression. In other words, you define a container element
|
||||
* (where you place the directive), place an expression on the **`[switch]="..."` attribute**),
|
||||
* define any inner elements inside of the directive and place a `[switch-when]` attribute per
|
||||
* element.
|
||||
* The when attribute is used to inform Switch which element to display when the expression is
|
||||
* evaluated. If a matching expression is not found via a when attribute then an element with the
|
||||
* default attribute is displayed.
|
||||
*
|
||||
* # Example:
|
||||
*
|
||||
* ```
|
||||
* <ANY [switch]="expression">
|
||||
* <template [switch-when]="whenExpression1">...</template>
|
||||
* <template [switch-when]="whenExpression1">...</template>
|
||||
* <template [switch-default]>...</template>
|
||||
* </ANY>
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
function Switch(): void;
|
||||
}
|
||||
|
||||
declare module "angular2/di" {
|
||||
/**
|
||||
* Provides an API for imperatively constructing {@link Binding}s.
|
||||
*
|
||||
* This is only relevant for JavaScript. See {@link BindingBuilder}.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* ```javascript
|
||||
* bind(MyInterface).toClass(MyClass)
|
||||
*
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
function bind(token: any): any;
|
||||
}
|
||||
@@ -62,8 +62,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
obj.$save();
|
||||
});
|
||||
|
||||
// $inst()
|
||||
if (obj.$inst() !== sync) throw "error";
|
||||
// $ref()
|
||||
if (obj.$ref() !== sync) 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
|
||||
}
|
||||
@@ -94,8 +94,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi
|
||||
{
|
||||
var list = sync.$asArray();
|
||||
|
||||
// $inst()
|
||||
if (list.$inst() !== sync) throw "error";
|
||||
// $ref()
|
||||
if (list.$ref() !== sync) 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
+23
-11
@@ -28,17 +28,19 @@ interface AngularFireObject extends AngularFireSimpleObject {
|
||||
$id: string;
|
||||
$priority: number;
|
||||
$value: any;
|
||||
$remove(): ng.IPromise<Firebase>;
|
||||
$save(): ng.IPromise<Firebase>;
|
||||
$loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
$loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
$loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
$inst(): AngularFire;
|
||||
$ref(): AngularFire;
|
||||
$bindTo(scope: ng.IScope, varName: string): ng.IPromise<any>;
|
||||
$watch(callback: Function, context?: any): Function;
|
||||
$destroy(): void;
|
||||
}
|
||||
interface AngularFireObjectService {
|
||||
$extendFactory(ChildClass: Object, methods?: Object): Object;
|
||||
(firebase: Firebase): AngularFireObject;
|
||||
$extend(ChildClass: Object, methods?: Object): Object;
|
||||
}
|
||||
|
||||
interface AngularFireArray extends Array<AngularFireSimpleObject> {
|
||||
@@ -51,12 +53,13 @@ interface AngularFireArray extends Array<AngularFireSimpleObject> {
|
||||
$loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
$loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
$loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
$inst(): AngularFire;
|
||||
$ref(): AngularFire;
|
||||
$watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function;
|
||||
$destroy(): void;
|
||||
}
|
||||
interface AngularFireArrayService {
|
||||
$extendFactory(ChildClass: Object, methods?: Object): Object;
|
||||
(firebase: Firebase): AngularFireArray;
|
||||
$extend(ChildClass: Object, methods?: Object): Object;
|
||||
}
|
||||
|
||||
interface AngularFireSimpleObject {
|
||||
@@ -72,11 +75,20 @@ 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>;
|
||||
$authWithCustomToken(authToken: string, options?: Object): ng.IPromise<any>;
|
||||
$authAnonymously(options?: Object): ng.IPromise<any>;
|
||||
$authWithPassword(credentials: FirebaseCredentials, options?: Object): ng.IPromise<any>;
|
||||
$authWithOAuthPopup(provider: string, options?: Object): ng.IPromise<any>;
|
||||
$authWithOAuthRedirect(provider: string, options?: Object): ng.IPromise<any>;
|
||||
$authWithOAuthToken(provider: string, credentials: Object|string, options?: Object): ng.IPromise<any>;
|
||||
$getAuth(): FirebaseAuthData;
|
||||
$onAuth(callback: Function, context?: any): Function;
|
||||
$unauth(): void;
|
||||
$waitForAuth(): ng.IPromise<any>;
|
||||
$requireAuth(): ng.IPromise<any>;
|
||||
$createUser(credentials: FirebaseCredentials): ng.IPromise<any>;
|
||||
$removeUser(credentials: FirebaseCredentials): ng.IPromise<any>;
|
||||
$changeEmail(credentials: FirebaseChangeEmailCredentials): ng.IPromise<any>;
|
||||
$changePassword(credentials: FirebaseChangePasswordCredentials): ng.IPromise<any>;
|
||||
$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
+94
-13
@@ -539,9 +539,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;
|
||||
@@ -1012,37 +1032,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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
/// <reference path="chai-as-promised.d.ts" />
|
||||
|
||||
import chai = require('chai');
|
||||
@@ -6,6 +5,7 @@ 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);
|
||||
|
||||
+10
-10
@@ -6,21 +6,21 @@
|
||||
/// <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;
|
||||
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 +32,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 +0,0 @@
|
||||
|
||||
@@ -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
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for chai-subset 1.0.0
|
||||
// Project: https://github.com/e-conomic/chai-subset
|
||||
// Definitions by: Sam Noedel <https://github.com/delta62/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
|
||||
declare module Chai {
|
||||
interface Assertion {
|
||||
containSubset(obj: Object): Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
interface Object {
|
||||
should: Chai.Assertion;
|
||||
}
|
||||
|
||||
declare module "chai-subset" {
|
||||
function chaiSubset(chai: any, utils: any): void;
|
||||
export = chaiSubset;
|
||||
}
|
||||
+726
-725
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
|
||||
Vendored
+156
-159
@@ -1,67 +1,46 @@
|
||||
// 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>
|
||||
// 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;
|
||||
/**
|
||||
* 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 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 +51,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 +92,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 +116,168 @@ 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Vendored
+25
-4
@@ -60,6 +60,7 @@ declare module D3 {
|
||||
altKey?: boolean;
|
||||
ctrlKey?: boolean;
|
||||
metaKey?: boolean;
|
||||
shiftKey?: boolean;
|
||||
type: string;
|
||||
}
|
||||
|
||||
@@ -786,8 +787,18 @@ declare module D3 {
|
||||
(valueFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
};
|
||||
|
||||
append: (name: string) => _Selection<T>;
|
||||
insert: (name: string, before: string) => _Selection<T>;
|
||||
append: {
|
||||
(name: string): _Selection<T>;
|
||||
(elementFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
}
|
||||
|
||||
insert: {
|
||||
(name: string, before: string): _Selection<T>;
|
||||
(insertElementFunction: (data: T, index: number) => any, before: string): _Selection<T>;
|
||||
(name: string, beforeElementFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
(insertElementFunction: (data: T, index: number) => any, beforeElementFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
}
|
||||
|
||||
remove: () => _Selection<T>;
|
||||
empty: () => boolean;
|
||||
|
||||
@@ -873,8 +884,18 @@ declare module D3 {
|
||||
export interface Selection extends _Selection<any> { }
|
||||
|
||||
export interface _EnterSelection<T> {
|
||||
append: (name: string) => _Selection<T>;
|
||||
insert: (name: string, before?: string) => _Selection<T>;
|
||||
append: {
|
||||
(name: string): _Selection<T>;
|
||||
(elementFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
}
|
||||
|
||||
insert: {
|
||||
(name: string, before?: string): _Selection<T>;
|
||||
(insertElementFunction: (data: T, index: number) => any, before?: string): _Selection<T>;
|
||||
(name: string, beforeElementFunction?: (data: T, index: number) => any): _Selection<T>;
|
||||
(insertElementFunction: (data: T, index: number) => any, beforeElementFunction?: (data: T, index: number) => any): _Selection<T>;
|
||||
}
|
||||
|
||||
select: (selector: string) => _Selection<T>;
|
||||
empty: () => boolean;
|
||||
node: () => Element;
|
||||
|
||||
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
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
+596
@@ -0,0 +1,596 @@
|
||||
// Type definitions for DYMO Label Framework v1.2.6
|
||||
// Project: http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html
|
||||
// Definitions by: Thijs Kuipers <https://github.com/thijskuipers>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Top namespace for DYMO Label Framework JavaScript library.
|
||||
* Latest library available at http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js
|
||||
*
|
||||
* Based on information from http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html
|
||||
* which is Copyright (c), 2010, Sanford, L.P. All Rights Reserved.
|
||||
*
|
||||
* Based on information from http://developers.dymo.com/2010/06/02/dymo-label-framework-overview/
|
||||
* which is © 2013 DYMO Label Inside Out
|
||||
*/
|
||||
declare module dymo.label.framework {
|
||||
|
||||
/** Enumeration that specifies where to draw the Intellegent Mail barcode for an Address object. */
|
||||
enum AddressBarcodePosition {
|
||||
/** Indicates to print the barcode above the address. */
|
||||
AboveAddress,
|
||||
/** Indicates to print the barcode below the address. */
|
||||
BelowAddress,
|
||||
/** Indicates to not print the barcode at all. */
|
||||
Suppress
|
||||
}
|
||||
|
||||
/**
|
||||
* Emuneration that specifies the direction in which objects and object text are laid out on the label.
|
||||
* For Middle East labels/content specify "RightToLeft", otherwise specify "LeftToRight" (default).
|
||||
*/
|
||||
enum FlowDirection {
|
||||
/** Indicates that the content flows from left to right. */
|
||||
LeftToRight,
|
||||
/** Indicates that the content flows from right to left. */
|
||||
RightToLeft
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration that specifies the print quality when printing to a LabelWriter printer.
|
||||
*/
|
||||
enum LabelWriterPrintQuality {
|
||||
/** Indicates that text print quality (fast) is used. */
|
||||
Text,
|
||||
/** Indicates that barcode and images print quality (slow) is used. */
|
||||
BarcodeAndGraphics,
|
||||
/** Indicates that the print quality is automatically determined based on the types of objects on the label. */
|
||||
Auto
|
||||
}
|
||||
|
||||
/** Print Job Status */
|
||||
enum PrintJobStatus {
|
||||
Error,
|
||||
Finished,
|
||||
InQueue,
|
||||
InvalidJobId,
|
||||
NotSpooled,
|
||||
PaperOut,
|
||||
PrinterBusy,
|
||||
Printing,
|
||||
ProcessingError,
|
||||
Unknown
|
||||
}
|
||||
|
||||
/** Enumeration that specifies the leader and trailer for a tape label when printing to a Tape printer. */
|
||||
enum TapeAlignment {
|
||||
/** Indicates a 10mm leader and a 10mm trailer. */
|
||||
Center,
|
||||
/** Indicates a 6mm leader and a 10mm trailer. */
|
||||
Left,
|
||||
/** Indicates a 10mm leader and a 6mm trailer. */
|
||||
Right
|
||||
}
|
||||
|
||||
/** Enumeration that specifies the tape cut mode when printing multiple labels to a Tape printer. Note: This enumeration affects multiple page print jobs only. If a one page job is printed, the tape is always cut. */
|
||||
enum TapeCutMode {
|
||||
/** Indicates to cut the tape between labels. */
|
||||
AutoCut,
|
||||
/** Indicates to print cut marks between labels. */
|
||||
ChainMarks
|
||||
}
|
||||
|
||||
/** Enumeration that specifies which roll to print to when printing to a Twin Turbo printer. */
|
||||
enum TwinTurboRoll {
|
||||
/** Indicates to print to the left roll only. */
|
||||
Left,
|
||||
/** Indicates to print to the right roll only. */
|
||||
Right,
|
||||
/** Indicates to continue printing to the other roll when the current roll is out of paper. Note: This does not indicate which roll to print to first; printing may start on either roll. */
|
||||
Auto
|
||||
}
|
||||
|
||||
/** Returns the library version number, e.g. "1.2.6" */
|
||||
var VERSION: string;
|
||||
|
||||
/** Checks that the browser enviroment is suitable for the Framework. */
|
||||
function checkEnvironment(): {
|
||||
/** Indicates whether the browser is supported or not. */
|
||||
isBrowserSupported: boolean;
|
||||
/** Indicates whether the Framework is installed or not. */
|
||||
isFrameworkInstalled: boolean;
|
||||
/** An empty string if no error is detected; an error message if an error is detected. */
|
||||
errorDetails: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Object with properties 'a' or 'alpha' to specify color's alpha channel,
|
||||
* r/red, g/green, b/blue for red, green, blue channels.
|
||||
* The valid range for a/r/g/b fields is [0..255].
|
||||
*/
|
||||
interface Color {
|
||||
/** alpha channel [0..255] default: 255 */
|
||||
alpha?: number;
|
||||
/** red channel [0..255] default: 0 */
|
||||
red?: number;
|
||||
/** green channel [0..255] default: 0 */
|
||||
green?: number;
|
||||
/** blue channel [0..255] default: 0 */
|
||||
blue?: number;
|
||||
}
|
||||
|
||||
interface CreateLabelRenderParamsXmlParams {
|
||||
/** The color of the label. */
|
||||
labelColor?: Color;
|
||||
/** The color of label shadow. */
|
||||
shadowColor?: Color;
|
||||
/** The shadow width in TWIPS. If '0' is specified, no shadow is rendered. */
|
||||
shadowDepth?: number;
|
||||
/** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */
|
||||
flowDirection?: FlowDirection;
|
||||
/**
|
||||
* If true, the PNG will be generated using the display resolution.
|
||||
* If false, the PNG will be generated using the printer resolution.
|
||||
* If the display resolution is used, the resulting PNG will be smaller.
|
||||
* Use the printer resolution if the resulting image will be zoomed. This will give the zoomed preview better quality.
|
||||
*/
|
||||
pngUseDisplayResolution?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an XML string suitable to pass to the dymo.label.framework.renderLabel function
|
||||
* as renderParamsXml parameter. Returns an XML string.
|
||||
*
|
||||
* @param params A JavaScript object with the following properties
|
||||
* (not all properties must be defined; if a property is not defined, a default value is used)
|
||||
*/
|
||||
function createLabelRenderParamsXml(params: CreateLabelRenderParamsXmlParams): string;
|
||||
|
||||
interface CreateLabelWriterPrintParamsXmlParams {
|
||||
/** The number of copies to print. */
|
||||
copies?: number;
|
||||
/** The print job title/description. */
|
||||
jobTitle?: string;
|
||||
/** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */
|
||||
flowDirection?: FlowDirection;
|
||||
/** The print quality. Use the dymo.label.framework.LabelWriterPrintQuality enumeration to specify the value. */
|
||||
printQuality?: LabelWriterPrintQuality;
|
||||
/** The roll to print to if the printer is a TwinTurbo printer. Use the dymo.label.framework.TwinTurboRoll enumeration to specify the value. */
|
||||
twinTurboRoll?: TwinTurboRoll;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an XML string suitable to to pass to the dymo.label.framework.printLabel function
|
||||
* as printParamsXml parameter. Created print parameters are for printing to LabelWriter printers.
|
||||
* Returns an XML string.
|
||||
*
|
||||
* @param params A JavaScript object with the following properties
|
||||
* (not all properties must be defined; if a property is not defined, a default value is used)
|
||||
*/
|
||||
function createLabelWriterPrintParamsXml(params: CreateLabelWriterPrintParamsXmlParams): string;
|
||||
|
||||
interface CreateTapePrintParamsXmlParams {
|
||||
/** The number of copies to print. */
|
||||
copies?: number;
|
||||
/** The print job title/description. */
|
||||
jobTitle?: string;
|
||||
/** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */
|
||||
flowDirection?: FlowDirection;
|
||||
/** The label alignment on the tape. Use the dymo.label.framework.TapeAlignment enumeration to specify the value. */
|
||||
alignment?: TapeAlignment;
|
||||
/** The cut mode (if auto-cut is supported by the printer). Use the dymo.label.framework.TapeCutMode enumeration to specify the value. */
|
||||
cutMode?: TapeCutMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an XML string suitable to pass to the dymo.label.framework.printLabel function as printParamsXml parameter. Created print parameters are for printing to Tape printers.
|
||||
* Returns an XML string.
|
||||
*
|
||||
* @param params A JavaScript object with the following properties
|
||||
* (not all properties must be defined; if a property is not defined, a default value is used)
|
||||
*/
|
||||
function createTapePrintParamsXml(params: CreateTapePrintParamsXmlParams): string;
|
||||
|
||||
interface PrinterInfo {
|
||||
/** Indicates whether the Auto-Cut feature is supported by the printer or not. Note: The property is only defined if printerType is "TapePrinter". */
|
||||
isAutoCutSupported: boolean;
|
||||
/** Indicates whether the printer is connected to a computer or not. Note: Currently only returns properly for local USB-connected printers on Windows. */
|
||||
isConnected: boolean;
|
||||
/** Indicates whether the printer is a local USB-connected printer or a shared network printer. Note: Currently only returns properly on Windows. */
|
||||
isLocal: boolean;
|
||||
/** Indicates whether the printer is a "LabelWriter Twin Turbo" (has two rolls) or not. Note: The property is only defined if printerType is "LabelWriterPrinter". */
|
||||
isTwinTurbo: boolean;
|
||||
/** Returns the printer model/driver name. */
|
||||
modelName: string;
|
||||
/** Returns the printer name (print queue name on Mac). */
|
||||
name: string;
|
||||
/** Returns the printer type; "LabelWriterPrinter" or "TapePrinter". */
|
||||
printerType: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of all printers supported by the DYMO Label Framework.
|
||||
* Results are returned in an array-like object.
|
||||
* Each item is of the type dymo.label.framework.PrinterInfo.
|
||||
* In addition, items can be accessed by printer name.
|
||||
*/
|
||||
function getPrinters(): PrinterInfo[];
|
||||
|
||||
/**
|
||||
* Convenience method (overload of getPrinters) to get a list of all printers of type "LabelWriterPrinter".
|
||||
*/
|
||||
function getLabelWriterPrinters(): PrinterInfo[];
|
||||
|
||||
/**
|
||||
* Convenience method (overload of getPrinters) to get a list of all printers of type "TapePrinter".
|
||||
*/
|
||||
function getTapePrinters(): PrinterInfo[];
|
||||
|
||||
/**
|
||||
* Loads an image from a URL or file and returns it as a base64-encoded PNG stream.
|
||||
* The loaded image is not necessarily in PNG format.
|
||||
* The image can be in any format supported by the Framework (by DYMO Label v.8).
|
||||
* The loaded data can be used to set content for an image object on a label.
|
||||
* Note: The comments for {@link openLabelFile} apply to this function as well.
|
||||
*
|
||||
* @param imageUri URL or file name to load the image from.
|
||||
*
|
||||
* @returns A base64-encoded PNG stream.
|
||||
*/
|
||||
function loadImageAsPngBase64(imageUri: string): string;
|
||||
|
||||
/** Print Job */
|
||||
interface PrintJob {
|
||||
/**
|
||||
* Gets a status of the print job
|
||||
*
|
||||
* @param replyCallback a function called when the status is available
|
||||
*/
|
||||
getStatus(replyCallback: (printJobStatusInfo: PrintJobStatusInfo) => any): void;
|
||||
}
|
||||
|
||||
/** Print Job Status Info */
|
||||
interface PrintJobStatusInfo {
|
||||
statusMessage: string;
|
||||
status: PrintJobStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* There is no constructor function for ILabel. To get ILabel instance use the
|
||||
* dymo.label.framework.openLabelFile or dymo.label.framework.openLabelXml function.
|
||||
* ILabel provides methods for manipulating label content, such as set address or text
|
||||
* on the label.
|
||||
*/
|
||||
interface ILabel {
|
||||
/**
|
||||
* Gets the Intelligent Mail barcode position for an Address object.
|
||||
*
|
||||
* @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label.
|
||||
*
|
||||
* @returns A string with one of the values defined by the dymo.label.framework.AddressBarcodePosition enumeration.
|
||||
*/
|
||||
getAddressBarcodePosition(addressIndex: number): AddressBarcodePosition;
|
||||
|
||||
/**
|
||||
* Gets the number of Address objects on the label.
|
||||
*/
|
||||
getAddressObjectCount(): number;
|
||||
|
||||
/**
|
||||
* Gets the text content of an Address object.
|
||||
*
|
||||
* @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label.
|
||||
*
|
||||
* @returns The plain text from the Address object.
|
||||
*/
|
||||
getAddressText(addressIndex: number): string;
|
||||
|
||||
/**
|
||||
* Returns the current label as an XML string. The returned XML string can be passed
|
||||
* to functions that accept label XML as a parameter, or can be used to direct content
|
||||
* manipulations not currently supported by the Framework.
|
||||
*/
|
||||
getLabelXml(): string;
|
||||
|
||||
/**
|
||||
* Gets an array of object reference names on the label. Returns an array of strings.
|
||||
*/
|
||||
getObjectNames(): string[];
|
||||
|
||||
/**
|
||||
* Gets the 'text' content of an object. The content depends on the object type.
|
||||
* * Address and Text objects - Returns the object text without formatting.
|
||||
* * Barcode object - Returns the barcode string.
|
||||
* * Image - Returns the base64-encoded string on the image's PNG stream (only if image data is embedded with the label and not linked to a URL or file).
|
||||
* * Circular Text object - Returns the object text.
|
||||
* * Other objects - Returns an empty string.
|
||||
*
|
||||
* @param objectName The name of the object.
|
||||
*/
|
||||
getObjectText(objectName: string): string;
|
||||
|
||||
/**
|
||||
* Prints the label.
|
||||
*
|
||||
* @param printerName The name of the printer to print to. A list of printers can be obtained using dymo.label.framework.getPrinters.
|
||||
* @param printParamsXml The print parameters, such as number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}.
|
||||
* @param labelSetXml
|
||||
* The LabelSet to print. LabelSet is used to print multiple labels with the same layout, but with different
|
||||
* data, such as multiple addresses. Use the dymo.label.framework.LabelSetBuilder class to create a LabelSet
|
||||
* or construct XML manually according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}.
|
||||
*/
|
||||
print(printerName: string, printParamsXml: string, labelSetXml: string): void;
|
||||
|
||||
/**
|
||||
* Prints a label and runs status checking in a loop
|
||||
*
|
||||
* @param printerName The name of the printer to print to. A list of printers can be obtained using dymo.label.framework.getPrinters.
|
||||
* @param printParamsXml The print parameters, such as number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}.
|
||||
* @param labelSetXml The LabelSet to print.
|
||||
* LabelSet is used to print multiple labels with the same layout, but with different data, such as multiple
|
||||
* addresses. Use the dymo.label.framework.LabelSetBuilder class to create a LabelSet or construct XML manually
|
||||
* according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}.
|
||||
* @param statusCallback Status callback function called when the service returned status information.
|
||||
* The callback takes two parameters; the first is PrintJob object. It can be used to get the status information on demand,
|
||||
* without using polling. Also, it might be extended in the future to provide more control over the print job, e.g. an ability
|
||||
* to cancel it. The second parameter to the callback is PrintJobStatusInfo class. PrintJobStatusInfo has two properties:
|
||||
* statusMessage that contains a status message string; and status that contains status code. The callback has to return a
|
||||
* boolean value. If true is returned, than pritnAndPollStatus() will poll the service again after the pollInterval passed.
|
||||
* If false is returned, then printAndPollStatus() finishes processing.
|
||||
* @param pollInterval Interval in milliseconds to ask the proxy service for the job status information.
|
||||
*
|
||||
* @returns The print job.
|
||||
*/
|
||||
printAndPollStatus(
|
||||
printerName: string,
|
||||
printParamsXml: string,
|
||||
labelSetXml: string,
|
||||
statusCallback: (printJob: PrintJob, printJobStatusInfo: PrintJobStatusInfo) => boolean,
|
||||
pollInterval: number): PrintJob;
|
||||
|
||||
/**
|
||||
* Creates a label raster image that can be used for label previewing.
|
||||
*
|
||||
* @param renderParamsXml Rendering parameters, such as shadow depth, label color, etc.
|
||||
* See [LabelRenderParams.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelRenderParams.xsd}.
|
||||
* @param printerName The name of the printer that the preview is generated for.
|
||||
* The preview/output can be different for different printers,
|
||||
* especially for tape printers with different print head sizes.
|
||||
* If it is not important what printer the label is printed to,
|
||||
* an empty string can be passed. In this case, the default printer metrics will
|
||||
* be used. The default is LW400 for LabelWriter printers and LW400 DUO Tape for
|
||||
* tape printers.
|
||||
*/
|
||||
render(renderParamsXml: string, printerName: string): string;
|
||||
|
||||
/**
|
||||
* Sets the Intelligent Mail barcode position for an Address object.
|
||||
*
|
||||
* @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label.
|
||||
* @param barcodePosition The barcode position.
|
||||
*
|
||||
* @returns self
|
||||
*/
|
||||
setAddressBarcodePosition(addressIndex: number, barcodePosition: AddressBarcodePosition): ILabel;
|
||||
|
||||
/**
|
||||
* Sets the text content of an Address object.
|
||||
*
|
||||
* @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label.
|
||||
* @param text The plain text string that contains the content of the Address object. Note: The current text formatting is retained on a line-by-line basis.
|
||||
*
|
||||
* @returns self
|
||||
*/
|
||||
setAddressText(addressIndex: number, text: string): ILabel;
|
||||
|
||||
/**
|
||||
* Sets the text content for an object. The content and/or text formatting are set differently
|
||||
* depending on the object type.
|
||||
*
|
||||
* * Address object - The formatting is applied on a line-by-line basis (using list).
|
||||
* * Text object - The formatting of the current first character is applied to all text.
|
||||
* * Barcode object - The barcode text.
|
||||
* * Image object - The base64-encoded string of image's PNG stream.
|
||||
* * CircularText object - The object text.
|
||||
* * Date and Time and Counter objects - The object's 'Before' text.
|
||||
* * Other objects - An empty string.
|
||||
*
|
||||
* @param objectName The name of the object.
|
||||
* @param text The plain text string for new object content.
|
||||
*/
|
||||
setObjectText(objectName: string, text: string): ILabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* ILabelSetRecord instance holds data of one LabelSet record. ILabelSetRecord provides
|
||||
* methods for adding data to the record. To create ILabelSetRecord instance,
|
||||
* use dymo.label.framework.LabelSetBuilder.prototype.addRecord method.
|
||||
*/
|
||||
interface ILabelSetRecord {
|
||||
/**
|
||||
* Adds image data to the record.
|
||||
*
|
||||
* @param objectName The name of the object that the markup is set for.
|
||||
* @param base64Image The string containing the base64-encoded PNG image stream.
|
||||
*
|
||||
* @returns self
|
||||
*/
|
||||
setBase64Image(objectName: string, base64Image: string): ILabelSetRecord;
|
||||
|
||||
/** Adds data to the record specified as plain text.
|
||||
*
|
||||
* @param objectName The name of the object that the markup is set for.
|
||||
* @param text The object text to set.
|
||||
*
|
||||
* @returns self
|
||||
*/
|
||||
setText(objectName: string, text: string): ILabelSetRecord;
|
||||
|
||||
/**
|
||||
* Adds data to the record specified as text markup.
|
||||
*
|
||||
* @param objectName The name of the object that the markup is set for.
|
||||
* @param textMarkup The markup string. See [TextMarkup.xsd]{@link http://labelwriter.com/software/dls/sdk/TextMarkup.xsd}.
|
||||
*
|
||||
* @returns self
|
||||
*/
|
||||
setTextMarkup(objectName: string, textMarkup: string): ILabelSetRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads label content from a file or URL.
|
||||
* The following considerations should be taken before using this function:
|
||||
*
|
||||
* * The full file name or URL should be specified. The function will not honor relative paths based on document.location.href.
|
||||
* * The fileName can be an http:// or file:// URL. On Windows the file name can be a regular file name, for example 'c:\users\desktop\address.label'.
|
||||
* * The content of the label will be loaded synchronously. Therefore, if the remote server is down there will be a timeout.
|
||||
* * Any local file can be accessed or attempted to be accessed. The function is not limited by any browser restrictions. However, only a valid label file (according to label.xsd schema) can be loaded. This could still be a potential security concern.
|
||||
* * The URL is not limited to same-site-origin browser policy. Any URL can be opened.
|
||||
* * The proxy settings are the system default settings, these are not necessarily the browser settings.
|
||||
*
|
||||
* Use this function only when there is no other way to load label data. In most cases, label data should be loaded using dymo.label.framework.openLabelXml.
|
||||
*
|
||||
* @param fileName FileName or URL to load label from.
|
||||
*
|
||||
* @returns Returns Label object; provides label manipulation methods.
|
||||
*/
|
||||
function openLabelFile(fileName: string): ILabel;
|
||||
|
||||
/**
|
||||
* Loads label content from an XML stream/string.
|
||||
* Note: This is the preferred way to load/open label files.
|
||||
* Use XMLHttpRequest() or other standard browser methods to get XML string.
|
||||
*
|
||||
* @param labelXml The label definition as an XML string.
|
||||
* @returns Label object.
|
||||
*/
|
||||
function openLabelXml(labelXml: string): ILabel;
|
||||
|
||||
/**
|
||||
* Prints one or more labels.
|
||||
*
|
||||
* @param printerName The name of the printer to print to. A list of printers can be obtained using
|
||||
* dymo.label.framework.getPrinters.
|
||||
* @param printParamsXml The print parameters, such as number of copies, print quality, etc.
|
||||
* See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}.
|
||||
* @param labelXml The label to print.
|
||||
* @param labelSetXml The LabelSet to print. LabelSet is used to print multiple labels with the same layout,
|
||||
* but with different data, such as multiple addresses. Use dymo.label.framework.LabelSetBuilder class to
|
||||
* create a LabelSet, or construct XML manualy according to
|
||||
* [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}.
|
||||
*/
|
||||
function printLabel(printerName: string, printParamsXml: string, labelXml: string, labelSetXml: string): void;
|
||||
|
||||
/**
|
||||
* Prints a label and returns a print job object
|
||||
*
|
||||
* @param printerName The printer to print on. A list of printers can be obtained by getPrinters()
|
||||
* @param printParamsXml Printing parameters, like number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}
|
||||
* @param labelXml Label to print
|
||||
* @param labelSetXml
|
||||
* LabelSet to print. LabelSet is used to print multiple labels with same layout but different data, e.g. multiple addresses.
|
||||
* Use LabelSetBuilder to create a LabelSet or construct xml manualy according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}.
|
||||
*/
|
||||
function printLabel2(printerName: string, printParamsXml: string, labelXml: string, labelSetXml: string): PrintJob;
|
||||
|
||||
/**
|
||||
* Prints a label and runs status checking in a loop
|
||||
*
|
||||
* @param printerName The printer to print on. A list of printers can be obtained by getPrinters()
|
||||
* @param printParamsXml Printing parameters, like number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}
|
||||
* @param labelXml Label to print
|
||||
* @param labelSetXml
|
||||
* LabelSet to print. LabelSet is used to print multiple labels with same layout but different data, e.g.
|
||||
* multiple addresses.
|
||||
* Use LabelSetBuilder to create a LabelSet or construct xml manually according to
|
||||
* [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}
|
||||
* @param statusCallback
|
||||
* Function to be called when a print job status is available.
|
||||
* To continue polling the status the function should return true, false otherwise.
|
||||
* @param pollInterval Polling interval in milliseconds
|
||||
*/
|
||||
function printLabelAndPollStatus(
|
||||
printerName: string,
|
||||
printParamsXml: string,
|
||||
labelXml: string,
|
||||
labelSetXml: string,
|
||||
statusCallback: (printJob: PrintJob, printJobStatusInfo: PrintJobStatusInfo) => boolean,
|
||||
pollInterval: number): PrintJob;
|
||||
|
||||
/**
|
||||
* Creates a label raster image that can be used for label previewing.
|
||||
* Returns a string that is a base64-encoded PNG stream of the label image.
|
||||
* This string can be used as data: url for element.
|
||||
* Note: data: urls are not supported by IE6 and IE7. IE8 supports them with a 32KB limit (so it may not be possible to preview 'large' labels).
|
||||
*
|
||||
* @param labelXml Label to preview.
|
||||
* @param renderParamsXml The rendering parameters, such as shadow depth, label color, etc. See [LabelRenderParams.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelRenderParams.xsd}.
|
||||
* @param printerName The name of the printer that the preview is generated for.
|
||||
* The preview/output can be different for different printers, especially for tape printers
|
||||
* with different print head sizes. If it is not important what printer the label is
|
||||
* printed to, an empty string can be passed. In this case, the default printer metrics
|
||||
* will be used. The default is LW400 for LabelWriter printers and LW400 DUO Tape for tape printers.
|
||||
*
|
||||
* @returns A base64-encoded PNG stream of the label image.
|
||||
*/
|
||||
function renderLabel(labelXml: string, renderParamsXml: string, printerName: string): string;
|
||||
|
||||
/**
|
||||
* Undocumented
|
||||
*/
|
||||
interface AddPrinterUriCallback {
|
||||
(printerUri: string): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119
|
||||
*/
|
||||
function addPrinterUri(
|
||||
printerUri: string,
|
||||
location?: string,
|
||||
successCallback?: AddPrinterUriCallback,
|
||||
errorCallback?: AddPrinterUriCallback): void;
|
||||
|
||||
/**
|
||||
* Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119
|
||||
*/
|
||||
function removePrinterUri(printerUri: string): void;
|
||||
|
||||
/**
|
||||
* Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119
|
||||
*/
|
||||
function removeAllPrinterUri(): void;
|
||||
|
||||
/**
|
||||
* LabelSetBuilder is used to create a LabelSet to print multiple labels in one print job.
|
||||
* LabelSet is a collection of records. Each record contains multiple pairs; each pair consists
|
||||
* of the object name and the object text data/content. The data of each record are applied to all
|
||||
* corresponend objects and for each record one label is printed.
|
||||
*/
|
||||
class LabelSetBuilder {
|
||||
/**
|
||||
* Converts record objects to XML format. The XML format schema is defined in [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}.
|
||||
* Returned XML can be passed to dymo.label.framefork.printLabel as labelSetXml parameter. This function can be used independent of other LabelSetBuilder methods, if records data is generated by other functions.
|
||||
*
|
||||
* @param records The records to convert to XML. Records should be an array-like object of associative-arrays with object names as keys and object text as values.
|
||||
*
|
||||
* @returns An XML string.
|
||||
*/
|
||||
static toXml(records: {}[]): string;
|
||||
|
||||
/**
|
||||
* Adds a new record to the LabelSet. Returns a record object.
|
||||
*/
|
||||
addRecord(): ILabelSetRecord;
|
||||
|
||||
/**
|
||||
* Get all record objects in this LabelSetBuilder.
|
||||
*/
|
||||
getRecords(): ILabelSetRecord[];
|
||||
|
||||
/**
|
||||
* Converts the builder's content to an XML string suitable to pass to dymo.label.framefork.printLabel.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
Vendored
+598
-26
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Ember.js 1.0.0
|
||||
// Type definitions for Ember.js 1.11.3
|
||||
// Project: http://emberjs.com/
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -387,8 +387,10 @@ interface DisconnectOutletOptions {
|
||||
|
||||
interface RenderOptions {
|
||||
into?: string;
|
||||
outlet?: string;
|
||||
controller?: string;
|
||||
model?: any;
|
||||
outlet?: string;
|
||||
view?: string;
|
||||
}
|
||||
|
||||
interface ModifyObserver {
|
||||
@@ -1683,7 +1685,21 @@ declare module Ember {
|
||||
cacheFor(keyName: string): any;
|
||||
decrementProperty(keyName: string, decrement?: number): number;
|
||||
endPropertyChanges(): Observable;
|
||||
|
||||
/**
|
||||
* Retrieves the value of a property from the object
|
||||
* @param keyName
|
||||
* @returns {}
|
||||
*/
|
||||
get(keyName: string): any;
|
||||
|
||||
/**
|
||||
* Retrieves the value of a property from the object
|
||||
* @param keyName
|
||||
* @returns {}
|
||||
*/
|
||||
get<T>(keyName: string): T;
|
||||
|
||||
getProperties(...args: string[]): {};
|
||||
getProperties(keys: string[]): {};
|
||||
getWithDefault(keyName: string, defaultValue: any): any;
|
||||
@@ -1764,10 +1780,70 @@ declare module Ember {
|
||||
remove(obj: any): void;
|
||||
toArray(): any[];
|
||||
}
|
||||
|
||||
// FYI - RSVP source comes from https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/promise.js
|
||||
module RSVP {
|
||||
interface PromiseResolve {
|
||||
(value?: any): void;
|
||||
}
|
||||
interface PromiseReject {
|
||||
(reason?: any): void;
|
||||
}
|
||||
interface PromiseResolverFunction {
|
||||
(resolve: PromiseResolve, reject: PromiseReject): void;
|
||||
}
|
||||
|
||||
class Promise {
|
||||
constructor(resolver: Function, label?: string);
|
||||
then(done?: Function, fail?: Function): Promise;
|
||||
|
||||
/**
|
||||
Promise objects represent the eventual result of an asynchronous operation. The
|
||||
primary way of interacting with a promise is through its `then` method, which
|
||||
registers callbacks to receive either a promise's eventual value or the reason
|
||||
why the promise cannot be fulfilled.
|
||||
@class RSVP.Promise
|
||||
@param {function} resolver
|
||||
@param {String} label optional string for labeling the promise.
|
||||
Useful for tooling.
|
||||
@constructor
|
||||
*/
|
||||
constructor(resolver: PromiseResolverFunction, label?: string);
|
||||
|
||||
/**
|
||||
The primary way of interacting with a promise is through its `then` method,
|
||||
which registers callbacks to receive either a promise's eventual value or the
|
||||
reason why the promise cannot be fulfilled.
|
||||
@method then
|
||||
@param {Function} onFulfilled
|
||||
@param {Function} onRejected
|
||||
@param {String} label optional string for labeling the promise.
|
||||
Useful for tooling.
|
||||
@return {Promise}
|
||||
*/
|
||||
then(onFulfilled?: Function, onRejected?: Function): Promise;
|
||||
|
||||
/**
|
||||
`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
|
||||
as the catch block of a try/catch statement.
|
||||
|
||||
@method catch
|
||||
@param {Function} onRejection
|
||||
@param {String} label optional string for labeling the promise.
|
||||
Useful for tooling.
|
||||
@return {Promise}
|
||||
*/
|
||||
catch(onRejection: Function, label?: string): Promise;
|
||||
|
||||
/**
|
||||
`finally` will be invoked regardless of the promise's fate just as native
|
||||
try/catch/finally behaves
|
||||
|
||||
@method finally
|
||||
@param {Function} callback
|
||||
@param {String} label optional string for labeling the promise.
|
||||
Useful for tooling.
|
||||
@return {Promise}
|
||||
*/
|
||||
finally(callback: Function, label?: string): Promise;
|
||||
}
|
||||
}
|
||||
class RenderBuffer {
|
||||
@@ -1789,41 +1865,531 @@ declare module Ember {
|
||||
elementTag: string;
|
||||
parentBuffer: RenderBuffer;
|
||||
}
|
||||
class Route extends Object implements ActionHandlerMixin {
|
||||
static detect(obj: any): boolean;
|
||||
static detectInstance(obj: any): boolean;
|
||||
/**
|
||||
Iterate over each computed property for the class, passing its name and any
|
||||
associated metadata (see metaForProperty) to the callback.
|
||||
**/
|
||||
static eachComputedProperty(callback: Function, binding: {}): void;
|
||||
/**
|
||||
Returns the original hash that was passed to meta().
|
||||
@param key property name
|
||||
**/
|
||||
static metaForProperty(key: string): {};
|
||||
|
||||
/**
|
||||
The `Ember.Route` class is used to define individual routes. Refer to
|
||||
the [routing guide](http://emberjs.com/guides/routing/) for documentation.
|
||||
*/
|
||||
class Route extends Object implements ActionHandlerMixin, Evented {
|
||||
|
||||
static isClass: boolean;
|
||||
static isMethod: boolean;
|
||||
|
||||
/**
|
||||
This hook is executed when the router enters the route. It is not executed
|
||||
when the model for the route changes.
|
||||
@method activate
|
||||
*/
|
||||
activate: Function;
|
||||
|
||||
/**
|
||||
This hook is called after this route's model has resolved.
|
||||
It follows identical async/promise semantics to `beforeModel`
|
||||
but is provided the route's resolved model in addition to
|
||||
the `transition`, and is therefore suited to performing
|
||||
logic that can only take place after the model has already
|
||||
resolved.
|
||||
|
||||
Refer to documentation for `beforeModel` for a description
|
||||
of transition-pausing semantics when a promise is returned
|
||||
from this hook.
|
||||
@method afterModel
|
||||
@param {Object} resolvedModel the value returned from `model`,
|
||||
or its resolved value if it was a promise
|
||||
@param {Transition} transition
|
||||
@return {Promise} if the value returned from this hook is
|
||||
a promise, the transition will pause until the transition
|
||||
resolves. Otherwise, non-promise return values are not
|
||||
utilized in any way.
|
||||
*/
|
||||
afterModel(resolvedModel: any, transition: EmberStates.Transition): RSVP.Promise;
|
||||
|
||||
/**
|
||||
This hook is the first of the route entry validation hooks
|
||||
called when an attempt is made to transition into a route
|
||||
or one of its children. It is called before `model` and
|
||||
`afterModel`, and is appropriate for cases when:
|
||||
1) A decision can be made to redirect elsewhere without
|
||||
needing to resolve the model first.
|
||||
2) Any async operations need to occur first before the
|
||||
model is attempted to be resolved.
|
||||
This hook is provided the current `transition` attempt
|
||||
as a parameter, which can be used to `.abort()` the transition,
|
||||
save it for a later `.retry()`, or retrieve values set
|
||||
on it from a previous hook. You can also just call
|
||||
`this.transitionTo` to another route to implicitly
|
||||
abort the `transition`.
|
||||
You can return a promise from this hook to pause the
|
||||
transition until the promise resolves (or rejects). This could
|
||||
be useful, for instance, for retrieving async code from
|
||||
the server that is required to enter a route.
|
||||
|
||||
@method beforeModel
|
||||
@param {Transition} transition
|
||||
@return {Promise} if the value returned from this hook is
|
||||
a promise, the transition will pause until the transition
|
||||
resolves. Otherwise, non-promise return values are not
|
||||
utilized in any way.
|
||||
*/
|
||||
beforeModel(transition: EmberStates.Transition): RSVP.Promise;
|
||||
|
||||
/**
|
||||
The controller associated with this route.
|
||||
|
||||
@property controller
|
||||
@type Ember.Controller
|
||||
@since 1.6.0
|
||||
*/
|
||||
controller: Controller;
|
||||
|
||||
/**
|
||||
Returns the controller for a particular route or name.
|
||||
The controller instance must already have been created, either through entering the
|
||||
associated route or using `generateController`.
|
||||
|
||||
@method controllerFor
|
||||
@param {String} name the name of the route or controller
|
||||
@return {Ember.Controller}
|
||||
*/
|
||||
controllerFor(name: string): Controller;
|
||||
|
||||
/**
|
||||
The name of the controller to associate with this route.
|
||||
By default, Ember will lookup a route's controller that matches the name
|
||||
of the route (i.e. `App.PostController` for `App.PostRoute`). However,
|
||||
if you would like to define a specific controller to use, you can do so
|
||||
using this property.
|
||||
This is useful in many ways, as the controller specified will be:
|
||||
* passed to the `setupController` method.
|
||||
* used as the controller for the view being rendered by the route.
|
||||
* returned from a call to `controllerFor` for the route.
|
||||
@property controllerName
|
||||
@type String
|
||||
@default null
|
||||
@since 1.4.0
|
||||
*/
|
||||
controllerName: string;
|
||||
|
||||
/**
|
||||
This hook is executed when the router completely exits this route. It is
|
||||
not executed when the model for the route changes.
|
||||
@method deactivate
|
||||
*/
|
||||
deactivate: Function;
|
||||
disconnectOutlet(options?: DisconnectOutletOptions): void;
|
||||
generateController(name: string, model: {}): void;
|
||||
model(params: {}, transition: EmberStates.Transition): any;
|
||||
|
||||
/**
|
||||
Deserializes value of the query parameter based on defaultValueType
|
||||
@method deserializeQueryParam
|
||||
@param {Object} value
|
||||
@param {String} urlKey
|
||||
@param {String} defaultValueType
|
||||
*/
|
||||
deserializeQueryParam(value: any, urlKey: string, defaultValueType: string): any;
|
||||
|
||||
/**
|
||||
Disconnects a view that has been rendered into an outlet.
|
||||
You may pass any or all of the following options to `disconnectOutlet`:
|
||||
* `outlet`: the name of the outlet to clear (default: 'main')
|
||||
* `parentView`: the name of the view containing the outlet to clear
|
||||
(default: the view rendered by the parent route)
|
||||
|
||||
@method disconnectOutlet
|
||||
@param {Object|String} options the options hash or outlet name
|
||||
*/
|
||||
disconnectOutlet(options: DisconnectOutletOptions|string): void;
|
||||
|
||||
/**
|
||||
@method findModel
|
||||
@param {String} type the model type
|
||||
@param {Object} value the value passed to find
|
||||
*/
|
||||
findModel(type: string, value: any): any;
|
||||
|
||||
/**
|
||||
Generates a controller for a route.
|
||||
If the optional model is passed then the controller type is determined automatically,
|
||||
e.g., an ArrayController for arrays.
|
||||
|
||||
@method generateController
|
||||
@param {String} name the name of the controller
|
||||
@param {Object} model the model to infer the type of the controller (optional)
|
||||
*/
|
||||
generateController(name: string, model: {}): Controller;
|
||||
|
||||
/**
|
||||
Perform a synchronous transition into another route without attempting
|
||||
to resolve promises, update the URL, or abort any currently active
|
||||
asynchronous transitions (i.e. regular transitions caused by
|
||||
`transitionTo` or URL changes).
|
||||
This method is handy for performing intermediate transitions on the
|
||||
way to a final destination route, and is called internally by the
|
||||
default implementations of the `error` and `loading` handlers.
|
||||
@method intermediateTransitionTo
|
||||
@param {String} name the name of the route
|
||||
@param {...Object} models the model(s) to be used while transitioning
|
||||
to the route.
|
||||
@since 1.2.0
|
||||
*/
|
||||
intermediateTransitionTo(name: string, ...models: any[]): void;
|
||||
|
||||
/**
|
||||
A hook you can implement to convert the URL into the model for
|
||||
this route.
|
||||
|
||||
@method model
|
||||
@param {Object} params the parameters extracted from the URL
|
||||
@param {Transition} transition
|
||||
@return {Object|Promise} the model for this route. If
|
||||
a promise is returned, the transition will pause until
|
||||
the promise resolves, and the resolved value of the promise
|
||||
will be used as the model for this route.
|
||||
*/
|
||||
model(params: {}, transition: EmberStates.Transition): any|RSVP.Promise;
|
||||
|
||||
/**
|
||||
Returns the model of a parent (or any ancestor) route
|
||||
in a route hierarchy. During a transition, all routes
|
||||
must resolve a model object, and if a route
|
||||
needs access to a parent route's model in order to
|
||||
resolve a model (or just reuse the model from a parent),
|
||||
it can call `this.modelFor(theNameOfParentRoute)` to
|
||||
retrieve it.
|
||||
|
||||
@method modelFor
|
||||
@param {String} name the name of the route
|
||||
@return {Object} the model object
|
||||
*/
|
||||
modelFor(name: string): {};
|
||||
|
||||
/**
|
||||
Retrieves parameters, for current route using the state.params
|
||||
variable and getQueryParamsFor, using the supplied routeName.
|
||||
@method paramsFor
|
||||
@param {String} name
|
||||
*/
|
||||
paramsFor(name: string) : any;
|
||||
|
||||
/**
|
||||
Configuration hash for this route's queryParams.
|
||||
@property queryParams
|
||||
@for Ember.Route
|
||||
@type Hash
|
||||
*/
|
||||
queryParams: {};
|
||||
|
||||
/**
|
||||
Refresh the model on this route and any child routes, firing the
|
||||
`beforeModel`, `model`, and `afterModel` hooks in a similar fashion
|
||||
to how routes are entered when transitioning in from other route.
|
||||
The current route params (e.g. `article_id`) will be passed in
|
||||
to the respective model hooks, and if a different model is returned,
|
||||
`setupController` and associated route hooks will re-fire as well.
|
||||
An example usage of this method is re-querying the server for the
|
||||
latest information using the same parameters as when the route
|
||||
was first entered.
|
||||
Note that this will cause `model` hooks to fire even on routes
|
||||
that were provided a model object when the route was initially
|
||||
entered.
|
||||
@method refresh
|
||||
@return {Transition} the transition object associated with this
|
||||
attempted transition
|
||||
@since 1.4.0
|
||||
*/
|
||||
redirect(): EmberStates.Transition;
|
||||
|
||||
|
||||
/**
|
||||
Refresh the model on this route and any child routes, firing the
|
||||
`beforeModel`, `model`, and `afterModel` hooks in a similar fashion
|
||||
to how routes are entered when transitioning in from other route.
|
||||
The current route params (e.g. `article_id`) will be passed in
|
||||
to the respective model hooks, and if a different model is returned,
|
||||
`setupController` and associated route hooks will re-fire as well.
|
||||
An example usage of this method is re-querying the server for the
|
||||
latest information using the same parameters as when the route
|
||||
was first entered.
|
||||
Note that this will cause `model` hooks to fire even on routes
|
||||
that were provided a model object when the route was initially
|
||||
entered.
|
||||
@method refresh
|
||||
@return {Transition} the transition object associated with this
|
||||
attempted transition
|
||||
@since 1.4.0
|
||||
*/
|
||||
refresh(): EmberStates.Transition;
|
||||
|
||||
/**
|
||||
`render` is used to render a template into a region of another template
|
||||
(indicated by an `{{outlet}}`). `render` is used both during the entry
|
||||
phase of routing (via the `renderTemplate` hook) and later in response to
|
||||
user interaction.
|
||||
|
||||
@method render
|
||||
@param {String} name the name of the template to render
|
||||
@param {Object} [options] the options
|
||||
@param {String} [options.into] the template to render into,
|
||||
referenced by name. Defaults to the parent template
|
||||
@param {String} [options.outlet] the outlet inside `options.template` to render into.
|
||||
Defaults to 'main'
|
||||
@param {String|Object} [options.controller] the controller to use for this template,
|
||||
referenced by name or as a controller instance. Defaults to the Route's paired controller
|
||||
@param {Object} [options.model] the model object to set on `options.controller`.
|
||||
Defaults to the return value of the Route's model hook
|
||||
*/
|
||||
render(name: string, options?: RenderOptions): void;
|
||||
|
||||
/**
|
||||
A hook you can use to render the template for the current route.
|
||||
This method is called with the controller for the current route and the
|
||||
model supplied by the `model` hook. By default, it renders the route's
|
||||
template, configured with the controller for the route.
|
||||
This method can be overridden to set up and render additional or
|
||||
alternative templates.
|
||||
|
||||
@method renderTemplate
|
||||
@param {Object} controller the route's controller
|
||||
@param {Object} model the route's model
|
||||
*/
|
||||
renderTemplate(controller: Controller, model: {}): void;
|
||||
// ReSharper disable once InconsistentNaming
|
||||
replaceWith(name: string, ...object: any[]): void;
|
||||
send(name: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
Transition into another route while replacing the current URL, if possible.
|
||||
This will replace the current history entry instead of adding a new one.
|
||||
Beside that, it is identical to `transitionTo` in all other respects. See
|
||||
'transitionTo' for additional information regarding multiple models.
|
||||
|
||||
@method replaceWith
|
||||
@param {String} name the name of the route or a URL
|
||||
@param {...Object} models the model(s) or identifier(s) to be used while
|
||||
transitioning to the route.
|
||||
@return {Transition} the transition object associated with this
|
||||
attempted transition
|
||||
*/
|
||||
replaceWith(name: string, ...models: any[]): void;
|
||||
|
||||
/**
|
||||
A hook you can use to reset controller values either when the model
|
||||
changes or the route is exiting.
|
||||
|
||||
@method resetController
|
||||
@param {Controller} controller instance
|
||||
@param {Boolean} isExiting
|
||||
@param {Object} transition
|
||||
@since 1.7.0
|
||||
*/
|
||||
resetController(controller: Ember.Controller, isExiting: boolean, transition: any): void;
|
||||
|
||||
/**
|
||||
A hook you can implement to convert the route's model into parameters
|
||||
for the URL.
|
||||
|
||||
The default `serialize` method will insert the model's `id` into the
|
||||
route's dynamic segment (in this case, `:post_id`) if the segment contains '_id'.
|
||||
If the route has multiple dynamic segments or does not contain '_id', `serialize`
|
||||
will return `Ember.getProperties(model, params)`
|
||||
This method is called when `transitionTo` is called with a context
|
||||
in order to populate the URL.
|
||||
@method serialize
|
||||
@param {Object} model the route's model
|
||||
@param {Array} params an Array of parameter names for the current
|
||||
route (in the example, `['post_id']`.
|
||||
@return {Object} the serialized parameters
|
||||
*/
|
||||
serialize(model: {}, params: string[]): string;
|
||||
|
||||
/**
|
||||
Serializes value of the query parameter based on defaultValueType
|
||||
@method serializeQueryParam
|
||||
@param {Object} value
|
||||
@param {String} urlKey
|
||||
@param {String} defaultValueType
|
||||
*/
|
||||
serializeQueryParam(value: any, urlKey: string, defaultValueType: string): string;
|
||||
|
||||
/**
|
||||
Serializes the query parameter key
|
||||
@method serializeQueryParamKey
|
||||
@param {String} controllerPropertyName
|
||||
*/
|
||||
serializeQueryParamKey(controllerPropertyName: string): string;
|
||||
|
||||
/**
|
||||
A hook you can use to setup the controller for the current route.
|
||||
This method is called with the controller for the current route and the
|
||||
model supplied by the `model` hook.
|
||||
By default, the `setupController` hook sets the `model` property of
|
||||
the controller to the `model`.
|
||||
If you implement the `setupController` hook in your Route, it will
|
||||
prevent this default behavior. If you want to preserve that behavior
|
||||
when implementing your `setupController` function, make sure to call
|
||||
`_super`
|
||||
@method setupController
|
||||
@param {Controller} controller instance
|
||||
@param {Object} model
|
||||
*/
|
||||
setupController(controller: Controller, model: {}): void;
|
||||
// ReSharper disable once InconsistentNaming
|
||||
|
||||
/**
|
||||
Store property provides a hook for data persistence libraries to inject themselves.
|
||||
By default, this store property provides the exact same functionality previously
|
||||
in the model hook.
|
||||
Currently, the required interface is:
|
||||
`store.find(modelName, findArguments)`
|
||||
@method store
|
||||
@param {Object} store
|
||||
*/
|
||||
store(store: any): any;
|
||||
|
||||
/**
|
||||
The name of the template to use by default when rendering this routes
|
||||
template.
|
||||
This is similar with `viewName`, but is useful when you just want a custom
|
||||
template without a view.
|
||||
|
||||
@property templateName
|
||||
@type String
|
||||
@default null
|
||||
@since 1.4.0
|
||||
*/
|
||||
templateName: string;
|
||||
|
||||
/**
|
||||
Transition the application into another route. The route may
|
||||
be either a single route or route path
|
||||
|
||||
@method transitionTo
|
||||
@param {String} name the name of the route or a URL
|
||||
@param {...Object} models the model(s) or identifier(s) to be used while
|
||||
transitioning to the route.
|
||||
@param {Object} [options] optional hash with a queryParams property
|
||||
containing a mapping of query parameters
|
||||
@return {Transition} the transition object associated with this
|
||||
attempted transition
|
||||
*/
|
||||
transitionTo(name: string, ...object: any[]): EmberStates.Transition;
|
||||
|
||||
/**
|
||||
The name of the view to use by default when rendering this routes template.
|
||||
When rendering a template, the route will, by default, determine the
|
||||
template and view to use from the name of the route itself. If you need to
|
||||
define a specific view, set this property.
|
||||
This is useful when multiple routes would benefit from using the same view
|
||||
because it doesn't require a custom `renderTemplate` method.
|
||||
@property viewName
|
||||
@type String
|
||||
@default null
|
||||
@since 1.4.0
|
||||
*/
|
||||
viewName: string;
|
||||
|
||||
// ActionHandlerMixin methods
|
||||
|
||||
/**
|
||||
Sends an action to the router, which will delegate it to the currently
|
||||
active route hierarchy per the bubbling rules explained under actions
|
||||
|
||||
@method send
|
||||
@param {String} actionName The action to trigger
|
||||
@param {*} context a context to send with the action
|
||||
*/
|
||||
send(name: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
The collection of functions, keyed by name, available on this
|
||||
`ActionHandler` as action targets.
|
||||
These functions will be invoked when a matching `{{action}}` is triggered
|
||||
from within a template and the application's current route is this route.
|
||||
Actions can also be invoked from other parts of your application
|
||||
via `ActionHandler#send`.
|
||||
The `actions` hash will inherit action handlers from
|
||||
the `actions` hash defined on extended parent classes
|
||||
or mixins rather than just replace the entire hash.
|
||||
|
||||
Within a Controller, Route, View or Component's action handler,
|
||||
the value of the `this` context is the Controller, Route, View or
|
||||
Component object:
|
||||
|
||||
It is also possible to call `this._super.apply(this, arguments)` from within an
|
||||
action handler if it overrides a handler defined on a parent
|
||||
class or mixin.
|
||||
|
||||
## Bubbling
|
||||
By default, an action will stop bubbling once a handler defined
|
||||
on the `actions` hash handles it. To continue bubbling the action,
|
||||
you must return `true` from the handler
|
||||
|
||||
@property actions
|
||||
@type Hash
|
||||
@default null
|
||||
*/
|
||||
actions: ActionsHash;
|
||||
|
||||
// Evented methods
|
||||
|
||||
/**
|
||||
Subscribes to a named event with given function.
|
||||
|
||||
An optional target can be passed in as the 2nd argument that will
|
||||
be set as the "this" for the callback. This is a good way to give your
|
||||
function access to the object triggering the event. When the target
|
||||
parameter is used the callback becomes the third argument.
|
||||
|
||||
@method on
|
||||
@param {String} name The name of the event
|
||||
@param {Object} [target] The "this" binding for the callback
|
||||
@param {Function} method The callback to execute
|
||||
@return this
|
||||
*/
|
||||
on(name: string, target: any, method: Function): Evented;
|
||||
|
||||
/**
|
||||
Subscribes a function to a named event and then cancels the subscription
|
||||
after the first time the event is triggered. It is good to use ``one`` when
|
||||
you only care about the first time an event has taken place.
|
||||
This function takes an optional 2nd argument that will become the "this"
|
||||
value for the callback. If this argument is passed then the 3rd argument
|
||||
becomes the function.
|
||||
|
||||
@method one
|
||||
@param {String} name The name of the event
|
||||
@param {Object} [target] The "this" binding for the callback
|
||||
@param {Function} method The callback to execute
|
||||
@return this
|
||||
*/
|
||||
one(name: string, target: any, method: Function): Evented;
|
||||
|
||||
/**
|
||||
Triggers a named event for the object. Any additional arguments
|
||||
will be passed as parameters to the functions that are subscribed to the
|
||||
event.
|
||||
|
||||
@method trigger
|
||||
@param {String} name The name of the event
|
||||
@param {Object...} args Optional arguments to pass on
|
||||
*/
|
||||
trigger(name: string, ...args: string[]): void;
|
||||
|
||||
/**
|
||||
Cancels subscription for given name, target, and method.
|
||||
|
||||
@method off
|
||||
@param {String} name The name of the event
|
||||
@param {Object} target The target of the subscription
|
||||
@param {Function} method The function of the subscription
|
||||
@return this
|
||||
*/
|
||||
off(name: string, target:any , method: Function): Evented;
|
||||
|
||||
/**
|
||||
Checks to see if object has any subscriptions for named event.
|
||||
|
||||
@method has
|
||||
@param {String} name The name of the event
|
||||
@return {Boolean} does the object have a subscription for event
|
||||
*/
|
||||
has(name: string): boolean;
|
||||
}
|
||||
|
||||
class Router extends Object {
|
||||
static detect(obj: any): boolean;
|
||||
static detectInstance(obj: any): boolean;
|
||||
@@ -2264,7 +2830,7 @@ declare module Ember {
|
||||
function compare(v: any, w: any): number;
|
||||
// ReSharper disable once DuplicatingLocalDeclaration
|
||||
var computed: {
|
||||
(callback: Function): ComputedProperty;
|
||||
(...args: any[]): ComputedProperty;
|
||||
alias(dependentKey: string): ComputedProperty;
|
||||
and(...args: string[]): ComputedProperty;
|
||||
any(...args: string[]): ComputedProperty;
|
||||
@@ -2350,7 +2916,7 @@ declare module Ember {
|
||||
**/
|
||||
var none: typeof deprecateFunc;
|
||||
function normalizeTuple(target: any, path: string): any[];
|
||||
function observer(func: Function, ...args: string[]): Function;
|
||||
function observer(...args: any[]): Function;
|
||||
function observersFor(obj: any, path: string): any[];
|
||||
function onLoad(name: string, callback: Function): void;
|
||||
function oneWay(obj: any, to: string, from: string): Binding;
|
||||
@@ -2531,6 +3097,9 @@ declare module Em {
|
||||
class Observable extends Ember.Observable { }
|
||||
class OrderedSet extends Ember.OrderedSet { }
|
||||
module RSVP {
|
||||
interface PromiseResolve extends Ember.RSVP.PromiseResolve { }
|
||||
interface PromiseReject extends Ember.RSVP.PromiseReject { }
|
||||
interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { }
|
||||
class Promise extends Ember.RSVP.Promise { }
|
||||
}
|
||||
class RenderBuffer extends Ember.RenderBuffer { }
|
||||
@@ -2772,6 +3341,9 @@ declare module "Ember" {
|
||||
class Observable extends Ember.Observable { }
|
||||
class OrderedSet extends Ember.OrderedSet { }
|
||||
module RSVP {
|
||||
interface PromiseResolve extends Ember.RSVP.PromiseResolve { }
|
||||
interface PromiseReject extends Ember.RSVP.PromiseReject { }
|
||||
interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { }
|
||||
class Promise extends Ember.RSVP.Promise { }
|
||||
}
|
||||
class RenderBuffer extends Ember.RenderBuffer { }
|
||||
|
||||
@@ -160,3 +160,32 @@ getJSON('story.json').then(function(story: Story) {
|
||||
}).then(function() {
|
||||
(<HTMLElement>document.querySelector('.spinner')).style.display = 'none';
|
||||
});
|
||||
|
||||
interface T1 {
|
||||
__t1: string;
|
||||
}
|
||||
|
||||
interface T2 {
|
||||
__t2: string;
|
||||
}
|
||||
|
||||
interface T3 {
|
||||
__t3: string;
|
||||
}
|
||||
|
||||
function f1(): Promise<T1> {
|
||||
return Promise.resolve({ __t1: "foo_t1" });
|
||||
}
|
||||
|
||||
function f2(x: T1): T2 {
|
||||
return { __t2: x.__t1 + ":foo_21" };
|
||||
}
|
||||
|
||||
var x3 = f1()
|
||||
.then(f2, (e: Error) => {
|
||||
console.log("error 1");
|
||||
throw e;
|
||||
})
|
||||
.then((x: T2) => {
|
||||
return { __t3: x.__t2 + "bar" };
|
||||
});
|
||||
Vendored
+4
-2
@@ -4,7 +4,8 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Thenable<R> {
|
||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
|
||||
}
|
||||
|
||||
declare class Promise<R> implements Thenable<R> {
|
||||
@@ -27,7 +28,8 @@ declare class Promise<R> implements Thenable<R> {
|
||||
* @param onFulfilled called when/if "promise" resolves
|
||||
* @param onRejected called when/if "promise" rejects
|
||||
*/
|
||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
|
||||
|
||||
/**
|
||||
* Sugar for promise.then(undefined, onRejected)
|
||||
|
||||
+954
-956
File diff suppressed because it is too large
Load Diff
Vendored
+4590
-893
File diff suppressed because it is too large
Load Diff
Vendored
+32
-3
@@ -9,6 +9,11 @@ interface FirebaseAuthResult {
|
||||
}
|
||||
|
||||
interface FirebaseDataSnapshot {
|
||||
/**
|
||||
* Returns true if this DataSnapshot contains any data.
|
||||
* It is slightly more efficient than using snapshot.val() !== null.
|
||||
*/
|
||||
exists(): boolean;
|
||||
/**
|
||||
* Gets the JavaScript object representation of the DataSnapshot.
|
||||
*/
|
||||
@@ -108,6 +113,10 @@ interface FirebaseQuery {
|
||||
* Generates a new Query object ordered by key name.
|
||||
*/
|
||||
orderByKey(): FirebaseQuery;
|
||||
/**
|
||||
* Generates a new Query object ordered by child values.
|
||||
*/
|
||||
orderByValue(): FirebaseQuery;
|
||||
/**
|
||||
* Generates a new Query object ordered by priority.
|
||||
*/
|
||||
@@ -255,10 +264,14 @@ interface Firebase extends FirebaseQuery {
|
||||
* Creates a new user account using an email / password combination.
|
||||
*/
|
||||
createUser(credentials: FirebaseCredentials, onComplete: (error: any) => void): void;
|
||||
/**
|
||||
* Updates the email associated with an email / password user account.
|
||||
*/
|
||||
changeEmail(credentials: FirebaseChangeEmailCredentials, onComplete: (error: any) => void): void;
|
||||
/**
|
||||
* Change the password of an existing user using an email / password combination.
|
||||
*/
|
||||
changePassword(credentials: { email: string; oldPassword: string; newPassword: string }, onComplete: (error: any) => void): void;
|
||||
changePassword(credentials: FirebaseChangePasswordCredentials, onComplete: (error: any) => void): void;
|
||||
/**
|
||||
* Removes an existing user account using an email / password combination.
|
||||
*/
|
||||
@@ -266,7 +279,7 @@ interface Firebase extends FirebaseQuery {
|
||||
/**
|
||||
* Sends a password-reset email to the owner of the account, containing a token that may be used to authenticate and change the user password.
|
||||
*/
|
||||
resetPassword(credentials: { email: string }, onComplete: (error: any) => void): void;
|
||||
resetPassword(credentials: FirebaseResetPasswordCredentials, onComplete: (error: any) => void): void;
|
||||
onDisconnect(): FirebaseOnDisconnect;
|
||||
}
|
||||
interface FirebaseStatic {
|
||||
@@ -305,4 +318,20 @@ interface FirebaseAuthData {
|
||||
interface FirebaseCredentials {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
}
|
||||
|
||||
interface FirebaseChangePasswordCredentials {
|
||||
email: string;
|
||||
oldPassword: string;
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
interface FirebaseChangeEmailCredentials {
|
||||
oldEmail: string;
|
||||
newEmail: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface FirebaseResetPasswordCredentials {
|
||||
email: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/// <reference path="./forge-di.d.ts" />
|
||||
|
||||
import Forge = require('forge-di');
|
||||
|
||||
var forge = new Forge();
|
||||
|
||||
class Bar {}
|
||||
|
||||
class Foo {
|
||||
constructor(public bar: Bar) {
|
||||
}
|
||||
}
|
||||
|
||||
forge.bind('foo').to.type(Foo);
|
||||
forge.bind('bar').to.type(Bar);
|
||||
|
||||
var foo: Foo = forge.get<Foo>('foo');
|
||||
var barInst = foo.bar;
|
||||
|
||||
// register functions
|
||||
var createFoo = (bar: Bar) => new Foo(bar);
|
||||
forge.bind('foo').to.function(createFoo);
|
||||
|
||||
// Conditional bindings and resolution hints
|
||||
class RedFoo {}
|
||||
class BlueFoo {}
|
||||
|
||||
forge.bind('foo').to.type(RedFoo).when('red');
|
||||
forge.bind('foo').to.type(BlueFoo).when((hint) => hint === 'blue');
|
||||
|
||||
// Lifecycles
|
||||
forge.bind('foo').to.type(Foo).as.singleton();
|
||||
forge.bind('bar').to.type(Bar).as.transient();
|
||||
|
||||
// explicit arguments
|
||||
var manuallyCreatedBar = new Bar();
|
||||
forge.bind('foo').to.type(Foo).with({bar: manuallyCreatedBar});
|
||||
|
||||
var bindingArgs: Forge.IBindingArguments = {
|
||||
bar: manuallyCreatedBar
|
||||
};
|
||||
forge.bind('foo').to.type(Foo).with(bindingArgs);
|
||||
|
||||
// Ephemeral Bindings TODO
|
||||
class DependsOnFoo {
|
||||
constructor(public foo: Foo){}
|
||||
}
|
||||
var dependsOnFoo = forge.create(DependsOnFoo);
|
||||
|
||||
// Unbinding and rebinding
|
||||
forge.unbind('foo');
|
||||
forge.rebind('foo').to.type(Foo);
|
||||
Vendored
+206
@@ -0,0 +1,206 @@
|
||||
// Type definitions for forge-di v0.9.5
|
||||
// Project: https://github.com/nkohari/forge
|
||||
// Definitions by: Adam Carr <https://github.com/adamcarr/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "forge-di" {
|
||||
/**
|
||||
* Implementation of the forge dependency injection manager.
|
||||
*/
|
||||
class Forge {
|
||||
/**
|
||||
* Creates a new instance
|
||||
* @returns {Forge} a new instance.
|
||||
*/
|
||||
new(): Forge;
|
||||
|
||||
/**
|
||||
* The bindings mapped to this forge instance.
|
||||
*/
|
||||
bindings: Forge.IBindingMap;
|
||||
|
||||
/**
|
||||
* Creates a new binding.
|
||||
* @param {string} name The binding name.
|
||||
*/
|
||||
bind(name: string): Forge.IBinding;
|
||||
/**
|
||||
* Unbinds then recreates a binding for this name.
|
||||
* @param {string} name The binding name.
|
||||
*/
|
||||
rebind(name: string): Forge.IBinding;
|
||||
/**
|
||||
* Unbinds all bindings for this name. Returns the number of bindings removed.
|
||||
* @param {string} name The binding name.
|
||||
*/
|
||||
unbind(name: string): number;
|
||||
/**
|
||||
* Get instance or instances of type registered under the provided name and optional hint.
|
||||
* @param {string} name The binding name.
|
||||
* @param {string} hint The binding hint.
|
||||
* @param {...args} args Additional args.
|
||||
*/
|
||||
get<T>(name: string, hint?: string, ...args: any[]): T;
|
||||
/**
|
||||
* Get a single instance of type registered under the provided name and optional hint.
|
||||
* @param {string} name The binding name.
|
||||
* @param {string} hint The binding hint.
|
||||
* @param {...args} args Additional args.
|
||||
*/
|
||||
getOne<T>(name: string, hint?: string, ...args: any[]): T;
|
||||
/**
|
||||
* Gets all instances of the type registered under the provided name.
|
||||
* @param {string} name The binding name.
|
||||
* @param {...args} args Additional args.
|
||||
*/
|
||||
getAll<T>(name: string, ...args: any[]): T | T[];
|
||||
/**
|
||||
* Creates an instance of the target type attempting to resolve any dependencies.
|
||||
* @param {T} target The target type.
|
||||
* @param {...args} args Additional args.
|
||||
*/
|
||||
create<T>(target: T, ...args: any[]): T;
|
||||
/**
|
||||
* Get all bindings registered under a binding name and optional hint.
|
||||
* @param {string} name The binding name.
|
||||
* @param {string} hint The binding hint.
|
||||
*/
|
||||
getMatchingBindings(name: string, hint?: string): Forge.IBinding[];
|
||||
/**
|
||||
* Returns a string that represents all bindings within this forge instance.
|
||||
*/
|
||||
inspect(): string;
|
||||
|
||||
resolve<T>(name: string, context?: Forge.IContext, hint?: string, all?: boolean, ...args: any[]): T | T[];
|
||||
resolveBindings(context: Forge.IContext, bindings: Forge.IBinding[], hint: string, args: any[], unwrap: boolean): Forge.IBinding[];
|
||||
}
|
||||
|
||||
module Forge {
|
||||
interface IContext {
|
||||
new (): IContext;
|
||||
bindings: IBinding[];
|
||||
has(binding: IBinding): boolean;
|
||||
push(binding: IBinding): void;
|
||||
pop(): IBinding;
|
||||
toString(indent: number): string;
|
||||
}
|
||||
|
||||
interface IType {
|
||||
new (...args: any[]): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents arguments to help with resolving a binding.
|
||||
*/
|
||||
interface IBindingArguments {
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a binding between a name, type/instance/function and optional hint.
|
||||
*/
|
||||
interface IBinding {
|
||||
/** The forge that contains this binding. */
|
||||
forge: Forge;
|
||||
/** The binding name. */
|
||||
name: string;
|
||||
/** Alias mapping to this binding. */
|
||||
to: IBinding;
|
||||
/** Alias mapping to this binding. */
|
||||
as: IBinding;
|
||||
/** Whether or not this binding is currently resolving. */
|
||||
isResolving: boolean;
|
||||
/** The resolver for this binding. */
|
||||
resolver: IResolver;
|
||||
/** The lifecycle associated with this binding. Defaults to singleton. */
|
||||
lifecycle: ILifecycle;
|
||||
/** The predicate associated with this binding. Used to support hints. */
|
||||
predicate: IPredicate;
|
||||
/** The additional binding arguments to help resolve dependencies. */
|
||||
arguments: IBindingArguments;
|
||||
|
||||
/**
|
||||
* Checks whether or not this binding matches the hint by executing the predicate.
|
||||
* @param {string} hint The hint to check against.
|
||||
*/
|
||||
matches(hint: string): boolean;
|
||||
/**
|
||||
* Registers a type to a binding. This type must have a constructor.
|
||||
* @param {T} target The target type.
|
||||
*/
|
||||
type<T extends IType>(target: T): IBinding;
|
||||
/**
|
||||
* Registers a type to a binding. This must be a callable function.
|
||||
* @param {T} target The target function.
|
||||
*/
|
||||
function<T extends{(...args: any[]):any}>(target: T): IBinding;
|
||||
/**
|
||||
* Registeres an instance to a binding. This instance will always be returned.
|
||||
* @param {T} target The target instance.
|
||||
*/
|
||||
instance<T extends Object>(target: T): IBinding;
|
||||
/**
|
||||
* Configures this binding lifecycle as a singleton. This is the default lifecycle.
|
||||
*/
|
||||
singleton(): IBinding;
|
||||
/**
|
||||
* Configures this binding lifecycle as transient.
|
||||
* New instances will be created, if this is a type based binding, on each get.
|
||||
*/
|
||||
transient(): IBinding;
|
||||
/**
|
||||
* Registers a predicate for this binding.
|
||||
* @param {IPredicate} predicate The predicate.
|
||||
*/
|
||||
when(predicate:IPredicate): IBinding;
|
||||
/**
|
||||
* Registers a hint for this binding.
|
||||
* @param {string} hint The hint.
|
||||
*/
|
||||
when(hint: string): IBinding;
|
||||
/**
|
||||
* Registers additional binding arguments to help with resolving.
|
||||
* @param {IBindingArguments} args The additional binding arguments.
|
||||
*/
|
||||
with(args: IBindingArguments): IBinding;
|
||||
/**
|
||||
* Returns a string representing this binding.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/** Represents a binding map. */
|
||||
interface IBindingMap {
|
||||
/** Gets a binding by name. */
|
||||
[name: string]: IBinding[];
|
||||
}
|
||||
|
||||
/** Represents a predicate. */
|
||||
interface IPredicate {
|
||||
/**
|
||||
* Returns whether or not the hit satisfies this predicate.
|
||||
* @param {string} hint The hint to check against.
|
||||
*/
|
||||
(hint: string): boolean;
|
||||
}
|
||||
|
||||
/** Represents a resolver. */
|
||||
interface IResolver {
|
||||
/**
|
||||
* Resolves a specific type.
|
||||
*/
|
||||
resolve<T>(): T;
|
||||
}
|
||||
|
||||
/** Represents a binding lifecycle. */
|
||||
interface ILifecycle {
|
||||
/**
|
||||
* Returns the instance from a resolver based on the configured lifecycle.
|
||||
* @param {IResolver} resolver The type resolver.
|
||||
*/
|
||||
getInstance<T>(resolver: IResolver): T;
|
||||
}
|
||||
}
|
||||
|
||||
export = Forge;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
[*.ts]
|
||||
indent_style = tab
|
||||
@@ -0,0 +1,437 @@
|
||||
/// <reference path="./github-electron-main.d.ts" />
|
||||
import app = require('app');
|
||||
import AutoUpdater = require('auto-updater');
|
||||
import BrowserWindow = require('browser-window');
|
||||
import ContentTracing = require('content-tracing');
|
||||
import Dialog = require('dialog');
|
||||
import GlobalShortcut = require('global-shortcut');
|
||||
import ipc = require('ipc');
|
||||
import Menu = require('menu');
|
||||
import MenuItem = require('menu-item');
|
||||
import PowerMonitor = require('power-monitor');
|
||||
import Protocol = require('protocol');
|
||||
import Tray = require('tray');
|
||||
import Clipboard = require('clipboard');
|
||||
import CrashReporter = require('crash-reporter');
|
||||
import NativeImage = require('native-image');
|
||||
import Screen = require('screen');
|
||||
import Shell = require('shell');
|
||||
|
||||
import path = require('path');
|
||||
|
||||
// Quick start
|
||||
// https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md
|
||||
|
||||
// Report crashes to our server.
|
||||
require('crash-reporter').start();
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the javascript object is GCed.
|
||||
var mainWindow: GitHubElectron.BrowserWindow = null;
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin')
|
||||
app.quit();
|
||||
});
|
||||
|
||||
// This method will be called when Electron has done everything
|
||||
// initialization and ready for creating browser windows.
|
||||
app.on('ready', () => {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({ width: 800, height: 600 });
|
||||
|
||||
// and load the index.html of the app.
|
||||
mainWindow.loadUrl(`file://${__dirname}/index.html`);
|
||||
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('closed', () => {
|
||||
// Dereference the window object, usually you would store windows
|
||||
// in an array if your app supports multi windows, this is the time
|
||||
// when you should delete the corresponding element.
|
||||
mainWindow = null;
|
||||
});
|
||||
});
|
||||
|
||||
// Desktop environment integration
|
||||
// https://github.com/atom/electron/blob/master/docs/tutorial/desktop-environment-integration.md
|
||||
|
||||
app.addRecentDocument('/Users/USERNAME/Desktop/work.type');
|
||||
app.clearRecentDocuments();
|
||||
var dockMenu = Menu.buildFromTemplate([
|
||||
<GitHubElectron.MenuItemOptions>{
|
||||
label: 'New Window',
|
||||
click: () => {
|
||||
console.log('New Window');
|
||||
}
|
||||
},
|
||||
<GitHubElectron.MenuItemOptions>{
|
||||
label: 'New Window with Settings',
|
||||
submenu: [
|
||||
<GitHubElectron.MenuItemOptions>{ label: 'Basic' },
|
||||
<GitHubElectron.MenuItemOptions>{ label: 'Pro' }
|
||||
]
|
||||
},
|
||||
<GitHubElectron.MenuItemOptions>{ label: 'New Command...' }
|
||||
]);
|
||||
app.dock.setMenu(dockMenu);
|
||||
|
||||
app.setUserTasks([
|
||||
<GitHubElectron.Task>{
|
||||
program: process.execPath,
|
||||
arguments: '--new-window',
|
||||
iconPath: process.execPath,
|
||||
iconIndex: 0,
|
||||
title: 'New Window',
|
||||
description: 'Create a new window'
|
||||
}
|
||||
]);
|
||||
app.setUserTasks([]);
|
||||
|
||||
var window = new BrowserWindow();
|
||||
window.setProgressBar(0.5);
|
||||
window.setRepresentedFilename('/etc/passwd');
|
||||
window.setDocumentEdited(true);
|
||||
|
||||
// Online/Offline Event Detection
|
||||
// https://github.com/atom/electron/blob/master/docs/tutorial/online-offline-events.md
|
||||
|
||||
var onlineStatusWindow: GitHubElectron.BrowserWindow;
|
||||
|
||||
app.on('ready', () => {
|
||||
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false });
|
||||
onlineStatusWindow.loadUrl(`file://${__dirname}/online-status.html`);
|
||||
});
|
||||
|
||||
ipc.on('online-status-changed', (event: any, status: any) => {
|
||||
console.log(status);
|
||||
});
|
||||
|
||||
// Synopsis
|
||||
// https://github.com/atom/electron/blob/master/docs/api/synopsis.md
|
||||
|
||||
app.on('ready', () => {
|
||||
window = new BrowserWindow({ width: 800, height: 600 });
|
||||
window.loadUrl('https://github.com');
|
||||
});
|
||||
|
||||
// Supported Chrome command line switches
|
||||
// https://github.com/atom/electron/blob/master/docs/api/chrome-command-line-switches.md
|
||||
|
||||
app.commandLine.appendSwitch('remote-debugging-port', '8315');
|
||||
app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1');
|
||||
app.commandLine.appendSwitch('v', -1);
|
||||
app.commandLine.appendSwitch('vmodule', 'console=0');
|
||||
|
||||
// auto-updater
|
||||
// https://github.com/atom/electron/blob/master/docs/api/auto-updater.md
|
||||
|
||||
AutoUpdater.setFeedUrl('http://mycompany.com/myapp/latest?version=' + app.getVersion());
|
||||
|
||||
// browser-window
|
||||
// https://github.com/atom/electron/blob/master/docs/api/browser-window.md
|
||||
|
||||
var win = new BrowserWindow({ width: 800, height: 600, show: false });
|
||||
win.on('closed', () => {
|
||||
win = null;
|
||||
});
|
||||
|
||||
win.loadUrl('https://github.com');
|
||||
win.show();
|
||||
|
||||
// content-tracing
|
||||
// https://github.com/atom/electron/blob/master/docs/api/content-tracing.md
|
||||
|
||||
ContentTracing.startRecording('*', ContentTracing.DEFAULT_OPTIONS, () => {
|
||||
console.log('Tracing started');
|
||||
|
||||
setTimeout(() => {
|
||||
ContentTracing.stopRecording('', path => {
|
||||
console.log('Tracing data recorded to ' + path);
|
||||
});
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
// dialog
|
||||
// https://github.com/atom/electron/blob/master/docs/api/dialog.md
|
||||
|
||||
console.log(Dialog.showOpenDialog({
|
||||
properties: ['openFile', 'openDirectory', 'multiSelections']
|
||||
}));
|
||||
|
||||
// global-shortcut
|
||||
// https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md
|
||||
|
||||
// Register a 'ctrl+x' shortcut listener.
|
||||
var ret = GlobalShortcut.register('ctrl+x', () => {
|
||||
console.log('ctrl+x is pressed');
|
||||
});
|
||||
if (!ret)
|
||||
console.log('registerion fails');
|
||||
|
||||
// Check whether a shortcut is registered.
|
||||
console.log(GlobalShortcut.isRegistered('ctrl+x'));
|
||||
|
||||
// Unregister a shortcut.
|
||||
GlobalShortcut.unregister('ctrl+x');
|
||||
|
||||
// Unregister all shortcuts.
|
||||
GlobalShortcut.unregisterAll();
|
||||
|
||||
// ipc
|
||||
// https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md
|
||||
|
||||
ipc.on('asynchronous-message', (event: any, arg: any) => {
|
||||
console.log(arg); // prints "ping"
|
||||
event.sender.send('asynchronous-reply', 'pong');
|
||||
});
|
||||
|
||||
ipc.on('synchronous-message', (event: any, arg: any) => {
|
||||
console.log(arg); // prints "ping"
|
||||
event.returnValue = 'pong';
|
||||
});
|
||||
|
||||
// menu
|
||||
// https://github.com/atom/electron/blob/master/docs/api/menu.md
|
||||
|
||||
var menu = new Menu();
|
||||
menu.append(new MenuItem({ label: 'MenuItem1', click: () => { console.log('item 1 clicked'); } }));
|
||||
menu.append(new MenuItem({ type: 'separator' }));
|
||||
menu.append(new MenuItem({ label: 'MenuItem2', type: 'checkbox', checked: true }));
|
||||
|
||||
// main.js
|
||||
var template = [
|
||||
{
|
||||
label: 'Electron',
|
||||
submenu: [
|
||||
{
|
||||
label: 'About Electron',
|
||||
selector: 'orderFrontStandardAboutPanel:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Services',
|
||||
submenu: <any[]>[]
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Hide Electron',
|
||||
accelerator: 'Command+H',
|
||||
selector: 'hide:'
|
||||
},
|
||||
{
|
||||
label: 'Hide Others',
|
||||
accelerator: 'Command+Shift+H',
|
||||
selector: 'hideOtherApplications:'
|
||||
},
|
||||
{
|
||||
label: 'Show All',
|
||||
selector: 'unhideAllApplications:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Quit',
|
||||
accelerator: 'Command+Q',
|
||||
click: () => { app.quit(); }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Undo',
|
||||
accelerator: 'Command+Z',
|
||||
selector: 'undo:'
|
||||
},
|
||||
{
|
||||
label: 'Redo',
|
||||
accelerator: 'Shift+Command+Z',
|
||||
selector: 'redo:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Cut',
|
||||
accelerator: 'Command+X',
|
||||
selector: 'cut:'
|
||||
},
|
||||
{
|
||||
label: 'Copy',
|
||||
accelerator: 'Command+C',
|
||||
selector: 'copy:'
|
||||
},
|
||||
{
|
||||
label: 'Paste',
|
||||
accelerator: 'Command+V',
|
||||
selector: 'paste:'
|
||||
},
|
||||
{
|
||||
label: 'Select All',
|
||||
accelerator: 'Command+A',
|
||||
selector: 'selectAll:'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'Command+R',
|
||||
click: () => { BrowserWindow.getFocusedWindow().reloadIgnoringCache(); }
|
||||
},
|
||||
{
|
||||
label: 'Toggle DevTools',
|
||||
accelerator: 'Alt+Command+I',
|
||||
click: () => { BrowserWindow.getFocusedWindow().toggleDevTools(); }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Window',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Minimize',
|
||||
accelerator: 'Command+M',
|
||||
selector: 'performMiniaturize:'
|
||||
},
|
||||
{
|
||||
label: 'Close',
|
||||
accelerator: 'Command+W',
|
||||
selector: 'performClose:'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Bring All to Front',
|
||||
selector: 'arrangeInFront:'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Help',
|
||||
submenu: []
|
||||
}
|
||||
];
|
||||
|
||||
menu = Menu.buildFromTemplate(template);
|
||||
|
||||
Menu.setApplicationMenu(menu); // Must be called within app.on('ready', function(){ ... });
|
||||
|
||||
Menu.buildFromTemplate([
|
||||
{ label: '4', id: '4' },
|
||||
{ label: '5', id: '5' },
|
||||
{ label: '1', id: '1', position: 'before=4' },
|
||||
{ label: '2', id: '2' },
|
||||
{ label: '3', id: '3' }
|
||||
]);
|
||||
|
||||
Menu.buildFromTemplate([
|
||||
{ label: 'a', position: 'endof=letters' },
|
||||
{ label: '1', position: 'endof=numbers' },
|
||||
{ label: 'b', position: 'endof=letters' },
|
||||
{ label: '2', position: 'endof=numbers' },
|
||||
{ label: 'c', position: 'endof=letters' },
|
||||
{ label: '3', position: 'endof=numbers' }
|
||||
]);
|
||||
|
||||
// power-monitor
|
||||
// https://github.com/atom/electron/blob/master/docs/api/power-monitor.md
|
||||
|
||||
app.on('ready', () => {
|
||||
PowerMonitor.on('suspend', () => {
|
||||
console.log('The system is going to sleep');
|
||||
});
|
||||
});
|
||||
|
||||
// protocol
|
||||
// https://github.com/atom/electron/blob/master/docs/api/protocol.md
|
||||
|
||||
app.on('ready', () => {
|
||||
Protocol.registerProtocol('atom', (request: any) => {
|
||||
var url = request.url.substr(7);
|
||||
return new Protocol.RequestFileJob(path.normalize(`${__dirname}/${url}`));
|
||||
});
|
||||
});
|
||||
|
||||
// tray
|
||||
// https://github.com/atom/electron/blob/master/docs/api/tray.md
|
||||
|
||||
var appIcon: GitHubElectron.Tray = null;
|
||||
app.on('ready', () => {
|
||||
appIcon = new Tray('/path/to/my/icon');
|
||||
var contextMenu = Menu.buildFromTemplate([
|
||||
{ label: 'Item1', type: 'radio' },
|
||||
{ label: 'Item2', type: 'radio' },
|
||||
{ label: 'Item3', type: 'radio', checked: true },
|
||||
{ label: 'Item4', type: 'radio' },
|
||||
]);
|
||||
appIcon.setToolTip('This is my application.');
|
||||
appIcon.setContextMenu(contextMenu);
|
||||
});
|
||||
|
||||
// clipboard
|
||||
// https://github.com/atom/electron/blob/master/docs/api/clipboard.md
|
||||
|
||||
Clipboard.writeText('Example String');
|
||||
Clipboard.writeText('Example String', 'selection');
|
||||
console.log(Clipboard.readText('selection'));
|
||||
|
||||
// crash-reporter
|
||||
// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md
|
||||
|
||||
CrashReporter.start({
|
||||
productName: 'YourName',
|
||||
companyName: 'YourCompany',
|
||||
submitUrl: 'https://your-domain.com/url-to-submit',
|
||||
autoSubmit: true
|
||||
});
|
||||
|
||||
// NativeImage
|
||||
// https://github.com/atom/electron/blob/master/docs/api/native-image.md
|
||||
|
||||
var appIcon2 = new Tray('/Users/somebody/images/icon.png');
|
||||
var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' });
|
||||
var image = Clipboard.readImage();
|
||||
var appIcon3 = new Tray(image);
|
||||
var appIcon4 = new Tray('/Users/somebody/images/icon.png');
|
||||
|
||||
// screen
|
||||
// https://github.com/atom/electron/blob/master/docs/api/screen.md
|
||||
|
||||
app.on('ready', () => {
|
||||
var size = Screen.getPrimaryDisplay().workAreaSize;
|
||||
mainWindow = new BrowserWindow({ width: size.width, height: size.height });
|
||||
});
|
||||
|
||||
app.on('ready', () => {
|
||||
var displays = Screen.getAllDisplays();
|
||||
var externalDisplay: any = null;
|
||||
for (var i in displays) {
|
||||
if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) {
|
||||
externalDisplay = displays[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (externalDisplay) {
|
||||
mainWindow = new BrowserWindow({
|
||||
x: externalDisplay.bounds.x + 50,
|
||||
y: externalDisplay.bounds.y + 50,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// shell
|
||||
// https://github.com/atom/electron/blob/master/docs/api/shell.md
|
||||
|
||||
Shell.openExternal('https://github.com');
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
// Type definitions for the Electron 0.25.2 main process
|
||||
// Project: http://electron.atom.io/
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="./github-electron.d.ts" />
|
||||
|
||||
declare module 'app' {
|
||||
var _app: GitHubElectron.App;
|
||||
export = _app;
|
||||
}
|
||||
|
||||
declare module 'auto-updater' {
|
||||
var _autoUpdater: GitHubElectron.AutoUpdater;
|
||||
export = _autoUpdater;
|
||||
}
|
||||
|
||||
declare module 'browser-window' {
|
||||
var BrowserWindow: typeof GitHubElectron.BrowserWindow;
|
||||
export = BrowserWindow;
|
||||
}
|
||||
|
||||
declare module 'content-tracing' {
|
||||
/**
|
||||
* Get a set of category groups. The category groups can change as new code paths are reached.
|
||||
* @param callback Called once all child processes have acked to the getCategories request.
|
||||
*/
|
||||
export function getCategories(callback: (categoryGroups: any[]) => void): void;
|
||||
/**
|
||||
* Start recording on all processes. Recording begins immediately locally, and asynchronously
|
||||
* on child processes as soon as they receive the EnableRecording request.
|
||||
* @param categoryFilter A filter to control what category groups should be traced.
|
||||
* A filter can have an optional "-" prefix to exclude category groups that contain
|
||||
* a matching category. Having both included and excluded category patterns in the
|
||||
* same list would not be supported.
|
||||
* @param options controls what kind of tracing is enabled, it could be a OR-ed
|
||||
* combination of tracing.DEFAULT_OPTIONS, tracing.ENABLE_SYSTRACE, tracing.ENABLE_SAMPLING
|
||||
* and tracing.RECORD_CONTINUOUSLY.
|
||||
* @param callback Called once all child processes have acked to the startRecording request.
|
||||
*/
|
||||
export function startRecording(categoryFilter: string, options: number, callback: Function): void;
|
||||
/**
|
||||
* Stop recording on all processes. Child processes typically are caching trace data and
|
||||
* only rarely flush and send trace data back to the main process. That is because it may
|
||||
* be an expensive operation to send the trace data over IPC, and we would like to avoid
|
||||
* much runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
|
||||
* child processes to flush any pending trace data.
|
||||
* @param resultFilePath Trace data will be written into this file if it is not empty,
|
||||
* or into a temporary file.
|
||||
* @param callback Called once all child processes have acked to the stopRecording request.
|
||||
*/
|
||||
export function stopRecording(resultFilePath: string, callback:
|
||||
/**
|
||||
* @param filePath A file that contains the traced data.
|
||||
*/
|
||||
(filePath: string) => void
|
||||
): void;
|
||||
/**
|
||||
* Start monitoring on all processes. Monitoring begins immediately locally, and asynchronously
|
||||
* on child processes as soon as they receive the startMonitoring request.
|
||||
* @param callback Called once all child processes have acked to the startMonitoring request.
|
||||
*/
|
||||
export function startMonitoring(categoryFilter: string, options: number, callback: Function): void;
|
||||
/**
|
||||
* Stop monitoring on all processes.
|
||||
* @param callback Called once all child processes have acked to the stopMonitoring request.
|
||||
*/
|
||||
export function stopMonitoring(callback: Function): void;
|
||||
/**
|
||||
* Get the current monitoring traced data. Child processes typically are caching trace data
|
||||
* and only rarely flush and send trace data back to the main process. That is because it may
|
||||
* be an expensive operation to send the trace data over IPC, and we would like to avoid much
|
||||
* runtime overhead of tracing. So, to end tracing, we must asynchronously ask all child
|
||||
* processes to flush any pending trace data.
|
||||
* @param callback Called once all child processes have acked to the captureMonitoringSnapshot request.
|
||||
*/
|
||||
export function captureMonitoringSnapshot(resultFilePath: string, callback:
|
||||
/**
|
||||
* @param filePath A file that contains the traced data
|
||||
* @returns {}
|
||||
*/
|
||||
(filePath: string) => void
|
||||
): void;
|
||||
/**
|
||||
* Get the maximum across processes of trace buffer percent full state.
|
||||
* @param callback Called when the TraceBufferUsage value is determined.
|
||||
*/
|
||||
export function getTraceBufferUsage(callback: Function): void;
|
||||
/**
|
||||
* @param callback Called every time the given event occurs on any process.
|
||||
*/
|
||||
export function setWatchEvent(categoryName: string, eventName: string, callback: Function): void;
|
||||
/**
|
||||
* Cancel the watch event. If tracing is enabled, this may race with the watch event callback.
|
||||
*/
|
||||
export function cancelWatchEvent(): void;
|
||||
export var DEFAULT_OPTIONS: number;
|
||||
export var ENABLE_SYSTRACE: number;
|
||||
export var ENABLE_SAMPLING: number;
|
||||
export var RECORD_CONTINUOUSLY: number;
|
||||
}
|
||||
|
||||
declare module 'dialog' {
|
||||
/**
|
||||
* @param callback If supplied, the API call will be asynchronous.
|
||||
* @returns On success, returns an array of file paths chosen by the user,
|
||||
* otherwise returns undefined.
|
||||
*/
|
||||
export var showOpenDialog: typeof GitHubElectron.Dialog.showOpenDialog;
|
||||
/**
|
||||
* @param callback If supplied, the API call will be asynchronous.
|
||||
* @returns On success, returns the path of file chosen by the user, otherwise
|
||||
* returns undefined.
|
||||
*/
|
||||
export var showSaveDialog: typeof GitHubElectron.Dialog.showSaveDialog;
|
||||
/**
|
||||
* Shows a message box. It will block until the message box is closed. It returns .
|
||||
* @param callback If supplied, the API call will be asynchronous.
|
||||
* @returns The index of the clicked button.
|
||||
*/
|
||||
export var showMessageBox: typeof GitHubElectron.Dialog.showMessageBox;
|
||||
|
||||
/**
|
||||
* Runs a modal dialog that shows an error message. This API can be called safely
|
||||
* before the ready event of app module emits, it is usually used to report errors
|
||||
* in early stage of startup.
|
||||
*/
|
||||
export function showErrorBox(title: string, content: string): void;
|
||||
}
|
||||
|
||||
declare module 'global-shortcut' {
|
||||
/**
|
||||
* Registers a global shortcut of accelerator.
|
||||
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
|
||||
* and key codes, combined by the "+" character.
|
||||
* @param callback Called when the registered shortcut is pressed by the user.
|
||||
* @returns {}
|
||||
*/
|
||||
export function register(accelerator: string, callback: Function): void;
|
||||
/**
|
||||
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
|
||||
* and key codes, combined by the "+" character.
|
||||
* @returns Whether the accelerator is registered.
|
||||
*/
|
||||
export function isRegistered(accelerator: string): boolean;
|
||||
/**
|
||||
* Unregisters the global shortcut of keycode.
|
||||
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
|
||||
* and key codes, combined by the "+" character.
|
||||
*/
|
||||
export function unregister(accelerator: string): void;
|
||||
/**
|
||||
* Unregisters all the global shortcuts.
|
||||
*/
|
||||
export function unregisterAll(): void;
|
||||
}
|
||||
|
||||
declare module 'ipc' {
|
||||
var ipc: NodeJS.EventEmitter;
|
||||
export = ipc;
|
||||
}
|
||||
|
||||
declare module 'menu' {
|
||||
var Menu: typeof GitHubElectron.Menu;
|
||||
export = Menu;
|
||||
}
|
||||
|
||||
declare module 'menu-item' {
|
||||
var MenuItem: typeof GitHubElectron.MenuItem;
|
||||
export = MenuItem;
|
||||
}
|
||||
|
||||
declare module 'power-monitor' {
|
||||
var powerMonitor: NodeJS.EventEmitter;
|
||||
export = powerMonitor;
|
||||
}
|
||||
|
||||
declare module 'protocol' {
|
||||
export function registerProtocol(scheme: string, handler: (request: any) => void): void;
|
||||
export function unregisterProtocol(scheme: string): void;
|
||||
export function isHandledProtocol(scheme: string): boolean;
|
||||
export function interceptProtocol(scheme: string, handler: (request: any) => void): void;
|
||||
export function uninterceptProtocol(scheme: string): void;
|
||||
export class RequestFileJob {
|
||||
/**
|
||||
* Create a request job which would query a file of path and set corresponding mime types.
|
||||
*/
|
||||
constructor(path: string);
|
||||
}
|
||||
export class RequestStringJob {
|
||||
/**
|
||||
* Create a request job which sends a string as response.
|
||||
*/
|
||||
constructor(options?: {
|
||||
/**
|
||||
* Default is "text/plain".
|
||||
*/
|
||||
mimeType?: string;
|
||||
/**
|
||||
* Default is "UTF-8".
|
||||
*/
|
||||
charset?: string;
|
||||
data?: string;
|
||||
});
|
||||
}
|
||||
export class RequestBufferJob {
|
||||
/**
|
||||
* Create a request job which accepts a buffer and sends a string as response.
|
||||
*/
|
||||
constructor(options?: {
|
||||
/**
|
||||
* Default is "application/octet-stream".
|
||||
*/
|
||||
mimeType?: string;
|
||||
/**
|
||||
* Default is "UTF-8".
|
||||
*/
|
||||
encoding?: string;
|
||||
data?: Buffer;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'tray' {
|
||||
var Tray: typeof GitHubElectron.Tray;
|
||||
export = Tray;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
/// <reference path="./github-electron-renderer.d.ts" />
|
||||
import ipc = require('ipc');
|
||||
import remote = require('remote');
|
||||
import WebFrame = require('web-frame');
|
||||
import Clipboard = require('clipboard');
|
||||
import CrashReporter = require('crash-reporter');
|
||||
import NativeImage = require('native-image');
|
||||
import Screen = require('screen');
|
||||
import Shell = require('shell');
|
||||
|
||||
import fs = require('fs');
|
||||
|
||||
// In renderer process (web page).
|
||||
// https://github.com/atom/electron/blob/master/docs/api/ipc-renderer.md
|
||||
console.log(ipc.sendSync('synchronous-message', 'ping')); // prints "pong"
|
||||
|
||||
ipc.on('asynchronous-reply', (arg: any) => {
|
||||
console.log(arg); // prints "pong"
|
||||
});
|
||||
ipc.send('asynchronous-message', 'ping');
|
||||
|
||||
// remote
|
||||
// https://github.com/atom/electron/blob/master/docs/api/remote.md
|
||||
|
||||
var BrowserWindow: typeof GitHubElectron.BrowserWindow = remote.require('browser-window');
|
||||
var win = new BrowserWindow({ width: 800, height: 600 });
|
||||
win.loadUrl('https://github.com');
|
||||
|
||||
remote.getCurrentWindow().on('close', () => {
|
||||
// blabla...
|
||||
});
|
||||
|
||||
remote.getCurrentWindow().capturePage(buf => {
|
||||
fs.writeFile('/tmp/screenshot.png', buf, err => {
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
|
||||
remote.getCurrentWindow().capturePage(buf => {
|
||||
remote.require('fs').writeFile('/tmp/screenshot.png', buf, (err: Error) => {
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
|
||||
// web-frame
|
||||
// https://github.com/atom/electron/blob/master/docs/api/web-frame.md
|
||||
|
||||
WebFrame.setZoomFactor(2);
|
||||
|
||||
WebFrame.setSpellCheckProvider('en-US', true, {
|
||||
spellCheck: text => {
|
||||
return !(require('spellchecker').isMisspelled(text));
|
||||
}
|
||||
});
|
||||
|
||||
// clipboard
|
||||
// https://github.com/atom/electron/blob/master/docs/api/clipboard.md
|
||||
|
||||
Clipboard.writeText('Example String');
|
||||
Clipboard.writeText('Example String', 'selection');
|
||||
console.log(Clipboard.readText('selection'));
|
||||
|
||||
// crash-reporter
|
||||
// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md
|
||||
|
||||
CrashReporter.start({
|
||||
productName: 'YourName',
|
||||
companyName: 'YourCompany',
|
||||
submitUrl: 'https://your-domain.com/url-to-submit',
|
||||
autoSubmit: true
|
||||
});
|
||||
|
||||
// NativeImage
|
||||
// https://github.com/atom/electron/blob/master/docs/api/native-image.md
|
||||
|
||||
var Tray: typeof GitHubElectron.Tray = remote.require('Tray');
|
||||
var appIcon2 = new Tray('/Users/somebody/images/icon.png');
|
||||
var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' });
|
||||
var image = Clipboard.readImage();
|
||||
var appIcon3 = new Tray(image);
|
||||
var appIcon4 = new Tray('/Users/somebody/images/icon.png');
|
||||
|
||||
// screen
|
||||
// https://github.com/atom/electron/blob/master/docs/api/screen.md
|
||||
|
||||
var app: GitHubElectron.App = remote.require('app');
|
||||
|
||||
var mainWindow: GitHubElectron.BrowserWindow = null;
|
||||
|
||||
app.on('ready', () => {
|
||||
var size = Screen.getPrimaryDisplay().workAreaSize;
|
||||
mainWindow = new BrowserWindow({ width: size.width, height: size.height });
|
||||
});
|
||||
|
||||
app.on('ready', () => {
|
||||
var displays = Screen.getAllDisplays();
|
||||
var externalDisplay: any = null;
|
||||
for (var i in displays) {
|
||||
if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) {
|
||||
externalDisplay = displays[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (externalDisplay) {
|
||||
mainWindow = new BrowserWindow({
|
||||
x: externalDisplay.bounds.x + 50,
|
||||
y: externalDisplay.bounds.y + 50,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// shell
|
||||
// https://github.com/atom/electron/blob/master/docs/api/shell.md
|
||||
|
||||
Shell.openExternal('https://github.com');
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
// Type definitions for the Electron 0.25.2 renderer process (web page)
|
||||
// Project: http://electron.atom.io/
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="./github-electron.d.ts" />
|
||||
|
||||
declare module GitHubElectron {
|
||||
|
||||
class InProcess implements NodeJS.EventEmitter {
|
||||
addListener(event: string, listener: Function): InProcess;
|
||||
on(event: string, listener: Function): InProcess;
|
||||
once(event: string, listener: Function): InProcess;
|
||||
removeListener(event: string, listener: Function): InProcess;
|
||||
removeAllListeners(event?: string): InProcess;
|
||||
setMaxListeners(n: number): void;
|
||||
listeners(event: string): Function[];
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
/**
|
||||
* Send ...args to the renderer via channel in asynchronous message, the main
|
||||
* process can handle it by listening to the channel event of ipc module.
|
||||
*/
|
||||
send(channel: string, ...args: any[]): void;
|
||||
/**
|
||||
* Send ...args to the renderer via channel in synchronous message, and returns
|
||||
* the result sent from main process. The main process can handle it by listening
|
||||
* to the channel event of ipc module, and returns by setting event.returnValue.
|
||||
* Note: Usually developers should never use this API, since sending synchronous
|
||||
* message would block the whole renderer process.
|
||||
* @returns The result sent from the main process.
|
||||
*/
|
||||
sendSync(channel: string, ...args: any[]): string;
|
||||
/**
|
||||
* Like ipc.send but the message will be sent to the host page instead of the main process.
|
||||
* This is mainly used by the page in <webview> to communicate with host page.
|
||||
*/
|
||||
sendToHost(channel: string, ...args: any[]): void;
|
||||
}
|
||||
|
||||
module Remote {
|
||||
export function getCurrentWindow(): BrowserWindow;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'ipc' {
|
||||
var InProcess: GitHubElectron.InProcess;
|
||||
export = InProcess;
|
||||
}
|
||||
|
||||
declare module 'remote' {
|
||||
/**
|
||||
* @returns The object returned by require(module) in the main process.
|
||||
*/
|
||||
export function require(module: string): any;
|
||||
/**
|
||||
* @returns The BrowserWindow object which this web page belongs to.
|
||||
*/
|
||||
export var getCurrentWindow: typeof GitHubElectron.Remote.getCurrentWindow;
|
||||
/**
|
||||
* @returns The global variable of name (e.g. global[name]) in the main process.
|
||||
*/
|
||||
export function getGlobal(name: string): any;
|
||||
/**
|
||||
* Returns the process object in the main process. This is the same as
|
||||
* remote.getGlobal('process'), but gets cached.
|
||||
*/
|
||||
export var process: any;
|
||||
}
|
||||
|
||||
declare module 'web-frame' {
|
||||
/**
|
||||
* Changes the zoom factor to the specified factor, zoom factor is
|
||||
* zoom percent / 100, so 300% = 3.0.
|
||||
*/
|
||||
export function setZoomFactor(factor: number): void;
|
||||
/**
|
||||
* @returns The current zoom factor.
|
||||
*/
|
||||
export function getZoomFactor(): number;
|
||||
/**
|
||||
* Changes the zoom level to the specified level, 0 is "original size", and each
|
||||
* increment above or below represents zooming 20% larger or smaller to default
|
||||
* limits of 300% and 50% of original size, respectively.
|
||||
*/
|
||||
export function setZoomLevel(level: number): void;
|
||||
/**
|
||||
* @returns The current zoom level.
|
||||
*/
|
||||
export function getZoomLevel(): number;
|
||||
/**
|
||||
* Sets a provider for spell checking in input fields and text areas.
|
||||
*/
|
||||
export function setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: {
|
||||
/**
|
||||
* @returns Whether the word passed is correctly spelled.
|
||||
*/
|
||||
spellCheck: (text: string) => boolean;
|
||||
}): void;
|
||||
/**
|
||||
* Sets the scheme as secure scheme. Secure schemes do not trigger mixed content
|
||||
* warnings. For example, https and data are secure schemes because they cannot be
|
||||
* corrupted by active network attackers.
|
||||
*/
|
||||
export function registerUrlSchemeAsSecure(scheme: string): void;
|
||||
}
|
||||
Vendored
+1295
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,357 @@
|
||||
/// <reference path="gl-matrix.d.ts" />
|
||||
|
||||
// common
|
||||
var result: number = glMatrix.toRadian(180);
|
||||
|
||||
var out: GLM.IArray;
|
||||
var outVal: number;
|
||||
var outStr: string;
|
||||
|
||||
// vec2
|
||||
var vecA: GLM.IArray, vecB: GLM.IArray, matA: GLM.IArray;
|
||||
var vecArray: GLM.IArray;
|
||||
|
||||
vecA = [1, 2];
|
||||
vecB = new Float32Array([3, 4]);
|
||||
out = [0, 0];
|
||||
matA = [1, 2, 3, 4, 5, 6];
|
||||
vecArray = [1, 2, 3, 4, 0, 0];
|
||||
|
||||
out = vec2.create();
|
||||
out = vec2.clone(vecA);
|
||||
out = vec2.fromValues(1, 2);
|
||||
out = vec2.copy(out, vecA);
|
||||
out = vec2.set(out, 1, 2);
|
||||
out = vec2.add(out, vecA, vecB);
|
||||
out = vec2.subtract(out, vecA, vecB);
|
||||
out = vec2.sub(out, vecA, vecB);
|
||||
out = vec2.multiply(out, vecA, vecB);
|
||||
out = vec2.mul(out, vecA, vecB);
|
||||
out = vec2.divide(out, vecA, vecB);
|
||||
out = vec2.div(out, vecA, vecB);
|
||||
out = vec2.min(out, vecA, vecB);
|
||||
out = vec2.max(out, vecA, vecB);
|
||||
out = vec2.scale(out, vecA, 2);
|
||||
out = vec2.scaleAndAdd(out, vecA, vecB, 0.5);
|
||||
outVal = vec2.distance(vecA, vecB);
|
||||
outVal = vec2.dist(vecA, vecB);
|
||||
outVal = vec2.squaredDistance(vecA, vecB);
|
||||
outVal = vec2.sqrDist(vecA, vecB);
|
||||
outVal = vec2.length(vecA);
|
||||
outVal = vec2.len(vecA);
|
||||
outVal = vec2.squaredLength(vecA);
|
||||
outVal = vec2.sqrLen(vecA);
|
||||
out = vec2.negate(out, vecA);
|
||||
out = vec2.inverse(out, vecA);
|
||||
out = vec2.normalize(out, vecA);
|
||||
outVal = vec2.dot(vecA, vecB);
|
||||
out = vec2.cross(out, vecA, vecB);
|
||||
out = vec2.lerp(out, vecA, vecB, 0.5);
|
||||
out = vec2.random(out);
|
||||
out = vec2.random(out, 5.0);
|
||||
out = vec2.transformMat2(out, vecA, matA);
|
||||
out = vec2.transformMat2d(out, vecA, matA);
|
||||
out = vec2.transformMat3(out, vecA, matA);
|
||||
out = vec2.transformMat4(out, vecA, matA);
|
||||
out = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
|
||||
outStr = vec2.str(vecA);
|
||||
|
||||
// vec3
|
||||
var matr: GLM.IArray;
|
||||
var q: GLM.IArray;
|
||||
|
||||
vecA = [1, 2, 3];
|
||||
vecB = new Float32Array([4, 5, 6]);
|
||||
out = [0, 0, 0];
|
||||
vecArray = [1, 2, 3, 4, 5, 6, 0, 0, 0];
|
||||
matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ];
|
||||
|
||||
out = vec3.create();
|
||||
out = vec3.clone(vecA);
|
||||
out = vec3.fromValues(1, 2, 3);
|
||||
out = vec3.copy(out, vecA);
|
||||
out = vec3.set(out, 1, 2, 3);
|
||||
out = vec3.add(out, vecA, vecB);
|
||||
out = vec3.subtract(out, vecA, vecB);
|
||||
out = vec3.sub(out, vecA, vecB);
|
||||
out = vec3.multiply(out, vecA, vecB);
|
||||
out = vec3.mul(out, vecA, vecB);
|
||||
out = vec3.divide(out, vecA, vecB);
|
||||
out = vec3.div(out, vecA, vecB);
|
||||
out = vec3.min(out, vecA, vecB);
|
||||
out = vec3.max(out, vecA, vecB);
|
||||
out = vec3.scale(out, vecA, 2);
|
||||
out = vec3.scaleAndAdd(out, vecA, vecB, 0.5);
|
||||
outVal = vec3.distance(vecA, vecB);
|
||||
outVal = vec3.dist(vecA, vecB);
|
||||
outVal = vec3.squaredDistance(vecA, vecB);
|
||||
outVal = vec3.sqrDist(vecA, vecB);
|
||||
outVal = vec3.length(vecA);
|
||||
outVal = vec3.len(vecA);
|
||||
outVal = vec3.squaredLength(vecA);
|
||||
outVal = vec3.sqrLen(vecA);
|
||||
out = vec3.negate(out, vecA);
|
||||
out = vec3.inverse(out, vecA);
|
||||
out = vec3.normalize(out, vecA);
|
||||
outVal = vec3.dot(vecA, vecB);
|
||||
out = vec3.cross(out, vecA, vecB);
|
||||
out = vec3.lerp(out, vecA, vecB, 0.5);
|
||||
out = vec3.random(out);
|
||||
out = vec3.random(out, 5.0);
|
||||
out = vec3.rotateX(out, vecA, vecB, Math.PI);
|
||||
out = vec3.rotateY(out, vecA, vecB, Math.PI);
|
||||
out = vec3.rotateZ(out, vecA, vecB, Math.PI);
|
||||
out = vec3.transformMat3(out, vecA, matr);
|
||||
|
||||
matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ];
|
||||
out = vec3.transformMat4(out, vecA, matr);
|
||||
|
||||
q = [1, 2, 3, 4];
|
||||
out = vec3.transformQuat(out, vecA, matr);
|
||||
|
||||
out = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
|
||||
outVal = vec3.angle(vecA, vecB);
|
||||
outStr = vec3.str(vecA);
|
||||
|
||||
// vec4
|
||||
var q: GLM.IArray;
|
||||
|
||||
vecA = [1, 2, 3, 4];
|
||||
vecB = new Float32Array([5, 6, 7, 8]);
|
||||
out = [0, 0, 0, 0];
|
||||
q = [1, 2, 3, 4];
|
||||
|
||||
out = vec4.create();
|
||||
out = vec4.clone(vecA);
|
||||
out = vec4.fromValues(1, 2, 3, 4);
|
||||
out = vec4.copy(out, vecA);
|
||||
out = vec4.set(out, 1, 2, 3, 4);
|
||||
out = vec4.add(out, vecA, vecB);
|
||||
out = vec4.subtract(out, vecA, vecB);
|
||||
out = vec4.sub(out, vecA, vecB);
|
||||
out = vec4.multiply(out, vecA, vecB);
|
||||
out = vec4.mul(out, vecA, vecB);
|
||||
out = vec4.divide(out, vecA, vecB);
|
||||
out = vec4.div(out, vecA, vecB);
|
||||
out = vec4.min(out, vecA, vecB);
|
||||
out = vec4.max(out, vecA, vecB);
|
||||
out = vec4.scale(out, vecA, 2);
|
||||
out = vec4.scaleAndAdd(out, vecA, vecB, 0.5);
|
||||
outVal = vec4.distance(vecA, vecB);
|
||||
outVal = vec4.dist(vecA, vecB);
|
||||
outVal = vec4.squaredDistance(vecA, vecB);
|
||||
outVal = vec4.sqrDist(vecA, vecB);
|
||||
outVal = vec4.length(vecA);
|
||||
outVal = vec4.len(vecA);
|
||||
outVal = vec4.squaredLength(vecA);
|
||||
outVal = vec4.sqrLen(vecA);
|
||||
out = vec4.negate(out, vecA);
|
||||
out = vec4.inverse(out, vecA);
|
||||
out = vec4.normalize(out, vecA);
|
||||
outVal = vec4.dot(vecA, vecB);
|
||||
out = vec4.lerp(out, vecA, vecB, 0.5);
|
||||
out = vec4.random(out);
|
||||
out = vec4.random(out, 5.0);
|
||||
|
||||
matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]
|
||||
out = vec4.transformMat4(out, vecA, matr);
|
||||
out = vec4.transformQuat(out, vecA, q);
|
||||
|
||||
vecArray = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0];
|
||||
out = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
|
||||
outStr = vec4.str(vecA);
|
||||
|
||||
// mat2
|
||||
var matB: GLM.IArray, identity: GLM.IArray;
|
||||
|
||||
matA = [1, 2, 3, 4];
|
||||
matB = new Float32Array([5, 6, 7, 8]);
|
||||
out = [0, 0, 0, 0];
|
||||
identity = [1, 0, 0, 1];
|
||||
|
||||
out = mat2.create();
|
||||
out = mat2.clone(matA);
|
||||
out = mat2.copy(out, matA);
|
||||
out = mat2.identity(out);
|
||||
out = mat2.transpose(out, matA);
|
||||
out = mat2.invert(out, matA);
|
||||
out = mat2.adjoint(out, matA);
|
||||
outVal = mat2.determinant(matA);
|
||||
out = mat2.multiply(out, matA, matB);
|
||||
out = mat2.mul(out, matA, matB);
|
||||
out = mat2.rotate(out, matA, Math.PI * 0.5);
|
||||
|
||||
vecA = [2, 3];
|
||||
out = mat2.scale(out, matA, vecA);
|
||||
outStr = mat2.str(matA);
|
||||
outVal = mat2.frob(matA);
|
||||
|
||||
var L = mat2.create();
|
||||
var D = mat2.create();
|
||||
var U = mat2.create();
|
||||
out = mat2.LDU(L, D, U, [4,3,6,3]);
|
||||
|
||||
// mat2d
|
||||
matA = [1, 2, 3, 4, 5, 6];
|
||||
matB = [7, 8, 9, 10, 11, 12];
|
||||
out = [0, 0, 0, 0, 0, 0];
|
||||
identity = [1, 0, 0, 1, 0, 0];
|
||||
|
||||
out = mat2d.create();
|
||||
out = mat2d.clone(matA);
|
||||
out = mat2d.copy(out, matA);
|
||||
out = mat2d.identity(out);
|
||||
out = mat2d.invert(out, matA);
|
||||
outVal = mat2d.determinant(matA);
|
||||
out = mat2d.multiply(out, matA, matB);
|
||||
out = mat2d.mul(out, matA, matB);
|
||||
out = mat2d.rotate(out, matA, Math.PI * 0.5);
|
||||
|
||||
vecA = [2, 3];
|
||||
out = mat2d.scale(out, matA, vecA);
|
||||
out = mat2d.translate(out, matA, vecA);
|
||||
outStr = mat2d.str(matA);
|
||||
outVal = mat2d.frob(matA);
|
||||
|
||||
// mat3
|
||||
matA = [1, 0, 0, 0, 1, 0, 1, 2, 1];
|
||||
matB = [1, 0, 0, 0, 1, 0, 3, 4, 1];
|
||||
out = [0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
identity = [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
||||
|
||||
out = mat3.create();
|
||||
out = mat3.clone(matA);
|
||||
out = mat3.copy(out, matA);
|
||||
out = mat3.identity(out);
|
||||
out = mat3.transpose(out, matA);
|
||||
out = mat3.invert(out, matA);
|
||||
out = mat3.adjoint(out, matA);
|
||||
outVal = mat3.determinant(matA);
|
||||
out = mat3.multiply(out, matA, matB);
|
||||
out = mat3.mul(out, matA, matB);
|
||||
outStr = mat3.str(matA);
|
||||
outVal = mat3.frob(matA);
|
||||
|
||||
matA = [1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1];
|
||||
out = mat3.normalFromMat4(out, matA);
|
||||
|
||||
q = [ 0, -0.7071067811865475, 0, 0.7071067811865475 ];
|
||||
out = mat3.fromQuat(out, q);
|
||||
|
||||
out = mat3.normalFromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]);
|
||||
out = mat3.fromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]);
|
||||
out = mat3.scale(out, matA, [2,2]);
|
||||
out = mat3.fromMat2d(out, [1, 2, 3, 4, 5, 6]);
|
||||
|
||||
out = mat3.translate(out, matA, [1, 2, 3]);
|
||||
out = mat3.rotate(out, matA, Math.PI/2);
|
||||
|
||||
// mat4
|
||||
matA = [1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
1, 2, 3, 1];
|
||||
|
||||
matB = [1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
4, 5, 6, 1];
|
||||
|
||||
out = [0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0];
|
||||
|
||||
identity = [1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1];
|
||||
|
||||
out = mat4.create();
|
||||
out = mat4.clone(matA);
|
||||
out = mat4.copy(out, matA);
|
||||
out = mat4.identity(out);
|
||||
out = mat4.transpose(out, matA);
|
||||
out = mat4.invert(out, matA);
|
||||
out = mat4.adjoint(out, matA);
|
||||
outVal = mat4.determinant(matA);
|
||||
out = mat4.multiply(out, matA, matB);
|
||||
out = mat4.mul(out, matA, matB);
|
||||
out = mat4.translate(out, matA, [4, 5, 6]);
|
||||
out = mat4.scale(out, matA, [4, 5, 6]);
|
||||
|
||||
var rad = Math.PI * 0.5;
|
||||
var axis = [1, 0, 0];
|
||||
out = mat4.rotate(out, matA, rad, axis);
|
||||
out = mat4.rotateX(out, matA, rad);
|
||||
out = mat4.rotateY(out, matA, rad);
|
||||
out = mat4.rotateZ(out, matA, rad);
|
||||
|
||||
out = mat4.frustum(out, -1, 1, -1, 1, -1, 1);
|
||||
|
||||
var fovy = Math.PI * 0.5;
|
||||
out = mat4.perspective(out, fovy, 1, 0, 1);
|
||||
out = mat4.ortho(out, -1, 1, -1, 1, -1, 1);
|
||||
|
||||
var eye = [0, 0, 1];
|
||||
var center = [0, 0, -1];
|
||||
var up = [0, 1, 0];
|
||||
out = mat4.lookAt(out, eye, center, up);
|
||||
|
||||
outStr = mat4.str(matA);
|
||||
outVal = mat4.frob(matA);
|
||||
|
||||
q = [0, 0, 0, 1];
|
||||
out = mat4.fromRotationTranslation(out, q, [1, 2, 3]);
|
||||
out = mat4.fromQuat(out, q);
|
||||
|
||||
// quat
|
||||
var quatA = [1, 2, 3, 4];
|
||||
var quatB = [5, 6, 7, 8];
|
||||
out = [0, 0, 0, 0];
|
||||
var vec = [1, 1, -1];
|
||||
var id = [0, 0, 0, 1];
|
||||
var deg90 = Math.PI / 2;
|
||||
|
||||
out = quat.create();
|
||||
out = quat.clone(quatA);
|
||||
out = quat.fromValues(1, 2, 3, 4);
|
||||
out = quat.copy(out, quatA);
|
||||
out = quat.set(out, 1, 2, 3, 4);
|
||||
out = quat.identity(out);
|
||||
out = quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5);
|
||||
out = quat.add(out, quatA, quatB);
|
||||
out = quat.multiply(out, quatA, quatB);
|
||||
out = quat.mul(out, quatA, quatB);
|
||||
out = quat.scale(out, quatA, 2);
|
||||
outVal = quat.length(quatA);
|
||||
outVal = quat.len(quatA);
|
||||
outVal = quat.squaredLength(quatA);
|
||||
outVal = quat.sqrLen(quatA);
|
||||
out = quat.normalize(out, quatA);
|
||||
outVal = quat.dot(out, quatA, quatB);
|
||||
out = quat.lerp(out, quatA, quatB, 0.5);
|
||||
out = quat.slerp(out, quatA, quatB, 0.5);
|
||||
out = quat.invert(out, quatA);
|
||||
out = quat.conjugate(out, quatA);
|
||||
outStr = quat.str(quatA);
|
||||
out = quat.rotateX(out, id, deg90);
|
||||
out = quat.rotateY(out, id, deg90);
|
||||
out = quat.rotateZ(out, id, deg90);
|
||||
|
||||
matr = [ 1, 0, 0,
|
||||
0, 0, -1,
|
||||
0, 1, 0 ];
|
||||
out = quat.fromMat3(out, matr);
|
||||
|
||||
var view = [-1, 0, 0];
|
||||
up = [ 0, 1, 0];
|
||||
var right= [ 0, 0,-1];
|
||||
out = quat.setAxes([], view, right, up);
|
||||
|
||||
out = quat.rotationTo(out, [0, 1, 0], [1, 0, 0]);
|
||||
out = quat.calculateW(out, quatA);
|
||||
|
||||
Vendored
+2144
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,107 @@
|
||||
// Test file for Google Maps JavaScript API Definition file
|
||||
/// <reference path="google.maps.d.ts" />
|
||||
|
||||
var map = new google.maps.Map(document.querySelector("☺"));
|
||||
|
||||
/***** Data *****/
|
||||
|
||||
new google.maps.Data();
|
||||
new google.maps.Data({ map: map });
|
||||
|
||||
var latLng = new google.maps.LatLng(52.201203, -1.724370),
|
||||
feature = new google.maps.Data.Feature(),
|
||||
geometry = new google.maps.Data.Geometry();
|
||||
|
||||
var data = map.data;
|
||||
|
||||
data.add(feature);
|
||||
|
||||
data.add({
|
||||
geometry: latLng,
|
||||
id: "Test feature",
|
||||
properties: {}
|
||||
});
|
||||
|
||||
var isIn: boolean = map.data.contains(feature);
|
||||
|
||||
data.forEach((feature: google.maps.Data.Feature) => {
|
||||
console.log(feature.getId());
|
||||
});
|
||||
|
||||
var map: google.maps.Map = data.getMap();
|
||||
data.setMap(map);
|
||||
|
||||
var style = data.getStyle();
|
||||
data.setStyle(style);
|
||||
|
||||
data.setStyle({
|
||||
clickable: true,
|
||||
cursor: "pointer",
|
||||
fillColor: "#79B55B",
|
||||
fillOpacity: 1,
|
||||
icon: {},
|
||||
shape: { coords: [1, 2, 3], type: "circle" },
|
||||
strokeColor: "#79B55B",
|
||||
strokeOpacity: 1,
|
||||
strokeWeight: 1,
|
||||
title: "string",
|
||||
visible: true,
|
||||
zIndex: 1
|
||||
});
|
||||
|
||||
data.overrideStyle(feature, { visible: true });
|
||||
|
||||
data.revertStyle(feature);
|
||||
|
||||
data.addGeoJson({});
|
||||
data.addGeoJson({}, { idPropertyName: "Test feature" });
|
||||
|
||||
data.loadGeoJson("http://magicGeoJsonSource.com");
|
||||
|
||||
data.loadGeoJson(
|
||||
"http://magicGeoJsonSource.com",
|
||||
{ idPropertyName: "test" });
|
||||
|
||||
data.loadGeoJson(
|
||||
"http://magicGeoJsonSource.com",
|
||||
{ idPropertyName: "test" },
|
||||
(features) => {
|
||||
for (var i = 0, len = features.length; i < len; i++) {
|
||||
console.log(features[i].getId());
|
||||
}
|
||||
});
|
||||
|
||||
data.toGeoJson((feature) => { });
|
||||
|
||||
var dataMouseEvent: google.maps.Data.MouseEvent = {
|
||||
feature: feature,
|
||||
latLng: latLng,
|
||||
stop: (): void => {}
|
||||
};
|
||||
|
||||
var addFeatureEvent : google.maps.Data.AddFeatureEvent = {
|
||||
feature: feature
|
||||
};
|
||||
|
||||
var removeFeatureEvent: google.maps.Data.RemoveFeatureEvent = {
|
||||
feature: feature
|
||||
};
|
||||
|
||||
var setGeometryEvent: google.maps.Data.SetGeometryEvent = {
|
||||
feature: feature,
|
||||
newGeometry: geometry,
|
||||
oldGeometry: geometry,
|
||||
};
|
||||
|
||||
var setPropertyEvent: google.maps.Data.SetPropertyEvent = {
|
||||
feature: feature,
|
||||
name: "test",
|
||||
newValue: {},
|
||||
oldValue: {}
|
||||
};
|
||||
|
||||
var removePropertyEvent: google.maps.Data.RemovePropertyEvent = {
|
||||
feature: feature,
|
||||
name: "test",
|
||||
oldValue: {}
|
||||
};
|
||||
Vendored
+267
-67
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Google Geolocation 0.4.8
|
||||
// Type definitions for Google Maps JavaScript API 3.19
|
||||
// Project: https://developers.google.com/maps/
|
||||
// Definitions by: Folia A/S <http://www.folia.dk>
|
||||
// Definitions by: Folia A/S <http://www.folia.dk>, Chris Wrench <https://github.com/cgwrench>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/*
|
||||
@@ -80,9 +80,10 @@ declare module google.maps {
|
||||
setStreetView(panorama: StreetViewPanorama): void;
|
||||
setTilt(tilt: number): void;
|
||||
setZoom(zoom: number): void;
|
||||
controls: MVCArray[]; //Array.<MVCArray.<Node >>
|
||||
controls: MVCArray[]; //Array<MVCArray.<Node >>
|
||||
data: Data;
|
||||
mapTypes: MapTypeRegistry;
|
||||
overlayMapTypes: MVCArray; // MVCArray.<MapType>
|
||||
overlayMapTypes: MVCArray; // MVCArray<MapType>
|
||||
}
|
||||
|
||||
export interface MapOptions {
|
||||
@@ -206,6 +207,159 @@ declare module google.maps {
|
||||
ZOOM_PAN
|
||||
}
|
||||
|
||||
/***** Data *****/
|
||||
export class Data extends MVCObject {
|
||||
constructor(options?: Data.DataOptions);
|
||||
add(feature: Data.Feature|Data.FeatureOptions): Data.Feature;
|
||||
addGeoJson(geoJson: Object, options?: Data.GeoJsonOptions): Data.Feature[];
|
||||
contains(feature: Data.Feature): boolean;
|
||||
forEach(callback: (feature: Data.Feature) => void): void;
|
||||
getFeatureById(id: number|string): Data.Feature;
|
||||
getMap(): Map;
|
||||
getStyle(): Data.StylingFunction|Data.StyleOptions;
|
||||
loadGeoJson(url: string, options?: Data.GeoJsonOptions, callback?: (features: Data.Feature[]) => void): void;
|
||||
overrideStyle(feature: Data.Feature, style: Data.StyleOptions): void;
|
||||
remove(feature: Data.Feature): void;
|
||||
revertStyle(feature?: Data.Feature): void;
|
||||
setMap(map: Map): void;
|
||||
setStyle(style: Data.StylingFunction|Data.StyleOptions): void;
|
||||
toGeoJson(callback: (feature: Object) => void): void;
|
||||
}
|
||||
|
||||
export module Data {
|
||||
export interface DataOptions {
|
||||
map?: Map;
|
||||
style?: Data.StylingFunction|Data.StyleOptions;
|
||||
}
|
||||
|
||||
export interface GeoJsonOptions {
|
||||
idPropertyName?: string;
|
||||
}
|
||||
|
||||
export interface StyleOptions {
|
||||
clickable?: boolean;
|
||||
cursor?: string;
|
||||
fillColor?: string;
|
||||
fillOpacity?: number;
|
||||
icon?: any; // TODO string|Icon|Symbol;
|
||||
shape?: MarkerShape;
|
||||
strokeColor?: string;
|
||||
strokeOpacity?: number;
|
||||
strokeWeight?: number;
|
||||
title?: string;
|
||||
visible?: boolean;
|
||||
zIndex?: number;
|
||||
}
|
||||
|
||||
export type StylingFunction = (feature: Data.Feature) => Data.StyleOptions;
|
||||
|
||||
export class Feature {
|
||||
constructor(options?: Data.FeatureOptions);
|
||||
forEachProperty(callback: (value: any, name: string) => void): void;
|
||||
getGeometry(): Data.Geometry;
|
||||
getId(): number|string;
|
||||
getProperty(name: string): any;
|
||||
removeProperty(name: string): void;
|
||||
setGeometry(newGeometry: Data.Geometry|LatLng): void; // TODO LatLngLiteral
|
||||
setProperty(name: string, newValue: any): void
|
||||
toGeoJson(callback: (feature: Object) => void): void
|
||||
}
|
||||
|
||||
export interface FeatureOptions {
|
||||
geometry?: Data.Geometry|LatLng; // TODO LatLngLiteral
|
||||
id?: number|string;
|
||||
properties?: Object;
|
||||
}
|
||||
|
||||
export class Geometry {
|
||||
getType(): string;
|
||||
}
|
||||
|
||||
export class Point extends Data.Geometry {
|
||||
constructor(latLng: LatLng); // TODO LatLngLiteral
|
||||
get(): LatLng;
|
||||
}
|
||||
|
||||
export class MultiPoint extends Data.Geometry {
|
||||
constructor(elements: LatLng[]); // TODO LatLngLiteral
|
||||
getAt(n: number): LatLng;
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
export class LineString extends Data.Geometry {
|
||||
constructor(elements: LatLng[]); // TODO LatLngLiteral
|
||||
getArray(): LatLng[];
|
||||
getAt(n: number): LatLng;
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
export class MultiLineString extends Data.Geometry {
|
||||
constructor(elements: Data.LineString[]|LatLng[]); // TODO LatLngLiteral
|
||||
getArray(): Data.LineString[];
|
||||
getAt(n: number): Data.LineString;
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
export class LinearRing extends Data.Geometry {
|
||||
constructor(elements: LatLng[]); // TODO LatLngLiteral
|
||||
getArray(): LatLng[];
|
||||
getAt(n: number): LatLng;
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
export class Polygon extends Data.Geometry {
|
||||
constructor(elements: LinearRing[]|LatLng[][]); // TODO LatLngLiteral
|
||||
getArray(): LinearRing[];
|
||||
getAt(n: number): LinearRing;
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
export class MultiPolygon extends Data.Geometry {
|
||||
constructor(elements: Data.Polygon[]|LinearRing[][]|LatLng[][][]); // TODO LatLngLiteral
|
||||
getArray(): Data.Polygon[];
|
||||
getAt(n: number): Data.Polygon;
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
export class GeometryCollection extends Data.Geometry {
|
||||
constructor(elements: Data.Geometry[]|LatLng[]); // TODO LatLngLiteral
|
||||
getArray(): Data.Geometry[];
|
||||
getAt(n: number): Data.Geometry;
|
||||
getLength(): number;
|
||||
}
|
||||
|
||||
export interface MouseEvent extends google.maps.MouseEvent {
|
||||
feature: Data.Feature;
|
||||
}
|
||||
|
||||
export interface AddFeatureEvent {
|
||||
feature: Data.Feature;
|
||||
}
|
||||
|
||||
export interface RemoveFeatureEvent {
|
||||
feature: Data.Feature;
|
||||
}
|
||||
|
||||
export interface SetGeometryEvent {
|
||||
feature: Data.Feature;
|
||||
newGeometry: Data.Geometry;
|
||||
oldGeometry: Data.Geometry;
|
||||
}
|
||||
|
||||
export interface SetPropertyEvent {
|
||||
feature: Data.Feature;
|
||||
name: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
}
|
||||
|
||||
export interface RemovePropertyEvent {
|
||||
feature: Data.Feature;
|
||||
name: string;
|
||||
oldValue: any;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Overlays *****/
|
||||
export class Marker extends MVCObject {
|
||||
static MAX_ZINDEX: number;
|
||||
@@ -470,7 +624,7 @@ declare module google.maps {
|
||||
visible?: boolean;
|
||||
zIndex?: number;
|
||||
}
|
||||
|
||||
|
||||
export enum StrokePosition {
|
||||
CENTER,
|
||||
INSIDE,
|
||||
@@ -1345,54 +1499,54 @@ declare module google.maps {
|
||||
}
|
||||
|
||||
export module places {
|
||||
|
||||
export class AutocompleteService extends MVCObject {
|
||||
constructor();
|
||||
getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void;
|
||||
getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void;
|
||||
}
|
||||
|
||||
export interface AutocompletionRequest {
|
||||
input: string;
|
||||
bounds?: LatLngBounds;
|
||||
componentRestrictions?: ComponentRestrictions;
|
||||
location?: LatLng;
|
||||
offset?: number;
|
||||
radius?: number;
|
||||
types?: string[];
|
||||
}
|
||||
|
||||
export interface QueryAutocompletionRequest {
|
||||
input: string;
|
||||
bounds?: LatLngBounds;
|
||||
location?: LatLng;
|
||||
offset?: number;
|
||||
radius?: number;
|
||||
}
|
||||
|
||||
export interface AutocompletePrediction {
|
||||
description: string;
|
||||
matched_substrings: PredictionSubstring[];
|
||||
place_id: string;
|
||||
terms: PredictionTerm[];
|
||||
types: string[]
|
||||
}
|
||||
|
||||
export interface PredictionTerm {
|
||||
offset: number;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface PredictionSubstring {
|
||||
length: number;
|
||||
offset: number;
|
||||
}
|
||||
|
||||
export interface QueryAutocompletePrediction {
|
||||
description: string;
|
||||
matched_substrings: PredictionSubstring[];
|
||||
place_id: string;
|
||||
terms: PredictionTerm[];
|
||||
|
||||
export class AutocompleteService extends MVCObject {
|
||||
constructor();
|
||||
getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void;
|
||||
getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void;
|
||||
}
|
||||
|
||||
export interface AutocompletionRequest {
|
||||
input: string;
|
||||
bounds?: LatLngBounds;
|
||||
componentRestrictions?: ComponentRestrictions;
|
||||
location?: LatLng;
|
||||
offset?: number;
|
||||
radius?: number;
|
||||
types?: string[];
|
||||
}
|
||||
|
||||
export interface QueryAutocompletionRequest {
|
||||
input: string;
|
||||
bounds?: LatLngBounds;
|
||||
location?: LatLng;
|
||||
offset?: number;
|
||||
radius?: number;
|
||||
}
|
||||
|
||||
export interface AutocompletePrediction {
|
||||
description: string;
|
||||
matched_substrings: PredictionSubstring[];
|
||||
place_id: string;
|
||||
terms: PredictionTerm[];
|
||||
types: string[]
|
||||
}
|
||||
|
||||
export interface PredictionTerm {
|
||||
offset: number;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface PredictionSubstring {
|
||||
length: number;
|
||||
offset: number;
|
||||
}
|
||||
|
||||
export interface QueryAutocompletePrediction {
|
||||
description: string;
|
||||
matched_substrings: PredictionSubstring[];
|
||||
place_id: string;
|
||||
terms: PredictionTerm[];
|
||||
}
|
||||
|
||||
export class Autocomplete extends MVCObject {
|
||||
@@ -1414,8 +1568,19 @@ declare module google.maps {
|
||||
country: string;
|
||||
}
|
||||
|
||||
export interface PhotoOptions {
|
||||
maxHeight?: number;
|
||||
maxWidth?: number;
|
||||
}
|
||||
|
||||
export interface PlaceAspectRating {
|
||||
rating: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface PlaceDetailsRequest {
|
||||
reference: string;
|
||||
placeId: string;
|
||||
reference?: string;
|
||||
}
|
||||
|
||||
export interface PlaceGeometry {
|
||||
@@ -1423,29 +1588,53 @@ declare module google.maps {
|
||||
viewport: LatLngBounds;
|
||||
}
|
||||
|
||||
export interface PlacePhoto {
|
||||
height: number;
|
||||
html_attributions: string[];
|
||||
width: number;
|
||||
getUrl(opts: PhotoOptions): string;
|
||||
}
|
||||
|
||||
export interface PlaceResult {
|
||||
address_components: GeocoderAddressComponent[];
|
||||
aspects: PlaceAspectRating[];
|
||||
formatted_address: string;
|
||||
formatted_phone_number: string;
|
||||
geometry: PlaceGeometry;
|
||||
html_attributions: string[];
|
||||
icon: string;
|
||||
id: string;
|
||||
id?: string;
|
||||
international_phone_number: string;
|
||||
name: string;
|
||||
permanently_closed: boolean;
|
||||
photos: PlacePhoto[];
|
||||
place_id: string;
|
||||
price_level: number;
|
||||
rating: number;
|
||||
reference: string;
|
||||
reference?: string;
|
||||
reviews: PlaceReview[];
|
||||
types: string[];
|
||||
url: string;
|
||||
vicinity: string;
|
||||
website: string;
|
||||
}
|
||||
|
||||
export interface PlaceReview {
|
||||
aspects: PlaceAspectRating[];
|
||||
author_name: string;
|
||||
author_url: string;
|
||||
language: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface PlaceSearchRequest {
|
||||
bounds: LatLngBounds;
|
||||
keyword: string;
|
||||
location: LatLng;
|
||||
maxPriceLevel?: number;
|
||||
minPriceLevel?: number;
|
||||
name: string;
|
||||
openNow: boolean;
|
||||
radius: number;
|
||||
rankBy: RankBy;
|
||||
types: string[];
|
||||
@@ -1461,6 +1650,7 @@ declare module google.maps {
|
||||
constructor (attrContainer: Map);
|
||||
getDetails(request: PlaceDetailsRequest, callback: (result: PlaceResult, status: PlacesServiceStatus) => void ): void;
|
||||
nearbySearch(request: PlaceSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus, pagination: PlaceSearchPagination) => void ): void;
|
||||
radarSearch(request: RadarSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void ): void;
|
||||
textSearch(request: TextSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void ): void;
|
||||
}
|
||||
|
||||
@@ -1473,27 +1663,37 @@ declare module google.maps {
|
||||
ZERO_RESULTS
|
||||
}
|
||||
|
||||
export interface RadarSearchRequest {
|
||||
bounds: LatLngBounds;
|
||||
keyword: string;
|
||||
location: LatLng;
|
||||
name: string;
|
||||
radius: number;
|
||||
types: string[];
|
||||
}
|
||||
|
||||
export enum RankBy {
|
||||
DISTANCE,
|
||||
PROMINENCE
|
||||
}
|
||||
|
||||
export class SearchBox {
|
||||
constructor(inputField: HTMLInputElement, opts?: SearchBoxOptions);
|
||||
getBounds(): LatLngBounds;
|
||||
setBounds(bounds: LatLngBounds): void;
|
||||
getPlaces(): PlaceResult[];
|
||||
}
|
||||
|
||||
export interface SearchBoxOptions {
|
||||
bounds: LatLngBounds;
|
||||
}
|
||||
export class SearchBox extends MVCObject {
|
||||
constructor(inputField: HTMLInputElement, opts?: SearchBoxOptions);
|
||||
getBounds(): LatLngBounds;
|
||||
setBounds(bounds: LatLngBounds): void;
|
||||
getPlaces(): PlaceResult[];
|
||||
}
|
||||
|
||||
export interface SearchBoxOptions {
|
||||
bounds: LatLngBounds;
|
||||
}
|
||||
|
||||
export interface TextSearchRequest {
|
||||
bounds: LatLngBounds;
|
||||
location: LatLng;
|
||||
query: string;
|
||||
radius: number;
|
||||
types: string[];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1643,6 +1843,6 @@ declare module google.maps {
|
||||
|
||||
export class MapsEventListener {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+127
-125
@@ -1,167 +1,169 @@
|
||||
// Type definitions for GreenSock Animation Platform 1.1
|
||||
// Type definitions for GreenSock Animation Platform 1.15.1
|
||||
// Project: http://www.greensock.com/get-started-js/
|
||||
// Definitions by: Robert S <https://github.com/codebelt>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// JavaScript Docs http://api.greensock.com/js/
|
||||
// Version 1.1 (TypeScript 0.9)
|
||||
// Version 1.15.1 (TypeScript 1.4)
|
||||
|
||||
interface IDispatcher {
|
||||
addEventListener(type:string, callback:Function, scope?:Object, useParam?:boolean, priority?:number):void;
|
||||
removeEventListener(type:string, callback:Function):void;
|
||||
}
|
||||
|
||||
declare type Tween = TweenLite | TweenMax;
|
||||
declare type Timeline = SimpleTimeline | TimelineLite | TimelineMax;
|
||||
|
||||
//com.greensock.core
|
||||
declare class Animation {
|
||||
data:any;
|
||||
static ticker:IDispatcher;
|
||||
timeline:SimpleTimeline;
|
||||
vars:Object;
|
||||
static ticker: IDispatcher;
|
||||
data: any;
|
||||
timeline: SimpleTimeline;
|
||||
vars: Object;
|
||||
|
||||
constructor(duration?:number, vars?:Object);
|
||||
constructor(duration?: number, vars?: Object);
|
||||
|
||||
delay(value:number):any;
|
||||
duration(value:number):any;
|
||||
eventCallback(type:string, callback?:Function, params?:any[], scope?:any):any;
|
||||
invalidate():any;
|
||||
isActive():boolean;
|
||||
kill(vars?:Object, target?:Object):any;
|
||||
pause(atTime?:any, suppressEvents?:boolean):any;
|
||||
paused(value?:boolean):any;
|
||||
play(from?:any, suppressEvents?:boolean):any;
|
||||
restart(includeDelay?:boolean, suppressEvents?:boolean):any;
|
||||
resume(from?:any, suppressEvents?:boolean):any;
|
||||
reverse(from?:any, suppressEvents?:boolean):any;
|
||||
reversed(value?:boolean):any;
|
||||
seek(time:any, suppressEvents?:boolean):any;
|
||||
startTime(value:number):any;
|
||||
time(value:number, suppressEvents?:boolean):any;
|
||||
timeScale(value:number):any;
|
||||
totalDuration(value:number):any;
|
||||
totalTime(time:number, suppressEvents?:boolean):any;
|
||||
delay(): number;
|
||||
delay(value: number): Animation;
|
||||
duration(): number;
|
||||
duration(value: number): Animation;
|
||||
eventCallback(type: string): Function;
|
||||
eventCallback(type: string, callback: Function, params?: any[], scope?: any): Animation;
|
||||
invalidate(): Animation;
|
||||
isActive(): boolean;
|
||||
kill(vars?: Object, target?: Object): Animation;
|
||||
pause(atTime?: any, suppressEvents?: boolean): Animation;
|
||||
paused(): boolean;
|
||||
paused(value: boolean): Animation;
|
||||
play(from?: any, suppressEvents?: boolean): Animation;
|
||||
progress(): number;
|
||||
progress(value: number, supressEvents?: boolean): Animation;
|
||||
restart(includeDelay?: boolean, suppressEvents?: boolean): Animation;
|
||||
resume(from?: any, suppressEvents?: boolean): Animation;
|
||||
reverse(from?: any, suppressEvents?: boolean): Animation;
|
||||
reversed(): boolean;
|
||||
reversed(value: boolean): Animation;
|
||||
seek(time: any, suppressEvents?: boolean): Animation;
|
||||
startTime(): number;
|
||||
startTime(value: number): Animation;
|
||||
time(): number;
|
||||
time(value: number, suppressEvents?: boolean): Animation;
|
||||
timeScale(): number;
|
||||
timeScale(value: number): Animation;
|
||||
totalDuration(): number;
|
||||
totalDuration(value: number): Animation;
|
||||
totalProgress(): number;
|
||||
totalProgress(value: number): Animation;
|
||||
totalTime(): number;
|
||||
totalTime(time: number, suppressEvents?: boolean): Animation;
|
||||
}
|
||||
|
||||
declare class SimpleTimeline extends Animation {
|
||||
autoRemoveChildren:boolean;
|
||||
smoothChildTiming:boolean;
|
||||
autoRemoveChildren: boolean;
|
||||
smoothChildTiming: boolean;
|
||||
|
||||
constructor(vars?:Object);
|
||||
constructor(vars?: Object);
|
||||
|
||||
add(value:any, position?:any, align?:string, stagger?:number):any;
|
||||
insert(tween:any, time:any):any;
|
||||
render(time:number, suppressEvents?:boolean, force?:boolean):void;
|
||||
add(value: any, position?: any, align?: string, stagger?: number): SimpleTimeline;
|
||||
render(time: number, suppressEvents?: boolean, force?: boolean): void;
|
||||
}
|
||||
|
||||
//com.greensock
|
||||
declare class TweenLite extends Animation {
|
||||
static defaultEase:Ease;
|
||||
static defaultOverwrite:string;
|
||||
static selector:any;
|
||||
target:Object;
|
||||
static ticker:IDispatcher;
|
||||
timeline:SimpleTimeline;
|
||||
vars:Object;
|
||||
static defaultEase: Ease;
|
||||
static defaultOverwrite: string;
|
||||
static selector: any;
|
||||
target: Object;
|
||||
|
||||
constructor(target:Object, duration:number, vars:Object);
|
||||
constructor(target: Object, duration: number, vars: Object);
|
||||
|
||||
static delayedCall(delay:number, callback:Function, params?:any[], scope?:any, useFrames?:boolean):TweenLite;
|
||||
static from(target:Object, duration:number, vars:Object):TweenLite;
|
||||
static fromTo(target:Object, duration:number, fromVars:Object, toVars:Object):TweenLite;
|
||||
static getTweensOf(target:Object):any[];
|
||||
invalidate():any;
|
||||
static killDelayedCallsTo(func:Function):void;
|
||||
static killTweensOf(target:Object, vars?:Object):void;
|
||||
static set(target:Object, vars:Object):TweenLite;
|
||||
static to(target:Object, duration:number, vars:Object):TweenLite;
|
||||
static delayedCall(delay: number, callback: Function, params?: any[], scope?: any, useFrames?: boolean): TweenLite;
|
||||
endTime(includeRepeats?: boolean): number;
|
||||
static from(target: Object | Object[], duration: number, vars: Object): TweenLite;
|
||||
static fromTo(target: Object | Object[], duration: number, fromVars: Object, toVars: Object): TweenLite;
|
||||
static getTweensOf(target: Object, onlyActive: boolean): Tween[];
|
||||
static killDelayedCallsTo(func: Function): void;
|
||||
static killTweensOf(target: Object, onlyActive?: boolean, vars?: Object): void;
|
||||
static lagSmoothing(threshold: number, adjustedLag: number): void;
|
||||
static set(target: Object, vars: Object): TweenLite;
|
||||
static to(target: Object, duration: number, vars: Object): TweenLite;
|
||||
}
|
||||
|
||||
declare class TweenMax extends TweenLite {
|
||||
static ticker:IDispatcher;
|
||||
constructor(target: Object, duration: number, vars: Object);
|
||||
|
||||
constructor(target:Object, duration:number, vars:Object);
|
||||
|
||||
static delayedCall(delay:number, callback:Function, params?:any[], scope?:any, useFrames?:boolean):TweenMax;
|
||||
static from(target:Object, duration:number, vars:Object):TweenMax;
|
||||
static fromTo(target:Object, duration:number, fromVars:Object, toVars:Object):TweenMax;
|
||||
static getAllTweens(includeTimelines?:boolean):any[];
|
||||
static getTweensOf(target:Object):any[];
|
||||
invalidate():any;
|
||||
static isTweening(target:Object):boolean;
|
||||
static killAll(complete?:boolean, tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void;
|
||||
static killChildTweensOf(parent:any, complete?:boolean):void;
|
||||
static killDelayedCallsTo(func:Function):void;
|
||||
static killTweensOf(target:Object, vars?:Object):void;
|
||||
static pauseAll(tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void;
|
||||
progress(value:number):any;
|
||||
repeat(value:number):any;
|
||||
repeatDelay(value:number):any;
|
||||
static resumeAll(tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void;
|
||||
static set(target:Object, vars:Object):TweenMax;
|
||||
static staggerFrom(targets:any, duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[];
|
||||
static staggerFromTo(targets:any, duration:number, fromVars:Object, toVars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[];
|
||||
static staggerTo(targets:any, duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[];
|
||||
time(value:number, suppressEvents?:boolean):any;
|
||||
static delayedCall(delay: number, callback: Function, params?: any[], scope?: Object, useFrames?: boolean): TweenMax;
|
||||
static from(target: Object, duration: number, vars: Object): TweenMax;
|
||||
static fromTo(target: Object, duration: number, fromVars: Object, toVars: Object): TweenMax;
|
||||
static getAllTweens(includeTimelines?: boolean): Tween[];
|
||||
static getTweensOf(target: Object): Tween[];
|
||||
static isTweening(target: Object): boolean;
|
||||
static killAll(complete?: boolean, tweens?: boolean, delayedCalls?: boolean, timelines?: boolean): void;
|
||||
static killChildTweensOf(parent: any, complete?: boolean): void;
|
||||
static killDelayedCallsTo(func: Function): void;
|
||||
static killTweensOf(target: Object, vars?: Object): void;
|
||||
static pauseAll(tweens?: boolean, delayedCalls?: boolean, timelines?: boolean): void;
|
||||
repeat(): number;
|
||||
repeat(value: number): TweenMax;
|
||||
repeatDelay(): number;
|
||||
repeatDelay(value: number): TweenMax;
|
||||
static resumeAll(tweens?: boolean, delayedCalls?: boolean, timelines?: boolean): void;
|
||||
static set(target: Object, vars: Object): TweenMax;
|
||||
static staggerFrom(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[];
|
||||
static staggerFromTo(targets: any, duration: number, fromVars: Object, toVars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[];
|
||||
static staggerTo(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[];
|
||||
static to(target:Object, duration:number, vars:Object):TweenMax;
|
||||
totalDuration(value:number):any;
|
||||
totalProgress(value:number):any;
|
||||
updateTo(vars:Object, resetDuration?:boolean):any;
|
||||
yoyo(value?:boolean):any;
|
||||
updateTo(vars: Object, resetDuration?: boolean): TweenMax;
|
||||
yoyo(): boolean;
|
||||
yoyo(value?: boolean): TweenMax;
|
||||
}
|
||||
|
||||
declare class TimelineLite extends SimpleTimeline {
|
||||
constructor(vars?:Object);
|
||||
constructor(vars?: Object);
|
||||
|
||||
add(value:any, position?:any, align?:string, stagger?:number):any;
|
||||
addLabel(label:string, position:any):any;
|
||||
addPause(position?:any, callback?:Function, params?:any[], scope?:any):any;
|
||||
append(value:any, offsetOrLabel?:any):any;
|
||||
appendMultiple(tweens:any[], offsetOrLabel?:any, align?:string, stagger?:number):any;
|
||||
call(callback:Function, params?:any[], scope?:any, position?:any):any;
|
||||
clear(labels?:boolean):any;
|
||||
duration(value:number):any;
|
||||
exportRoot(vars?:Object, omitDelayedCalls?:boolean):TimelineLite;
|
||||
from(target:Object, duration:number, vars:Object, position?:any):any;
|
||||
fromTo(target:Object, duration:number, fromVars:Object, toVars:Object, position?:any):any;
|
||||
getChildren(nested?:boolean, tweens?:boolean, timelines?:boolean, ignoreBeforeTime?:number):any[];
|
||||
getLabelTime(label:string):number;
|
||||
getTweensOf(target:Object, nested?:boolean):any[];
|
||||
insert(value:any, timeOrLabel?:any):any;
|
||||
insertMultiple(tweens:any[], timeOrLabel?:any, align?:string, stagger?:number):any;
|
||||
invalidate():any;
|
||||
progress(value:number):any;
|
||||
remove(value:any):any;
|
||||
removeLabel(label:string):any;
|
||||
set(target: Object, vars: Object, position?:any):any;
|
||||
seek(position:any, suppressEvents?:boolean):any;
|
||||
shiftChildren(amount:number, adjustLabels?:boolean, ignoreBeforeTime?:number):any;
|
||||
staggerFrom(targets:any, duration:number, vars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteScope?:any):any;
|
||||
staggerFromTo(targets:any, duration:number, fromVars:Object, toVars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any;
|
||||
staggerTo(targets:any, duration:number, vars:Object, stagger:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any;
|
||||
stop():any;
|
||||
to(target:Object, duration:number, vars:Object, position?:any):any;
|
||||
usesFrames():Boolean;
|
||||
add(value: any, position?: any, align?: string, stagger?: number): TimelineLite;
|
||||
addLabel(label: string, position: any): TimelineLite;
|
||||
addPause(position?: any, callback?: Function, params?: any[], scope?: any): TimelineLite;
|
||||
call(callback: Function, params?: any[], scope?: any, position?: any): TimelineLite;
|
||||
clear(labels?: boolean): TimelineLite;
|
||||
endTime(includeRepeats?: boolean): number;
|
||||
static exportRoot(vars?: Object, omitDelayedCalls?: boolean): TimelineLite;
|
||||
from(target: Object, duration: number, vars: Object, position?: any): TimelineLite;
|
||||
fromTo(target: Object, duration: number, fromVars: Object, toVars: Object, position?: any): TimelineLite;
|
||||
getChildren(nested?: boolean, tweens?: boolean, timelines?: boolean, ignoreBeforeTime?: number): Tween | Timeline[];
|
||||
getLabelTime(label: string): number;
|
||||
getTweensOf(target: Object, nested?: boolean): Tween[];
|
||||
recent(): Animation;
|
||||
remove(value: any): TimelineLite;
|
||||
removeLabel(label: string): any;
|
||||
set(target: Object, vars: Object, position?: any): TimelineLite;
|
||||
shiftChildren(amount: number, adjustLabels?: boolean, ignoreBeforeTime?: number): TimelineLite;
|
||||
staggerFrom(targets: any, duration: number, vars: Object, stagger?: number, position?: any, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteScope?: any): TimelineLite;
|
||||
staggerFromTo(targets: any, duration: number, fromVars: Object, toVars: Object, stagger?: number, position?: any, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): TimelineLite;
|
||||
staggerTo(targets: any, duration: number, vars: Object, stagger: number, position?: any, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): TimelineLite;
|
||||
to(target: Object, duration: number, vars: Object, position?: any): TimelineLite;
|
||||
usesFrames(): boolean;
|
||||
}
|
||||
|
||||
declare class TimelineMax extends TimelineLite {
|
||||
constructor(vars?:Object);
|
||||
constructor(vars?: Object);
|
||||
|
||||
addCallback(callback:Function, position:any, params?:any[], scope?:any):TimelineMax;
|
||||
currentLabel(value?:string):any;
|
||||
getActive(nested?:boolean, tweens?:boolean, timelines?:boolean):any[];
|
||||
getLabelAfter(time:number):string;
|
||||
getLabelBefore(time:number):string;
|
||||
getLabelsArray():any[];
|
||||
invalidate():any;
|
||||
progress(value:number):any;
|
||||
removeCallback(callback:Function, timeOrLabel?:any):TimelineMax;
|
||||
repeat(value?:number):any;
|
||||
repeatDelay(value?:number):any;
|
||||
time(value:number, suppressEvents?:boolean):any;
|
||||
totalDuration(value:number):any;
|
||||
totalProgress(value:number):any;
|
||||
tweenFromTo(fromPosition:any, toPosition:any, vars?:Object):TweenLite;
|
||||
tweenTo(position:any, vars?:Object):TweenLite;
|
||||
yoyo(value?:boolean):any;
|
||||
addCallback(callback: Function, position: any, params?: any[], scope?: any): TimelineMax;
|
||||
currentLabel(): string;
|
||||
currentLabel(value: string): TimelineMax;
|
||||
getActive(nested?: boolean, tweens?: boolean, timelines?: boolean): Tween | Timeline[];
|
||||
getLabelAfter(time: number): string;
|
||||
getLabelBefore(time: number): string;
|
||||
getLabelsArray(): any[];
|
||||
removeCallback(callback: Function, timeOrLabel?: any): TimelineMax;
|
||||
repeat(): number;
|
||||
repeat(value: number): TimelineMax;
|
||||
repeatDelay(): number;
|
||||
repeatDelay(value: number): TimelineMax;
|
||||
tweenFromTo(fromPosition: any, toPosition: any, vars?: Object): TweenLite;
|
||||
tweenTo(position: any, vars?: Object): TweenLite;
|
||||
yoyo(): boolean;
|
||||
yoyo(value: boolean): TimelineMax;
|
||||
}
|
||||
|
||||
//com.greensock.easing
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/// <reference path="irc.d.ts" />
|
||||
// https://github.com/martynsmith/node-irc/blob/master/example/bot.js
|
||||
|
||||
import irc = require('irc');
|
||||
|
||||
var bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', {
|
||||
debug: true,
|
||||
channels: ['#blah', '#test']
|
||||
});
|
||||
|
||||
bot.addListener('error', <irc.handlers.IError> ((message: irc.IMessage) => {
|
||||
console.error('ERROR: %s: %s', message.command, message.args.join(' '));
|
||||
}));
|
||||
|
||||
bot.addListener('message#blah', <irc.handlers.IMessageChannel> ((from: string, message: string) => {
|
||||
console.log('<%s> %s', from, message);
|
||||
}));
|
||||
|
||||
bot.addListener('message', <irc.handlers.IRecievedMessage> ((from: string, to: string, message: string) => {
|
||||
console.log('%s => %s: %s', from, to, message);
|
||||
|
||||
if (to.match(/^[#&]/)) {
|
||||
// channel message
|
||||
if (message.match(/hello/i)) {
|
||||
bot.say(to, 'Hello there ' + from);
|
||||
}
|
||||
if (message.match(/dance/)) {
|
||||
setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D\\-<\u0001'); }, 1000);
|
||||
setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D|-<\u0001'); }, 2000);
|
||||
setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D/-<\u0001'); }, 3000);
|
||||
setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D|-<\u0001'); }, 4000);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// private message
|
||||
console.log('private message');
|
||||
}
|
||||
}));
|
||||
|
||||
bot.addListener('pm', <irc.handlers.IPm> ((nick: string, message: string) => {
|
||||
console.log('Got private message from %s: %s', nick, message);
|
||||
}));
|
||||
|
||||
bot.addListener('join', <irc.handlers.IJoin> ((channel: string, who: string) => {
|
||||
console.log('%s has joined %s', who, channel);
|
||||
}));
|
||||
|
||||
bot.addListener('part', <irc.handlers.IPart> ((channel: string, who: string, reason: string) => {
|
||||
console.log('%s has left %s: %s', who, channel, reason);
|
||||
}));
|
||||
|
||||
bot.addListener('kick', <irc.handlers.IKick> ((channel: string, who: string, by: string, reason: string) => {
|
||||
console.log('%s was kicked from %s by %s: %s', who, channel, by, reason);
|
||||
}));
|
||||
Vendored
+879
@@ -0,0 +1,879 @@
|
||||
// Type definitions for irc v0.3.12
|
||||
// Project: https://github.com/martynsmith/node-irc
|
||||
// Definitions by: phillips1012 <https://github.com/phillips1012>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node-0.10.d.ts" />
|
||||
|
||||
/** This library provides IRC client functionality. */
|
||||
declare module 'irc' {
|
||||
import events = require('events');
|
||||
import crypto = require('crypto');
|
||||
import net = require('net');
|
||||
|
||||
/** This library provides IRC client functionality. */
|
||||
module NodeIRC {
|
||||
/** A nick connect to an IRC server. */
|
||||
export class Client extends events.EventEmitter {
|
||||
/**
|
||||
* Socket to the server. Rarely, if ever needed. Use Client#send
|
||||
* instead.
|
||||
*/
|
||||
public conn: net.Socket
|
||||
|
||||
/**
|
||||
* Channels joined. Includes channel modes, user list, and topic
|
||||
* information. Only updated after the server recognizes the join.
|
||||
*/
|
||||
public chans: {
|
||||
[index: string]: {
|
||||
key: string;
|
||||
serverName: string;
|
||||
users: {
|
||||
[index: string]: string;
|
||||
};
|
||||
mode: string;
|
||||
created: string;
|
||||
}
|
||||
}
|
||||
|
||||
/** Features supported by the server */
|
||||
public supported: {
|
||||
channel: {
|
||||
idlength: string[];
|
||||
length: number;
|
||||
limit: string[];
|
||||
modes: {
|
||||
[index: string]: string;
|
||||
}
|
||||
types: string;
|
||||
};
|
||||
|
||||
kicklength: number;
|
||||
maxlist: number[];
|
||||
maxtargets: string[];
|
||||
modes: number;
|
||||
nicklength: number
|
||||
topiclength: number;
|
||||
usermodes: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current nick of the client. Updated if the nick changes
|
||||
*/
|
||||
public nick: string;
|
||||
|
||||
/** Channel listing data. */
|
||||
public channellist: IChannel[];
|
||||
|
||||
/** IRC server MOTD */
|
||||
public motd: string;
|
||||
|
||||
/** Maximum line length */
|
||||
public maxLineLength: number;
|
||||
|
||||
/** Bot options */
|
||||
public opt: IClientOpts;
|
||||
|
||||
/** Host mask */
|
||||
public hostMask: string;
|
||||
|
||||
/**
|
||||
* Connect to an IRC server
|
||||
* @param server - server hostname
|
||||
* @param nick - nickname
|
||||
* @param opts
|
||||
*/
|
||||
constructor(
|
||||
server: string,
|
||||
nick: string,
|
||||
opts?: IClientOpts
|
||||
);
|
||||
|
||||
/**
|
||||
* Send a raw message to the server; generally speaking, it’s best
|
||||
* not to use this method unless you know what you’re doing.
|
||||
* @param command - irc command
|
||||
* @param args - command arguments (splat)
|
||||
*/
|
||||
public send(
|
||||
command: string,
|
||||
...args: string[]
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Join the specified channel
|
||||
* @param channel - channel to join
|
||||
* @param callback
|
||||
*/
|
||||
public join(
|
||||
channel: string,
|
||||
callback?: handlers.IJoinChannel
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Part the specified channel
|
||||
* @param channel - channel to part
|
||||
* @param message - optional message to send
|
||||
* @param callback
|
||||
*/
|
||||
public part(
|
||||
channel: string,
|
||||
message: string,
|
||||
callback: handlers.IPartChannel
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Send a message to the specified target
|
||||
* @param target - nick or channel
|
||||
* @param message - message to send
|
||||
*/
|
||||
public say(
|
||||
target: string,
|
||||
message: string
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Send a CTCP message to the specified target
|
||||
* @param target - nick or channel
|
||||
* @param type - "privmsg" for PRIVMSG, anything else for NOTICE
|
||||
* @param text - CTCP message
|
||||
*/
|
||||
public ctcp(
|
||||
target: string,
|
||||
type: string,
|
||||
text: string
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Send an action to the specified target
|
||||
* @param target - target
|
||||
* @param message - message
|
||||
*/
|
||||
public action(
|
||||
target: string,
|
||||
message: string
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Send a notice to the specified target.
|
||||
* @param target - nick or channel
|
||||
* @param message - message to send
|
||||
*/
|
||||
public notice(
|
||||
target: string,
|
||||
message: string
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Request a whois for the specified nick
|
||||
* @param nick - nickname
|
||||
* @param callback
|
||||
*/
|
||||
public whois(
|
||||
nick: string,
|
||||
callback: handlers.IWhois
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Request a channel listing from the server. The arguments for this
|
||||
* are farily server specific, this method passes them as specified.
|
||||
*
|
||||
* Responses from the server are available via `channellist_start`,
|
||||
* `channellist_item`, and `channellist` events.
|
||||
*
|
||||
* @param args - arguments
|
||||
*/
|
||||
public list(
|
||||
...args: string[]
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Connect to the server. Use when `autoConnect` is false.
|
||||
* @param retryCount - times to retry
|
||||
* @param callback
|
||||
*/
|
||||
public connect(
|
||||
retryCount?: number,
|
||||
callback?: handlers.IRaw
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Disconnect from the IRC server
|
||||
* @param message - message to send
|
||||
* @param callback
|
||||
*/
|
||||
public disconnect(
|
||||
message: string,
|
||||
callback: () => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Activate flood protection “after the fact”. You can also use
|
||||
* floodProtection while instantiating the Client to enable flood
|
||||
* protection, and floodProtectionDelay to set the default message
|
||||
* interval.
|
||||
* @param interval - ms to wait between messages
|
||||
*/
|
||||
public activateFloodProtection(
|
||||
interval: number
|
||||
): void;
|
||||
}
|
||||
|
||||
/** Client options object */
|
||||
export interface IClientOpts {
|
||||
/**
|
||||
* IRC username
|
||||
* @default 'nodebot'
|
||||
*/
|
||||
userName?: string;
|
||||
|
||||
/**
|
||||
* IRC "real name"
|
||||
* @default 'nodeJS IRC client'
|
||||
*/
|
||||
realName?: string;
|
||||
|
||||
/**
|
||||
* IRC connection port. See
|
||||
* https://nodejs.org/api/net.html#net_socket_remoteport
|
||||
* @default 6667
|
||||
*/
|
||||
port?: number;
|
||||
|
||||
/**
|
||||
* Local interface to bind to for network connections. See
|
||||
* https://nodejs.org/api/net.html#net_socket_localaddress
|
||||
*/
|
||||
localAddress?: string;
|
||||
|
||||
/**
|
||||
* Should we output debug messages to STDOUT?
|
||||
* @default false
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* Should we output IRC errors?
|
||||
* @default false
|
||||
*/
|
||||
showErrors?: boolean;
|
||||
|
||||
/**
|
||||
* Should we auto-rejoin channels?
|
||||
* @default false
|
||||
*/
|
||||
autoRejoin?: boolean;
|
||||
|
||||
/**
|
||||
* Should we auto-reconnect to networks?
|
||||
* @default true
|
||||
*/
|
||||
autoConnect?: boolean;
|
||||
|
||||
/**
|
||||
* Channels to join
|
||||
* @default []
|
||||
*/
|
||||
channels?: string[];
|
||||
|
||||
/**
|
||||
* Should SSL be used? Can either be true or crypto credentials.
|
||||
* @default false
|
||||
*/
|
||||
secure?: boolean | crypto.Credentials;
|
||||
|
||||
/**
|
||||
* Should we accept self-signed certificates?
|
||||
* @default false
|
||||
*/
|
||||
selfSigned?: boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Should we accept expired certificates?
|
||||
* @default false
|
||||
*/
|
||||
certExpired?: boolean;
|
||||
|
||||
/**
|
||||
* Should we queue our messages to ensure we don't get kicked?
|
||||
* @default false
|
||||
*/
|
||||
floodProtection?: boolean;
|
||||
|
||||
/**
|
||||
* Delay between messages when flood protection is active
|
||||
* @default 1000
|
||||
*/
|
||||
floodProtectionDelay?: number;
|
||||
|
||||
/**
|
||||
* Should we use SASL authentication?
|
||||
* @default false
|
||||
*/
|
||||
sasl?: boolean;
|
||||
|
||||
/**
|
||||
* Should we strip mIRC colors from the output messages?
|
||||
* @default false
|
||||
*/
|
||||
stripColors?: boolean;
|
||||
|
||||
/**
|
||||
* Channel prefix
|
||||
* @default '&#'
|
||||
*/
|
||||
channelPrefixes?: string;
|
||||
|
||||
/**
|
||||
* Characters to split a message at.
|
||||
* @default 512
|
||||
*/
|
||||
messageSplit?: number;
|
||||
|
||||
/**
|
||||
* Encoding to use. See
|
||||
* https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding
|
||||
* @default 'utf-8'
|
||||
*/
|
||||
encoding?: string;
|
||||
}
|
||||
|
||||
/** Command types */
|
||||
export enum CommandType {
|
||||
normal, reply, error
|
||||
}
|
||||
|
||||
/** Parsed IRC message. */
|
||||
export interface IMessage {
|
||||
/** Prefix */
|
||||
prefix?: string;
|
||||
|
||||
/** Mapped IRC command */
|
||||
command: string;
|
||||
|
||||
/** Raw IRC command */
|
||||
rawCommand: string;
|
||||
|
||||
/** Command type */
|
||||
commandType: CommandType;
|
||||
|
||||
/** Command arguments */
|
||||
args: string[];
|
||||
}
|
||||
|
||||
/** Whois data */
|
||||
export interface IWhoisData {
|
||||
/** Nickname */
|
||||
nick: string;
|
||||
|
||||
/** Username */
|
||||
user: string;
|
||||
|
||||
/** Hostnamej */
|
||||
host: string;
|
||||
|
||||
/** Real name" */
|
||||
realname: string;
|
||||
|
||||
/** Channels */
|
||||
channels: string[];
|
||||
|
||||
/** Server */
|
||||
server: string;
|
||||
|
||||
/** Server description string */
|
||||
serverinfo: string;
|
||||
|
||||
/** Is this user an operator? */
|
||||
operator: string;
|
||||
}
|
||||
|
||||
/** A channel returned by a channel listing. */
|
||||
export interface IChannel {
|
||||
/** Channel name */
|
||||
name: string;
|
||||
|
||||
/** User count */
|
||||
users: string;
|
||||
|
||||
/** Topic string */
|
||||
topic: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler functions for Client.
|
||||
*/
|
||||
module handlers {
|
||||
/**
|
||||
* 'registered': Emitted when the server sends the initial 001 line,
|
||||
* indicating you’ve connected to the server. See the raw event for
|
||||
* details on the message object.
|
||||
*/
|
||||
export interface IRegistered {
|
||||
/**
|
||||
* @param message - raw message
|
||||
*/
|
||||
(message: IMessage): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'motd': Emitted when the server sends the message of the day to
|
||||
* clients.
|
||||
*/
|
||||
export interface IMotd {
|
||||
/**
|
||||
* @param motd - motd string
|
||||
*/
|
||||
(motd: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'names': Emitted when the server sends a list of nicks for a channel
|
||||
* (which happens immediately after joining and on request. The nicks
|
||||
* object passed to the callback is keyed by nick names, and has
|
||||
* values ‘’, ‘+’, or ‘@’ depending on the level of that nick in the
|
||||
* channel.
|
||||
*/
|
||||
export interface INames {
|
||||
/**
|
||||
* @param channel - channel name
|
||||
* @param nicks - nicks list
|
||||
*/
|
||||
(channel: string, nicks: string[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'names#*' As per ‘names’ event but only emits for the subscribed
|
||||
* channel.
|
||||
*/
|
||||
export interface INamesChannel {
|
||||
/**
|
||||
* @param channel - channel name
|
||||
* @param nicks - nicks list
|
||||
*/
|
||||
(nicks: string[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'topic': Emitted when the server sends the channel topic on joining
|
||||
* a channel, or when a user changes the topic on a channel. See the
|
||||
* raw event for details on the message object.
|
||||
*/
|
||||
export interface ITopic {
|
||||
/**
|
||||
* @param channel - channel name
|
||||
* @param topic - topic
|
||||
* @param nick - nick
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
channel: string,
|
||||
topic: string,
|
||||
nick: string,
|
||||
message: IMessage
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'join': Emitted when a user joins a channel (including when the
|
||||
* client itself joins a channel). See the raw event for details on the
|
||||
* message object.
|
||||
*/
|
||||
export interface IJoin {
|
||||
/**
|
||||
* @param channel - channel name
|
||||
* @param nick - who joined
|
||||
* @param message - raw message
|
||||
*/
|
||||
(channel: string, nick: string, message: IMessage): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'join#*': As per ‘join’ event but only emits for the subscribed
|
||||
* channel. See the raw event for details on the message object.
|
||||
*/
|
||||
export interface IJoinChannel {
|
||||
/**
|
||||
* @param nick - who joined
|
||||
* @param message - raw message
|
||||
*/
|
||||
(nick: string, message: IMessage): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'part': Emitted when a user parts a channel (including when the
|
||||
* client itself parts a channel). See the raw event for details on the
|
||||
* message object.
|
||||
*/
|
||||
export interface IPart {
|
||||
/**
|
||||
* @param channel - channel name
|
||||
* @param nick - who parted
|
||||
* @param reason - part reason
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
channel: string,
|
||||
nick: string,
|
||||
reason: string,
|
||||
message: IMessage
|
||||
): void
|
||||
}
|
||||
|
||||
/**
|
||||
* 'part': As per ‘part’ event but only emits for the subscribed
|
||||
* channel. See the raw event for details on the message object.
|
||||
*/
|
||||
export interface IPartChannel {
|
||||
/**
|
||||
* @param nick - who parted
|
||||
* @param reason - part reason
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
nick: string,
|
||||
reason: string,
|
||||
message: IMessage
|
||||
): void
|
||||
}
|
||||
|
||||
/**
|
||||
* 'kick': Emitted when a user is kicked from a channel. See the raw
|
||||
* event for details on the message object.
|
||||
*/
|
||||
export interface IKick {
|
||||
/**
|
||||
* @param channel - channel name
|
||||
* @param nick - who was kicked
|
||||
* @param by - kicker
|
||||
* @param reason - kick reason
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
channel: string,
|
||||
nick: string,
|
||||
by: string,
|
||||
reason: string,
|
||||
message: IMessage
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'kick#*': Emitted when a user is kicked from a channel. See the raw
|
||||
* event for details on the message object.
|
||||
*/
|
||||
export interface IKickChannel {
|
||||
/**
|
||||
* @param nick - who was kicked
|
||||
* @param by - kicker
|
||||
* @param reason - kick reason
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
nick: string,
|
||||
by: string,
|
||||
reason: string,
|
||||
message: IMessage
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'message': Emitted when a message is sent. to can be either a nick
|
||||
* (which is most likely this clients nick and means a private message),
|
||||
* or a channel (which means a message to that channel). See the raw
|
||||
* event for details on the message object.
|
||||
*/
|
||||
export interface IRecievedMessage {
|
||||
/**
|
||||
* @param nick - who sent the message
|
||||
* @param to - to whom was the message sent
|
||||
* @param text - message text
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
nick: string, to: string, text: string, message: IMessage
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'message#': Emitted when a message is sent to any channel (i.e.
|
||||
* exactly the same as the message event but excluding private
|
||||
* messages. See the raw event for details on the message object.
|
||||
*/
|
||||
export interface IMessageAllChannels {
|
||||
/**
|
||||
* @param nick - who sent the message
|
||||
* @param to - to whom was the message sent
|
||||
* @param text - message text
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
nick: string, to: string, text: string, message: IMessage
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'message#*': As per ‘message’ event but only emits for the
|
||||
* subscribed channel. See the raw event for details on the message
|
||||
* object.
|
||||
*/
|
||||
export interface IMessageChannel {
|
||||
/**
|
||||
* @param nick - who sent the message
|
||||
* @param text - message text
|
||||
* @param message - raw message
|
||||
*/
|
||||
(nick: string, text: string, message: IMessage): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'selfMessage': Emitted when a message is sent from the client.
|
||||
* `to` is who the message was sent to. It can be either a nick
|
||||
* (which most likely means a private message), or a channel (which
|
||||
* means a message to that channel).
|
||||
*/
|
||||
export interface ISelfMessage {
|
||||
(to: string, text: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'notice': Emitted when a notice is sent. to can be either a nick
|
||||
* (which is most likely this clients nick and means a private
|
||||
* message), or a channel (which means a message to that channel). nick
|
||||
* is either the senders nick or null which means that the notice comes
|
||||
* from the server. See the raw event for details on the message object.
|
||||
*/
|
||||
export interface INotice {
|
||||
/**
|
||||
* @param nick - from
|
||||
* @param to - to
|
||||
* @param text - text
|
||||
* @param message - raw message
|
||||
*/
|
||||
(nick: string, to: string, text: string, message: IMessage): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'ping': Emitted when a server PINGs the client. The client will
|
||||
* automatically send a PONG request just before this is emitted.
|
||||
*/
|
||||
export interface IPing {
|
||||
/**
|
||||
* @param server - server that adiministered the ping
|
||||
*/
|
||||
(server: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'pm': As per ‘message’ event but only emits when the message is
|
||||
* direct to the client. See the raw event for details on the message
|
||||
* object.
|
||||
*/
|
||||
export interface IPm {
|
||||
/**
|
||||
* @param nick - sender
|
||||
* @param text - message text
|
||||
* @param message - raw message
|
||||
*/
|
||||
(nick: string, text: string, message: IMessage): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'ctcp': Emitted when a CTCP notice or privmsg was received (type
|
||||
* is either ‘notice’ or ‘privmsg’). See the raw event for details
|
||||
* on the message object.
|
||||
*/
|
||||
export interface ICtcp {
|
||||
/**
|
||||
* @param from - sender
|
||||
* @param to - recievier
|
||||
* @param text - ctcp text
|
||||
* @param type - ctcp type
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
from: string,
|
||||
to: string,
|
||||
text: string,
|
||||
type: string,
|
||||
message: IMessage
|
||||
): void;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 'ctcp-*': Emitted when a specific type of CTCP request was
|
||||
* recieved.
|
||||
*/
|
||||
export interface ICtcpSpecific {
|
||||
/**
|
||||
* @param from - sender
|
||||
* @param to - recievier
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
from: string,
|
||||
to: string,
|
||||
text: string,
|
||||
message: IMessage
|
||||
): void;
|
||||
|
||||
(
|
||||
from: string,
|
||||
to: string,
|
||||
text: string,
|
||||
type: string,
|
||||
message: IMessage
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'nick': Emitted when a user changes nick along with the channels
|
||||
* the user is in. See the raw event for details on the message
|
||||
* object.
|
||||
*/
|
||||
export interface INick {
|
||||
/**
|
||||
* @param oldnick - old nickname
|
||||
* @param newnick - new nickname
|
||||
* @param channels - channels the nick changed in
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
oldnick: string,
|
||||
newnick: string,
|
||||
channels: string[],
|
||||
message: IMessage
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'invite': Emitted when the client receives an /invite. See the
|
||||
* raw event for details on the message object.
|
||||
*/
|
||||
export interface IInvite {
|
||||
/**
|
||||
* @param channel - channel user was invited to
|
||||
* @param from - user who invited
|
||||
* @param message - raw message
|
||||
*/
|
||||
(channel: string, from: string, message: IMessage): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* '+mode'/'-mode': Emitted when a mode is added or removed from a user or
|
||||
* channel. channel is the channel which the mode is being set on/in
|
||||
* . by is the user setting the mode. mode is the single character
|
||||
* mode identifier. If the mode is being set on a user, argument is
|
||||
* the nick of the user. If the mode is being set on a channel,
|
||||
* argument is the argument to the mode. If a channel mode doesn’t
|
||||
* have any arguments, argument will be ‘undefined’. See the raw
|
||||
* event for details on the message object.
|
||||
*/
|
||||
export interface IModeChange {
|
||||
/**
|
||||
* @param channel - channel
|
||||
* @param by - nick that changed mode
|
||||
* @param mode - single character mode identifier
|
||||
* @param argument - mode argument
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
channel: string,
|
||||
by: string,
|
||||
mode: string,
|
||||
argument: string,
|
||||
message: IMessage
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'whois': Emitted whenever the server finishes outputting a WHOIS
|
||||
* response.
|
||||
*/
|
||||
export interface IWhois {
|
||||
(info: IWhoisData): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'channellist': Emitted when the server has finished returning a
|
||||
* channel list. The channel_list array is simply a list of the
|
||||
* objects that were returned in the intervening channellist_item
|
||||
* events.
|
||||
*
|
||||
* This data is also available via the Client.channellist property
|
||||
* after this event has fired.
|
||||
*/
|
||||
export interface IChannelList {
|
||||
/**
|
||||
* @param list - channels
|
||||
*/
|
||||
(
|
||||
list: IChannel[]
|
||||
): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'raw': Emitted when ever the client receives a “message” from
|
||||
* the server. A message is a parsed line from the server.
|
||||
*/
|
||||
export interface IRaw {
|
||||
/**
|
||||
* @param message - raw message
|
||||
*/
|
||||
(message: IMessage): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'error': Emitted when ever the server responds with an error-type message. The message parameter is exactly as in the ‘raw’ event.
|
||||
*/
|
||||
export interface IError {
|
||||
/**
|
||||
* @param message - raw message
|
||||
*/
|
||||
(message: IMessage): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* 'action': Emitted whenever a user performs an action
|
||||
* (e.g. /me waves).
|
||||
*/
|
||||
export interface IAction {
|
||||
/**
|
||||
* @param from - sender
|
||||
* @param to - reciever
|
||||
* @param text - text
|
||||
* @param message - raw message
|
||||
*/
|
||||
(
|
||||
from: string, to: string, text: string, message: IMessage
|
||||
): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Colors */
|
||||
module NodeIRC.colors {
|
||||
/**
|
||||
* Takes a color by name, text, and optionally what color to return.
|
||||
* @param color - name of color
|
||||
* @param text - text to color
|
||||
* @param reset_color - color to set after text
|
||||
*/
|
||||
export function wrap(
|
||||
color: string, text: string, reset_color?: string
|
||||
): string;
|
||||
|
||||
/**
|
||||
* This contains the set of colors available and a function to wrap
|
||||
* text in a color.
|
||||
*/
|
||||
export var codes: {
|
||||
[index: string]: string;
|
||||
};
|
||||
}
|
||||
|
||||
export = NodeIRC;
|
||||
}
|
||||
@@ -748,6 +748,82 @@ describe("Fail", function () {
|
||||
|
||||
});
|
||||
|
||||
// test based on http://jasmine.github.io/2.2/custom_equality.html
|
||||
describe("custom equality", function() {
|
||||
var myCustomEquality: jasmine.CustomEqualityTester = function(first: any, second: any): boolean {
|
||||
if (typeof first == "string" && typeof second == "string") {
|
||||
return first[0] == second[1];
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(function() {
|
||||
jasmine.addCustomEqualityTester(myCustomEquality);
|
||||
});
|
||||
|
||||
|
||||
it("should be custom equal", function() {
|
||||
expect("abc").toEqual("aaa");
|
||||
});
|
||||
|
||||
it("should be custom not equal", function() {
|
||||
expect("abc").not.toEqual("abc");
|
||||
});
|
||||
});
|
||||
|
||||
// test based on http://jasmine.github.io/2.2/custom_matcher.html
|
||||
var customMatchers: jasmine.CustomMatcherFactories = {
|
||||
toBeGoofy: function (util: jasmine.MatchersUtil, customEqualityTesters: Array<jasmine.CustomEqualityTester>) {
|
||||
return {
|
||||
compare: function (actual: any, expected: any): jasmine.CustomMatcherResult {
|
||||
if (expected === undefined) {
|
||||
expected = '';
|
||||
}
|
||||
var result: jasmine.CustomMatcherResult = { pass: false, message: ''};
|
||||
|
||||
result.pass = util.equals(actual.hyuk, "gawrsh" + expected, customEqualityTesters);
|
||||
|
||||
if (result.pass) {
|
||||
result.message = "Expected " + actual + " not to be quite so goofy";
|
||||
} else {
|
||||
result.message = "Expected " + actual + " to be goofy, but it was not very goofy";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
// add the custom matchers to interface jasmine.Matchers via TypeScript declaration merging
|
||||
declare module jasmine {
|
||||
interface Matchers {
|
||||
toBeGoofy(expected?: any): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
describe("Custom matcher: 'toBeGoofy'", function () {
|
||||
beforeEach(function () {
|
||||
jasmine.addMatchers(customMatchers);
|
||||
});
|
||||
|
||||
it("is available on an expectation", function () {
|
||||
expect({
|
||||
hyuk: 'gawrsh'
|
||||
}).toBeGoofy();
|
||||
});
|
||||
|
||||
it("can take an 'expected' parameter", function () {
|
||||
expect({
|
||||
hyuk: 'gawrsh is fun'
|
||||
}).toBeGoofy(' is fun');
|
||||
});
|
||||
|
||||
it("can be negated", function () {
|
||||
expect({
|
||||
hyuk: 'this is fun'
|
||||
}).not.toBeGoofy();
|
||||
});
|
||||
});
|
||||
|
||||
(() => {
|
||||
// from boot.js
|
||||
var env = jasmine.getEnv();
|
||||
|
||||
Vendored
+39
-3
@@ -52,7 +52,8 @@ declare module jasmine {
|
||||
function createSpyObj<T>(baseName: string, methodNames: any[]): T;
|
||||
function pp(value: any): string;
|
||||
function getEnv(): Env;
|
||||
function addMatchers(matchers: any): Any;
|
||||
function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
|
||||
function addMatchers(matchers: CustomMatcherFactories): void;
|
||||
|
||||
interface Any {
|
||||
|
||||
@@ -62,6 +63,12 @@ declare module jasmine {
|
||||
jasmineToString(): string;
|
||||
}
|
||||
|
||||
// taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
interface ObjectContaining {
|
||||
new (sample: any): any;
|
||||
|
||||
@@ -91,6 +98,34 @@ declare module jasmine {
|
||||
tick(ms: number): void;
|
||||
}
|
||||
|
||||
interface CustomEqualityTester {
|
||||
(first: any, second: any): boolean;
|
||||
}
|
||||
|
||||
interface CustomMatcher {
|
||||
compare<T>(actual: T, expected: T): CustomMatcherResult;
|
||||
compare(actual: any, expected: any): CustomMatcherResult;
|
||||
}
|
||||
|
||||
interface CustomMatcherFactory {
|
||||
(util: MatchersUtil, customEqualityTesters: Array<CustomEqualityTester>): CustomMatcher;
|
||||
}
|
||||
|
||||
interface CustomMatcherFactories {
|
||||
[index: string]: CustomMatcherFactory;
|
||||
}
|
||||
|
||||
interface CustomMatcherResult {
|
||||
pass: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface MatchersUtil {
|
||||
equals(a: any, b: any, customTesters?: Array<CustomEqualityTester>): boolean;
|
||||
contains<T>(haystack: ArrayLike<T> | string, needle: any, customTesters?: Array<CustomEqualityTester>): boolean;
|
||||
buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array<any>): string;
|
||||
}
|
||||
|
||||
interface Env {
|
||||
setTimeout: any;
|
||||
clearTimeout: void;
|
||||
@@ -122,7 +157,8 @@ declare module jasmine {
|
||||
compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
||||
contains_(haystack: any, needle: any): boolean;
|
||||
addEqualityTester(equalityTester: (a: any, b: any, env: Env, mismatchKeys: string[], mismatchValues: string[]) => boolean): void;
|
||||
addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
|
||||
addMatchers(matchers: CustomMatcherFactories): void;
|
||||
specFilter(spec: Spec): boolean;
|
||||
}
|
||||
|
||||
@@ -320,7 +356,7 @@ declare module jasmine {
|
||||
waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec;
|
||||
fail(e?: any): void;
|
||||
getMatchersClass_(): Matchers;
|
||||
addMatchers(matchersPrototype: any): void;
|
||||
addMatchers(matchersPrototype: CustomMatcherFactories): void;
|
||||
finishCallback(): void;
|
||||
finish(onComplete?: () => void): void;
|
||||
after(doAfter: SpecFunction): void;
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
/// <reference path="jquery-sortable.d.ts" />
|
||||
|
||||
|
||||
/**
|
||||
* http://johnny.github.io/jquery-sortable/#connected
|
||||
*/
|
||||
function connectedListsWithDropAnimation() {
|
||||
var adjustment: any;
|
||||
|
||||
$('ol.simple_with_animation').sortable({
|
||||
group: 'simple_with_animation',
|
||||
pullPlaceholder: false,
|
||||
// animation on drop
|
||||
onDrop: function (item, targetContainer, _super) {
|
||||
var clonedItem = $('<li/>').css({height: 0})
|
||||
item.before(clonedItem)
|
||||
clonedItem.animate({'height': item.height()})
|
||||
|
||||
item.animate(clonedItem.position(), function () {
|
||||
clonedItem.detach();
|
||||
_super(item);
|
||||
})
|
||||
},
|
||||
|
||||
// set item relative to cursor position
|
||||
onDragStart: function ($item, container, _super) {
|
||||
var offset = $item.offset(),
|
||||
pointer = container.rootGroup.pointer;
|
||||
|
||||
adjustment = {
|
||||
left: pointer.left - offset.left,
|
||||
top: pointer.top - offset.top
|
||||
};
|
||||
|
||||
_super($item, container);
|
||||
},
|
||||
onDrag: function ($item, position) {
|
||||
$item.css({
|
||||
left: position.left - adjustment.left,
|
||||
top: position.top - adjustment.top
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* http://johnny.github.io/jquery-sortable/#handle
|
||||
*/
|
||||
function sortHandleAndLimitedDragDrop() {
|
||||
$('ol.simple_with_drop').sortable({
|
||||
group: 'no-drop',
|
||||
handle: 'i.icon-move',
|
||||
onDragStart: function (item, container, _super) {
|
||||
// Duplicate items of the no drop area
|
||||
if(!container.options.drop)
|
||||
item.clone().insertAfter(item)
|
||||
_super(item)
|
||||
}
|
||||
});
|
||||
|
||||
$('ol.simple_with_no_drop').sortable({
|
||||
group: 'no-drop',
|
||||
drop: false
|
||||
});
|
||||
|
||||
$('ol.simple_with_no_drag').sortable({
|
||||
group: 'no-drop',
|
||||
drag: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* http://johnny.github.io/jquery-sortable/#nested
|
||||
*/
|
||||
function toggleNestedLists() {
|
||||
var oldContainer: any;
|
||||
|
||||
$('ol.nested_with_switch').sortable({
|
||||
group: 'nested',
|
||||
afterMove: function (placeholder, container) {
|
||||
if(oldContainer != container){
|
||||
if(oldContainer)
|
||||
oldContainer.el.removeClass('active')
|
||||
container.el.addClass('active')
|
||||
|
||||
oldContainer = container
|
||||
}
|
||||
},
|
||||
onDrop: function (item, container, _super) {
|
||||
container.el.removeClass('active')
|
||||
_super(item)
|
||||
}
|
||||
});
|
||||
|
||||
$('.switch-container').on('click', '.switch', function (e) {
|
||||
var method = $(this).hasClass('active') ? 'enable' : 'disable'
|
||||
$(e.delegateTarget).next().sortable(method)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* http://johnny.github.io/jquery-sortable/#limited-target
|
||||
*/
|
||||
function connectedListsWithLimitedDropTargets() {
|
||||
var group = $('ol.limited_drop_targets').sortable({
|
||||
group: 'limited_drop_targets',
|
||||
isValidTarget: function (item, container) {
|
||||
if(item.is('.highlight'))
|
||||
return true
|
||||
else {
|
||||
return item.parent('ol')[0] == container.el[0]
|
||||
}
|
||||
},
|
||||
onDrop: function (item, container, _super) {
|
||||
$('#serialize_output').text(group.sortable('serialize').get().join('\n'));
|
||||
_super(item, container);
|
||||
},
|
||||
serialize: function (parent, children, isContainer) {
|
||||
return isContainer ? children.join() : 24;
|
||||
},
|
||||
tolerance: 6,
|
||||
distance: 10
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* http://johnny.github.io/jquery-sortable/#bootstrap
|
||||
*/
|
||||
function sortingABootstrapMenu() {
|
||||
$('ol.nav').sortable({
|
||||
group: 'nav',
|
||||
nested: false,
|
||||
vertical: false,
|
||||
exclude: '.divider-vertical',
|
||||
onDragStart: function($item, container, _super) {
|
||||
$item.find('ol.dropdown-menu').sortable('disable');
|
||||
_super($item, container);
|
||||
},
|
||||
onDrop: function($item, container, _super) {
|
||||
$item.find('ol.dropdown-menu').sortable('enable');
|
||||
_super($item, container);
|
||||
}
|
||||
});
|
||||
|
||||
$('ol.dropdown-menu').sortable({
|
||||
group: 'nav'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* http://johnny.github.io/jquery-sortable#serialization
|
||||
*/
|
||||
function serializationAndDelay() {
|
||||
var group = $('ol.serialization').sortable({
|
||||
group: 'serialization',
|
||||
delay: 500,
|
||||
onDrop: function (item, container, _super) {
|
||||
var data = group.sortable('serialize').get();
|
||||
|
||||
var jsonString = JSON.stringify(data, null, ' ');
|
||||
|
||||
$('#serialize_output2').text(jsonString);
|
||||
_super(item, container);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* http://johnny.github.io/jquery-sortable/#table
|
||||
*/
|
||||
function sortTables() {
|
||||
// Sortable rows
|
||||
$('.sorted_table').sortable({
|
||||
containerSelector: 'table',
|
||||
itemPath: '> tbody',
|
||||
itemSelector: 'tr',
|
||||
placeholder: '<tr class="placeholder"/>'
|
||||
});
|
||||
|
||||
// Sortable column heads
|
||||
var oldIndex: any;
|
||||
|
||||
$('.sorted_head tr').sortable({
|
||||
containerSelector: 'tr',
|
||||
itemSelector: 'th',
|
||||
placeholder: '<th class="placeholder"/>',
|
||||
vertical: false,
|
||||
onDragStart: function (item, group, _super) {
|
||||
oldIndex = item.index();
|
||||
item.appendTo(item.parent());
|
||||
_super(item);
|
||||
},
|
||||
onDrop: function (item, container, _super) {
|
||||
var field: any,
|
||||
newIndex = item.index()
|
||||
|
||||
if (newIndex != oldIndex)
|
||||
item.closest('table').find('tbody tr').each(function (i, row) {
|
||||
var $row = $(row);
|
||||
field = $row.children().eq(oldIndex);
|
||||
if(newIndex)
|
||||
field.before($row.children()[newIndex]);
|
||||
else
|
||||
$row.prepend(field);
|
||||
});
|
||||
|
||||
_super(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* http://johnny.github.io/jquery-sortable/#docs
|
||||
*/
|
||||
function api() {
|
||||
$('.horatio').sortable().sortable('disable').sortable('enable')
|
||||
.sortable('refresh').sortable('serialize').sortable('destroy');
|
||||
}
|
||||
Vendored
+104
@@ -0,0 +1,104 @@
|
||||
// Type definitions for jQuery Sortable v0.9.12
|
||||
// Project: http://johnny.github.io/jquery-sortable/
|
||||
// Definitions by: Nathan Pitman <https://github.com/Seltzer>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module JQuerySortable {
|
||||
|
||||
interface Position {
|
||||
top: number;
|
||||
left: number;
|
||||
}
|
||||
|
||||
type Dimensions = number[];
|
||||
|
||||
interface ContainerGroup {
|
||||
$document: JQuery;
|
||||
containerDimensions: Dimensions[]
|
||||
containers: Container[];
|
||||
delayMet: boolean;
|
||||
dragInitDone: boolean;
|
||||
dragProxy: any;
|
||||
dragging: boolean;
|
||||
dropProxy: any;
|
||||
item: JQuery;
|
||||
itemContainer: Container;
|
||||
lastAppendedItem: JQuery;
|
||||
lastPointer: Position;
|
||||
lastRelativePointer: Position;
|
||||
offsetParent: JQuery;
|
||||
options: Options;
|
||||
placeholder: JQuery;
|
||||
pointer: Position;
|
||||
relativePointer: Position;
|
||||
sameResultBox: { bottom: number; left: number; right: number; top: number; };
|
||||
scrollProxy: any;
|
||||
}
|
||||
|
||||
interface Container {
|
||||
el: JQuery;
|
||||
options: Options;
|
||||
group: ContainerGroup;
|
||||
rootGroup: ContainerGroup;
|
||||
handle: string;
|
||||
target: JQuery;
|
||||
itemDimensions: Dimensions[];
|
||||
items: HTMLElement[];
|
||||
}
|
||||
|
||||
|
||||
type GenericEventHandler = ($item?: JQuery, container?: Container, _super?: GenericEventHandler, event?: Event) => void;
|
||||
type OnDragEventHandler = ($item?: JQuery, position?: Position, _super?: OnDragEventHandler, event?: Event) => void;
|
||||
type OnMousedownHandler = ($item?: JQuery, _super?: OnMousedownHandler, event?: Event) => void;
|
||||
type OnCancelHandler = ($item?: JQuery, container?: Container, _super?: OnCancelHandler, event?: Event) => void;
|
||||
|
||||
// Deliberately typing $children as an any here as it makes it much easier to use. Actual type is JQuery | any[]
|
||||
type SerializeFunc = ($parent: JQuery, $children: any, parentIsContainer: boolean) => void;
|
||||
|
||||
interface GroupOptions {
|
||||
afterMove?: ($placeholder: JQuery, container: Container, $closestItemOrContainer: JQuery) => void;
|
||||
containerPath?: string;
|
||||
containerSelector?: string;
|
||||
distance?: number;
|
||||
delay?: number;
|
||||
handle?: string;
|
||||
itemPath?: string;
|
||||
itemSelector?: string;
|
||||
isValidTarget?: ($item: JQuery, container: Container) => boolean;
|
||||
onCancel?: OnCancelHandler;
|
||||
onDrag?: OnDragEventHandler;
|
||||
onDragStart?: GenericEventHandler;
|
||||
onDrop?: GenericEventHandler;
|
||||
onMousedown?: OnMousedownHandler;
|
||||
placeholder?: JQuery | any[] | Element | string;
|
||||
pullPlaceholder?: boolean;
|
||||
serialize?: SerializeFunc;
|
||||
tolerance?: number;
|
||||
}
|
||||
|
||||
|
||||
interface ContainerOptions {
|
||||
drag?: boolean;
|
||||
drop?: boolean;
|
||||
exclude?: string;
|
||||
nested?: boolean;
|
||||
vertical?: boolean;
|
||||
}
|
||||
|
||||
interface Options extends GroupOptions, ContainerOptions {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface JQuery {
|
||||
sortable(options?: JQuerySortable.Options): JQuery;
|
||||
|
||||
sortable(methodName: 'enable'): JQuery;
|
||||
sortable(methodName: 'disable'): JQuery;
|
||||
sortable(methodName: 'refresh'): JQuery;
|
||||
sortable(methodName: 'destroy'): JQuery;
|
||||
sortable(methodName: 'serialize'): JQuery;
|
||||
sortable(methodName: string): JQuery;
|
||||
}
|
||||
@@ -1,420 +0,0 @@
|
||||
///<reference path="jquery.pickadate.d.ts" />
|
||||
|
||||
/*
|
||||
* Date picker tests
|
||||
* From http://amsul.ca/pickadate.js/date.htm
|
||||
*/
|
||||
|
||||
$('.datepicker').pickadate();
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
weekdaysShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
||||
showMonthsShort: true
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
today: '',
|
||||
clear: 'Clear selection'
|
||||
});
|
||||
|
||||
// Extend the default picker options for all instances.
|
||||
$.extend($.fn.pickadate.defaults, {
|
||||
monthsFull: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
||||
weekdaysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
|
||||
today: 'aujourd\'hui',
|
||||
clear: 'effacer',
|
||||
formatSubmit: 'yyyy/mm/dd'
|
||||
});
|
||||
|
||||
// Or, pass the months and weekdays as an array for each invocation.
|
||||
$('.datepicker').pickadate({
|
||||
monthsFull: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
|
||||
weekdaysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
|
||||
today: 'aujourd\'hui',
|
||||
clear: 'effacer',
|
||||
formatSubmit: 'yyyy/mm/dd'
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
// Escape any "rule" characters with an exclamation mark (!).
|
||||
format: 'You selecte!d: dddd, dd mmm, yyyy',
|
||||
formatSubmit: 'yyyy/mm/dd',
|
||||
hiddenPrefix: 'prefix__',
|
||||
hiddenSuffix: '__suffix'
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
selectYears: true,
|
||||
selectMonths: true
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
// `true` defaults to 10.
|
||||
selectYears: 4
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
firstDay: 1
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
min: new Date(2013, 3, 20),
|
||||
max: new Date(2013, 7, 14)
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
min: [2013, 3, 20],
|
||||
max: [2013, 7, 14]
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
// An integer (positive/negative) sets it relative to today.
|
||||
min: -15,
|
||||
// `true` sets it to today. `false` removes any limits.
|
||||
max: true
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
disable: [
|
||||
[2013, 3, 3],
|
||||
[2013, 3, 12],
|
||||
[2013, 3, 20],
|
||||
[2013, 3, 29]
|
||||
]
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
disable: [
|
||||
1, 4, 7
|
||||
]
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
disable: [
|
||||
new Date(2013, 3, 13),
|
||||
new Date(2013, 3, 29)
|
||||
]
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
disable: [
|
||||
true,
|
||||
1, 4, 7,
|
||||
[2013, 3, 3],
|
||||
[2013, 3, 12],
|
||||
[2013, 3, 20],
|
||||
[2013, 3, 29]
|
||||
]
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
container: '#root-outlet'
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
onStart: function () {
|
||||
console.log('Hello there :)')
|
||||
},
|
||||
onRender: function () {
|
||||
console.log('Whoa.. rendered anew')
|
||||
},
|
||||
onOpen: function () {
|
||||
console.log('Opened up')
|
||||
},
|
||||
onClose: function () {
|
||||
console.log('Closed now')
|
||||
},
|
||||
onStop: function () {
|
||||
console.log('See ya.')
|
||||
},
|
||||
onSet: function (event) {
|
||||
console.log('Just set stuff:', event)
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Time picker tests
|
||||
* From http://amsul.ca/pickadate.js/time.htm
|
||||
*/
|
||||
|
||||
$('.timepicker').pickatime();
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
clear: ''
|
||||
});
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
// Escape any "rule" characters with an exclamation mark (!).
|
||||
format: 'T!ime selected: h:i a',
|
||||
formatLabel: '<b>h</b>:i <!i>a</!i>',
|
||||
formatSubmit: 'HH:i',
|
||||
hiddenPrefix: 'prefix__',
|
||||
hiddenSuffix: '__suffix'
|
||||
});
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
formatLabel: function (time: TimePickerItemObject) {
|
||||
var hours = (time.pick - this.get('now').pick) / 60,
|
||||
label = hours < 0 ? ' !hours to now' : hours > 0 ? ' !hours from now' : 'now'
|
||||
return 'h:i a <sm!all>' + (hours ? Math.abs(hours).toString() : '') + label + '</sm!all>'
|
||||
}
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
interval: 150
|
||||
});
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
min: [7, 30],
|
||||
max: [14, 0]
|
||||
});
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
// An integer (positive/negative) sets it as intervals relative from now.
|
||||
min: -5,
|
||||
// `true` sets it to now. `false` removes any limits.
|
||||
max: true
|
||||
});
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
disable: [
|
||||
[0, 30],
|
||||
[2, 0],
|
||||
[8, 30],
|
||||
[9, 0]
|
||||
]
|
||||
});
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
disable: [
|
||||
3, 5, 7
|
||||
]
|
||||
});
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
disable: [
|
||||
true,
|
||||
3, 5, 7,
|
||||
[0, 30],
|
||||
[2, 0],
|
||||
[8, 30],
|
||||
[9, 0]
|
||||
]
|
||||
});
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
container: '#root-outlet'
|
||||
});
|
||||
|
||||
$('.timepicker').pickatime({
|
||||
onStart: function () {
|
||||
console.log('Hello there :)')
|
||||
},
|
||||
onRender: function () {
|
||||
console.log('Whoa.. rendered anew')
|
||||
},
|
||||
onOpen: function () {
|
||||
console.log('Opened up')
|
||||
},
|
||||
onClose: function () {
|
||||
console.log('Closed now')
|
||||
},
|
||||
onStop: function () {
|
||||
console.log('See ya.')
|
||||
},
|
||||
onSet: function (event) {
|
||||
console.log('Just set stuff:', event)
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* API tests
|
||||
* From http://amsul.ca/pickadate.js/api.htm
|
||||
*/
|
||||
|
||||
var $input = $('.datepicker').pickadate();
|
||||
|
||||
// Use the picker object directly.
|
||||
var picker = $input.pickadate('picker');
|
||||
|
||||
picker.open().clear().close();
|
||||
|
||||
picker.open();
|
||||
picker.close();
|
||||
picker.close(true);
|
||||
|
||||
picker.open(false)
|
||||
$(document).on('click', function () {
|
||||
picker.close()
|
||||
});
|
||||
|
||||
picker.start();
|
||||
picker.stop();
|
||||
picker.render();
|
||||
picker.clear();
|
||||
|
||||
picker.get() // Short for `picker.get('value')`
|
||||
|
||||
picker.get('select');
|
||||
picker.get('select', 'yyyy/mm/dd');
|
||||
|
||||
picker.get('highlight');
|
||||
picker.get('highlight', 'yyyy/mm/dd');
|
||||
|
||||
picker.get('view');
|
||||
|
||||
picker.get('min');
|
||||
picker.get('min', 'yyyy/mm/dd');
|
||||
picker.get('max');
|
||||
picker.get('max', 'yyyy/mm/dd');
|
||||
|
||||
picker.get('open');
|
||||
picker.get('start');
|
||||
picker.get('id');
|
||||
picker.get('disable');
|
||||
|
||||
picker.set('clear');
|
||||
|
||||
// reset disabled dates
|
||||
picker.set('disable', undefined);
|
||||
|
||||
// Using arrays formatted as [YEAR,MONTH,DATE].
|
||||
picker.set('select', [2013, 3, 20]);
|
||||
|
||||
// Using JavaScript Date objects.
|
||||
picker.set('select', new Date(2013,03,20));
|
||||
|
||||
// Using positive integers as UNIX timestamps.
|
||||
picker.set('select', 1365961912346);
|
||||
|
||||
// Using arrays formatted as [HOUR,MINUTE].
|
||||
picker.set('select', [3, 0]);
|
||||
|
||||
// Using positive integers as minutes.
|
||||
picker.set('select', 540);
|
||||
|
||||
// Using arrays formatted as [YEAR,MONTH,DATE].
|
||||
picker.set('highlight', [2013, 3, 20]);
|
||||
|
||||
// Using JavaScript Date objects.
|
||||
picker.set('highlight', new Date(2013,7,14));
|
||||
|
||||
// Using positive integers as UNIX timestamps.
|
||||
picker.set('highlight', 1365961912346);
|
||||
|
||||
// Using arrays formatted as [HOUR,MINUTE].
|
||||
picker.set('highlight', [15, 30]);
|
||||
|
||||
// Using positive integers as minutes.
|
||||
picker.set('highlight', 1080);
|
||||
|
||||
// Using arrays formatted as [YEAR,MONTH,DATE].
|
||||
picker.set('view', [2000, 3, 20]);
|
||||
|
||||
// Using JavaScript Date objects.
|
||||
picker.set('view', new Date(1988,7,14));
|
||||
|
||||
// Using positive integers as UNIX timestamps.
|
||||
picker.set('view', 1587355200000);
|
||||
|
||||
// Using arrays formatted as [HOUR,MINUTE].
|
||||
picker.set('view', [15, 30]);
|
||||
|
||||
// Using positive integers as minutes.
|
||||
picker.set('view', 1080);
|
||||
|
||||
// Using arrays formatted as [YEAR,MONTH,DATE].
|
||||
picker.set('min', [2013, 3, 20]);
|
||||
|
||||
// Using JavaScript Date objects.
|
||||
picker.set('min', new Date(2013,7,14));
|
||||
|
||||
// Using integers as days relative to today.
|
||||
picker.set('min', -4);
|
||||
|
||||
// Using `true` for "today".
|
||||
picker.set('min', true);
|
||||
|
||||
// Using `false` to remove.
|
||||
picker.set('min', false);
|
||||
|
||||
// Using arrays formatted as [HOUR,MINUTE].
|
||||
picker.set('min', [15, 30]);
|
||||
|
||||
// Using integers as intervals relative from now.
|
||||
picker.set('min', -4);
|
||||
|
||||
// Using `true` for "now".
|
||||
picker.set('min', true);
|
||||
|
||||
// Using `false` to remove.
|
||||
picker.set('min', false);
|
||||
|
||||
// Using arrays formatted as [YEAR,MONTH,DATE].
|
||||
picker.set('max', [2013, 3, 20]);
|
||||
|
||||
// Using JavaScript Date objects.
|
||||
picker.set('max', new Date(2013,7,14));
|
||||
|
||||
// Using integers as days relative to today.
|
||||
picker.set('max', 4);
|
||||
|
||||
// Using `true` for "today".
|
||||
picker.set('max', true);
|
||||
|
||||
// Using `false` to remove.
|
||||
picker.set('max', false);
|
||||
|
||||
// Using arrays formatted as [HOUR,MINUTE].
|
||||
picker.set('max', [15, 30]);
|
||||
|
||||
// Using integers as intervals relative from now.
|
||||
picker.set('max', 4);
|
||||
|
||||
// Using `true` for "now".
|
||||
picker.set('max', true);
|
||||
|
||||
// Using `false` to remove.
|
||||
picker.set('max', false);
|
||||
|
||||
picker.on('open', function () {
|
||||
console.log('Opened.. and here I am!');
|
||||
});
|
||||
|
||||
picker.on({
|
||||
open: function () {
|
||||
console.log('Opened.. and here I am!');
|
||||
},
|
||||
close: function () {
|
||||
console.log('Closed.. and here I am!');
|
||||
}
|
||||
});
|
||||
|
||||
$('.datepicker').pickadate({
|
||||
onOpen: function () {
|
||||
console.log('Opened up!')
|
||||
},
|
||||
onClose: function () {
|
||||
console.log('Closed now')
|
||||
},
|
||||
onRender: function () {
|
||||
console.log('Just rendered anew')
|
||||
},
|
||||
onStart: function () {
|
||||
console.log('Hello there :)')
|
||||
},
|
||||
onStop: function () {
|
||||
console.log('See ya')
|
||||
},
|
||||
onSet: function (event) {
|
||||
console.log('Set stuff:', event)
|
||||
}
|
||||
});
|
||||
|
||||
picker.on('open', function () {
|
||||
console.log('Didn\'t open.. yet here I am!');
|
||||
})
|
||||
picker.trigger('open');
|
||||
|
||||
picker.$node;
|
||||
picker.$root;
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
-319
@@ -1,319 +0,0 @@
|
||||
// Type definitions for pickadate.js 3.3.0
|
||||
// Project: https://github.com/amsul/pickadate.js
|
||||
// Definitions by: Theodore Brown <https://github.com/theodorejb/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
/** Options shared between date and time pickers */
|
||||
interface pickerOptions {
|
||||
/** Set clear button text */
|
||||
clear?: string; // default 'Clear'
|
||||
|
||||
/** Specify where to insert the picker's root element by passing any valid CSS selector to this option */
|
||||
container?: any;
|
||||
|
||||
// Events
|
||||
onStart?: (event: any) => void;
|
||||
onRender?: (event: any) => void;
|
||||
onOpen?: (event: any) => void;
|
||||
onClose?: (event: any) => void;
|
||||
onSet?: (event: any) => void;
|
||||
onStop?: (event: any) => void;
|
||||
}
|
||||
|
||||
interface pickadateOptions extends pickerOptions {
|
||||
// Strings and translations
|
||||
monthsFull?: string[]; // default 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
|
||||
monthsShort?: string[]; // default 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
|
||||
weekdaysFull?: string[]; // default 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
|
||||
weekdaysShort?: string[]; // default 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
|
||||
showMonthsShort?: boolean;
|
||||
showWeekdaysFull?: boolean;
|
||||
|
||||
// Buttons
|
||||
today?: string; // default 'Today'
|
||||
|
||||
// Formats
|
||||
format?: string; // default 'd mmmm, yyyy'
|
||||
formatSubmit?: string; // e.g. 'yyyy/mm/dd'
|
||||
hiddenPrefix?: string; // default undefined
|
||||
hiddenSuffix?: string; // default '_submit'
|
||||
hiddenName?: boolean; // default undefined
|
||||
|
||||
// Dropdown selectors
|
||||
selectYears?: any; // Specify the number of years selectable using an even integer - half before and half after the year in focus:
|
||||
selectMonths?: boolean;
|
||||
|
||||
// First day of the week
|
||||
firstDay?: any; // The first day of the week can be set to either Sunday or Monday. Anything truth-y sets it as Monday and anything false-y as Sunday
|
||||
|
||||
// Date limits
|
||||
min?: any; // date object, array formatted as [YEAR,MONTH,DATE], or dates relative to today using integers or a boolean (`true` sets it to today. `false` removes any limits).
|
||||
max?: any;
|
||||
|
||||
// Disable dates
|
||||
disable?: any[]; // Date objects, arrays formatted as [YEAR,MONTH,DATE], or integers representing days of the week (from 1 to 7). Switch to whitelist by setting first item in collection to `true`.
|
||||
|
||||
// Classes
|
||||
klass?: {
|
||||
|
||||
// The element states
|
||||
input?: string; // default 'picker__input'
|
||||
active?: string; // default 'picker__input--active'
|
||||
|
||||
// The root picker and states
|
||||
picker?: string; // default 'picker'
|
||||
opened?: string; // default 'picker--opened'
|
||||
focused?: string; // default 'picker--focused'
|
||||
|
||||
// The picker holder
|
||||
holder?: string; // default 'picker__holder'
|
||||
|
||||
// The picker frame, wrapper, and box
|
||||
frame?: string; // default 'picker__frame'
|
||||
wrap?: string; // default 'picker__wrap'
|
||||
box?: string; // default 'picker__box'
|
||||
|
||||
// The picker header
|
||||
header?: string; // default 'picker__header'
|
||||
|
||||
// Month navigation
|
||||
navPrev?: string; // default 'picker__nav--prev'
|
||||
navNext?: string; // default 'picker__nav--next'
|
||||
navDisabled?: string; // default 'picker__nav--disabled'
|
||||
|
||||
// Month & year labels
|
||||
month?: string; // default 'picker__month'
|
||||
year?: string; // default 'picker__year'
|
||||
|
||||
// Month & year dropdowns
|
||||
selectMonth?: string; // default 'picker__select--month'
|
||||
selectYear?: string; // default 'picker__select--year'
|
||||
|
||||
// Table of dates
|
||||
table?: string; // default 'picker__table'
|
||||
|
||||
// Weekday labels
|
||||
weekdays?: string; // default 'picker__weekday'
|
||||
|
||||
// Day states
|
||||
day?: string; // default 'picker__day'
|
||||
disabled?: string; // default 'picker__day--disabled'
|
||||
selected?: string // default 'picker__day--selected'
|
||||
highlighted?: string // default 'picker__day--highlighted'
|
||||
now?: string; // default 'picker__day--today'
|
||||
infocus?: string; // default 'picker__day--infocus'
|
||||
outfocus?: string; // default 'picker__day--outfocus'
|
||||
|
||||
// The picker footer
|
||||
footer?: string; // default 'picker__footer'
|
||||
|
||||
// Today & clear buttons
|
||||
buttonClear?: string; // default 'picker__button--clear'
|
||||
buttonToday?: string; // default 'picker__button--today'
|
||||
}
|
||||
}
|
||||
|
||||
interface pickatimeOptions extends pickerOptions {
|
||||
|
||||
// Formats
|
||||
format?: string; // default 'h:i A'
|
||||
formatLabel?: any;
|
||||
formatSubmit?: string;
|
||||
hiddenPrefix?: string; // default undefined
|
||||
hiddenSuffix?: string; // default '_submit'
|
||||
|
||||
// Time intervals
|
||||
interval?: number; // interval in minutes. default 30.
|
||||
|
||||
// Time limits
|
||||
min?: any; // array formatted as [HOUR,MINUTE], or as times relative to now using integers or a boolean (`true` sets it to now, `false` removes any limits).
|
||||
max?: any;
|
||||
|
||||
// Disable times
|
||||
disable?: any[]; // arrays formatted as [HOUR,MINUTE] or integers representing hours (from 0 to 23). Switch to whitelist by setting true as the first item in the collection.
|
||||
|
||||
// Classes
|
||||
klass?: {
|
||||
|
||||
// The element states
|
||||
input?: string; // default 'picker__input'
|
||||
active?: string; // default 'picker__input--active'
|
||||
|
||||
// The root picker and states
|
||||
picker?: string; // default 'picker picker--time'
|
||||
opened?: string; // default 'picker--opened'
|
||||
focused?: string; // default 'picker--focused'
|
||||
|
||||
// The picker holder
|
||||
holder?: string; // default 'picker__holder'
|
||||
|
||||
// The picker frame, wrapper, and box
|
||||
frame?: string; // default 'picker__frame'
|
||||
wrap?: string; // default 'picker__wrap'
|
||||
box?: string; // default 'picker__box'
|
||||
|
||||
// List of times
|
||||
list?: string; // default 'picker__list'
|
||||
listItem?: string; // default 'picker__list-item'
|
||||
|
||||
// Time states
|
||||
disabled?: string; // default 'picker__list-item--disabled'
|
||||
selected?: string; // default 'picker__list-item--selected'
|
||||
highlighted?: string; // default 'picker__list-item--highlighted'
|
||||
viewset?: string; // default 'picker__list-item--viewset'
|
||||
now?: string; // default 'picker__list-item--now'
|
||||
|
||||
// Clear button
|
||||
buttonClear?: string; // default 'picker__button--clear'
|
||||
}
|
||||
}
|
||||
|
||||
interface PickerItemObject {
|
||||
/** The "pick" value used for comparisons. */
|
||||
pick: number;
|
||||
}
|
||||
|
||||
interface DatePickerItemObject extends PickerItemObject {
|
||||
/** The full year. */
|
||||
year: number;
|
||||
|
||||
/** The month with zero-as-index. */
|
||||
month: number;
|
||||
|
||||
/** The date of the month. */
|
||||
date: number;
|
||||
|
||||
/** The day of the week with zero-as-index. */
|
||||
day: number;
|
||||
|
||||
/** The underlying JavaScript Date object. */
|
||||
obj: Date;
|
||||
}
|
||||
|
||||
interface TimePickerItemObject extends PickerItemObject {
|
||||
/** Hour of the day from 0 to 23. */
|
||||
hour: number;
|
||||
|
||||
/** The minutes of the hour from 0 to 59 (based on the interval). */
|
||||
mins: number;
|
||||
}
|
||||
|
||||
interface CallbackObject {
|
||||
open?: () => void;
|
||||
close?: () => void;
|
||||
render?: () => void;
|
||||
start?: () => void;
|
||||
stop?: () => void;
|
||||
set?: () => void;
|
||||
}
|
||||
|
||||
interface SetThings {
|
||||
clear?;
|
||||
select?: any;
|
||||
highlight?: any;
|
||||
view?: any;
|
||||
min?: any;
|
||||
max?: any;
|
||||
disable?: any;
|
||||
enable?: any;
|
||||
}
|
||||
|
||||
interface TimePickerSetThings extends SetThings {
|
||||
interval?: any;
|
||||
}
|
||||
|
||||
interface PickerObject<TPickerObject, TItemObject extends PickerItemObject, TOptions extends SetThings> {
|
||||
/** The picker's relative input element wrapped as a jQuery object. */
|
||||
$node: JQuery;
|
||||
|
||||
/** The picker's relative root holder element wrapped as a jQuery object. */
|
||||
$root: JQuery;
|
||||
|
||||
open(withoutFocus?: boolean): TPickerObject;
|
||||
close(withFocus?: boolean): TPickerObject;
|
||||
|
||||
/** Rebuild the picker. */
|
||||
start(): TPickerObject;
|
||||
|
||||
/** Destroy the picker. */
|
||||
stop(): TPickerObject;
|
||||
|
||||
/**
|
||||
* Refresh the picker box after adding something to the holder.
|
||||
* By default, only the "face" of the picker (i.e. the box element)
|
||||
* has it’s contents re-rendered. To render the entire picker from
|
||||
* the root up, pass true as the first argument.
|
||||
*/
|
||||
render(entirePicker?: boolean): TPickerObject;
|
||||
|
||||
/** Clear the value in the picker's input element. */
|
||||
clear(): TPickerObject;
|
||||
|
||||
/** Short for picker.get('value') */
|
||||
get(): string;
|
||||
|
||||
/** Get the properties, objects, and states that make up the current state of the picker. */
|
||||
get(thing: string): any;
|
||||
|
||||
/** Returns the string value of the picker's input element. */
|
||||
get(thing: 'value'): string;
|
||||
|
||||
/** Returns the item object that is visually selected. */
|
||||
get(thing: 'select'): TItemObject;
|
||||
|
||||
/** Returns the item object that is visually highlighted. */
|
||||
get(thing: 'highlight'): TItemObject;
|
||||
|
||||
/** Returns the item object that sets the current view. */
|
||||
get(thing: 'view'): TItemObject;
|
||||
|
||||
/** Returns the item object that limits the picker's lower range. */
|
||||
get(thing: 'min'): TItemObject;
|
||||
|
||||
/** Returns the item object that limits the picker's upper range. */
|
||||
get(thing: 'max'): TItemObject;
|
||||
|
||||
/** Returns a boolean value of whether the picker is open or not. */
|
||||
get(thing: 'open'): boolean;
|
||||
|
||||
/** Returns a boolean value of whether the picker has started or not. */
|
||||
get(thing: 'start'): boolean;
|
||||
|
||||
/** Returns a unique 9-digit integer that is the ID of the picker. */
|
||||
get(thing: 'id'): number;
|
||||
|
||||
/** Returns an array of items that determine which item objects to disable on the picker. */
|
||||
get(thing: 'disable'): any[];
|
||||
|
||||
/** Returns a formatted string for the item object specified by `thing` */
|
||||
get(thing: string, format: string): string;
|
||||
|
||||
/** Set the properties, objects, and states to change the state of the picker. */
|
||||
set(thing: string, value?: any, options?: any): TPickerObject;
|
||||
set(things: TOptions, options?: any): TPickerObject;
|
||||
|
||||
/** Bind callbacks to get fired off when the relative picker method is called. */
|
||||
on(methodName, callback: () => void): TPickerObject;
|
||||
|
||||
/** Bind multiple callbacks at once to get fired off when the relative picker method is called. */
|
||||
on(callbackObject: CallbackObject): TPickerObject;
|
||||
|
||||
/** Trigger callbacks that have been queued up using the the on method. */
|
||||
trigger(event: string): TPickerObject;
|
||||
}
|
||||
|
||||
interface DatePickerObject extends PickerObject<DatePickerObject, DatePickerItemObject, SetThings> { }
|
||||
interface TimePickerObject extends PickerObject<TimePickerObject, TimePickerItemObject, TimePickerSetThings> { }
|
||||
|
||||
interface JQuery {
|
||||
pickadate(methodName: "picker"): DatePickerObject;
|
||||
pickadate(methodName: string): any;
|
||||
pickadate(options?: pickadateOptions): JQuery;
|
||||
|
||||
pickatime(methodName: "picker"): TimePickerObject;
|
||||
pickatime(methodName: string): any;
|
||||
pickatime(options?: pickatimeOptions): JQuery;
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
+6
-6
@@ -27,12 +27,12 @@ interface JQueryLayout {
|
||||
resizeContent(pane: any): any;
|
||||
resizeAll(): any;
|
||||
|
||||
addToggleBtn(selector: string, pane: any)
|
||||
addCloseBtn(selector: string, pane: any)
|
||||
addOpenBtn(selector: string, pane: any)
|
||||
addPinBtn(selector: string, pane: any)
|
||||
allowOverflow(elemOrPane: any)
|
||||
resetOverflow(elemOrPane: any)
|
||||
addToggleBtn(selector: string, pane: any): any;
|
||||
addCloseBtn(selector: string, pane: any): any;
|
||||
addOpenBtn(selector: string, pane: any): any;
|
||||
addPinBtn(selector: string, pane: any): any;
|
||||
allowOverflow(elemOrPane: any): any;
|
||||
resetOverflow(elemOrPane: any): any;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
|
||||
Vendored
+4
@@ -5,6 +5,10 @@
|
||||
|
||||
declare var signals: SignalWrapper;
|
||||
|
||||
declare module "signals" {
|
||||
export = signals;
|
||||
}
|
||||
|
||||
interface SignalWrapper {
|
||||
Signal: Signal
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ interface PersonProps {
|
||||
age: number
|
||||
}
|
||||
|
||||
var Person = React.createClass<PersonProps>({
|
||||
render(): React.ReactHTMLElement { return null }
|
||||
var Person = React.createClass<PersonProps, {}>({
|
||||
render():React.ReactElement<any> { return null; }
|
||||
});
|
||||
|
||||
var PersonTag = React.createFactory(Person);
|
||||
@@ -19,7 +19,7 @@ var clickHandler: React.MouseEventHandler
|
||||
|
||||
// Tests with spec string
|
||||
function spec_string () {
|
||||
var result: React.ReactHTMLElement
|
||||
var result: React.HTMLComponent
|
||||
|
||||
// just spec string
|
||||
result = $('div')
|
||||
@@ -38,7 +38,7 @@ function spec_string () {
|
||||
|
||||
// Tests with react component
|
||||
function react_component() {
|
||||
var result: React.ReactHTMLElement
|
||||
var result: React.ReactElement<{}>
|
||||
|
||||
// with nothing more
|
||||
result = $(Person)
|
||||
@@ -54,4 +54,4 @@ function react_component() {
|
||||
result = $(Person, props, 'hello') // one string child
|
||||
result = $(Person, props, $('span', 'world')) // one element child
|
||||
result = $(Person, props, ['hello', PersonTag()]) // mixed array of children
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
-4
@@ -1,12 +1,14 @@
|
||||
// Type definitions for JSnoX
|
||||
// Type definitions for JSnoX
|
||||
// Project: https://github.com/af/jsnox
|
||||
// Definitions by: Steve Baker <https://github.com/stkb/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/legacy/react-0.12.d.ts" />
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
declare module 'jsnox' {
|
||||
|
||||
import React = require("react");
|
||||
|
||||
/*
|
||||
* JSnoX requires an object with a createElement method.
|
||||
* This will normally be the React object but could be something else
|
||||
@@ -29,7 +31,7 @@ declare module 'jsnox' {
|
||||
* @param children A single React node (string or ReactElement) or array of nodes.
|
||||
* Note that unlike with React itself, multiple children must be placed into an array.
|
||||
*/
|
||||
(specString: string, children: React.ReactNode): React.ReactHTMLElement
|
||||
(specString: string, children: React.ReactNode): React.HTMLComponent
|
||||
|
||||
/**
|
||||
* Renders an HTML element from the given spec string, with optional props
|
||||
@@ -40,7 +42,7 @@ declare module 'jsnox' {
|
||||
* @param children A single React node (string or ReactElement) or array of nodes.
|
||||
* Note that unlike with React itself, multiple children must be placed into an array.
|
||||
*/
|
||||
(specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.ReactHTMLElement
|
||||
(specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.HTMLComponent
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/// <reference path="jsuri.d.ts" />
|
||||
|
||||
function test_createUri() {
|
||||
var uri = new jsuri.Uri('http://user:pass@www.test.com:81/index.html?q=books#fragment');
|
||||
|
||||
var getTests = {
|
||||
protocol: 'http' == uri.protocol(),
|
||||
userInfo: 'user:pass' == uri.userInfo(),
|
||||
host: 'www.test.com' == uri.host(),
|
||||
port: 81 == uri.port(),
|
||||
path: '/index.html' == uri.path(),
|
||||
query: 'q=books' == uri.query(),
|
||||
anchor: 'fragment' == uri.anchor()
|
||||
};
|
||||
|
||||
uri.protocol('https');
|
||||
var setProtocolTest = uri.toString() == 'https://user:pass@www.test.com:81/index.html?q=books#fragment';
|
||||
|
||||
uri.host('mydomain.com');
|
||||
var setHostTest = uri.toString() == 'https://user:pass@mydomain.com:81/index.html?q=books#fragment';
|
||||
}
|
||||
|
||||
function test_chainable() {
|
||||
new jsuri.Uri()
|
||||
.setPath('/archives/1979/')
|
||||
.setQuery('?page=1'); // /archives/1979?page=1
|
||||
|
||||
new jsuri.Uri()
|
||||
.setPath('/index.html')
|
||||
.setAnchor('content')
|
||||
.setHost('www.test.com')
|
||||
.setPort(8080)
|
||||
.setUserInfo('username:password')
|
||||
.setProtocol('https')
|
||||
.setQuery('this=that&some=thing'); // https://username:password@www.test.com:8080/index.html?this=that&some=thing#content
|
||||
|
||||
new jsuri.Uri('http://www.test.com')
|
||||
.setHost('www.yahoo.com')
|
||||
.setProtocol('https'); // https://www.yahoo.com
|
||||
}
|
||||
|
||||
function test_queryParams() {
|
||||
new jsuri.Uri('?cat=1&cat=2&cat=3').getQueryParamValue('cat'); // 1
|
||||
|
||||
new jsuri.Uri('?cat=1&cat=2&cat=3').getQueryParamValues('cat'); // [1, 2, 3]
|
||||
|
||||
new jsuri.Uri().addQueryParam('q', 'books'); // ?q=books
|
||||
|
||||
new jsuri.Uri('http://www.github.com')
|
||||
.addQueryParam('testing', '123')
|
||||
.addQueryParam('one', 1); // http://www.github.com/?testing=123&one=1
|
||||
|
||||
// insert param at index 0
|
||||
new jsuri.Uri('?b=2&c=3&d=4').addQueryParam('a', '1', 0); // ?a=1&b=2&c=3&d=4
|
||||
|
||||
new jsuri.Uri().replaceQueryParam('page', 2); // ?page=2
|
||||
|
||||
new jsuri.Uri('?a=1&b=2&c=3')
|
||||
.replaceQueryParam('a', 'eh'); // ?a=eh&b=2&c=3
|
||||
|
||||
new jsuri.Uri('?a=1&b=2&c=3&c=4&c=5&c=6')
|
||||
.replaceQueryParam('c', 'five', '5'); // ?a=1&b=2&c=3&c=4&c=five&c=6
|
||||
|
||||
new jsuri.Uri('?a=1&b=2&c=3')
|
||||
.deleteQueryParam('a'); // ?b=2&c=3
|
||||
|
||||
new jsuri.Uri('test.com?a=1&b=2&c=3&a=eh')
|
||||
.deleteQueryParam('a', 'eh'); // test.com/?a=1&b=2&c=3
|
||||
|
||||
new jsuri.Uri('?a=1&b=2&c=3')
|
||||
.hasQueryParam('a'); // true
|
||||
|
||||
new jsuri.Uri('?a=1&b=2&c=3')
|
||||
.hasQueryParam('d'); // false
|
||||
}
|
||||
|
||||
function test_clone() {
|
||||
var baseUri = new jsuri.Uri('http://localhost/');
|
||||
|
||||
baseUri.clone().setProtocol('https'); // https://localhost/
|
||||
baseUri; // http://localhost/
|
||||
}
|
||||
Vendored
+139
@@ -0,0 +1,139 @@
|
||||
// Type definitions for jsUri 1.3+
|
||||
// Project: https://github.com/derek-watson/jsUri
|
||||
// Definitions by: Chris Charabaruk <http://github.com/coldacid>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module jsuri {
|
||||
type Primitive = string | number | boolean;
|
||||
|
||||
export class Uri {
|
||||
/**
|
||||
* Creates a new Uri object
|
||||
* @constructor
|
||||
* @param {string} str
|
||||
*/
|
||||
constructor(str?: string);
|
||||
|
||||
/**
|
||||
* Define getter/setter methods
|
||||
*/
|
||||
protocol(val?: string): string;
|
||||
userInfo(val?: string): string;
|
||||
host(val?: string): string;
|
||||
port(val?: number): number;
|
||||
path(val?: string): string;
|
||||
anchor(val?: string): string;
|
||||
|
||||
/**
|
||||
* if there is no protocol, the leading // can be enabled or disabled
|
||||
* @param {Boolean} val
|
||||
* @return {Boolean}
|
||||
*/
|
||||
hasAuthorityPrefix(val?: boolean): boolean;
|
||||
|
||||
isColonUri(val?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* Serializes the internal state of the query pairs
|
||||
* @param {string} [val] set a new query string
|
||||
* @return {string} query string
|
||||
*/
|
||||
query(val?: string): string;
|
||||
|
||||
/**
|
||||
* returns the first query param value found for the key
|
||||
* @param {string} key query key
|
||||
* @return {string} first value found for key
|
||||
*/
|
||||
getQueryParamValue(key: string): string;
|
||||
|
||||
/**
|
||||
* returns an array of query param values for the key
|
||||
* @param {string} key query key
|
||||
* @return {array} array of values
|
||||
*/
|
||||
getQueryParamValues(key: string): string[];
|
||||
|
||||
/**
|
||||
* removes query parameters
|
||||
* @param {string} key remove values for key
|
||||
* @param {val} [val] remove a specific value, otherwise removes all
|
||||
* @return {Uri} returns self for fluent chaining
|
||||
*/
|
||||
deleteQueryParam(key: string, val?: string): Uri;
|
||||
|
||||
/**
|
||||
* adds a query parameter
|
||||
* @param {string} key add values for key
|
||||
* @param {string} val value to add
|
||||
* @param {integer} [index] specific index to add the value at
|
||||
* @return {Uri} returns self for fluent chaining
|
||||
*/
|
||||
addQueryParam(key: string, val: Primitive, index?: number): Uri;
|
||||
|
||||
/**
|
||||
* test for the existence of a query parameter
|
||||
* @param {string} key check values for key
|
||||
* @return {Boolean} true if key exists, otherwise false
|
||||
*/
|
||||
hasQueryParam(key: string): boolean;
|
||||
|
||||
/**
|
||||
* replaces query param values
|
||||
* @param {string} key key to replace value for
|
||||
* @param {string} newVal new value
|
||||
* @param {string} [oldVal] replace only one specific value (otherwise replaces all)
|
||||
* @return {Uri} returns self for fluent chaining
|
||||
*/
|
||||
replaceQueryParam(key: string, newVal: Primitive, oldVal?: Primitive): Uri;
|
||||
|
||||
/**
|
||||
* Define fluent setter methods (setProtocol, setHasAuthorityPrefix, etc)
|
||||
*/
|
||||
setProtocol(val: string): Uri;
|
||||
setHasAuthorityPrefix(val: boolean): Uri;
|
||||
setIsColonUri(val: boolean): Uri;
|
||||
setUserInfo(val: string): Uri;
|
||||
setHost(val: string): Uri;
|
||||
setPort(val: number): Uri;
|
||||
setPath(val: string): Uri;
|
||||
setQuery(val: string): Uri;
|
||||
setAnchor(val: string): Uri;
|
||||
|
||||
/**
|
||||
* Scheme name, colon and doubleslash, as required
|
||||
* @return {string} http:// or possibly just //
|
||||
*/
|
||||
scheme(): string;
|
||||
|
||||
/**
|
||||
* Same as Mozilla nsIURI.prePath
|
||||
* @return {string} scheme://user:password@host:port
|
||||
* @see https://developer.mozilla.org/en/nsIURI
|
||||
*/
|
||||
origin(): string;
|
||||
|
||||
/**
|
||||
* Adds a trailing slash to the path
|
||||
*/
|
||||
addTrailingSlash(): Uri;
|
||||
|
||||
/**
|
||||
* Serializes the internal state of the Uri object
|
||||
* @return {string}
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* Clone a Uri object
|
||||
* @return {Uri} duplicate copy of the Uri
|
||||
*/
|
||||
clone(): Uri;
|
||||
}
|
||||
}
|
||||
|
||||
declare type Uri = jsuri.Uri;
|
||||
|
||||
declare module 'jsuri' {
|
||||
export = Uri;
|
||||
}
|
||||
+32
-13
@@ -33,18 +33,18 @@ function testJSZip() {
|
||||
var folder = newJszip.folder("test");
|
||||
if(folder.file("test.txt").asText() == "test string") {
|
||||
log(SEVERITY.INFO, "all ok");
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(SEVERITY.ERROR, "wrong file");
|
||||
}
|
||||
|
||||
var folders = newJszip.folder(new RegExp("^test"));
|
||||
|
||||
|
||||
if(folders.length == 1) {
|
||||
log(SEVERITY.INFO, "all ok");
|
||||
if(folders[0].dir == true) {
|
||||
log(SEVERITY.INFO, "all ok");
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(SEVERITY.ERROR, "wrong file");
|
||||
}
|
||||
@@ -59,14 +59,14 @@ function testJSZip() {
|
||||
log(SEVERITY.INFO, "all ok");
|
||||
}
|
||||
else {
|
||||
log(SEVERITY.ERROR, "wrong data in files");
|
||||
log(SEVERITY.ERROR, "wrong data in files");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
log(SEVERITY.ERROR, "wrong number of files");
|
||||
}
|
||||
|
||||
var filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => {
|
||||
var filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => {
|
||||
if (file.asText() == "test string") {
|
||||
return true;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ function testJSZip() {
|
||||
|
||||
newJszip.remove("test/test.txt");
|
||||
|
||||
filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => {
|
||||
filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => {
|
||||
if (file.asText() == "test string") {
|
||||
return true;
|
||||
}
|
||||
@@ -95,24 +95,43 @@ function testJSZip() {
|
||||
else {
|
||||
log(SEVERITY.ERROR, "wrong number of files");
|
||||
}
|
||||
|
||||
var uncompressedStr = JSZip.compressions.DEFLATE.uncompress(
|
||||
JSZip.compressions.DEFLATE.compress("\0\1\2\3\4\5\6\7",{level:9}));
|
||||
var uncompressedArr = JSZip.compressions.DEFLATE.uncompress(
|
||||
JSZip.compressions.DEFLATE.compress([0,1,2,3,4,5,6,7],{level:9}));
|
||||
var uncompressedUint8Arr = JSZip.compressions.DEFLATE.uncompress(
|
||||
JSZip.compressions.DEFLATE.compress(new Uint8Array([0,1,2,3,4,5,6,7]),{level:9}));
|
||||
|
||||
var every_match = [0,1,2,3,4,5,6,7].every(function(val, i){
|
||||
return uncompressedStr[i] === val &&
|
||||
uncompressedArr[i] === val &&
|
||||
uncompressedUint8Arr[i] === val;
|
||||
});
|
||||
if(every_match) {
|
||||
log(SEVERITY.INFO, "compress and uncompress ok.");
|
||||
}else{
|
||||
log(SEVERITY.ERROR, "compress or uncompress failed.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function log(severity:number, message: any) {
|
||||
var log = "";
|
||||
switch(severity) {
|
||||
case 0:
|
||||
case 0:
|
||||
log += "[DEBUG] ";
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
log += "[INFO] ";
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
log += "[WARN] ";
|
||||
break;
|
||||
case 3:
|
||||
case 3:
|
||||
log += "[ERROR] ";
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
log += "[FATAL] ";
|
||||
break;
|
||||
default:
|
||||
@@ -122,4 +141,4 @@ function log(severity:number, message: any) {
|
||||
console.log(log += message);
|
||||
}
|
||||
|
||||
testJSZip();
|
||||
testJSZip();
|
||||
|
||||
Vendored
+18
-3
@@ -32,7 +32,7 @@ interface JSZip {
|
||||
|
||||
/**
|
||||
* Return an new JSZip instance with the given folder as root
|
||||
*
|
||||
*
|
||||
* @param name Name of the folder
|
||||
* @return New JSZip object with the given folder as root or null
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ interface JSZip {
|
||||
|
||||
/**
|
||||
* Returns new JSZip instances with the matching folders as root
|
||||
*
|
||||
*
|
||||
* @param name RegExp to match
|
||||
* @return New array of JSZipFile objects which match the RegExp
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ interface JSZip {
|
||||
|
||||
/**
|
||||
* Removes the file or folder from the archive
|
||||
*
|
||||
*
|
||||
* @param path Relative path of file or folder
|
||||
* @return Returns the JSZip instance
|
||||
*/
|
||||
@@ -140,6 +140,18 @@ interface JSZipSupport {
|
||||
nodebuffer: boolean;
|
||||
}
|
||||
|
||||
interface DEFLATE {
|
||||
/** pako.deflateRaw, level:0-9 */
|
||||
compress(input: string, compressionOptions: {level:number}): Uint8Array;
|
||||
compress(input: number[], compressionOptions: {level:number}): Uint8Array;
|
||||
compress(input: Uint8Array, compressionOptions: {level:number}): Uint8Array;
|
||||
|
||||
/** pako.inflateRaw */
|
||||
uncompress(input: string): Uint8Array;
|
||||
uncompress(input: number[]): Uint8Array;
|
||||
uncompress(input: Uint8Array): Uint8Array;
|
||||
}
|
||||
|
||||
declare var JSZip: {
|
||||
/**
|
||||
* Create JSZip instance
|
||||
@@ -169,6 +181,9 @@ declare var JSZip: {
|
||||
|
||||
prototype: JSZip;
|
||||
support: JSZipSupport;
|
||||
compressions: {
|
||||
DEFLATE: DEFLATE;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "jszip" {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/// <reference path="kendo-ui.d.ts" />
|
||||
Vendored
+15682
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
/// <reference path="knockout-paging.d.ts" />
|
||||
|
||||
// Different option formats
|
||||
var emptyOptions = {};
|
||||
var pageNumberOptions = { pageNumber: 2 };
|
||||
var pageSizeOptions = { pageSize: 10 };
|
||||
var generatorOptions = { pageGenerator: 'sliding' };
|
||||
var allOptions = { pageNumber: 2, pageSize: 10, pageGenerator: 'sliding' };
|
||||
|
||||
function defaults() {
|
||||
ko.paging.defaults.pageNumber = 1;
|
||||
ko.paging.defaults.pageSize = 50;
|
||||
}
|
||||
|
||||
function pageGenerators() {
|
||||
|
||||
// Allow to set the windowSize on sliding page generator
|
||||
ko.paging.generators['sliding'].windowSize(5);
|
||||
|
||||
// Add custom page generator
|
||||
ko.paging.generators['custom'] = {
|
||||
generate: function(pagedObservable: KnockoutObservable<any>) {
|
||||
return [0, 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function usingPagedObservableArrayFunctionOnKnockoutStatic() {
|
||||
var simplePaged = ko.pagedObservableArray();
|
||||
var initializedPaged = ko.pagedObservableArray([1, 2, 3]);
|
||||
var emptyOptionsPaged = ko.pagedObservableArray([1, 2, 3], emptyOptions);
|
||||
var pageNumberOptionsPaged = ko.pagedObservableArray([1, 2, 3], pageNumberOptions);
|
||||
var pageSizeOptionsPaged = ko.pagedObservableArray([1, 2, 3], pageSizeOptions);
|
||||
var generatorOptionsPaged = ko.pagedObservableArray([1, 2, 3], generatorOptions);
|
||||
var allOptionsPaged = ko.pagedObservableArray([1, 2, 3], allOptions);
|
||||
|
||||
// Here we verify that the returned type is the paged observable array
|
||||
simplePaged.pageSize();
|
||||
initializedPaged.pageSize();
|
||||
emptyOptionsPaged.pageSize();
|
||||
pageNumberOptionsPaged.pageSize();
|
||||
pageSizeOptionsPaged.pageSize();
|
||||
generatorOptionsPaged.pageSize();
|
||||
allOptionsPaged.pageSize();
|
||||
}
|
||||
|
||||
function usingExtend() {
|
||||
var emptyOptionsPaged = ko.observableArray([]).extend({ paged: emptyOptions });
|
||||
var pageNumberOptionsPaged = ko.observableArray([]).extend({ paged: pageNumberOptions });
|
||||
var pageSizeOptionsPaged = ko.observableArray([]).extend({ paged: pageSizeOptions });
|
||||
var generatorOptionsPaged = ko.observableArray([]).extend({ paged: generatorOptions });
|
||||
var allOptionsPaged = ko.observableArray([]).extend({ paged: allOptions });
|
||||
var withInitialArrayValue = ko.observableArray([1, 2, 3]).extend({ paged: emptyOptions });
|
||||
|
||||
// Here we verify that the returned type is the paged observable array
|
||||
emptyOptionsPaged.pageSize();
|
||||
pageNumberOptionsPaged.pageSize();
|
||||
pageSizeOptionsPaged.pageSize();
|
||||
generatorOptionsPaged.pageSize();
|
||||
allOptionsPaged.pageSize();
|
||||
}
|
||||
|
||||
function observables() {
|
||||
var paged = ko.pagedObservableArray([]);
|
||||
var pageSize = paged.pageSize();
|
||||
var pageNumber = paged.pageNumber();
|
||||
}
|
||||
|
||||
function computed() {
|
||||
var paged = ko.pagedObservableArray([]);
|
||||
var pageItems = paged.pageItems();
|
||||
var pageCount = paged.pageCount();
|
||||
var itemCount = paged.itemCount();
|
||||
var firstItemOnPage = paged.firstItemOnPage();
|
||||
var lastItemOnPage = paged.lastItemOnPage();
|
||||
var hasPreviousPage = paged.hasPreviousPage();
|
||||
var hasNextPage = paged.hasNextPage();
|
||||
var isFirstPage = paged.isFirstPage();
|
||||
var isLastPage = paged.isLastPage();
|
||||
var pages = paged.pages();
|
||||
}
|
||||
|
||||
function functions() {
|
||||
var paged = ko.pagedObservableArray([]);
|
||||
paged.toNextPage();
|
||||
paged.toLastPage();
|
||||
paged.toNextPage();
|
||||
paged.toPreviousPage();
|
||||
paged.toFirstPage();
|
||||
}
|
||||
Vendored
+67
@@ -0,0 +1,67 @@
|
||||
// Type definitions for knockout-paging
|
||||
// Project: https://github.com/ErikSchierboom/knockout-paging
|
||||
// Definitions by: Erik Schierboom <https://github.com/ErikSchierboom>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../knockout/knockout.d.ts" />
|
||||
|
||||
interface KnockoutStatic {
|
||||
paging: KnockoutPagingOptions;
|
||||
pagedObservableArray<T>(initialValue?: T[], options?: KnockoutPagedOptions): KnockoutPagedObservableArray<T>;
|
||||
}
|
||||
|
||||
interface KnockoutPagingOptions {
|
||||
defaults: KnockoutPagingDefaultOptions;
|
||||
generators: {
|
||||
[name: string]: KnockoutPageGenerator;
|
||||
'sliding': KnockoutSlidingPageGenerator
|
||||
}
|
||||
}
|
||||
|
||||
interface KnockoutPagingDefaultOptions {
|
||||
pageNumber: number;
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
interface KnockoutPagedObservableArray<T> extends KnockoutObservableArray<T> {
|
||||
pageSize: KnockoutObservable<number>;
|
||||
pageNumber: KnockoutObservable<number>;
|
||||
|
||||
pageItems: KnockoutComputed<T[]>;
|
||||
pageCount: KnockoutComputed<number>;
|
||||
itemCount: KnockoutComputed<number>;
|
||||
firstItemOnPage: KnockoutComputed<number>;
|
||||
lastItemOnPage: KnockoutComputed<number>;
|
||||
hasPreviousPage: KnockoutComputed<boolean>;
|
||||
hasNextPage: KnockoutComputed<boolean>;
|
||||
isFirstPage: KnockoutComputed<boolean>;
|
||||
isLastPage: KnockoutComputed<boolean>;
|
||||
pages: KnockoutComputed<number[]>;
|
||||
|
||||
toNextPage(): void;
|
||||
toPreviousPage(): void;
|
||||
toLastPage(): void;
|
||||
toFirstPage(): void;
|
||||
}
|
||||
|
||||
interface KnockoutPagedOptions {
|
||||
pageSize?: number;
|
||||
pageNumber?: number;
|
||||
pageGenerator?: string;
|
||||
}
|
||||
|
||||
interface KnockoutObservableArray<T> {
|
||||
extend(requestedExtenders: { 'paged': any; }): KnockoutPagedObservableArray<T>;
|
||||
}
|
||||
|
||||
interface KnockoutPageGenerator {
|
||||
generate<T>(pagedObservable: KnockoutPagedObservableArray<T>): number[];
|
||||
}
|
||||
|
||||
interface KnockoutSlidingPageGenerator extends KnockoutPageGenerator {
|
||||
windowSize: KnockoutObservable<number>;
|
||||
}
|
||||
|
||||
interface KnockoutExtenders {
|
||||
paged(target: KnockoutObservableArray<any>, options: KnockoutPagedOptions): KnockoutObservableArray<any>;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/// <reference path="knockout-pre-rendered.d.ts" />
|
||||
|
||||
function initBindingHandler() {
|
||||
ko.bindingHandlers.init = {
|
||||
init: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => {},
|
||||
update: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => {}
|
||||
};
|
||||
}
|
||||
|
||||
function foreachInitBindingHandler() {
|
||||
ko.bindingHandlers.foreachInit = {
|
||||
init: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => { },
|
||||
update: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => { }
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Type definitions for knockout-pre-rendered
|
||||
// Project: https://github.com/ErikSchierboom/knockout-pre-rendered
|
||||
// Definitions by: Erik Schierboom <https://github.com/ErikSchierboom>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../knockout/knockout.d.ts" />
|
||||
|
||||
interface KnockoutBindingHandlers {
|
||||
init: KnockoutBindingHandler;
|
||||
foreachInit: KnockoutBindingHandler;
|
||||
}
|
||||
+1
@@ -10,6 +10,7 @@ interface KnockoutPostBox {
|
||||
publish<T>(topic: string, value?: T): void;
|
||||
defaultComparer<T>(newValue: T, oldValue: T): boolean;
|
||||
serializer: (object: any) => string;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
interface KnockoutObservable<T> {
|
||||
|
||||
Vendored
+3
-4
@@ -248,9 +248,9 @@ interface KnockoutUtils {
|
||||
|
||||
removeDisposeCallback(node: Element, callback: Function): void;
|
||||
|
||||
cleanNode(node: Element): Element;
|
||||
cleanNode(node: Node): Element;
|
||||
|
||||
removeNode(node: Element): void;
|
||||
removeNode(node: Node): void;
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
@@ -281,8 +281,6 @@ interface KnockoutUtils {
|
||||
|
||||
extend(target: Object, source: Object): Object;
|
||||
|
||||
emptyDomNode(domNode: HTMLElement): void;
|
||||
|
||||
moveCleanedNodesToContainerElement(nodes: any[]): HTMLElement;
|
||||
|
||||
cloneNodes(nodesArray: any[], shouldCleanNodes: boolean): any[];
|
||||
@@ -576,6 +574,7 @@ declare module KnockoutComponentTypes {
|
||||
interface Config {
|
||||
viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
|
||||
template: string | Node[]| DocumentFragment | TemplateElement | AMDModule;
|
||||
synchronous?: boolean;
|
||||
}
|
||||
|
||||
interface ComponentConfig {
|
||||
|
||||
@@ -1,34 +1,68 @@
|
||||
/// <reference path="localForage.d.ts" />
|
||||
/// <reference path="localForage.d.ts" />
|
||||
|
||||
declare var localForage: lf.ILocalForage<string>
|
||||
declare var callback: lf.ICallback<string>
|
||||
declare var promise: lf.IPromise<string>
|
||||
declare var localForage: lf.ILocalForage<string>;
|
||||
declare var callback: lf.ICallback<string>;
|
||||
declare var iterateCallback: lf.IIterateCallback<string>;
|
||||
declare var errorCallback: lf.IErrorCallback;
|
||||
declare var keyCallback: lf.IKeyCallback;
|
||||
declare var keysCallback: lf.IKeysCallback;
|
||||
declare var numberCallback: lf.INumberCallback;
|
||||
declare var promise: lf.IPromise<string>;
|
||||
|
||||
() => {
|
||||
localForage.clear()
|
||||
localForage.length
|
||||
localForage.key(0)
|
||||
localForage.clear((err: any) => {
|
||||
var newError: any = err;
|
||||
});
|
||||
|
||||
localForage.iterate((str: string, key: string, num: number) => {
|
||||
var newStr: string = str;
|
||||
var newKey: string = key;
|
||||
var newNum: number = num;
|
||||
});
|
||||
|
||||
localForage.length((err: any, num: number) => {
|
||||
var newError: any = err;
|
||||
var newNumber: number = num;
|
||||
});
|
||||
|
||||
localForage.key(0,(err: any, value: string) => {
|
||||
var newError: any = err;
|
||||
var newValue: string = value;
|
||||
});
|
||||
|
||||
localForage.keys((err: any, keys: Array<string>) => {
|
||||
var newError: any = err;
|
||||
var newArray: Array<string> = keys;
|
||||
});
|
||||
|
||||
localForage.getItem("key",(err: any, str: string) => {
|
||||
var newError: any = err;
|
||||
var newStr: string = str
|
||||
});
|
||||
|
||||
localForage.getItem("key").then((err: any, str: string) => {
|
||||
var newError: any = err;
|
||||
var newStr: string = str
|
||||
});
|
||||
|
||||
localForage.getItem("key", (str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
localForage.getItem("key").then((str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
localForage.setItem("key", "value",(err: any, str: string) => {
|
||||
var newError: any = err;
|
||||
var newStr: string = str
|
||||
});
|
||||
|
||||
localForage.setItem("key", "value").then((err: any, str: string) => {
|
||||
var newError: any = err;
|
||||
var newStr: string = str;
|
||||
});
|
||||
|
||||
localForage.setItem("key", "value", (str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
localForage.setItem("key", "value").then((str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
localForage.removeItem("key",(err: any) => {
|
||||
var newError: any = err;
|
||||
});
|
||||
|
||||
localForage.removeItem("key").then((err: any, str: string) => {
|
||||
var newError: any = err;
|
||||
var newStr: string = str
|
||||
});
|
||||
|
||||
localForage.removeItem("key", (str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
localForage.removeItem("key").then((str: string) => {
|
||||
var newStr: string = str
|
||||
})
|
||||
|
||||
promise.then(callback)
|
||||
promise.then(callback);
|
||||
}
|
||||
|
||||
Vendored
+54
-7
@@ -1,23 +1,70 @@
|
||||
// Type definitions for Mozilla's localForage
|
||||
// Type definitions for Mozilla's localForage
|
||||
// Project: https://github.com/mozilla/localforage
|
||||
// Definitions by: david pichsenmeister <https://github.com/3x14159265>
|
||||
// Definitions by: yuichi david pichsenmeister <https://github.com/3x14159265>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module lf {
|
||||
interface ILocalForage<T> {
|
||||
clear(): void
|
||||
key(index: number): T
|
||||
length: number
|
||||
/**
|
||||
* Removes every key from the database, returning it to a blank slate.
|
||||
*/
|
||||
clear(callback: IErrorCallback): void
|
||||
/**
|
||||
* Iterate over all value/key pairs in datastore.
|
||||
*/
|
||||
iterate(iterateCallback: IIterateCallback<T>): void
|
||||
/**
|
||||
* Get the name of a key based on its ID.
|
||||
*/
|
||||
key(keyIndex: number, callback: IKeyCallback): void
|
||||
/**
|
||||
* Get the list of all keys in the datastore.
|
||||
*/
|
||||
keys(callback: IKeysCallback): void;
|
||||
/**
|
||||
* Gets the number of keys in the offline store (i.e. its “length”).
|
||||
*/
|
||||
length(callback: INumberCallback): void
|
||||
/**
|
||||
* Gets an item from the storage library and supplies the result to a callback.
|
||||
* If the key does not exist, getItem() will return null.
|
||||
*/
|
||||
getItem(key: string, callback: ICallback<T>): void
|
||||
getItem(key: string): IPromise<T>
|
||||
/**
|
||||
* Saves data to an offline store.
|
||||
*/
|
||||
setItem(key: string, value: T, callback: ICallback<T>): void
|
||||
setItem(key: string, value: T): IPromise<T>
|
||||
removeItem(key: string, callback: ICallback<T>): void
|
||||
/**
|
||||
* Removes the value of a key from the offline store.
|
||||
*/
|
||||
removeItem(key: string, callback: IErrorCallback): void
|
||||
removeItem(key: string): IPromise<T>
|
||||
}
|
||||
|
||||
interface ICallback<T> {
|
||||
(data: T): void
|
||||
(err: any, value: T): void
|
||||
}
|
||||
|
||||
interface IIterateCallback<T> {
|
||||
(value: T, key: string, iterationNumber: number): void
|
||||
}
|
||||
|
||||
interface IErrorCallback {
|
||||
(err: any): void
|
||||
}
|
||||
|
||||
interface IKeyCallback {
|
||||
(err: any, keyName: string): void
|
||||
}
|
||||
|
||||
interface IKeysCallback {
|
||||
(err: any, keys: Array<string>): void
|
||||
}
|
||||
|
||||
interface INumberCallback {
|
||||
(err: any, numberOfKeys: number): void
|
||||
}
|
||||
|
||||
interface IPromise<T> {
|
||||
|
||||
+48
-8
@@ -39,6 +39,10 @@ interface IKey {
|
||||
code: number;
|
||||
}
|
||||
|
||||
interface IDictionary<T> {
|
||||
[index: string]: T;
|
||||
}
|
||||
|
||||
var foodsOrganic: IFoodOrganic[] = [
|
||||
{ name: 'banana', organic: true },
|
||||
{ name: 'beet', organic: false },
|
||||
@@ -61,7 +65,10 @@ var stoogesAges: IStoogesAge[] = [
|
||||
{ 'name': 'moe', 'age': 40 },
|
||||
{ 'name': 'larry', 'age': 50 }
|
||||
];
|
||||
|
||||
var stoogesAgesDict: IDictionary<IStoogesAge> = {
|
||||
first: { 'name': 'moe', 'age': 40 },
|
||||
second: { 'name': 'larry', 'age': 50 }
|
||||
};
|
||||
var stoogesCombined: IStoogesCombined[] = [
|
||||
{ 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] },
|
||||
{ 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] }
|
||||
@@ -264,8 +271,14 @@ result = <IFoodType[]>_.last(foodsType, { 'type': 'vegetable' });
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
result = <{ [key: string]: any }>_.zipObject(['moe', 'larry'], [30, 40]);
|
||||
result = <{ [key: string]: any }>_.object(['moe', 'larry'], [30, 40]);
|
||||
result = <_.Dictionary<any>>_.zipObject(['moe', 'larry'], [30, 40]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_(['moe', 'larry']).zipObject([30, 40]);
|
||||
result = <_.Dictionary<any>>_.object(['moe', 'larry'], [30, 40]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_(['moe', 'larry']).object([30, 40]);
|
||||
result = <_.Dictionary<any>>_.zipObject([['moe', 30], ['larry', 40]]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]]).zipObject();
|
||||
result = <_.Dictionary<any>>_.object([['moe', 30], ['larry', 40]]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]]).object();
|
||||
|
||||
result = <number[]>_.pull([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
@@ -501,6 +514,23 @@ result = <_.LoDashWrapper<number>>_([4, 2, 8, 6]).min();
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).min(function (stooge) { return stooge.age; });
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).min('age');
|
||||
|
||||
result = <number>_.sum([4, 2, 8, 6]);
|
||||
result = <number>_.sum([4, 2, 8, 6], function(v) { return v; });
|
||||
result = <number>_.sum({a: 2, b: 4});
|
||||
result = <number>_.sum({a: 2, b: 4}, function(v) { return v; });
|
||||
result = <number>_.sum(stoogesAges, function (stooge) { return stooge.age; });
|
||||
result = <number>_.sum(stoogesAges, 'age');
|
||||
result = <number>_.sum(stoogesAgesDict, function(stooge) { return stooge.age; });
|
||||
result = <number>_.sum(stoogesAgesDict, 'age');
|
||||
result = <number>_([4, 2, 8, 6]).sum();
|
||||
result = <number>_([4, 2, 8, 6]).sum(function(v) { return v; });
|
||||
result = <number>_({a: 2, b: 4}).sum();
|
||||
result = <number>_({a: 2, b: 4}).sum(function(v) { return v; });
|
||||
result = <number>_(stoogesAges).sum(function (stooge) { return stooge.age; });
|
||||
result = <number>_(stoogesAges).sum('age');
|
||||
result = <number>_(stoogesAgesDict).sum(function (stooge) { return stooge.age; });
|
||||
result = <number>_(stoogesAgesDict).sum('age');
|
||||
|
||||
result = <string[]>_.pluck(stoogesAges, 'name');
|
||||
result = <string[]>_(stoogesAges).pluck('name').value();
|
||||
|
||||
@@ -611,6 +641,12 @@ result = <IStoogesCombined[]>_.where(stoogesCombined, { 'quotes': ['Poifect!'] }
|
||||
result = <IStoogesCombined[]>_(stoogesCombined).where({ 'age': 40 }).value();
|
||||
result = <IStoogesCombined[]>_(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value();
|
||||
|
||||
/********
|
||||
* Date *
|
||||
********/
|
||||
|
||||
result = <number>_.now();
|
||||
|
||||
/*************
|
||||
* Functions *
|
||||
*************/
|
||||
@@ -634,12 +670,16 @@ _.forEach(saves, function (type) {
|
||||
asyncSave({ 'type': type, 'complete': done });
|
||||
});
|
||||
|
||||
var funcBind = function (greeting: string) { return greeting + ' ' + this.name };
|
||||
var funcBind2: () => any = _.bind(funcBind, { 'name': 'moe' }, 'hi');
|
||||
funcBind2();
|
||||
var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; };
|
||||
var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi');
|
||||
funcBound1('!');
|
||||
|
||||
var funcBind3: () => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value();
|
||||
funcBind3();
|
||||
var funcBound2: (punctuation: string) => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value();
|
||||
funcBound2('!');
|
||||
|
||||
var addTwoNumbers = function (x: number, y: number) { return x + y };
|
||||
var plusTwo = _.bind(addTwoNumbers, null, 2);
|
||||
plusTwo(100);
|
||||
|
||||
var view = {
|
||||
'label': 'docs',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user