Merge branch 'master' of github.com:borisyankov/DefinitelyTyped

This commit is contained in:
Phips Peter
2015-02-04 22:26:08 -08:00
45 changed files with 2012 additions and 202 deletions
+28 -7
View File
@@ -2,6 +2,7 @@
This document generated by [dt-contributors-generator](https://github.com/vvakame/dt-contributors-generator).
(but run scripts are manual operation. please wait :P)
* [:link:](acc-wizard/acc-wizard.d.ts) [acc-wizard](https://github.com/sathomas/acc-wizard) by [Cyril Schumacher](https://github.com/cyrilschumacher)
* [:link:](accounting/accounting.d.ts) [accounting.js](http://josscrowcroft.github.io/accounting.js) by [Sergey Gerasimov](https://github.com/gerich-home)
* [:link:](ace/ace.d.ts) [Ace Ajax.org Cloud9 Editor](http://ace.ajax.org) by [Diullei Gomes](https://github.com/Diullei)
* [:link:](add2home/add2home.d.ts) [add2home](http://cubiq.org/add-to-home-screen) by [James Wilkins](http://www.codeplex.com/site/users/view/jamesnw)
@@ -73,10 +74,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](bootstrap-notify/bootstrap-notify.d.ts) [bootstrap-notify](https://github.com/Nijikokun/bootstrap-notify) by [Blake Niemyjski](https://github.com/niemyjski)
* [:link:](bootstrap.datepicker/bootstrap.datepicker.d.ts) [bootstrap.datepicker](https://github.com/eternicode/bootstrap-datepicker) by [Boris Yankov](https://github.com/borisyankov)
* [:link:](bootstrap.paginator/bootstrap.paginator.d.ts) [bootstrap.paginator](https://github.com/lyonlai/bootstrap-paginator) by [derikwhittaker](https://github.com/derikwhittaker)
* [:link:](box2d/box2dweb.d.ts) [bootstrap.timepicker](http://code.google.com/p/box2dweb) by [jbaldwin](https://github.com/jbaldwin)
* [:link:](bootstrap.timepicker/bootstrap.timepicker.d.ts) [bootstrap.timepicker](https://github.com/jdewit/bootstrap-timepicker) by [derikwhittaker](https://github.com/derikwhittaker)
* [:link:](box2d/box2dweb.d.ts) [bootstrap.timepicker](http://code.google.com/p/box2dweb) by [jbaldwin](https://github.com/jbaldwin)
* [:link:](breeze/breeze.d.ts) [Breeze](http://www.breezejs.com) by [Boris Yankov](https://github.com/borisyankov), [IdeaBlade](https://github.com/IdeaBlade/Breeze)
* [:link:](browser-harness/browser-harness.d.ts) [Browser Harness](https://github.com/scriby/browser-harness) by [Chris Scribner](https://github.com/scriby)
* [:link:](browser-sync/browser-sync.d.ts) [browser-sync](http://www.browsersync.io) by [Asana](https://asana.com)
* [:link:](browserify/browserify.d.ts) [Browserify](http://browserify.org) by [Andrew Gaspar](https://github.com/AndrewGaspar)
* [:link:](bucks/bucks.d.ts) [bucks.js](https://github.com/CyberAgent/bucks.js) by [Shunsuke Ohtani](https://github.com/zaneli)
* [:link:](buffer-equal/buffer-equal.d.ts) [buffer-equal](https://github.com/substack/node-buffer-equal) by [Bart van der Schoor](https://github.com/Bartvds)
@@ -136,6 +138,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](debug/debug.d.ts) [debug](https://github.com/visionmedia/debug) by [Seon-Wook Park](https://github.com/swook)
* [:link:](deep-diff/deep-diff.d.ts) [deep-diff](https://github.com/flitbit/diff) by [ZauberNerd](https://github.com/ZauberNerd)
* [:link:](deep-freeze/deep-freeze.d.ts) [deep-freeze](https://github.com/substack/deep-freeze) by [Bart van der Schoor](https://github.com/Bartvds)
* [:link:](del/del.d.ts) [del](https://github.com/sindresorhus/del) by [Asana](https://asana.com)
* [: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)
@@ -153,6 +156,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](doublearray/doublearray.d.ts) [doublearray](https://github.com/takuyaa/doublearray) by [MIZUSHIMA Junki](https://github.com/mzsm)
* [:link:](dropboxjs/dropboxjs.d.ts) [dropbox-js](https://github.com/dropbox/dropbox-js) by [Steve Fenton](https://github.com/Steve-Fenton), [Pedro Casaubon](https://github.com/xperiments)
* [:link:](dropzone/dropzone.d.ts) [Dropzone](http://www.dropzonejs.com) by [Natan Vivo](https://github.com/nvivo)
* [:link:](dts-bundle/dts-bundle.d.ts) [dts-bundle](https://github.com/TypeStrong/dts-bundle) by [Asana](https://asana.com)
* [:link:](durandal/durandal.d.ts) [Durandal](http://durandaljs.com) by [Blue Spire](https://github.com/BlueSpire)
* [:link:](easeljs/easeljs.d.ts) [EaselJS](http://www.createjs.com/#!/EaselJS) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist)
* [:link:](easy-table/easy-table.d.ts) [easy-table](https://github.com/eldargab/easy-table) by [Bart van der Schoor](https://github.com/Bartvds)
@@ -167,7 +171,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](emscripten/emscripten.d.ts) [Emscripten](http://kripken.github.io/emscripten-site/index.html) by [Kensuke Matsuzaki](https://github.com/zakki)
* [:link:](epiceditor/epiceditor.d.ts) [EpicEditor](http://epiceditor.com) by [Boris Yankov](https://github.com/borisyankov)
* [:link:](errorhandler/errorhandler.d.ts) [errorhandler](https://github.com/expressjs/errorhandler) by [Santi Albo](https://github.com/santialbo)
* [:link:](es6-promise/es6-promise.d.ts) [es6-promise](https://github.com/jakearchibald/ES6-Promise) by [François de Campredon](https://github.com/fdecampredon)
* [:link:](es6-promise/es6-promise.d.ts) [es6-promise](https://github.com/jakearchibald/ES6-Promise) by [François de Campredon](https://github.com/fdecampredon), [vvakame](https://github.com/vvakame)
* [:link:](esprima/esprima.d.ts) [Esprima](http://esprima.org) by [teppeis](https://github.com/teppeis)
* [:link:](eventemitter2/eventemitter2.d.ts) [EventEmitter2](https://github.com/asyncly/EventEmitter2) by [ryiwamoto](https://github.com/ryiwamoto)
* [:link:](exit/exit.d.ts) [exit](https://github.com/cowboy/node-exit) by [Bart van der Schoor](https://github.com/Bartvds)
@@ -226,8 +230,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](google.analytics/ga.d.ts) [Google Analytics (Classic and Universal)](https://developers.google.com/analytics/devguides/collection/gajs) by [Ronnie Haakon Hegelund](http://ronniehegelund.blogspot.dk), [Pat Kujawa](http://patkujawa.com)
* [:link:](gapi/gapi.d.ts) [Google API Client](https://code.google.com/p/google-api-javascript-client) by [Frank M](https://github.com/sgtfrankieboy)
* [:link:](google.feeds/google.feed.api.d.ts) [Google Feed Apis](https://developers.google.com/feed) by [RodneyJT](https://github.com/RodneyJT)
* [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone)
* [:link:](googlemaps/google.maps.d.ts) [Google Geolocation](https://developers.google.com/maps) by [Folia A/S](http://www.folia.dk)
* [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone)
* [:link:](gapi.pagespeedonline/gapi.pagespeedonline.d.ts) [Google Page Speed Online Api](https://developers.google.com/speed/pagespeed) by [Frank M](https://github.com/sgtfrankieboy)
* [:link:](recaptcha/recaptcha.d.ts) [Google Recaptcha](https://www.google.com/recaptcha) by [Brent Jenkins](https://github.com/brentj73)
* [:link:](gapi.translate/gapi.translate.d.ts) [Google Translate API](https://developers.google.com/translate) by [Frank M](https://github.com/sgtfrankieboy)
@@ -240,8 +244,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](gridfs-stream/gridfs-stream.d.ts) [gridfs-stream](https://github.com/aheckmann/gridfs-stream) by [Lior Mualem](https://github.com/liorm)
* [:link:](gruntjs/gruntjs.d.ts) [Grunt 0.4.x](http://gruntjs.com) by [Jeff May](https://github.com/jeffmay), [Basarat Ali Syed](https://github.com/basarat)
* [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com)
* [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com)
* [:link:](gulp-gh-pages/gulp-gh-pages.d.ts) [gulp-gh-pages](https://github.com/rowoot/gulp-gh-pages) by [Asana](https://asana.com)
* [:link:](gulp-if/gulp-if.d.ts) [gulp-if](https://github.com/robrich/gulp-if) by [Asana](https://asana.com)
* [:link:](gulp-istanbul/gulp-istanbul.d.ts) [gulp-istanbul](https://github.com/SBoudrias/gulp-istanbul) by [Asana](https://asana.com)
* [:link:](gulp-mocha/gulp-mocha.d.ts) [gulp-mocha](https://github.com/sindresorhus/gulp-mocha) by [Asana](https://asana.com)
* [:link:](gulp-rename/gulp-rename.d.ts) [gulp-rename](https://github.com/hparra/gulp-rename) by [Asana](https://asana.com)
* [:link:](gulp-replace/gulp-replace.d.ts) [gulp-replace](https://github.com/lazd/gulp-replace) by [Asana](https://asana.com)
* [:link:](gulp-sass/gulp-sass.d.ts) [gulp-sass](https://github.com/dlmanning/gulp-sass) by [Asana](https://asana.com)
* [:link:](gulp-sourcemaps/gulp-sourcemaps.d.ts) [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) by [Asana](https://asana.com)
* [:link:](gulp-tslint/gulp-tslint.d.ts) [gulp-tslint](https://github.com/panuhorsmalahti/gulp-tslint) by [Asana](https://asana.com)
* [:link:](gulp-typedoc/gulp-typedoc.d.ts) [gulp-typedoc](https://github.com/rogierschouten/gulp-typedoc) by [Asana](https://asana.com)
* [:link:](gulp-typescript/gulp-typescript.d.ts) [gulp-typescript](https://github.com/ivogabe/gulp-typescript) by [Asana](https://asana.com)
* [:link:](gulp-util/gulp-util.d.ts) [gulp-util v3.0.x](https://github.com/gulpjs/gulp-util) by [jedmao](https://github.com/jedmao)
* [:link:](hammerjs/hammerjs.d.ts) [Hammer.js](http://hammerjs.github.io) by [Philip Bulley](https://github.com/milkisevil)
* [:link:](hammerjs/hammerjs.d.ts) [Hammer.js](http://hammerjs.github.io) by [Philip Bulley](https://github.com/milkisevil), [Han Lin Yap](https://github.com/codler)
* [:link:](handlebars/handlebars.d.ts) [Handlebars](http://handlebarsjs.com) by [Boris Yankov](https://github.com/borisyankov)
* [:link:](hapi/hapi.d.ts) [hapi](http://github.com/spumko/hapi) by [Hakubo](http://github.com/hakubo)
* [:link:](hashmap/hashmap.d.ts) [HashMap](https://github.com/flesler/hashmap) by [Rafał Wrzeszcz](http://wrzasq.pl)
@@ -260,6 +276,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:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT)
* [: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)
* [:link:](imagemagick/imagemagick.d.ts) [imagemagick](http://github.com/rsms/node-imagemagick) by [Carlos Ballesteros Velasco](https://github.com/soywiz)
* [:link:](imap/imap.d.ts) [imap](https://www.npmjs.com/package/imap) by [Peter Snider](https://github.com/psnider)
@@ -276,7 +293,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](ix.js/ix.d.ts) [IxJS 1.0.6 / ix.js](https://github.com/Reactive-Extensions/IxJS) by [Igor Oleinikov](https://github.com/Igorbek)
* [:link:](ix.js/l2o.d.ts) [IxJS 1.0.6 / l2o.js](https://github.com/Reactive-Extensions/IxJS) by [Igor Oleinikov](https://github.com/Igorbek)
* [:link:](jake/jake.d.ts) [jake](https://github.com/mde/jake) by [Kon](http://phyzkit.net)
* [:link:](jasmine/jasmine.d.ts) [Jasmine](http://pivotal.github.com/jasmine) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb)
* [:link:](jasmine/jasmine.d.ts) [Jasmine](http://pivotal.github.com/jasmine) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb), [David Pärsson](https://github.com/davidparsson)
* [:link:](jasmine-data_driven_tests/jasmine-data_driven_tests.d.ts) [Jasmine Data Driven Tests](https://github.com/gburghardt/jasmine-data_driven_tests) by [Anthony MacKinnon](https://github.com/AnthonyMacKinnon)
* [:link:](jasmine-fixture/jasmine-fixture.d.ts) [Jasmine-fixture](https://github.com/searls/jasmine-fixture) by [Craig Brett](https://github.com/craigbrett17)
* [:link:](jasmine-jquery/jasmine-jquery.d.ts) [Jasmine-JQuery](https://github.com/velesin/jasmine-jquery) by [Gregor Stamac](https://github.com/gstamac)
@@ -325,6 +342,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](jquery.colorbox/jquery.colorbox.d.ts) [jQuery.Colorbox](http://www.jacklmoore.com/colorbox) by [Gidon Junge](https://github.com/gjunge)
* [:link:](jquery.customSelect/jquery.customSelect.d.ts) [jquery.customSelect.js](http://adam.co/lab/jquery/customselect/) by [adamcoulombe](https://github.com/adamcoulombe)
* [:link:](jquery.cycle/jquery.cycle.d.ts) [jQuery.cycle.js](http://jquery.malsup.com/cycle) by [François Guillot](http://fguillot.developpez.com)
* [:link:](jquery.dropotron/jquery.dropotron.d.ts) [jquery.dropotron](https://github.com/n33/jquery.dropotron) by [Cyril Schumacher](https://github.com/cyrilschumacher)
* [:link:](jquery.dynatree/jquery.dynatree.d.ts) [jquery.dynatree](http://code.google.com/p/dynatree) by [François de Campredon](https://github.com/fdecampredon)
* [:link:](jquery.fancytree/jquery.fancytree.d.ts) [jquery.fancytree](https://github.com/mar10/fancytree) by [Peter Palotas](https://github.com/alphaleonis)
* [:link:](jquery.finger/jquery.finger.d.ts) [jquery.finger.js](http://ngryman.sh/jquery.finger) by [Max Ackley](https://github.com/maxackley)
@@ -469,8 +487,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](mu2/mu2.d.ts) [mu2](http://github.com/raycmorgan/mu) by [Jeff Goddard](https://github.com/jedigo)
* [:link:](multer/multer.d.ts) [multer](https://github.com/expressjs/multer) by [jt000](https://github.com/jt000)
* [:link:](mustache/mustache.d.ts) [Mustache](https://github.com/janl/mustache.js) by [Mark Ashley Bell](https://github.com/markashleybell)
* [:link:](nconf/nconf.d.ts) [nconf](https://github.com/flatiron/nconf) by [Jeff Goddard](https://github.com/jedigo)
* [:link:](nconf/nconf.d.ts) [nconf](https://github.com/flatiron/nconf) by [Jeff Goddard](https://github.com/jedigo), [Jean-Martin Thibault](https://github.com/jmthibault)
* [:link:](ncp/ncp.d.ts) [ncp](https://github.com/AvianFlu/ncp) by [Bart van der Schoor](https://github.com/bartvds)
* [:link:](nedb/nedb.d.ts) [NeDB](https://github.com/louischatriot/nedb) by [Stefan Steinhart](https://github.com/reppners)
* [:link:](needle/needle.d.ts) [needle](https://github.com/tomas/needle) by [San Chen](https://github.com/bigsan)
* [:link:](nexpect/nexpect.d.ts) [nexpect](https://github.com/nodejitsu/nexpect) by [vvakame](http://github.com/vvakame)
* [:link:](ng-grid/ng-grid.d.ts) [ng-grid](http://angular-ui.github.io/ng-grid) by [Ken Smith](https://github.com/smithkl42), [Roland Zwaga](https://github.com/rolandzwaga), [Kent Cooper](https://github.com/kentcooper)
@@ -502,8 +521,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](nodemailer/nodemailer.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Vincent Bortone](https://github.com/vbortone)
* [:link:](nodeunit/nodeunit.d.ts) [nodeunit](https://github.com/caolan/nodeunit) by [Jeff Goddard](https://github.com/jedigo)
* [:link:](nomnom/nomnom.d.ts) [nomnom](https://github.com/harthur/nomnom) by [Paul Vick](https://github.com/panopticoncentral)
* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker)
* [:link:](notify/notify.d.ts) [Notify.js](https://github.com/jpillora/notifyjs) by [Xiaohan Zhang](https://github.com/hellochar)
* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker)
* [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42)
* [:link:](npm/npm.d.ts) [npm](https://github.com/npm/npm) by [Maxime LUCE](https://github.com/SomaticIT)
* [:link:](nprogress/nprogress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com)
@@ -714,12 +733,14 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [: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)
* [:link:](vinyl-fs/vinyl-fs.d.ts) [vinyl-fs](https://github.com/wearefractal/vinyl-fs) by [vvakame](https://github.com/vvakame)
* [:link:](vinyl-source-stream/vinyl-source-stream.d.ts) [vinyl-source-stream](https://github.com/hughsk/vinyl-source-stream) by [Asana](https://asana.com)
* [:link:](vue/vue.d.ts) [vuejs](https://github.com/yyx990803/vue) by [odangosan](https://github.com/odangosan)
* [:link:](watch/watch.d.ts) [watch](https://github.com/mikeal/watch) by [Carlos Ballesteros Velasco](https://github.com/soywiz)
* [:link:](jquery.watermark/jquery.watermark.d.ts) [Watermark plugin for jQuery](http://jquery-watermark.googlecode.com) by [Anwar Javed](https://github.com/anwarjaved)
* [:link:](webaudioapi/waa.d.ts) [Web Audio API](http://www.w3.org/TR/webaudio) by [Baruch Berger](https://github.com/bbss), [Kon](http://phyzkit.net), [kubosho](https://github.com/kubosho)
* [:link:](webaudioapi/waa-nightly.d.ts) [Web Audio API (nightly)](http://www.w3.org/TR/2012/WD-webaudio-20120802) by [Baruch Berger](https://github.com/bbss)
* [:link:](webmidi/webmidi.d.ts) [Web MIDI API](http://www.w3.org/TR/webmidi) by [Toshiya Nakakura](https://github.com/nakakura)
* [:link:](webspeechapi/webspeechapi.d.ts) [Web Speech API](https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html) by [SaschaNaz](https://github.com/saschanaz)
* [:link:](webcola/webcola.d.ts) [webcola](https://github.com/tgdwyer/WebCola) by [Qinfeng Chen](https://github.com/qinfchen)
* [:link:](webcrypto/WebCrypto.d.ts) [WebCrypto](http://www.w3.org/TR/WebCryptoAPI) by [Lucas Dixon](https://github.com/iislucas)
* [:link:](webrtc/MediaStream.d.ts) [WebRTC](http://dev.w3.org/2011/webrtc) by [Ken Smith](https://github.com/smithkl42)
+36
View File
@@ -0,0 +1,36 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="acc-wizard.d.ts" />
/**
* @summary Test for "accwizard" without options.
*/
function testBasic() {
$('#test').accwizard();
}
/**
* @summary Test for "accwizard" with options.
*/
function testWithOptions() {
var options: AccWizardOptions = {
addButtons: true,
sidebar: '.acc-wizard-sidebar',
activeClass: 'acc-wizard-active',
completedClass: 'acc-wizard-completed',
todoClass: 'acc-wizard-todo',
stepClass: 'acc-wizard-step',
nextText: 'Next Step',
backText: 'Go Back',
nextType: 'submit',
backType: 'reset',
nextClasses: 'btn btn-primary',
backClasses: 'btn',
autoScrolling: true,
onNext: function() {},
onBack: function() {},
onInit: function() {},
onDestroy: function() {}
};
$('#test').accwizard(options);
}
+101
View File
@@ -0,0 +1,101 @@
// Type definitions for acc-wizard
// Project: https://github.com/sathomas/acc-wizard
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface AccWizardOptions {
/**
* @summary Add next/prev buttons to panels.
* @type {boolean}
*/
addButtons: boolean;
/**
* @summary Selector for task sidebar.
* @type {string}
*/
sidebar: string;
/**
* @summary Class to indicate the active task in sidebar.
* @type {string}
*/
activeClass: string;
/**
* @summary Class to indicate task is complete.
* @type {string}
*/
completedClass: string;
/**
* @summary Class to indicate task is still pending.
* @type {string}
*/
todoClass: string;
/**
* @summary Class for step buttons within panels.
* @type {string}
*/
stepClass: string;
/**
* @summary Text for next button.
* @type {string}
*/
nextText: string;
/**
* @summary Text for back button
* @type {string}
*/
backType: string;
/**
* @summary Class(es) for next button.
* @type {string}
*/
nextClasses: string;
/**
* @summary Class(es) for back button.
* @type {string}
*/
backClasses: string;
/**
* @summary Auto-scrolling.
* @type {boolean}
*/
autoScrolling: boolean;
/**
* @summary Function to call on next step.
*/
onNext: Function;
/**
* @summary Function to call on back up.
*/
onBack: Function;
/**
* @summary A chance to hook initialization.
*/
onInit: Function;
/**
* @summary A chance to hook destruction.
*/
onDestroy: Function;
}
/**
* @summary Interface for "acc-wizard" JQuery plugin.
* @author Cyril Schumacher
* @version 1.0
*/
interface JQuery {
accwizard(options?: AccWizardOptions): void;
}
+1
View File
@@ -0,0 +1 @@
--noImplicitAny
@@ -19,8 +19,17 @@ declare module Microsoft.WindowsAzure {
logout(): void;
getTable(tableName: string): MobileServiceTable;
withFilter(serviceFilter: (request: any, next: (request: any, callback: (error:any, response: any) => void ) => void, callback: (error: any, response: any) => void ) => void ) : MobileServiceClient;
invokeApi(apiName: string, options?:InvokeApiOptions): asyncPromise;
}
interface InvokeApiOptions
{
method?: string;
body?: any;
headers?: Object;
parameters?: Object;
}
// User object based on Microsoft Azure documentation: http://msdn.microsoft.com/en-us/library/windowsazure/jj554220.aspx
interface User {
getIdentities(): any;// { [providerName: string]: { userId: string, accessToken: string, accessTokenSecret?: string }; };
+22 -80
View File
@@ -2269,49 +2269,36 @@ declare module chrome.webRequest {
file?: string;
}
interface OnCompletedDetails {
interface WebRequestCallbackDetails {
requestId: string;
url: string;
method: string;
tabId: number;
frameId: number;
parentFrameId: number;
timeStamp: number;
type: string;
}
interface OnCompletedDetails extends WebRequestCallbackDetails {
ip?: string;
statusLine?: string;
frameId: number;
responseHeaders?: HttpHeader[];
parentFrameId: number;
fromCache: boolean;
url: string;
timeStamp: number;
requestId: string;
type: string;
method: string;
fromCache: boolean;
statusCode: number;
}
interface OnHeadersReceivedDetails {
tabId: number;
parentFrameId: number;
url: string;
timeStamp: number;
interface OnHeadersReceivedDetails extends WebRequestCallbackDetails {
statusLine?: string;
frameId: number;
requestId: string;
responseHeaders?: HttpHeader[];
type: string;
method: string;
}
interface OnBeforeRedirectDetails {
tabId: number;
interface OnBeforeRedirectDetails extends WebRequestCallbackDetails {
ip?: string;
statusLine?: string;
frameId: number;
responseHeaders?: HttpHeader[];
parentFrameId: number;
fromCache: boolean;
url: string;
timeStamp: number;
requestId: string;
redirectUrl: string;
type: string;
method: string;
statusCode: number;
}
@@ -2320,75 +2307,35 @@ declare module chrome.webRequest {
port: number;
}
interface OnAuthRequiredDetails {
tabId: number;
interface OnAuthRequiredDetails extends WebRequestCallbackDetails {
statusLine?: string;
frameId: number;
challenger: Challenger;
responseHeaders?: HttpHeader[];
isProxy: boolean;
realm?: string;
parentFrameId: number;
url: string;
timeStamp: number;
requestId: string;
scheme: string;
type: string;
method: string;
}
interface OnBeforeSendHeadersDetails {
tabId: number;
parentFrameId: number;
url: string;
timeStamp: number;
frameId: number;
requestId: number;
interface OnBeforeSendHeadersDetails extends WebRequestCallbackDetails {
requestHeaders?: HttpHeader[];
type: string;
method: string;
}
interface OnErrorOccurredDetails {
tabId: number;
interface OnErrorOccurredDetails extends WebRequestCallbackDetails {
ip?: string;
frameId: number;
parentFrameId: number;
fromCache: boolean;
url: string;
timeStamp: number;
requestId: string;
error: string;
type: string;
method: string;
}
interface OnResponseStartedDetails {
tabId: number;
interface OnResponseStartedDetails extends WebRequestCallbackDetails {
ip?: string;
statusLine?: string;
frameId: number;
responseHeaders?: HttpHeader[];
parentFrameId: number;
fromCache: boolean;
url: string;
timeStamp: number;
requestId: string;
type: string;
method: string;
statusCode: number;
}
interface OnSendHeadersDetails {
tabId: number;
parentFrameId: number;
url: string;
timeStamp: number;
frameId: number;
requestId: string;
interface OnSendHeadersDetails extends WebRequestCallbackDetails {
requestHeaders?: HttpHeader[];
type: string;
method: string;
}
interface RequestBody {
@@ -2397,13 +2344,8 @@ declare module chrome.webRequest {
formData?: Object;
}
interface OnBeforeRequestDetails {
tabId: number;
parentFrameId: number;
url: string;
timeStamp: number;
frameId: number;
requestBody: RequestBody;
interface OnBeforeRequestDetails extends WebRequestCallbackDetails {
requestBody?: RequestBody;
}
interface WebRequestCompletedEvent extends chrome.events.Event {
@@ -2422,7 +2364,7 @@ declare module chrome.webRequest {
}
interface WebRequestAuthRequiredEvent extends chrome.events.Event {
addListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]) => void): void;
addListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
removeListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void) => void): void;
}
+14
View File
@@ -179,6 +179,20 @@ file.download('http://some.server.com/download.php',
{ headers: null },
true);
file.upload('cdvfile://localhost/persistent/path/to/downloads/',
'http://some.server.com/download.php',
(result: FileUploadResult)=> { console.log('File uploaded. Bytes uploaded: ' + result.bytesSent); },
(err: FileTransferError) => {
console.error('Error ' + err.code);
if (err.exception) {
console.error('Failed with exception ' + err.exception);
}
},
{ headers: null, httpMethod: "PUT" },
true);
file.abort();
file.abort();
-2
View File
@@ -18,8 +18,6 @@ interface Device {
* by the device manufacturer and may be different across versions of the same product.
*/
model: string;
/** device.name is deprecated as of version 2.3.0. Use device.model instead. */
name: string;
/** Get the device's operating system name. */
platform: string;
/** Get the device's Universally Unique Identifier (UUID). */
+6 -2
View File
@@ -84,6 +84,8 @@ interface FileUploadOptions {
fileKey?: string;
/** The file name to use when saving the file on the server. Defaults to image.jpg. */
fileName?: string;
/** The HTTP method to use - either `PUT` or `POST`. Defaults to `POST`. */
httpMethod?: string;
/** The mime type of the data to upload. Defaults to image/jpeg. */
mimeType?: string;
/** A set of optional key/value pairs to pass in the HTTP request. */
@@ -108,6 +110,7 @@ interface FileTransferError {
* FileTransferError.INVALID_URL_ERR
* FileTransferError.CONNECTION_ERR
* FileTransferError.ABORT_ERR
* FileTransferError.NOT_MODIFIED_ERR
*/
code: number;
/** URL to the source. */
@@ -116,8 +119,8 @@ interface FileTransferError {
target: string;
/** HTTP status code. This attribute is only available when a response code is received from the HTTP connection. */
http_status: number;
/* Request body */
body: any;
/* Response body. This attribute is only available when a response is received from the HTTP connection. */
body: string;
/* Exception that is thrown by native code */
exception: any;
}
@@ -129,4 +132,5 @@ declare var FileTransferError: {
INVALID_URL_ERR: number;
CONNECTION_ERR: number;
ABORT_ERR: number;
NOT_MODIFIED_ERR: number;
}
+23 -15
View File
@@ -173,6 +173,11 @@ declare module jquery.flot {
y: number;
}
interface offset {
left: number;
top: number;
}
interface canvasPoint {
top: number;
left: number;
@@ -188,26 +193,29 @@ declare module jquery.flot {
}
interface axis extends axisOptions {
p2c(point):canvasPoint;
c2p(canvasPoint):point;
options: axisOptions;
p2c(point: point):canvasPoint;
c2p(canvasPoint: canvasPoint):point;
}
interface plot {
highlight(series: dataSeries, datapoint: item);
unhightlight();
unhighlight(series: dataSeries, datapoint: item);
setData(data: any);
setupGrid();
draw();
triggerRedrawOverlay();
width();
height();
offset();
pointOffset(point: point);
resize();
shutdown();
highlight(series: dataSeries, datapoint: item): void;
unhightlight(): void;
unhighlight(series: dataSeries, datapoint: item): void;
setData(data: any): void;
setupGrid(): void;
draw(): void;
triggerRedrawOverlay(): void;
width(): number;
height(): number;
offset(): JQueryCoordinates;
pointOffset(point: point): offset;
resize(): void;
shutdown(): void;
getData(): dataSeries[];
getAxes(): axes;
getXAxes(): axis[];
getYAxes(): axis[];
getPlaceholder(): JQuery;
getCanvas(): HTMLCanvasElement;
getPlotOffset(): canvasPoint;
+1
View File
@@ -164,6 +164,7 @@ declare module "fs-extra" {
export function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
export function exists(path: string, callback?: (exists: boolean) => void ): void;
export function existsSync(path: string): boolean;
export function ensureDir(path: string, cb: (err: Error) => void): void;
export interface OpenOptions {
encoding?: string;
+8 -2
View File
@@ -1,10 +1,16 @@
// Type definitions for Hammer.js 2.0.4
// Project: http://hammerjs.github.io/
// Definitions by: Philip Bulley <https://github.com/milkisevil/>
// Definitions by: Philip Bulley <https://github.com/milkisevil/>, Han Lin Yap <https://github.com/codler>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../touch-events/touch-events.d.ts" />
declare var Hammer:HammerStatic;
declare module "Hammer" {
export = Hammer;
}
interface HammerStatic
{
new( element:HTMLElement, options?:any ): HammerManager;
@@ -163,7 +169,7 @@ declare class HammerInput
center:HammerPoint;
/** Source event object, type TouchEvent, MouseEvent or PointerEvent. */
srcEvent:Event; // TODO: Update to Union Type (TouchEvent | MouseEvent | PointerEvent) if it lands in TS1.4
srcEvent:TouchEvent | MouseEvent | PointerEvent;
/** Target that received the event. */
target:HTMLElement;
+9 -9
View File
@@ -136,7 +136,7 @@ interface HighchartsAxisOptions {
tickWidth?: number;
tickmarkPlacement?: string; // "between" or "on"
title?: HighchartsAxisTitle;
type?: string; // "linear", "logarithmic" or "datetime"
type?: string; // "linear", "logarithmic" or "datetime"
}
interface HighchartsExtremes {
@@ -175,7 +175,7 @@ interface HighchartsColorOrGradient {
cx: number; cy: number; r: number;
};
stops?: any[][];
brighten?(amount: number): HighchartsColorOrGradient;
get?(type: string): string;
}
@@ -986,10 +986,10 @@ interface HighchartsAxisObject {
}
interface HighchartsChartObject {
addSeries(options: HighchartsSeriesOptions): HighchartsSeriesOptions;
addSeries(options: HighchartsSeriesOptions, redraw: boolean): HighchartsSeriesOptions;
addSeries(options: HighchartsSeriesOptions, redraw: boolean, animation: boolean): HighchartsSeriesOptions;
addSeries(options: HighchartsSeriesOptions, redraw: boolean, animation: HighchartsAnimation): HighchartsSeriesOptions;
addSeries(options: HighchartsSeriesOptions, redraw?: boolean, animation?: boolean): HighchartsSeriesOptions;
addSeries(options: HighchartsSeriesOptions, redraw?: boolean, animation?: HighchartsAnimation): HighchartsSeriesOptions;
addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: boolean): HighchartsAxisObject;
addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: HighchartsAnimation): HighchartsAxisObject;
container: HTMLElement;
destroy(): void;
exportChart(): void;
@@ -1057,7 +1057,7 @@ interface HighchartsStatic {
numberFormat(value: number, decimals?: number, decimalPoint?: string, thousandsSep?: string): string;
setOptions(options: HighchartsOptions): HighchartsOptions;
getOptions(): HighchartsOptions;
map(array: any[], fn: Function): any[];
}
declare var Highcharts: HighchartsStatic;
@@ -1103,9 +1103,9 @@ interface HighchartsSeriesObject {
select(): void;
select(selected?: boolean): void;
selected: boolean;
setData(data: number[]): void; // [value1,value2, ... ]
setData(data: number[]): void; // [value1,value2, ... ]
setData(data: number[], redraw: boolean): void;
setData(data: number[][]): void; // [[x1,y1],[x2,y2],... ]
setData(data: number[][]): void; // [[x1,y1],[x2,y2],... ]
setData(data: number[][], redraw: boolean): void;
setData(data: HighchartsDataPoint[]): void; // HighchartsDataPoint[]
setData(data: HighchartsDataPoint[], redraw: boolean): void;
+53
View File
@@ -0,0 +1,53 @@
/// <reference path="iban.d.ts" />
/**
* @summary Test for "electronicFormat" method.
*/
function testElectronicFormat() {
var iban: string = 'BE68539007547034';
var format: string = IBAN.electronicFormat(iban);
}
/**
* @summary Test for "fromBBAN" method.
*/
function testFromBBAN() {
var countryCode: string = 'fr';
var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK';
var iban: string = IBAN.fromBBAN(countryCode, bban);
}
/**
* @summary Test for "isValid" method.
*/
function testIsValid() {
var iban: string = 'BE68539007547034';
var valid: boolean = IBAN.isValid(iban);
}
/**
* @summary Test for "isValidBBAN" method.
*/
function testIsValidBBAN() {
var countryCode: string = 'fr';
var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK';
var valid: boolean = IBAN.isValidBBAN(countryCode, bban);
}
/**
* @summary Test for "printFormat" method.
*/
function testPrintFormat() {
var iban: string = 'BE68539007547034';
var separator: string[] = ['fr'];
var format: string = IBAN.printFormat(iban, separator);
}
/**
* @summary Test for "toBBAN" method.
*/
function testToBBAN() {
var iban: string = 'BE68539007547034';
var separator: string[] = ['-'];
var bban: string = IBAN.toBBAN(iban, separator);
}
+60
View File
@@ -0,0 +1,60 @@
// Type definitions for iban.js 0.0.5
// Project: https://github.com/arhs/iban.js/
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module ARHS {
/**
* @summary Interface for {@link IBAN} object.
* @author Cyril Schumacher
* @version 1.0
*/
interface IBANStatic {
/**
* @summary Returns the IBAN in a electronic format.
* @param {string} iban The IBAN to convert.
* @param {string} The IBAN in electronic format.
*/
electronicFormat(iban: string): string;
/**
* @summary Convert the passed BBAN to an IBAN for this country specification.
* @param {string} countryCode The country of the BBAN.
* @param {string} bban The BBAN to convert to IBAN.
* @returns {string} The IBAN.
*/
fromBBAN(countryCode: string, bban: string): string;
/**
* @summary Check if the passed iban is valid according to this specification.
* @param {string} iban The iban to validate.
* @returns {boolean} True if valid, false otherwise.
*/
isValid(iban: string): boolean;
/**
* @summary Check of the passed BBAN is valid.
* @param {string} countryCode The country of the BBAN.
* @param {string} bban The BBAN to validate.
* @returns {boolean} True if valid, false otherwise.
*/
isValidBBAN(countryCode: string, bban: string): boolean;
/**
* @summary Returns the IBAN in a print format.
* @param {string} iban The IBAN to convert.
* @param {string} The IBAN in print format.
*/
printFormat(iban: string, separator: string[]): string;
/**
* @summary Convert the passed IBAN to a country-specific BBAN.
* @param {string} iban The IBAN to convert.
* @param {string[]} Separator the separator to use between BBAN blocks.
* @returns {string} The BBAN
*/
toBBAN(iban: string, separator: string[]): string;
}
}
declare var IBAN: ARHS.IBANStatic;
+1
View File
@@ -0,0 +1 @@
--noImplicitAny
+3 -1
View File
@@ -16,4 +16,6 @@ ip.mask("192.168.0.1", "255.255.255.0");
ip.not("255.255.255.0");
ip.or("192.168.0.1", "255.255.255.0");
var buff:any = ip.toBuffer(myIP);
ip.toString(buff);
ip.toString(buff);
ip.subnet('192.168.1.134', '255.255.255.192');
ip.cidrSubnet('192.168.1.134/26');
Vendored
+24
View File
@@ -5,6 +5,17 @@
interface NodeBuffer { }
interface SubnetInfo {
networkAddress: string;
firstAddress: string;
lastAddress: string;
broadcastAddress: string;
subnetMask: string;
subnetMaskLength: number;
numHosts: number;
length: number;
}
declare module "ip" {
/**
* Check two IP address are the same.
@@ -88,4 +99,17 @@ declare module "ip" {
* Convert an IPv4 IP address from its the long numeric value to a string.
**/
export function fromLong(ip: number): string;
/**
* Get the subnet information.
* @param ip IP address.
* @param subnet Subnet address.
*/
export function subnet(ip: string, subnet: string): SubnetInfo;
/**
* Get the subnet information.
* @param cidr CIDR address.
*/
export function cidrSubnet(cidr: string): SubnetInfo;
}
+54
View File
@@ -400,6 +400,44 @@ describe("A spy, when configured to throw a value", function () {
});
});
describe("A spy, when configured with multiple actions", function () {
var foo: any, bar: any, fetchedBar: any;
beforeEach(function () {
foo = {
setBar: function (value: any) {
bar = value;
},
getBar: function () {
return bar;
}
};
spyOn(foo, 'getBar').and.callThrough().and.callFake(() => {
this.fakeCalled = true;
});
foo.setBar(123);
fetchedBar = foo.getBar();
});
it("tracks that the spy was called", function () {
expect(foo.getBar).toHaveBeenCalled();
});
it("should not effect other functions", function () {
expect(bar).toEqual(123);
});
it("when called returns the requested value", function () {
expect(fetchedBar).toEqual(123);
});
it("should have called the fake implementation", function () {
expect(this.fakeCalled).toEqual(true);
});
});
describe("A spy", function () {
var foo: any, bar: any = null;
@@ -676,6 +714,22 @@ describe("Asynchronous specs", function () {
});
});
describe("Fail", function () {
it("should fail test when called without arguments", function () {
fail();
});
it("should fail test when called with a fail message", function () {
fail("The test failed");
});
it("should fail test when called an error", function () {
fail(new Error("The test failed with this error"));
});
});
(() => {
// from boot.js
var env = jasmine.getEnv();
+7 -5
View File
@@ -1,6 +1,6 @@
// Type definitions for Jasmine 2.1
// Project: http://pivotal.github.com/jasmine/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Theodore Brown <https://github.com/theodorejb>
// Project: http://jasmine.github.io/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Theodore Brown <https://github.com/theodorejb>, David Pärsson <https://github.com/davidparsson/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -33,6 +33,8 @@ declare function afterAll(action: (done: () => void) => void): void;
declare function expect(spy: Function): jasmine.Matchers;
declare function expect(actual: any): jasmine.Matchers;
declare function fail(e?: any): void;
declare function spyOn(object: any, method: string): jasmine.Spy;
declare function runs(asyncMethod: Function): void;
@@ -372,15 +374,15 @@ declare module jasmine {
interface SpyAnd {
/** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */
callThrough(): void;
callThrough(): Spy;
/** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
returnValue(val: any): void;
/** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
callFake(fn: Function): void;
callFake(fn: Function): Spy;
/** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
throwError(msg: string): void;
/** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
stub(): void;
stub(): Spy;
}
interface Calls {
+29 -1
View File
@@ -24,6 +24,7 @@ declare module joint {
getConnectedLinks(cell: Cell, opt?: any): Link[];
disconnectLinks(cell: Cell);
removeLinks(cell: Cell);
findModelsFromPoint(point:{x : number; y: number}):Element[];
}
class Cell extends Backbone.Model {
@@ -95,7 +96,34 @@ declare module joint {
}
module ui { }
module ui {
interface Handle {
name : string;
position : string;
icon: string;
}
class SelectionView extends Backbone.Model {
paper:joint.dia.Paper;
graph:joint.dia.Graph;
model:Backbone.Collection<joint.dia.Cell>;
constructor(opt:{
paper : joint.dia.Paper;
graph : joint.dia.Graph;
model : Backbone.Collection<joint.dia.Cell>
});
createSelectionBox(cellView:joint.dia.CellView);
destroySelectionBox(cellView:joint.dia.CellView);
startSelecting(evt:any);
cancelSelection();
addHandle(handle:Handle);
removeHandle(name:string);
changeHandle(name:string, handle:Handle);
}
}
module shapes {
module basic {
@@ -0,0 +1,42 @@
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="jquery.dropotron.d.ts" />
/**
* @summary Test for "dropotron" without configurations.
*/
function testDropotron() {
var foo: JQuery = $('#main-nav > ul');
foo.dropotron();
}
/**
* @summary Test for "dropotron" with configurations.
*/
function testDropotronConfiguration() {
var config: DropotronConfiguration = {
selectorParent: null,
baseZIndex: 1000,
menuClass: 'dropotron',
expandMode: 'hover',
hoverDelay: 150,
hideDelay: 250,
openerClass: 'opener',
openerActiveClass: 'active',
submenuClassPrefix: 'level-',
mode: 'fade',
speed: 'fast',
easing: 'swing',
alignment: 'left',
offsetX: 0,
offsetY: 0,
globalOffsetY: 0,
IEOffsetX: 0,
IEOffsetY: 0,
noOpenerFade: true,
detach: true,
cloneOnDetach: true
};
var foo: JQuery = $('#main-nav > ul');
foo.dropotron(config);
}
+160
View File
@@ -0,0 +1,160 @@
// Type definitions for jquery.dropotron 1.4.3
// Project: https://github.com/n33/jquery.dropotron
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/borisyankov/DefinitelyTyped/
/**
* @summary Interface for "dropotron" configurations.
* @author Cyril Schumacher
* @version 1.0
*/
interface DropotronConfiguration {
/**
* @summary Alignment ("left", "center", "right").
* @type {string}
*/
alignment: string;
/**
* @summary Base Z-Index.
* @type {number}
*/
baseZIndex: number;
/**
* @summary If true and detach = true, leave original menu intact.
* @type {boolean}
*/
cloneOnDetach: boolean;
/**
* @summary Detach second level menus (prevents parent style bleed).
* @type {boolean}
*/
detach: boolean;
/**
* @summary Easing mode ("swing", "linear").
* @type {string}
*/
easing: string;
/**
* @summary IE Offset X.
* @type {number}
*/
IEOffsetX: number;
/**
* @summary IE Offset Y.
* @type {number}
*/
IEOffsetY: number;
/**
* @summary Expansion mode ("hover" or "click").
* @type {string}
*/
expandMode: string;
/**
* @summary Global offset Y.
* @type {number}
*/
globalOffsetY: number;
/**
* @summary Hide delay (in ms; 0 disables).
* @type {number}
*/
hideDelay: number;
/**
* @summary Hover delay (in ms).
* @type {number}
*/
hoverDelay: number;
/**
* @summary Menu class (assigned to every <ul>).
* @type {string}
*/
menuClass: string;
/**
* @summary Menu mode ("instant", "fade", "slide", "zoom").
* @type {string}
*/
mode: string;
/**
* @summary If true and mode = "fade", prevents top-level opener fade.
* @type {boolean}
*/
noOpenerFade: boolean;
/**
* @summary Submenu offset X.
* @type {number}
*/
offsetX: number;
/**
* @summary Submenu offset Y.
* @type {number}
*/
offsetY: number;
/**
* @summary Active opener class.
* @type {string}
*/
openerActiveClass: string;
/**
* @summary Opener class.
* @type {string}
*/
openerClass: string;
/**
* @summary Parent jQuery object.
* @type {JQuery}
*/
selectorParent: JQuery;
/**
* @summary Menu speed ("fast", "slow", or ms).
* @type {string}
*/
speed: string;
/**
* @summary Submenu class prefix.
* @type {string}
*/
submenuClassPrefix: string;
}
/**
* @summary Interface for "dropotron".
* @author Cyril Schumacher
* @version 1.0
*/
interface Dropotron {
/**
* @summary Adds multilevel dropdown menus to jQuery.
* @param {DropotronConfiguration} config Optional. Configuration.
*/
(config?: DropotronConfiguration): void;
}
/**
* @summary Interface for "JQuery".
* @author Cyril Schumacher
* @version 1.0
*/
interface JQuery {
dropotron: Dropotron;
}
@@ -0,0 +1 @@
--noImplicitAny
+1
View File
@@ -96,6 +96,7 @@ module Marionette.Tests {
constructor() {
super();
this.getOption<string>('foo');
this.triggers = {
'click .foo': 'bar'
};
+8
View File
@@ -231,6 +231,8 @@ declare module Marionette {
* @param optionName the name of the option to retrieve.
*/
getOption(optionName: string): any;
triggerMethod(name: string, ...args: any[]): any;
}
interface RegionConstructionOptions {
@@ -721,6 +723,12 @@ declare module Marionette {
getTemplate(): any;
/**
* Retrieve an object's attribute either directly from the object, or
* from the object's this.options, with this.options taking precedence.
*/
getOption<T>(optionName:string): T;
mixinTemplateHelpers(target?: any): any;
configureTriggers(): any;
+4
View File
@@ -195,6 +195,10 @@ moment.isMoment();
moment.isMoment(new Date());
moment.isMoment(moment());
moment.isDuration();
moment.isDuration(new Date());
moment.isDuration(moment.duration());
moment.localeData('fr');
moment(1316116057189).fromNow();
+4
View File
@@ -195,6 +195,10 @@ moment.isMoment();
moment.isMoment(new Date());
moment.isMoment(moment());
moment.isDuration();
moment.isDuration(new Date());
moment.isDuration(moment.duration());
moment.localeData('fr');
moment(1316116057189).fromNow();
+2
View File
@@ -399,6 +399,8 @@ declare module moment {
invalid(parsingFlags?: Object): Moment;
isMoment(): boolean;
isMoment(m: any): boolean;
isDuration(): boolean;
isDuration(d: any): boolean;
// Deprecated in 2.8.0.
lang(language?: string): string;
+24 -1
View File
@@ -13,6 +13,7 @@ var opts: nconf.IOptions;
var fopts: nconf.IFileOptions;
var store: nconf.IStore;
var callback: (err: Error) => void;
var fmt: nconf.IFormat;
value = nconf.clear(str, callback);
value = nconf.get (str, callback);
@@ -37,7 +38,10 @@ p = nconf.env(opts);
p = nconf.file(str);
p = nconf.file(str, fopts);
p = nconf.file(fopts);
p = nconf.file({
format: fmt,
file: 'jsonFile.custom'
});
p = nconf.use(str);
p = nconf.use(str, opts);
@@ -92,6 +96,18 @@ p = p.env(opts);
p = p.file(str);
p = p.file(str, fopts);
p = p.file(fopts);
p = p.file({
file: 'iniFile.ini',
format: nconf.formats.ini
});
p = p.file({
file: 'jsonFile.json',
format: nconf.formats.json
});
p = p.file({
file: 'jsonFile.custom',
format: fmt
});
p = p.use(str, opts);
p = p.defaults(opts);
@@ -99,3 +115,10 @@ p.init(opts);
p = p.overrides(opts);
p.remove(str);
store = p.create(str, opts);
// - - - - - - - - - - - - - - - - - - - - - - - - -
class CustomFmt implements nconf.IFormat {
stringify(obj: any, replacer: any, spacing?: any): string { return ""; }
parse(str: string): any { return {} }
};
+10 -4
View File
@@ -1,6 +1,6 @@
// Type definitions for nconf
// Project: https://github.com/flatiron/nconf
// Definitions by: Jeff Goddard <https://github.com/jedigo>
// Definitions by: Jeff Goddard <https://github.com/jedigo>, Jean-Martin Thibault <https://github.com/jmthibault>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/nconf.d.ts
@@ -38,9 +38,14 @@ declare module "nconf" {
export function loadFiles(files: any, callback?: ICallbackFunction): void;
export function loadFilesSync(files: any, callback?: ICallbackFunction): void;
export enum formats {
json,
ini
export var formats: {
json: IFormat;
ini: IFormat;
};
export interface IFormat {
stringify: (obj: any, replacer: any, spacing?: any) => string;
parse: (str: string) => any;
}
export interface IOptions {
@@ -51,6 +56,7 @@ declare module "nconf" {
file?: string;
dir?: string;
search?: boolean;
format?: IFormat;
json_spacing?: number;
}
+553
View File
@@ -0,0 +1,553 @@
/**
* Created by stefansteinhart on 31.01.15.
*/
/// <reference path="../q/Q.d.ts" />
/// <reference path="../node/node.d.ts" />
/// <reference path="nedb.d.ts" />
import Q = require('q');
import nedb = require('nedb');
class BaseCollection<T> {
private dataStore:nedb;
constructor(dataStore:nedb) {
this.dataStore = dataStore;
}
public insert(document:T):Q.Promise<T> {
var deferred = Q.defer<T>();
this.dataStore.insert<T>(document, function (err:Error, newDoc:T) { // Callback is optional
// newDoc is the newly inserted document, including its _id
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(newDoc);
}
});
return deferred.promise;
}
public count():Q.Promise<number> {
var deferred = Q.defer<number>();
this.dataStore.count({}, function (err:Error, count:number) {
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(count);
}
});
return deferred.promise;
}
public countBy(criteria:any):Q.Promise<number> {
var deferred = Q.defer<number>();
this.dataStore.count(criteria, function (err:Error, count:number) {
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(count);
}
});
return deferred.promise;
}
public findByID(id:string):Q.Promise<T> {
var deferred = Q.defer<T>();
this.dataStore.findOne<T>({_id: id}, function (err:Error, doc:T) {
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(doc);
}
});
return deferred.promise;
}
public findOne(criteria:any):Q.Promise<T> {
var deferred = Q.defer<T>();
this.dataStore.findOne<T>(criteria, function (err:Error, doc:T) {
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(doc);
}
});
return deferred.promise;
}
public find(criteria:any):Q.Promise<Array<T>> {
var deferred = Q.defer<Array<T>>();
this.dataStore.find(criteria, function (err:Error, docs:Array<T>) {
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(docs);
}
});
return deferred.promise;
}
public all():Q.Promise<Array<T>> {
var deferred = Q.defer<Array<T>>();
this.dataStore.find({}, function (err:Error, docs:Array<T>) {
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(docs);
}
});
return deferred.promise;
}
public upsert(query:any, updateQuery:any):Q.Promise<T> {
var deferred = Q.defer<T>();
this.dataStore.update(query, updateQuery, {upsert: true}, function (err:Error, numberOfUpdated:number, upsert:boolean) {
if (err) {
deferred.reject(err);
}
else {
//deferred.resolve(newDoc);
}
});
return deferred.promise;
}
public update(query:Object, updateQuery:Object, options?:NeDB.UpdateOptions):Q.Promise<number> {
var deferred = Q.defer<number>();
this.dataStore.update(query, updateQuery, options, function (err:Error, numberOfUpdated:number) {
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(numberOfUpdated);
}
});
return deferred.promise;
}
public remove(criteria:any):Q.Promise<number> {
var deferred = Q.defer<number>();
this.dataStore.remove(criteria, function (err:Error, numberOfDeletedEntrys:number) {
if (err) {
deferred.reject(err);
}
else {
deferred.resolve(numberOfDeletedEntrys);
}
});
return deferred.promise;
}
}
// Type 1: In-memory only datastore (no need to load the database)
import Datastore = require('nedb');
var db = new Datastore();
// Type 2: Persistent datastore with manual loading
db = new Datastore({filename: 'path/to/datafile'});
db.loadDatabase(function (err) { // Callback is optional
// Now commands will be executed
});
// Type 3: Persistent datastore with automatic loading
db = new Datastore({filename: 'path/to/datafile', autoload: true});
// You can issue commands right away
// Type 4: Persistent datastore for a Node Webkit app called 'nwtest'
// For example on Linux, the datafile will be ~/.config/nwtest/nedb-data/something.db
import path = require('path');
db = new Datastore({filename: path.join(require('nw.gui').App.dataPath, 'something.db')});
// Of course you can create multiple datastores if you need several
// collections. In this case it's usually a good idea to use autoload for all collections.
var dbContainer:any = {};
dbContainer.users = new Datastore('path/to/users.db');
dbContainer.robots = new Datastore('path/to/robots.db');
// You need to load each database (here we do it asynchronously)
dbContainer.users.loadDatabase();
dbContainer.robots.loadDatabase();
var doc:any = {
hello: 'world'
, n: 5
, today: new Date()
, nedbIsAwesome: true
, notthere: null
, notToBeSaved: undefined // Will not be saved
, fruits: ['apple', 'orange', 'pear']
, infos: {name: 'nedb'}
};
db.insert(doc, function (err:Error, newDoc:any) { // Callback is optional
// newDoc is the newly inserted document, including its _id
// newDoc has no key called notToBeSaved since its value was undefined
});
db.insert([{a: 5}, {a: 42}], function (err:Error, newdocs:Array<any>) {
// Two documents were inserted in the database
// newDocs is an array with these documents, augmented with their _id
});
// If there is a unique constraint on field 'a', this will fail
db.insert([{a: 5}, {a: 42}, {a: 5}], function (err:Error) {
// err is a 'uniqueViolated' error
// The database was not modified
});
// Finding all planets in the solar system
db.find({system: 'solar'}, function (err:Error, docs:Array<any>) {
// docs is an array containing documents Mars, Earth, Jupiter
// If no document is found, docs is equal to []
});
// Finding all planets whose name contain the substring 'ar' using a regular expression
db.find({planet: /ar/}, function (err:Error, docs:Array<any>) {
// docs contains Mars and Earth
});
// Finding all inhabited planets in the solar system
db.find({system: 'solar', inhabited: true}, function (err:Error, docs:Array<any>) {
// docs is an array containing document Earth only
});
// Use the dot-notation to match fields in subdocuments
db.find({"humans.genders": 2}, function (err:Error, docs:Array<any>) {
// docs contains Earth
});
// Use the dot-notation to navigate arrays of subdocuments
db.find({"completeData.planets.name": "Mars"}, function (err:Error, docs:Array<any>) {
// docs contains document 5
});
db.find({"completeData.planets.name": "Jupiter"}, function (err:Error, docs:Array<any>) {
// docs is empty
});
db.find({"completeData.planets.0.name": "Earth"}, function (err:Error, docs:Array<any>) {
// docs contains document 5
// If we had tested against "Mars" docs would be empty because we are matching against a specific array element
});
// You can also deep-compare objects. Don't confuse this with dot-notation!
db.find({humans: {genders: 2}}, function (err:Error, docs:Array<any>) {
// docs is empty, because { genders: 2 } is not equal to { genders: 2, eyes: true }
});
// Find all documents in the collection
db.find({}, function (err:Error, docs:Array<any>) {
});
// The same rules apply when you want to only find one document
db.findOne({_id: 'id1'}, function (err:Error, doc:any) {
// doc is the document Mars
// If no document is found, doc is null
});
// $lt, $lte, $gt and $gte work on numbers and strings
db.find({"humans.genders": {$gt: 5}}, function (err:Error, docs:Array<any>) {
// docs contains Omicron Persei 8, whose humans have more than 5 genders (7).
});
// When used with strings, lexicographical order is used
db.find({planet: {$gt: 'Mercury'}}, function (err:Error, docs:Array<any>) {
// docs contains Omicron Persei 8
})
// Using $in. $nin is used in the same way
db.find({planet: {$in: ['Earth', 'Jupiter']}}, function (err:Error, docs:Array<any>) {
// docs contains Earth and Jupiter
});
// Using $exists
db.find({satellites: {$exists: true}}, function (err:Error, docs:Array<any>) {
// docs contains only Mars
});
// Using $regex with another operator
db.find({planet: {$regex: /ar/, $nin: ['Jupiter', 'Earth']}}, function (err:Error, docs:Array<any>) {
// docs only contains Mars because Earth was excluded from the match by $nin
});
// Using an array-specific comparison function
// Note: you can't use nested comparison functions, e.g. { $size: { $lt: 5 } } will throw an error
db.find({satellites: {$size: 2}}, function (err:Error, docs:Array<any>) {
// docs contains Mars
});
db.find({satellites: {$size: 1}}, function (err:Error, docs:Array<any>) {
// docs is empty
});
// If a document's field is an array, matching it means matching any element of the array
db.find({satellites: 'Phobos'}, function (err:Error, docs:Array<any>) {
// docs contains Mars. Result would have been the same if query had been { satellites: 'Deimos' }
});
// This also works for queries that use comparison operators
db.find({satellites: {$lt: 'Amos'}}, function (err:Error, docs:Array<any>) {
// docs is empty since Phobos and Deimos are after Amos in lexicographical order
});
// This also works with the $in and $nin operator
db.find({satellites: {$in: ['Moon', 'Deimos']}}, function (err:Error, docs:Array<any>) {
// docs contains Mars (the Earth document is not complete!)
});
db.find({$or: [{planet: 'Earth'}, {planet: 'Mars'}]}, function (err:Error, docs:Array<any>) {
// docs contains Earth and Mars
});
db.find({$not: {planet: 'Earth'}}, function (err:Error, docs:Array<any>) {
// docs contains Mars, Jupiter, Omicron Persei 8
});
db.find({
$where: function () {
return parseInt(Object.keys(this)[0]) > 6;
}
}, function (err:Error, docs:Array<any>) {
// docs with more than 6 properties
});
// You can mix normal queries, comparison queries and logical operators
db.find({$or: [{planet: 'Earth'}, {planet: 'Mars'}], inhabited: true}, function (err:Error, docs:Array<any>) {
// docs contains Earth
});
// No query used means all results are returned (before the Cursor modifiers)
db.find({}).sort({planet: 1}).skip(1).limit(2).exec(function (err:Error, docs:Array<any>) {
// docs is [doc3, doc1]
});
// You can sort in reverse order like this
db.find({system: 'solar'}).sort({planet: -1}).exec(function (err:Error, docs:Array<any>) {
// docs is [doc1, doc3, doc2]
});
// You can sort on one field, then another, and so on like this:
db.find({}).sort({firstField: 1, secondField: -1});
// Same database as above
// Keeping only the given fields
db.find({planet: 'Mars'}, {planet: 1, system: 1}, function (err:Error, docs:Array<any>) {
// docs is [{ planet: 'Mars', system: 'solar', _id: 'id1' }]
});
// Keeping only the given fields but removing _id
db.find({planet: 'Mars'}, {planet: 1, system: 1, _id: 0}, function (err:Error, docs:Array<any>) {
// docs is [{ planet: 'Mars', system: 'solar' }]
});
// Omitting only the given fields and removing _id
db.find({planet: 'Mars'}, {planet: 0, system: 0, _id: 0}, function (err:Error, docs:Array<any>) {
// docs is [{ inhabited: false, satellites: ['Phobos', 'Deimos'] }]
});
// Failure: using both modes at the same time
db.find({planet: 'Mars'}, {planet: 0, system: 1}, function (err:Error, docs:Array<any>) {
// err is the error message, docs is undefined
});
// You can also use it in a Cursor way but this syntax is not compatible with MongoDB
// If upstream compatibility is important don't use this method
db.find({planet: 'Mars'}).projection({planet: 1, system: 1}).exec(function (err:Error, docs:Array<any>) {
// docs is [{ planet: 'Mars', system: 'solar', _id: 'id1' }]
});
// Count all planets in the solar system
db.count({system: 'solar'}, function (err:Error, count:number) {
// count equals to 3
});
// Count all documents in the datastore
db.count({}, function (err:Error, count:number) {
// count equals to 4
});
// Let's use the same example collection as in the "finding document" part
// { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false }
// { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true }
// { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false }
// { _id: 'id4', planet: 'Omicron Persia 8', system: 'futurama', inhabited: true }
// Replace a document by another
db.update({planet: 'Jupiter'}, {planet: 'Pluton'}, {}, function (err:Error, numReplaced:number) {
// numReplaced = 1
// The doc #3 has been replaced by { _id: 'id3', planet: 'Pluton' }
// Note that the _id is kept unchanged, and the document has been replaced
// (the 'system' and inhabited fields are not here anymore)
});
// Set an existing field's value
db.update({system: 'solar'}, {$set: {system: 'solar system'}}, {multi: true}, function (err:Error, numReplaced:number) {
// numReplaced = 3
// Field 'system' on Mars, Earth, Jupiter now has value 'solar system'
});
// Setting the value of a non-existing field in a subdocument by using the dot-notation
db.update({planet: 'Mars'}, {$set: {"data.satellites": 2, "data.red": true}}, {}, function () {
// Mars document now is { _id: 'id1', system: 'solar', inhabited: false
// , data: { satellites: 2, red: true }
// }
// Not that to set fields in subdocuments, you HAVE to use dot-notation
// Using object-notation will just replace the top-level field
db.update({planet: 'Mars'}, {$set: {data: {satellites: 3}}}, {}, function () {
// Mars document now is { _id: 'id1', system: 'solar', inhabited: false
// , data: { satellites: 3 }
// }
// You lost the "data.red" field which is probably not the intended behavior
});
});
// Deleting a field
db.update({planet: 'Mars'}, {$unset: {planet: true}}, {}, function () {
// Now the document for Mars doesn't contain the planet field
// You can unset nested fields with the dot notation of course
});
// Upserting a document
db.update({planet: 'Pluton'}, {
planet: 'Pluton',
inhabited: false
}, {upsert: true}, function (err:Error, numReplaced:number, upsert:boolean) {
// numReplaced = 1, upsert = { _id: 'id5', planet: 'Pluton', inhabited: false }
// A new document { _id: 'id5', planet: 'Pluton', inhabited: false } has been added to the collection
});
// If you upsert with a modifier, the upserted doc is the query modified by the modifier
// This is simpler than it sounds :)
db.update({planet: 'Pluton'}, {$inc: {distance: 38}}, {upsert: true}, function () {
// A new document { _id: 'id5', planet: 'Pluton', distance: 38 } has been added to the collection
});
// If we insert a new document { _id: 'id6', fruits: ['apple', 'orange', 'pear'] } in the collection,
// let's see how we can modify the array field atomically
// $push inserts new elements at the end of the array
db.update({_id: 'id6'}, {$push: {fruits: 'banana'}}, {}, function () {
// Now the fruits array is ['apple', 'orange', 'pear', 'banana']
});
// $pop removes an element from the end (if used with 1) or the front (if used with -1) of the array
db.update({_id: 'id6'}, {$pop: {fruits: 1}}, {}, function () {
// Now the fruits array is ['apple', 'orange']
// With { $pop: { fruits: -1 } }, it would have been ['orange', 'pear']
});
// $addToSet adds an element to an array only if it isn't already in it
// Equality is deep-checked (i.e. $addToSet will not insert an object in an array already containing the same object)
// Note that it doesn't check whether the array contained duplicates before or not
db.update({_id: 'id6'}, {$addToSet: {fruits: 'apple'}}, {}, function () {
// The fruits array didn't change
// If we had used a fruit not in the array, e.g. 'banana', it would have been added to the array
});
// $pull removes all values matching a value or even any NeDB query from the array
db.update({_id: 'id6'}, {$pull: {fruits: 'apple'}}, {}, function () {
// Now the fruits array is ['orange', 'pear']
});
db.update({_id: 'id6'}, {$pull: {fruits: {$in: ['apple', 'pear']}}}, {}, function () {
// Now the fruits array is ['orange']
});
// $each can be used to $push or $addToSet multiple values at once
// This example works the same way with $addToSet
db.update({_id: 'id6'}, {$push: {fruits: {$each: ['banana', 'orange']}}}, {}, function () {
// Now the fruits array is ['apple', 'orange', 'pear', 'banana', 'orange']
});
// Let's use the same example collection as in the "finding document" part
// { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false }
// { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true }
// { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false }
// { _id: 'id4', planet: 'Omicron Persia 8', system: 'futurama', inhabited: true }
// Remove one document from the collection
// options set to {} since the default for multi is false
db.remove({_id: 'id2'}, {}, function (err:Error, numRemoved:number) {
// numRemoved = 1
});
// Remove multiple documents
db.remove({system: 'solar'}, {multi: true}, function (err:Error, numRemoved:number) {
// numRemoved = 3
// All planets from the solar system were removed
});
db.ensureIndex({fieldName: 'somefield'}, function (err:Error) {
// If there was an error, err is not null
});
// Using a unique constraint with the index
db.ensureIndex({fieldName: 'somefield', unique: true}, function (err:Error) {
});
// Using a sparse unique index
db.ensureIndex({fieldName: 'somefield', unique: true, sparse: true}, function (err:Error) {
});
// Format of the error message when the unique constraint is not met
db.insert({somefield: 'nedb'}, function (err:Error) {
// err is null
db.insert({somefield: 'nedb'}, function (err:Error) {
// err is { errorType: 'uniqueViolated'
// , key: 'name'
// , message: 'Unique constraint violated for key name' }
});
});
// Remove index on field somefield
db.removeIndex('somefield', function (err:Error) {
});
+207
View File
@@ -0,0 +1,207 @@
// Type definitions for NeDB
// Project: https://github.com/louischatriot/nedb
// Definitions by: Stefan Steinhart <https://github.com/reppners>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "nedb" {
class NeDBDataStore {
constructor();
constructor(path:string);
constructor(options:NeDB.DataStoreOptions);
persistence:NeDB.Persistence;
/**
* Load the database from the datafile, and trigger the execution of buffered commands if any
*/
loadDatabase(cb?:(err:Error)=>void):void;
/**
* Get an array of all the data in the database
*/
getAllData():Array<any>;
/**
* Reset all currently defined indexes
*/
resetIndexes(newData:any):void;
/**
* Ensure an index is kept for this field. Same parameters as lib/indexes
* For now this function is synchronous, we need to test how much time it takes
* We use an async API for consistency with the rest of the code
* @param {String} options.fieldName
* @param {Boolean} options.unique
* @param {Boolean} options.sparse
* @param {Function} cb Optional callback, signature: err
*/
ensureIndex(options:NeDB.EnsureIndexOptions, cb?:(err:Error)=>void):void;
/**
* Remove an index
* @param {String} fieldName
* @param {Function} cb Optional callback, signature: err
*/
removeIndex(fieldName:string, cb?:(err:Error)=>void):void;
/**
* Add one or several document(s) to all indexes
*/
addToIndexes<T>(doc:T):void;
addToIndexes<T>(doc:Array<T>):void;
/**
* Remove one or several document(s) from all indexes
*/
removeFromIndexes<T>(doc:T):void;
removeFromIndexes<T>(doc:Array<T>):void;
/**
* Update one or several documents in all indexes
* To update multiple documents, oldDoc must be an array of { oldDoc, newDoc } pairs
* If one update violates a constraint, all changes are rolled back
*/
updateIndexes<T>(oldDoc:T, newDoc:T):void;
updateIndexes<T>(updates:Array<{oldDoc:T; newDoc:T;}>):void;
/**
* Return the list of candidates for a given query
* Crude implementation for now, we return the candidates given by the first usable index if any
* We try the following query types, in this order: basic match, $in match, comparison match
* One way to make it better would be to enable the use of multiple indexes if the first usable index
* returns too much data. I may do it in the future.
*
* TODO: needs to be moved to the Cursor module
*/
getCandidates(query:any):void;
/**
* Insert a new document
* @param {Function} cb Optional callback, signature: err, insertedDoc
*/
insert<T>(newDoc:T, cb?:(err:Error, document:T)=>void):void;
/**
* Count all documents matching the query
* @param {any} query MongoDB-style query
*/
count(query:any, callback:(err:Error, n:number)=>void):void;
count(query:any):NeDB.CursorCount;
/**
* Find all documents matching the query
* If no callback is passed, we return the cursor so that user can limit, skip and finally exec
* @param {any} query MongoDB-style query
* @param {any} projection MongoDB-style projection
*/
find<T>(query:any, projection:T, callback:(err:Error, documents:Array<T>)=>void):void;
find<T>(query:any, projection:T):NeDB.Cursor<T>;
/**
* Find all documents matching the query
* If no callback is passed, we return the cursor so that user can limit, skip and finally exec
* * @param {any} query MongoDB-style query
*/
find<T>(query:any, callback:(err:Error, documents:Array<T>)=>void):void;
find<T>(query:any):NeDB.Cursor<T>;
/**
* Find one document matching the query
* @param {any} query MongoDB-style query
* @param {any} projection MongoDB-style projection
*/
findOne<T>(query:any, projection:T, callback:(err:Error, document:T)=>void):void;
/**
* Find one document matching the query
* @param {any} query MongoDB-style query
*/
findOne<T>(query:any, callback:(err:Error, document:T)=>void):void;
/**
* Update all docs matching query
* For now, very naive implementation (recalculating the whole database)
* @param {any} query
* @param {any} updateQuery
* @param {Object} options Optional options
* options.multi If true, can update multiple documents (defaults to false)
* options.upsert If true, document is inserted if the query doesn't match anything
* @param {Function} cb Optional callback, signature: err, numReplaced, upsert (set to true if the update was in fact an upsert)
*
* @api private Use Datastore.update which has the same signature
*/
update(query:any, updateQuery:any, options?:NeDB.UpdateOptions, cb?:(err:Error, numberOfUpdated:number, upsert:boolean)=>void):void;
/**
* Remove all docs matching the query
* For now very naive implementation (similar to update)
* @param {Object} query
* @param {Object} options Optional options
* options.multi If true, can update multiple documents (defaults to false)
* @param {Function} cb Optional callback, signature: err, numRemoved
*
* @api private Use Datastore.remove which has the same signature
*/
remove(query:any, options:NeDB.RemoveOptions, cb?:(err:Error, n:number)=>void):void;
remove(query:any, cb?:(err:Error, n:number)=>void):void;
}
export = NeDBDataStore;
}
declare module NeDB {
interface Cursor<T> {
sort(query:any):Cursor<T>;
skip(n:number):Cursor<T>;
limit(n:number):Cursor<T>;
projection(query:any):Cursor<T>;
exec(callback:(err:Error, documents:Array<T>)=>void):void;
}
interface CursorCount {
exec(callback:(err:Error, count:number)=>void):void;
}
interface DataStoreOptions {
filename?:string // Optional, datastore will be in-memory only if not provided
inMemoryOnly?:boolean // Optional, default to false
nodeWebkitAppName?:boolean // Optional, specify the name of your NW app if you want options.filename to be relative to the directory where
autoload?:boolean // Optional, defaults to false
onload?:(error:Error)=>any // Optional, if autoload is used this will be called after the load database with the error object as parameter. If you don't pass it the error will be thrown
afterSerialization?:(line:string)=>string; // (optional): hook you can use to transform data after it was serialized and before it is written to disk. Can be used for example to encrypt data before writing database to disk. This function takes a string as parameter (one line of an NeDB data file) and outputs the transformed string, which must absolutely not contain a \n character (or data will be lost)
beforeDeserialization?:(line:string)=>string; // (optional): reverse of afterSerialization. Make sure to include both and not just one or you risk data loss. For the same reason, make sure both functions are inverses of one another. Some failsafe mechanisms are in place to prevent data loss if you misuse the serialization hooks: NeDB checks that never one is declared without the other, and checks that they are reverse of one another by testing on random strings of various lengths. In addition, if too much data is detected as corrupt, NeDB will refuse to start as it could mean you're not using the deserialization hook corresponding to the serialization hook used before (see below)
corruptAlertThreshold?:number; // (optional): between 0 and 1, defaults to 10%. NeDB will refuse to start if more than this percentage of the datafile is corrupt. 0 means you don't tolerate any corruption, 1 means you don't care
}
/**
* multi (defaults to false) which allows the modification of several documents if set to true
* upsert (defaults to false) if you want to insert a new document corresponding to the update rules if your query doesn't match anything
*/
interface UpdateOptions {
multi?: boolean;
upsert?: boolean;
}
/**
* options only one option for now: multi which allows the removal of multiple documents if set to true. Default is false
*/
interface RemoveOptions {
multi?:boolean
}
interface EnsureIndexOptions {
fieldName:string;
unique?:boolean;
sparse?:boolean;
}
interface Persistence {
compactDatafile():void;
setAutocompactionInterval(interval:number):void;
stopAutocompaction():void;
}
}
+4
View File
@@ -5,6 +5,7 @@ import zmq = require('zmq');
function test1() {
var sock = zmq.socket('push');
sock.bindSync('tcp://127.0.0.1:3000');
sock.unbindSync('tcp://127.0.0.1:3000');
sock.send("some work");
}
@@ -28,6 +29,9 @@ function test4() {
sock.bind('tcp://127.0.0.1', err => {
sock.send("some work");
});
sock.unbind('tcp://127.0.0.1', err => {
//
});
}
function test5() {
+18 -1
View File
@@ -85,7 +85,7 @@ declare module 'zmq' {
* @param addr Socket address
* @param cb Bind callback
*/
bind(addr: string, callback: (error: string) => void ): Socket;
bind(addr: string, callback?: (error: string) => void ): Socket;
/**
* Sync bind.
@@ -94,6 +94,23 @@ declare module 'zmq' {
*/
bindSync(addr: string): Socket;
/**
* Async unbind.
*
* Emits the "unbind" event.
*
* @param addr Socket address
* @param cb Unind callback
*/
unbind(addr: string, callback?: (error: string) => void ): Socket;
/**
* Sync unbind.
*
* @param addr Socket address
*/
unbindSync(addr: string): Socket;
/**
* Connect to `addr`.
*
+8 -3
View File
@@ -42,7 +42,7 @@ var INPUT_REF: string = "input";
// Top-Level API
// --------------------------------------------------------------------------
var reactClass: React.ComponentClass<Props, State, Context> = React.createClass<Props, State, Context>({
var reactClassicClass: React.ClassicComponentClass<Props, State, Context> = React.createClass<Props, State, Context>({
getDefaultProps: () => {
return <Props>{
hello: undefined,
@@ -69,6 +69,8 @@ var reactClass: React.ComponentClass<Props, State, Context> = React.createClass<
}
});
var reactClass: React.ComponentClass<Props, State, Context> = reactClassicClass;
class ModernComponent extends React.Component<Props, State, Context> implements React.ChildContextProvider<ChildContext> {
constructor(props: Props, context: Context) {
super(props, context);
@@ -149,6 +151,11 @@ var isValid = React.isValidElement(reactElement); // true
React.initializeTouchEvents(true);
var domNode: Element = React.findDOMNode(component);
var reactClassicElement: React.ReactClassicElement<Props>;
reactClassicElement = React.createElement<Props>(reactClassicClass, props);
var classicComponent: React.ClassicComponent<Props, State, Context>;
classicComponent = React.render<Props, State>(reactClassicElement, container);
//
// React Elements
// --------------------------------------------------------------------------
@@ -177,8 +184,6 @@ component.setState({ inputValue: "!!!" });
component.forceUpdate();
// classic
var classicComponent = <React.ClassicComponent<Props, State, Context>>component;
var htmlElement: Element = classicComponent.getDOMNode();
var divElement: HTMLDivElement = classicComponent.getDOMNode<HTMLDivElement>();
var isMounted: boolean = classicComponent.isMounted();
+5
View File
@@ -17,6 +17,9 @@ declare module React {
ref: string;
}
interface ReactClassicElement<P> extends ReactElement<P> {
}
interface ReactHTMLElement extends ReactElement<HTMLAttributes> {}
interface ReactSVGElement extends ReactElement<SVGAttributes> {}
@@ -112,8 +115,10 @@ declare module React {
interface TopLevelAPI {
createClass<P, S, C>(spec: ComponentSpec<P, S, C>): ClassicComponentClass<P, S, C>;
createElement<P>(type: ClassicComponentClass<P, any, any>, props: P, ...children: ReactNode[]): ReactClassicElement<P>;
createElement<P>(type: ComponentClass<P, any, any> | string, props: P, ...children: ReactNode[]): ReactElement<P>;
createFactory<P>(type: ComponentClass<P, any, any> | string): ComponentFactory<P>;
render<P, S>(element: ReactClassicElement<P>, container: Element, callback?: () => any): ClassicComponent<P, S, any>;
render<P, S>(element: ReactElement<P>, container: Element, callback?: () => any): Component<P, S, any>;
unmountComponentAtNode(container: Element): boolean;
renderToString(element: ReactElement<any>): string;
+1
View File
@@ -95,6 +95,7 @@ declare module "restify" {
listen(... args: any[]): any;
close(... args: any[]): any;
pre(routeCallBack: RequestHandler): any;
server: http.Server;
}
+26
View File
@@ -85,8 +85,34 @@ shell.ln("-sf", "file", "existing");
var testPath = shell.env["path"];
import child = require("child_process");
var version = shell.exec("node --version").output;
var version2 = <shell.ExecOutputReturnValue>shell.exec("node --version", { async: false });
var output = version2.output;
var asyncVersion3 = <child.ChildProcess>shell.exec("node --version", { async: true });
var pid = asyncVersion3.pid;
shell.exec("node --version", { silent: true }, function (code, output) {
var version = output;
});
shell.exec("node --version", { silent: true, async: true }, function (code, output) {
var version = output;
});
shell.exec("node --version", function (code, output) {
var version = output;
});
shell.exec("node --version", function (code: number) {
var num: number = code;
});
var childProc = shell.exec("node --version", function (code: number) {
var num: number = code;
});
var pid = childProc.pid;
shell.chmod(755, "/Users/brandon");
shell.chmod("755", "/Users/brandon"); // same as above
shell.chmod("u+x", "/Users/brandon");
+36 -21
View File
@@ -8,6 +8,8 @@
declare module "shelljs"
{
import child = require("child_process");
/**
* Changes to directory dir for the duration of the script
* @param {string} dir Directory to change in.
@@ -434,31 +436,44 @@ declare module "shelljs"
* Object containing environment variables (both getter and setter). Shortcut to process.env.
*/
export var env: { [key: string]: string };
/*
// Not yet implemented due to implementation issues (constant overloads and return types).
// See: https://github.com/arturadib/shelljs#execcommand--options--callback
export function exec(command: string, options: ExecOptions, callback: (code: number, output: string) => any): any;
export function exec(command: string, options: ExecOptions): any;
interface ExecOptions
{
silent: boolean;
async: boolean;
}
*/
/**
* Executes the given command synchronously.
* @param {string} command The commadn to execute.
* @return {ExecReturnValue} Returns an object containing the return code and output as string.
* @param {string} command The command to execute.
* @return {ExecOutputReturnValue} Returns an object containing the return code and output as string.
*/
export function exec(command: string): ExecReturnValue;
export function exec(command: string): ExecOutputReturnValue;
/**
* Executes the given command synchronously.
* @param {string} command The command to execute.
* @param {ExecOptions} options Silence and synchronous options.
* @return {ExecOutputReturnValue | child.ChildProcess} Returns an object containing the return code and output as string, or if {async:true} was passed, a ChildProcess.
*/
export function exec(command: string, options: ExecOptions): ExecOutputReturnValue | child.ChildProcess;
/**
* Executes the given command synchronously.
* @param {string} command The command to execute.
* @param {ExecOptions} options Silence and synchronous options.
* @param {ExecCallback} callback Receives code and output asynchronously.
*/
export function exec(command: string, options: ExecOptions, callback: ExecCallback): child.ChildProcess;
/**
* Executes the given command synchronously.
* @param {string} command The command to execute.
* @param {ExecCallback} callback Receives code and output asynchronously.
*/
export function exec(command: string, callback: ExecCallback): child.ChildProcess;
interface ExecReturnValue
export interface ExecCallback {
(code: number, output: string): any;
}
export interface ExecOptions {
silent?: boolean;
async?: boolean;
}
export interface ExecOutputReturnValue
{
code: number;
output: string;
+3 -1
View File
@@ -317,7 +317,9 @@ declare var footstepsBuffer: any;
()=>{
var context = new webkitOfflineAudioContext(1, 2, 44100.5);
context.oncomplete = function(e) {
context.createBufferSource().buffer;
}
context.startRendering();
context.oncomplete(context.createBufferSource().buffer);
}
+82 -47
View File
@@ -12,7 +12,7 @@
*
* var context = new AudioContext();
*/
interface AudioContext {
interface AudioContext extends EventTarget {
/**
* An AudioDestinationNode with a single input representing the final destination for all audio (to be rendered to the audio hardware). All AudioNodes actively rendering audio will directly or indirectly connect to destination.
*/
@@ -33,11 +33,6 @@ interface AudioContext {
*/
listener: AudioListener;
/**
* The number of AudioBufferSourceNodes that are currently playing.
*/
activeSourceCount: number;
/**
* Creates an AudioBuffer of the given size. The audio data in the buffer will be zero-initialized (silent). An exception will be thrown if the numberOfChannels or sampleRate are out-of-bounds.
* @param numberOfChannels how many channels the buffer will have. An implementation must support at least 32 channels.
@@ -69,9 +64,9 @@ interface AudioContext {
* 5. The audioData neutered state will be restored to normal
* 6. The successCallback function will be scheduled to run on the main thread's event loop given the AudioBuffer from step (4) as an argument.
*
* @param ArrayBuffer containing audio file data.
* @param callback function which will be invoked when the decoding is finished. The single argument to this callback is an AudioBuffer representing the decoded PCM audio data.
* @param callback function which will be invoked if there is an error decoding the audio file data.
* @param audioData an ArrayBuffer containing audio file data.
* @param successCallback callback function which will be invoked when the decoding is finished. The single argument to this callback is an AudioBuffer representing the decoded PCM audio data.
* @param errorCallback callback function which will be invoked if there is an error decoding the audio file data.
*/
decodeAudioData(audioData: ArrayBuffer, successCallback: (decodedData: AudioBuffer) => any, errorCallback?: Function): void;
@@ -102,7 +97,7 @@ interface AudioContext {
* @param numberOfInputChannels (defaults to 2) the number of channels for this node's input. Values of up to 32 must be supported.
* @param numberOfOutputChannels (defaults to 2) the number of channels for this node's output. Values of up to 32 must be supported.
*/
createScriptProcessor(bufferSize: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
/**
* Creates a AnalyserNode.
@@ -119,7 +114,6 @@ interface AudioContext {
* @param maxDelayTime the maximum delay time in seconds allowed for the delay line. If specified, this value must be greater than zero and less than three minutes or a NOT_SUPPORTED_ERR exception will be thrown.
*/
createDelay(maxDelayTime?: number): DelayNode;
//createDelayNode(maxDelayTime?: number): DelayNode;
/**
* Creates a BiquadFilterNode representing a second order filter which can be configured as one of several common filter types.
@@ -180,10 +174,6 @@ declare var webkitAudioContext: {
new (): AudioContext;
}
interface OfflineRenderSuccessCallback{
(renderedData: AudioBuffer): void;
}
/**
* OfflineAudioContext is a particular type of AudioContext for rendering/mixing-down (potentially) faster than real-time. It does not render to the audio hardware, but instead renders as quickly as possible, calling a render callback function upon completion with the result provided as an AudioBuffer. It is constructed by specifying the numberOfChannels, length, and sampleRate as follows:
*
@@ -191,13 +181,36 @@ interface OfflineRenderSuccessCallback{
*/
interface OfflineAudioContext extends AudioContext{
startRendering(): void;
oncomplete: OfflineRenderSuccessCallback;
oncomplete: EventHandler;
}
declare var OfflineAudioContext: {
new (numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;
}
declare var webkitOfflineAudioContext: {
new (numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;
}
interface OfflineAudioCompletionEvent extends Event {
/**
* An AudioBuffer containing the rendered audio data once an OfflineAudioContext has finished rendering. It will have a number of channels equal to the numberOfChannels parameter of the OfflineAudioContext constructor.
*/
renderedBuffer: AudioBuffer;
}
declare enum ChannelCountMode {
'max',
'clamped-max',
'explicit'
}
declare enum ChannelInterpretation {
speakers,
discrete
}
/**
* AudioNodes are the building blocks of an AudioContext. This interface represents audio sources, the audio destination, and intermediate processing modules. These modules can be connected together to form processing graphs for rendering audio to the audio hardware. Each node can have inputs and/or outputs. An AudioSourceNode has no inputs and a single output. An AudioDestinationNode has one input and no outputs and represents the final destination to the audio hardware. Most processing nodes such as filters will have one input and one output. Each type of AudioNode differs in the details of how it processes or synthesizes audio. But, in general, AudioNodes will process its inputs (if it has any), and generate audio for its outputs (if it has any).
*
@@ -279,6 +292,25 @@ interface AudioNode extends EventTarget {
* The number of outputs coming out of the AudioNode. This will be 0 for an AudioDestinationNode.
*/
numberOfOutputs: number;
/**
* The number of channels used when up-mixing and down-mixing connections to any inputs to the node. The default value is 2 except for specific nodes where its value is specially determined. This attribute has no effect for nodes with no inputs. If this value is set to zero, the implementation MUST throw a NOT_SUPPORTED_ERR exception.
*/
channelCount: number;
/**
* Determines how channels will be counted when up-mixing and down-mixing connections to any inputs to the node . This attribute has no effect for nodes with no inputs.
*
* See the Channel up-mixing and down-mixing section for more information on this attribute.
*/
channelCountMode: ChannelCountMode;
/**
* Determines how individual channels will be treated when up-mixing and down-mixing connections to any inputs to the node. This attribute has no effect for nodes with no inputs.
*
* See the Channel up-mixing and down-mixing section for more information on this attribute.
*/
channelInterpretation: ChannelInterpretation;
}
@@ -371,7 +403,7 @@ interface AudioParam {
* @param value the value the parameter will linearly ramp to at the given time.
* @param endTime the time in the same time coordinate system as AudioContext.currentTime.
*/
linearRampToValueAtTime(value: number, time: number): void;
linearRampToValueAtTime(value: number, endTime: number): void;
/**
* Schedules an exponential continuous change in parameter value from the previous scheduled parameter value to the given value. Parameters representing filter frequencies and playback rate are best changed exponentially because of the way humans perceive sound.
@@ -420,7 +452,7 @@ interface AudioParam {
* @param duration the amount of time in seconds (after the time parameter) where values will be calculated according to the values parameter..
*
*/
setValueCurveAtTime(values: Float32Array, time: number, duration: number): void;
setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void;
/**
* Cancels all scheduled parameter changes with times greater than or equal to startTime.
@@ -506,17 +538,12 @@ interface AudioBuffer {
}
/**
* This interface represents an audio source from an in-memory audio asset in an AudioBuffer. It generally will be used for short audio assets which require a high degree of scheduling flexibility (can playback in rhythmically perfect ways). The playback state of an AudioBufferSourceNode goes through distinct stages during its lifetime in this order: UNSCHEDULED_STATE, SCHEDULED_STATE, PLAYING_STATE, FINISHED_STATE. The start() method causes a transition from the UNSCHEDULED_STATE to SCHEDULED_STATE. Depending on the time argument passed to start(), a transition is made from the SCHEDULED_STATE to PLAYING_STATE, at which time sound is first generated. Following this, a transition from the PLAYING_STATE to FINISHED_STATE happens when either the buffer's audio data has been completely played (if the loop attribute is false), or when the stop() method has been called and the specified time has been reached. Please see more details in the start() and stop() description. Once an AudioBufferSourceNode has reached the FINISHED state it will no longer emit any sound. Thus start() and stop() may not be issued multiple times for a given AudioBufferSourceNode.
* This interface represents an audio source from an in-memory audio asset in an AudioBuffer. It is useful for playing short audio assets which require a high degree of scheduling flexibility (can playback in rhythmically perfect ways). The start() method is used to schedule when sound playback will happen. The playback will stop automatically when the buffer's audio data has been completely played (if the loop attribute is false), or when the stop() method has been called and the specified time has been reached. Please see more details in the start() and stop() description. start() and stop() may not be issued multiple times for a given AudioBufferSourceNode.
*
* numberOfInputs : 0
* numberOfOutputs : 1
*/
interface AudioBufferSourceNode extends AudioSourceNode {
/**
* The playback state, initialized to UNSCHEDULED_STATE.
*/
playbackState: number;
interface AudioBufferSourceNode extends AudioNode {
/**
* Represents the audio asset to be played.
@@ -546,7 +573,7 @@ interface AudioBufferSourceNode extends AudioSourceNode {
/**
* A property used to set the EventHandler for the ended event that is dispatched to AudioBufferSourceNode node types. When the playback of the buffer for an AudioBufferSourceNode is finished, an event of type Event will be dispatched to the event handler.
*/
onended: EventListener;
onended: EventHandler;
/**
* Schedules a sound to playback at an exact time.
@@ -571,7 +598,7 @@ interface AudioBufferSourceNode extends AudioSourceNode {
* numberOfInputs : 0
* numberOfOutputs : 1
*/
interface MediaElementAudioSourceNode extends AudioSourceNode {
interface MediaElementAudioSourceNode extends AudioNode {
}
/**
@@ -590,7 +617,7 @@ interface ScriptProcessorNode extends AudioNode {
/**
* An event listener which is called periodically for audio processing. An event of type AudioProcessingEvent will be passed to the event handler.
*/
onaudioprocess: EventListener;
onaudioprocess: EventHandler;
/**
* The size of the buffer (in sample-frames) which needs to be processed each time onprocessaudio is called. Legal values are (256, 512, 1024, 2048, 4096, 8192, 16384).
@@ -604,11 +631,6 @@ interface ScriptProcessorNode extends AudioNode {
* The event handler processes audio from the input (if any) by accessing the audio data from the inputBuffer attribute. The audio data which is the result of the processing (or the synthesized data if there are no inputs) is then placed into the outputBuffer.
*/
interface AudioProcessingEvent extends Event {
/**
* The ScriptProcessorNode associated with this processing event.
*/
node: ScriptProcessorNode;
/**
* The time when the audio will be played in the same time coordinate system as AudioContext.currentTime. playbackTime allows for very tight synchronization between processing directly in JavaScript with the other events in the context's rendering graph.
*/
@@ -634,12 +656,7 @@ declare enum PanningModelType {
/**
* A higher quality spatialization algorithm using a convolution with measured impulse responses from human subjects. This panning method renders stereo output.
*/
HRTF,
/**
* An algorithm which spatializes multi-channel audio using sound field algorithms.
*/
soundfield
HRTF
}
declare enum DistanceModelType {
@@ -1056,6 +1073,12 @@ interface BiquadFilterNode extends AudioNode {
getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void;
}
declare enum OverSampleType {
'none',
'2x',
'4x'
}
/**
* WaveShaperNode is an AudioNode processor implementing non-linear distortion effects.
*
@@ -1069,6 +1092,19 @@ interface WaveShaperNode extends AudioNode {
* The shaping curve used for the waveshaping effect. The input signal is nominally within the range -1 -> +1. Each input sample within this range will index into the shaping curve with a signal level of zero corresponding to the center value of the curve array. Any sample value less than -1 will correspond to the first value in the curve array. Any sample value less greater than +1 will correspond to the last value in the curve array.
*/
curve: Float32Array;
/**
* Specifies what type of oversampling (if any) should be used when applying the shaping curve. The default value is "none", meaning the curve will be applied directly to the input samples. A value of "2x" or "4x" can improve the quality of the processing by avoiding some aliasing, with the "4x" value yielding the highest quality. For some applications, it's better to use no oversampling in order to get a very precise shaping curve.
*
* A value of "2x" or "4x" means that the following steps must be performed:
*
* 1. Up-sample the input samples to 2x or 4x the sample-rate of the AudioContext. Thus for each processing block of 128 samples, generate 256 (for 2x) or 512 (for 4x) samples.
* 2. Apply the shaping curve.
* 3. Down-sample the result back to the sample-rate of the AudioContext. Thus taking the 256 (or 512) processed samples, generating 128 as the final result.
*
* The exact up-sampling and down-sampling filters are not specified, and can be tuned for sound quality (low aliasing, etc.), low latency, and performance.
*/
oversample: OverSampleType
}
declare enum OscillatorType {
@@ -1099,18 +1135,12 @@ declare enum OscillatorType {
* numberOfInputs : 0
* numberOfOutputs : 1 (mono output)
*/
interface OscillatorNode extends AudioSourceNode {
interface OscillatorNode extends AudioNode {
/**
* The shape of the periodic waveform. It may directly be set to any of the type constant values except for "custom". The setPeriodicWave() method can be used to set a custom waveform, which results in this attribute being set to "custom". The default value is "sine".
*/
type: OscillatorType;
/**
* defined as in AudioBufferSourceNode.
* @readonly
*/
playbackState: number;
/**
* The frequency (in Hertz) of the periodic waveform. This parameter is a-rate
* @readonly
@@ -1136,6 +1166,11 @@ interface OscillatorNode extends AudioSourceNode {
* Sets an arbitrary custom periodic waveform given a PeriodicWave.
*/
setPeriodicWave(periodicWave: PeriodicWave): void;
/**
* A property used to set the EventHandler (described in HTML) for the ended event that is dispatched to OscillatorNode node types. When the playback of the buffer for an OscillatorNode is finished, an event of type Event (described in HTML) will be dispatched to the event handler.
*/
onended: EventHandler
}
/**
@@ -1150,7 +1185,7 @@ interface PeriodicWave {
* numberOfInputs : 0
* numberOfOutputs : 1
*/
interface MediaStreamAudioSourceNode extends AudioSourceNode {
interface MediaStreamAudioSourceNode extends AudioNode {
}
/**
+7
View File
@@ -30,6 +30,13 @@ declare module WebCola{
stop(): void;
}
interface Constraint {
axis: string;
gap: number;
left: number;
right: number;
}
interface FlowLayout{
axis: string;
minSeparation?: number;
+153
View File
@@ -0,0 +1,153 @@
///<reference path="webspeechapi.d.ts" />
/*
Examples from the spec:
https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#examples-recognition
*/
// 6.1 Speech Recognition Examples
// Example 1
declare var q: HTMLInputElement;
() => {
var recognition = new SpeechRecognition();
recognition.onresult = function (event) {
if (event.results.length > 0) {
q.value = event.results[0][0].transcript;
q.form.submit();
}
}
}
// Example 2
declare var select: HTMLSelectElement;
() => {
var recognition = new SpeechRecognition();
recognition.maxAlternatives = 10;
recognition.onresult = function (event) {
if (event.results.length > 0) {
var result = event.results[0];
for (var i = 0; i < result.length; ++i) {
var text = result[i].transcript;
select.options[i] = new Option(text, text);
}
}
}
function start() {
select.options.length = 0;
recognition.start();
}
}
// Example 3
/*
This example has some changes from the one in spec.
`var i = resultIndex` -> `var i = event.resultIndex` (Recorded as Errata 16)
`event.results.final` -> `event.results[i].isFinal` (Recorded as Errata 02)
*/
declare var textarea: HTMLTextAreaElement;
declare var button: HTMLButtonElement;
() => {
var recognizing: boolean;
var recognition = new SpeechRecognition();
recognition.continuous = true;
reset();
recognition.onend = reset;
recognition.onresult = function (event) {
for (var i = event.resultIndex; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
textarea.value += event.results[i][0].transcript;
}
}
}
function reset() {
recognizing = false;
button.innerHTML = "Click to Speak";
}
function toggleStartStop() {
if (recognizing) {
recognition.stop();
reset();
} else {
recognition.start();
recognizing = true;
button.innerHTML = "Click to Stop";
}
}
}
// Example 4
/*
This example has a change from the one in spec.
`recognition.interim = true;` -> `recognition.interimResults = true;` (Recorded as Errata 01)
`event.results[i].final` -> `event.results[i].isFinal` (Recorded as Errata 02)
*/
declare var button: HTMLButtonElement;
declare var final_span: HTMLSpanElement;
declare var interim_span: HTMLSpanElement;
() => {
var recognizing: boolean;
var recognition = new SpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
reset();
recognition.onend = reset;
recognition.onresult = function (event) {
var final = "";
var interim = "";
for (var i = 0; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
final += event.results[i][0].transcript;
} else {
interim += event.results[i][0].transcript;
}
}
final_span.innerHTML = final;
interim_span.innerHTML = interim;
}
function reset() {
recognizing = false;
button.innerHTML = "Click to Speak";
}
function toggleStartStop() {
if (recognizing) {
recognition.stop();
reset();
} else {
recognition.start();
recognizing = true;
button.innerHTML = "Click to Stop";
final_span.innerHTML = "";
interim_span.innerHTML = "";
}
}
}
// 6.2 Speech Synthesis Examples
// Example 1
/*
This example has a change from the one in spec.
`SpeechSynthesisUtterance('Hello World')` -> `new SpeechSynthesisUtterance('Hello World')` (Recorded as Errata 09)
*/
() => {
speechSynthesis.speak(new SpeechSynthesisUtterance('Hello World'));
}
//Example 2
() => {
var u = new SpeechSynthesisUtterance();
u.text = 'Hello World';
u.lang = 'en-US';
u.rate = 1.2;
u.onend = function (event) { alert('Finished in ' + event.elapsedTime + ' seconds.'); }
speechSynthesis.speak(u);
}
+164
View File
@@ -0,0 +1,164 @@
// Type definitions for Web Speech API
// Project: https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
// Definitions by: SaschaNaz <https://github.com/saschanaz>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Spec version: 19 October 2012
// Errata version: 6 June 2014
// Corrected unofficial spec version: 6 June 2014
interface SpeechRecognition extends EventTarget {
grammars: SpeechGrammarList;
lang: string;
continuous: boolean;
interimResults: boolean;
maxAlternatives: number;
serviceURI: string;
start(): void;
stop(): void;
abort(): void;
onaudiostart: (ev: Event) => any;
onsoundstart: (ev: Event) => any;
onspeechstart: (ev: Event) => any;
onspeechend: (ev: Event) => any;
onsoundend: (ev: Event) => any;
onresult: (ev: SpeechRecognitionEvent) => any;
onnomatch: (ev: SpeechRecognitionEvent) => any;
onerror: (ev: SpeechRecognitionError) => any;
onstart: (ev: Event) => any;
onend: (ev: Event) => any;
}
interface SpeechRecognitionStatic {
prototype: SpeechRecognition;
new (): SpeechRecognition;
}
declare var SpeechRecognition: SpeechRecognitionStatic;
declare var webkitSpeechRecognition: SpeechRecognitionStatic;
interface SpeechRecognitionError extends Event {
error: string;
message: string;
}
interface SpeechRecognitionAlternative {
transcript: string;
confidence: number;
}
interface SpeechRecognitionResult {
length: number;
item(index: number): SpeechRecognitionAlternative;
[index: number]: SpeechRecognitionAlternative;
/* Errata 02 */
isFinal: boolean;
}
interface SpeechRecognitionResultList {
length: number;
item(index: number): SpeechRecognitionResult;
[index: number]: SpeechRecognitionResult;
}
interface SpeechRecognitionEvent extends Event {
resultIndex: number;
results: SpeechRecognitionResultList;
interpretation: any;
emma: Document;
}
interface SpeechGrammar {
src: string;
weight: number;
}
interface SpeechGrammarStatic {
prototype: SpeechGrammar;
new (): SpeechGrammar;
}
declare var SpeechGrammar: SpeechGrammarStatic;
declare var webkitSpeechGrammar: SpeechGrammarStatic;
interface SpeechGrammarList {
length: number;
item(index: number): SpeechGrammar;
[index: number]: SpeechGrammar;
addFromURI(src: string, weight: number): void;
addFromString(string: string, weight: number): void;
}
interface SpeechGrammarListStatic {
prototype: SpeechGrammarList;
new (): SpeechGrammarList;
}
declare var SpeechGrammarList: SpeechGrammarListStatic;
declare var webkitSpeechGrammarList: SpeechGrammarListStatic;
/* Errata 08 */
interface SpeechSynthesis extends EventTarget {
pending: boolean;
speaking: boolean;
paused: boolean;
/* Errata 11 */
onvoiceschanged: (ev: Event) => any;
speak(utterance: SpeechSynthesisUtterance): void;
cancel(): void;
pause(): void;
resume(): void;
/* Errata 05 */
getVoices(): SpeechSynthesisVoice[];
}
interface SpeechSynthesisGetter {
speechSynthesis: SpeechSynthesis;
}
interface Window extends SpeechSynthesisGetter {
}
declare var speechSynthesis: SpeechSynthesis;
interface SpeechSynthesisUtterance extends EventTarget {
text: string;
lang: string;
/* Errata 07 */
voice: SpeechSynthesisVoice;
volume: number;
rate: number;
pitch: number;
onstart: (ev: SpeechSynthesisEvent) => any;
onend: (ev: SpeechSynthesisEvent) => any;
/* Errata 12 */
onerror: (ev: SpeechSynthesisErrorEvent) => any;
onpause: (ev: SpeechSynthesisEvent) => any;
onresume: (ev: SpeechSynthesisEvent) => any;
onmark: (ev: SpeechSynthesisEvent) => any;
onboundary: (ev: SpeechSynthesisEvent) => any;
}
interface SpeechSynthesisUtteranceStatic {
prototype: SpeechSynthesisUtterance;
new (): SpeechSynthesisUtterance;
new (text: string): SpeechSynthesisUtterance;
}
declare var SpeechSynthesisUtterance: SpeechSynthesisUtteranceStatic;
interface SpeechSynthesisEvent extends Event {
/* Errata 08 */
utterance: SpeechSynthesisUtterance;
charIndex: number;
elapsedTime: number;
name: string;
}
/* Errata 12 */
interface SpeechSynthesisErrorEvent extends SpeechSynthesisEvent {
error: string;
}
interface SpeechSynthesisVoice {
voiceURI: string;
name: string;
lang: string;
localService: boolean;
default: boolean;
}