diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index becc0e9b3..aadc541df 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -345,6 +345,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jstree/jstree.d.ts) [jsTree](http://www.jstree.com) by [Adam Pluciński](https://github.com/adaskothebeast) * [:link:](jszip/jszip.d.ts) [JSZip](http://stuk.github.com/jszip) by [mzeiher](https://github.com/mzeiher) * [:link:](jwplayer/jwplayer.d.ts) [JW Player](http://developer.longtailvideo.com/trac) by [Martin Duparc](https://github.com/martinduparc) +* [:link:](jwt-simple/jwt-simple.d.ts) [jwt-simple](https://github.com/hokaccha/node-jwt-simple) by [Ken Fukuyama](https://github.com/kenfdev) * [:link:](karma-jasmine/karma-jasmine.d.ts) [karma-jasmine plugin](https://github.com/karma-runner/karma-jasmine) by [Michel Salib](https://github.com/michelsalib) * [:link:](keyboardjs/keyboardjs.d.ts) [KeyboardJS](https://github.com/RobertWHurst/KeyboardJS) by [Vincent Bortone](https://github.com/vbortone) * [:link:](keymaster/keymaster.d.ts) [keymaster](https://github.com/madrobby/keymaster) by [Martin W. Kirst](https://github.com/nitram509) @@ -456,8 +457,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) @@ -509,6 +510,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](q-retry/q-retry.d.ts) [q-retry](https://github.com/vilic/q-retry) by [VILIC VANE](https://github.com/vilic) * [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade) * [:link:](qunit/qunit.d.ts) [QUnit](http://qunitjs.com) by [Diullei Gomes](https://github.com/diullei) +* [:link:](rabbit.js/rabbit.js.d.ts) [rabbit.js](https://github.com/squaremo/rabbit.js) by [Wonshik Kim](https://github.com/wokim) * [:link:](raphael/raphael.d.ts) [Raphael](http://raphaeljs.com) by [CheCoxshall](https://github.com/CheCoxshall) * [:link:](ravenjs/ravenjs.d.ts) [Raven.js](https://github.com/getsentry/raven-js) by [Santi Albo](https://github.com/santialbo) * [:link:](react/react.d.ts) [React](http://facebook.github.io/react) by [Asana](https://asana.com) @@ -549,6 +551,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](selenium-webdriver/selenium-webdriver.d.ts) [Selenium WebDriverJS](https://code.google.com/p/selenium) by [Bill Armstrong](https://github.com/BillArmstrong) * [:link:](semver/semver.d.ts) [semver](https://github.com/isaacs/node-semver) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](sendgrid/sendgrid.d.ts) [sendgrid](https://github.com/sendgrid/sendgrid-nodejs) by [Maxime LUCE](https://github.com/SomaticIT) +* [:link:](sharedworker/SharedWorker.d.ts) [SharedWorker](http://www.w3.org/TR/workers) by [Toshiya Nakakura](https://github.com/nakakura) * [:link:](shelljs/shelljs.d.ts) [ShellJS](http://shelljs.org) by [Niklas Mollenhauer](https://github.com/nikeee) * [:link:](should/should.d.ts) [should.js](https://github.com/visionmedia/should.js) by [Alex Varju](https://github.com/varju), [Maxime LUCE](https://github.com/SomaticIT) * [:link:](showdown/showdown.d.ts) [Showdown](https://github.com/coreyti/showdown) by [cbowdon](https://github.com/cbowdon) @@ -600,7 +603,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](swiz/swiz.d.ts) [swiz](https://github.com/racker/node-swiz) by [Jeff Goddard](https://github.com/jedigo) * [:link:](tape/tape.d.ts) [tape](https://github.com/substack/tape) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](tar/tar.d.ts) [tar](https://github.com/npm/node-tar) by [Maxime LUCE](https://github.com/SomaticIT) -* [:link:](tedious/tedious.d.ts) [tedious](https://github.com/pekim/tedious) by [Rogier Schouten](https://github.com/rogierschouten) +* [:link:](tedious/tedious.d.ts) [tedious](https://pekim.github.io/tedious) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](teechart/teechart.d.ts) [TeeChart](http://www.steema.com) by [Steema Software](https://steema.com) * [:link:](text-buffer/text-buffer.d.ts) [text-buffer](https://github.com/atom/text-buffer) by [vvakame](https://github.com/vvakame) * [:link:](text-encoding/text-encoding.d.ts) [text-encoding](https://github.com/inexorabletash/text-encoding) by [MIZUNE Pine](https://github.com/pine613) @@ -656,7 +659,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](vinyl-fs/vinyl-fs.d.ts) [vinyl-fs](https://github.com/wearefractal/vinyl-fs) by [vvakame](https://github.com/vvakame) * [: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) +* [: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:](devextreme/dx.webappjs.d.ts) [WebAppJS](http://js.devexpress.com/WebDevelopment) by [DevExpress Inc.](http://devexpress.com) diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 8e2637604..0cb827a28 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -109,7 +109,7 @@ declare module Backbone { urlRoot: any; constructor(attributes?: any, options?: any); - initialize(attributes?: any): void; + initialize(attributes?: any, options?: any): void; fetch(options?: ModelFetchOptions): JQueryXHR; @@ -176,6 +176,7 @@ declare module Backbone { length: number; constructor(models?: TModel[], options?: any); + initialize(models?: TModel[], options?: any): void; fetch(options?: CollectionFetchOptions): JQueryXHR; @@ -328,6 +329,7 @@ declare module Backbone { private static extend(properties: any, classProperties?: any): any; constructor(options?: ViewOptions); + initialize(options?: ViewOptions): void; /** * Events hash or a method returning the events hash that maps events/selectors to methods on your View. diff --git a/big.js/big.js-tests.ts b/big.js/big.js-tests.ts index 6de9ee7cc..df6128314 100644 --- a/big.js/big.js-tests.ts +++ b/big.js/big.js-tests.ts @@ -230,4 +230,21 @@ function propertiesTest3() { y.c // '0' [0].toString() y.e // 0 y.s // -1 +} + +// see http://mikemcl.github.io/big.js/#faq +// "How can I simultaneously use different decimal places and/or rounding mode settings for different Big numbers?" +function testMultipleConstructors() { + + var Big10 = Big(); + + // Set the decimal places of division operations for each constructor. + Big.DP = 3; + Big10.DP = 10; + + var x = Big(5); + var y = Big10(5); + + x.div(3) // 1.667 + y.div(3) // 1.6666666667 } \ No newline at end of file diff --git a/big.js/big.js.d.ts b/big.js/big.js.d.ts index 4f6278a80..0e4ac48be 100644 --- a/big.js/big.js.d.ts +++ b/big.js/big.js.d.ts @@ -42,6 +42,9 @@ declare module BigJsLibrary { (value: string): BigJS; /** A decimal value. */ (value: BigJS): BigJS; + + /** A decimal value. */ + (): BigJS; } /** BigJS instance methods */ diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 2f439a76f..15b1375f3 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -926,7 +926,7 @@ declare module D3 { (name: string, value: any, priority?: string): Transition; (name: string, valueFunction: (data: any, index: number) => any, priority?: string): Transition; }; - call(callback: (selection: Selection) => void ): Transition; + call(callback: (transition: Transition, ...args: any[]) => void, ...args: any[]): Transition; /** * Select an element from the current document */ @@ -1750,6 +1750,8 @@ declare module D3 { export interface Axis { (selection: Selection): void; + (transition: Transition.Transition): void; + scale: { (): any; (scale: any): Axis; diff --git a/jwt-simple/jwt-simple-tests.ts b/jwt-simple/jwt-simple-tests.ts new file mode 100644 index 000000000..8a0cc59c5 --- /dev/null +++ b/jwt-simple/jwt-simple-tests.ts @@ -0,0 +1,12 @@ +/// + +import jwt = require('jwt-simple'); +var payload = { foo: 'bar' }; +var secret:string = 'xxx'; + +// encode +var token = jwt.encode(payload, secret); + +// decode +var decoded = jwt.decode(token, secret); +console.log(decoded); //=> { foo: 'bar' } \ No newline at end of file diff --git a/jwt-simple/jwt-simple.d.ts b/jwt-simple/jwt-simple.d.ts new file mode 100644 index 000000000..0ee3cc679 --- /dev/null +++ b/jwt-simple/jwt-simple.d.ts @@ -0,0 +1,22 @@ +// Type definitions for jwt-simple v0.2.0 +// Project: https://github.com/hokaccha/node-jwt-simple +// Definitions by: Ken Fukuyama +// Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module "jwt-simple" { + /** + * Decode jwt + * @param token + * @param key + * @param noVerify + * @api public + */ + export function decode(token:any, key:string, noVerify?:boolean):any; + /** + * Encode jwt + * @param payload + * @param key + * @param algorithm default is HS256 + * @api public + */ + export function encode(payload:any, key:string, algorithm?:string):string; +} diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 719b3012b..730ba4880 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -281,13 +281,13 @@ declare module Marionette { renderModel(): any; } - class Layout extends ItemView { + class LayoutView extends ItemView { constructor(options?: any); addRegion(name: string, definition: any): Region; addRegions(regions: any): any; - render(): Layout; + render(): LayoutView; removeRegion(name: string); } diff --git a/mysql/mysql-tests.ts b/mysql/mysql-tests.ts index 83fdeb06a..f671a6372 100644 --- a/mysql/mysql-tests.ts +++ b/mysql/mysql-tests.ts @@ -1,6 +1,8 @@ /// +import fs = require('fs'); import mysql = require('mysql'); +import stream = require('stream'); /// Connections var connection = mysql.createConnection({ @@ -119,6 +121,8 @@ connection.config.queryFormat = function (query, values) { connection.query("UPDATE posts SET title = :title", { title: "Hello MySQL" }); +var s: stream.Readable = connection.query("UPDATE posts SET title = :title", { title: "Hello MySQL" }).stream({ highWaterMark: 5 }); + connection.query('INSERT INTO posts SET ?', { title: 'test' }, function (err, result) { if (err) throw err; @@ -243,9 +247,10 @@ query // all rows have been received }); +var writable = fs.createWriteStream('file.txt'); connection.query('SELECT * FROM posts') .stream({ highWaterMark: 5 }) - .pipe(() => { }); + .pipe(writable); connection = mysql.createConnection({ multipleStatements: true }); diff --git a/mysql/mysql.d.ts b/mysql/mysql.d.ts index 479b05266..4c701b931 100644 --- a/mysql/mysql.d.ts +++ b/mysql/mysql.d.ts @@ -3,29 +3,37 @@ // Definitions by: William Johnston // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module mysql { - export interface IMySql { - createConnection(connectionUri: string): IConnection; - createConnection(config: IConnectionConfig): IConnection; +/// - createPool(config: IPoolConfig): IPool; +declare module "mysql" { + import stream = require("stream"); - createPoolCluster(config?: IPoolClusterConfig): IPoolCluster; + function createConnection(connectionUri: string): IConnection; + function createConnection(config: IConnectionConfig): IConnection; + function createPool(config: IPoolConfig): IPool; + function createPoolCluster(config?: IPoolClusterConfig): IPoolCluster; + function escape(value: any): string; + function format(sql: string): string; + function format(sql: string, values: Array): string; - escape(value: any): string; + interface IMySql { + createConnection(connectionUri: string): IConnection; + createConnection(config: IConnectionConfig): IConnection; + createPool(config: IPoolConfig): IPool; + createPoolCluster(config?: IPoolClusterConfig): IPoolCluster; + escape(value: any): string; + format(sql: string): string; + format(sql: string, values: Array): string; + } - format(sql: string): string; - format(sql: string, values: Array): string; - } - - export interface IConnectionStatic { + interface IConnectionStatic { createQuery(sql: string): IQuery; createQuery(sql: string, callback: (err: IError, ...args: any[]) => void): IQuery; createQuery(sql: string, values: Array): IQuery; createQuery(sql: string, values: Array, callback: (err: IError, ...args: any[]) => void): IQuery; } - export interface IConnection { + interface IConnection { config: IConnectionConfig; threadId: number; @@ -68,7 +76,7 @@ declare module mysql { rollback(callback: () => void): void; } - export interface IPool { + interface IPool { config: IPoolConfig; getConnection(callback: (err: IError, connection: IConnection) => void): void; @@ -80,7 +88,7 @@ declare module mysql { on(ev: 'error', callback: (err: IError) => void): IPool; } - export interface IPoolCluster { + interface IPoolCluster { config: IPoolClusterConfig; add(config: IPoolConfig): void; @@ -101,7 +109,7 @@ declare module mysql { on(ev: 'error', callback: (err: IError) => void): IPoolCluster; } - export interface IQuery { + interface IQuery { /** * The SQL for a constructed query */ @@ -125,7 +133,7 @@ declare module mysql { * * @param options The options for the stream. */ - stream(options: IStreamOptions): IQuery; + stream(options: IStreamOptions): stream.Readable; /** * Pipes a stream downstream, providing automatic pause/resume based on the @@ -142,7 +150,7 @@ declare module mysql { on(ev: 'end', callback: () => void): IQuery; } - export interface IQueryFunction { + interface IQueryFunction { (sql: string): IQuery; (sql: string, callback: (err: IError, ...args: any[]) => void): IQuery; (sql: string, values: Array): IQuery; @@ -157,7 +165,7 @@ declare module mysql { (options: IQueryOptions, values: any, callback: (err: IError, ...args: any[]) => void): IQuery; } - export interface IQueryOptions { + interface IQueryOptions { /** * The SQL for the query */ @@ -200,7 +208,7 @@ declare module mysql { typeCast?: any; } - export interface IStreamOptions { + interface IStreamOptions { /** * Sets the max buffer size in objects of a stream */ @@ -212,7 +220,7 @@ declare module mysql { objectMode?: any; } - export interface IConnectionOptions { + interface IConnectionOptions { /** * The MySQL user to authenticate as */ @@ -236,7 +244,7 @@ declare module mysql { charset?: string; } - export interface IConnectionConfig extends IConnectionOptions { + interface IConnectionConfig extends IConnectionOptions { /** * The hostname of the database you are connecting to. (Default: localhost) */ @@ -356,7 +364,7 @@ declare module mysql { ssl?: any; } - export interface IPoolConfig extends IConnectionConfig { + interface IPoolConfig extends IConnectionConfig { /** * The milliseconds before a timeout occurs during the connection acquisition. This is slightly different from connectTimeout, * because acquiring a pool connection does not always involve making a connection. (Default: 10 seconds) @@ -382,7 +390,7 @@ declare module mysql { queueLimit?: number; } - export interface IPoolClusterConfig { + interface IPoolClusterConfig { /** * If true, PoolCluster will attempt to reconnect when connection fails. (Default: true) */ @@ -403,7 +411,7 @@ declare module mysql { defaultSelector?: string; } - export interface ISslCredentials { + interface ISslCredentials { /** * A string or buffer holding the PFX or PKCS12 encoded private key, certificate and CA certificates */ @@ -440,7 +448,7 @@ declare module mysql { ciphers?: string; } - export interface IError extends Error { + interface IError extends Error { /** * Either a MySQL server error (e.g. 'ER_ACCESS_DENIED_ERROR'), * a node.js error (e.g. 'ECONNREFUSED') or an internal error @@ -480,8 +488,3 @@ declare module mysql { } } -declare module 'mysql' { - var mysql: mysql.IMySql; - - export = mysql; -} diff --git a/node_zeromq/zmq-tests.ts b/node_zeromq/zmq-tests.ts index bb97fd2ca..cdc044b07 100644 --- a/node_zeromq/zmq-tests.ts +++ b/node_zeromq/zmq-tests.ts @@ -18,6 +18,9 @@ function test3() { var sock = zmq.socket('push'); sock.bindSync('tcp://127.0.0.1:3000'); sock.send(['hello', 'world']); + sock.on('message', function (buffer: Buffer) { + // + }); } function test4() { @@ -32,4 +35,6 @@ function test5() { sock.bind('tcp://127.0.0.1', err => { sock.send("some work"); }); -} \ No newline at end of file + sock.monitor(); + sock.monitor(10); +} diff --git a/node_zeromq/zmq.d.ts b/node_zeromq/zmq.d.ts index 7e81dd217..8a375352c 100644 --- a/node_zeromq/zmq.d.ts +++ b/node_zeromq/zmq.d.ts @@ -3,6 +3,8 @@ // Definitions by: Dave McKeown // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + interface EventEmitter {} declare module 'zmq' { @@ -144,12 +146,27 @@ declare module 'zmq' { */ send(msg: any[], flags?: number): Socket; + /** + * Enable monitoring of a Socket + * + * @param {Number} timer interval in ms > 0 or Undefined for default + * @return {Socket} for chaining + */ + monitor(interval?: number): Socket; + /** * Close the socket. * */ close(): Socket; + /** + * Socket event + * @param eventName {string} + * @param callback {Function} + */ + on(eventName: string, callback: (buffer: Buffer) => void): void; + // Socket Options _fd: any; _ioevents: any; @@ -181,5 +198,4 @@ declare module 'zmq' { function socket(type: number, options?: any): Socket; function createSocket(type: string, options?: any): Socket; - -} \ No newline at end of file +} diff --git a/nodemailer/nodemailer.d.ts b/nodemailer/nodemailer.d.ts index c95aee99f..a63479e83 100644 --- a/nodemailer/nodemailer.d.ts +++ b/nodemailer/nodemailer.d.ts @@ -104,3 +104,8 @@ interface Nodemailer { createTransport(type: string, path: string): Transport; createXOAuthGenerator(options: XOAuthGeneratorOptions): XOAuthGenerator; } + +declare module "nodemailer" { + var nodemailer: Nodemailer; + export = nodemailer; +} diff --git a/rabbit.js/rabbit.js-tests.ts b/rabbit.js/rabbit.js-tests.ts new file mode 100644 index 000000000..3e5a4d6d2 --- /dev/null +++ b/rabbit.js/rabbit.js-tests.ts @@ -0,0 +1,33 @@ +/// + +import rabbit = require('rabbit.js'); +var context = rabbit.createContext(); + +context.on('ready', function () { console.log('ready'); }); + +var pub = context.socket('PUB'); +var sub = context.socket('SUB'); +var push = context.socket('PUSH'); +var pull = context.socket('PULL'); +var req = context.socket('REQ'); +var rep = context.socket('REP'); +var task = context.socket('TASK'); +var worker = context.socket('WORKER'); + +pub.connect('chat'); +pub.write('hello', 'utf8'); +pub.close(); + +sub.connect('chat'); +sub.on('data', function (msg: string) { console.log(msg); }); +sub.close(); + +rep.setEncoding('utf8'); +rep.on('data', function (msg: string) { rep.write('msg', 'utf8'); }); +rep.connect('uppercase'); +req.connect('uppercase', function () { req.pipe(process.stdout); }); + +push.connect('items', function () { pull.pipe(push); }); +push.close(); +pull.connect('items', function () {}); +pull.close(); \ No newline at end of file diff --git a/rabbit.js/rabbit.js.d.ts b/rabbit.js/rabbit.js.d.ts new file mode 100644 index 000000000..98d8172fd --- /dev/null +++ b/rabbit.js/rabbit.js.d.ts @@ -0,0 +1,108 @@ +// Type definitions for rabbit.js v0.4.2 +// Project: https://github.com/squaremo/rabbit.js +// Definitions by: Wonshik Kim +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "rabbit.js" { + import events = require('events'); + import stream = require('stream'); + + export function createContext(url?: string): Context; + + export class Context extends events.EventEmitter { + public socket(type: string, options?: SocketOptions):T; + public close(callback: Function): any; + } + + export interface SocketOptions { + prefetch?: any; + expiration?: any; + persistent?: any; + topic?: any; + task?: any; + } + + export interface Socket { + connect(destination: string, callback?: Function): any; + setsockopt(opt: string, value: string): any; + close(): any; + } + + export class PubSocket extends stream.Writable implements Socket { + constructor(channel: string, opts: SocketOptions); + connect(destination: string, callback?: Function): any; + setsockopt(opt: string, value: string): any; + close(): any; + + publish(topic: string, chunk: string, encoding?: string): any; + publish(topic: string, chunk: Buffer, encoding?: string): any; + } + + export class SubSocket extends stream.Readable implements Socket { + constructor(channel: string, opts: SocketOptions); + connect(source: string, callback?: Function): any; + setsockopt(opt: string, value: string): any; + close(): any; + } + + export class PushSocket extends stream.Writable implements Socket { + constructor(channel: string, opts: SocketOptions); + connect(destination: string, callback?: Function): any; + setsockopt(opt: string, value: string): any; + close(): any; + } + + export class PullSocket extends stream.Readable implements Socket { + constructor(channel: string, opts: SocketOptions); + connect(source: string, callback?: Function): any; + setsockopt(opt: string, value: string): any; + close(): any; + } + + export class WorkerSocket extends stream.Readable implements Socket { + constructor(channel: string, opts: SocketOptions); + connect(source: string, callback?: Function): any; + setsockopt(opt: string, value: string): any; + close(): any; + + ack(): any; + requeue(): any; + discard(): any; + } + + export interface RequestMessage { + properties: { correlationId: number }; + content: any; + } + + export class ReqSocket extends stream.Duplex implements Socket { + constructor(channel: string, opts: SocketOptions); + connect(destination: string, callback?: Function): any; + setsockopt(opt: string, value: string): any; + close(): any; + + handleReply(msg: RequestMessage): any; + } + + export class RepSocket extends stream.Duplex implements Socket { + constructor(channel: string, opts: SocketOptions); + connect(source: string, callback?: Function): any; + setsockopt(opt: string, value: string): any; + close(): any; + + requeue(): any; + discard(): any; + } + + export class TaskSocket extends stream.Writable implements Socket { + constructor(channel: string, opts: SocketOptions); + connect(destination: string, callback?: Function): any; + setsockopt(opt: string, value: string): any; + close(): any; + + post(task: string, chunk: string, encoding?: string): any; + post(task: string, chunk: Buffer, encoding?: string): any; + } +} diff --git a/sharedworker/SharedWorker-tests.ts b/sharedworker/SharedWorker-tests.ts new file mode 100644 index 000000000..853daa6b2 --- /dev/null +++ b/sharedworker/SharedWorker-tests.ts @@ -0,0 +1,9 @@ +/// + +var worker_with_name = new SharedWorker('worker.js', "worker"); + +var worker = new SharedWorker('worker.js'); + +worker.port.onmessage = function(e) { + console.log(e); +}; diff --git a/sharedworker/SharedWorker.d.ts b/sharedworker/SharedWorker.d.ts new file mode 100644 index 000000000..b106d1342 --- /dev/null +++ b/sharedworker/SharedWorker.d.ts @@ -0,0 +1,29 @@ +// Type definitions for SharedWorker +// Project: http://www.w3.org/TR/workers/ +// Definitions by: Toshiya Nakakura +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module SharedWorker { + interface AbstractWorker extends EventTarget { + onerror: (ev: ErrorEvent) => any; + } + + export interface SharedWorker extends AbstractWorker { + /** + * the value it was assigned by the object's constructor. + * It represents the MessagePort for communicating with the shared worker. + * @type {MessagePort} + */ + port: MessagePort; + } +} + +declare var SharedWorker: { + prototype: SharedWorker.SharedWorker; + /*** + * + * @param {string} stringUrl Pathname to JavaScript file + * @param {string} name Name of the worker to execute + */ + new (stringUrl: string, name?: string): SharedWorker.SharedWorker; +}; diff --git a/sigmajs/sigmajs.d.ts b/sigmajs/sigmajs.d.ts index 7ffe26626..ae2b09816 100644 --- a/sigmajs/sigmajs.d.ts +++ b/sigmajs/sigmajs.d.ts @@ -31,6 +31,10 @@ declare module SigmaJs{ (key: string): string; } + interface CustomShapes { + init(sigma: Sigma): void; + } + interface DragNodes { (sigma: Sigma, renderer: Renderer): DragNodes; } @@ -78,8 +82,10 @@ declare module SigmaJs{ interface Node { color?: string; id: string; + image?: any; label?: string; size?: number; + type?: string; x?: number; y?: number; } @@ -107,6 +113,10 @@ declare module SigmaJs{ type?: string; } + interface ShapeLibrary { + enumerate(): any; + } + interface Sigma { addRenderer(): Renderer; addRenderer(configs: RendererConfigs): Renderer; @@ -253,3 +263,5 @@ declare module SigmaJs{ } declare var sigma: SigmaJs.SigmaFactory; +declare var CustomShapes: SigmaJs.CustomShapes; +declare var ShapeLibrary: SigmaJs.CustomShapes; diff --git a/socket.io-client/socket.io-client.d.ts b/socket.io-client/socket.io-client.d.ts index a3882bbd7..c5d783764 100644 --- a/socket.io-client/socket.io-client.d.ts +++ b/socket.io-client/socket.io-client.d.ts @@ -23,10 +23,11 @@ declare module SocketIOClient { interface Socket { on(event: string, fn: Function): Socket; once(event: string, fn: Function): Socket; - off(event: string, fn: Function): Socket; + off(event?: string, fn?: Function): Socket; emit(event: string, ...args: any[]): Socket; listeners(event: string): Function[]; hasListeners(event: string): boolean; + connected: boolean; } interface ManagerStatic { diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index b6aad3293..b1db7515f 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -27,10 +27,10 @@ declare module SocketIO { adapter(v: any): Server; origins(v: string): Server; sockets: Namespace; - attach(srv: any, opts: any): Server; - attach(port: number, opts: any): Server; - listen(srv: any, opts: any): Server; - listen(port: number, opts: any): Server; + attach(srv: any, opts?: any): Server; + attach(port: number, opts?: any): Server; + listen(srv: any, opts?: any): Server; + listen(port: number, opts?: any): Server; bind(srv: any): Server; onconnection(socket: any): Server; of(nsp: string): Namespace; diff --git a/threejs/three.d.ts b/threejs/three.d.ts index b1660aa7e..39d65da6c 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -3189,7 +3189,7 @@ declare module THREE { * Sets this quaternion from rotation component of m. Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm. */ setFromRotationMatrix(m: Matrix4): Quaternion; - setFromUnitVectors(vFrom: Vector3, vTo: Vector4): Quaternion; + setFromUnitVectors(vFrom: Vector3, vTo: Vector3): Quaternion; /** * Inverts this quaternion. */ diff --git a/webaudioapi/waa-tests.ts b/webaudioapi/waa-tests.ts index 20e49f8ea..91c611463 100644 --- a/webaudioapi/waa-tests.ts +++ b/webaudioapi/waa-tests.ts @@ -81,11 +81,20 @@ declare var footstepsBuffer: any; panner.connect(wet3); dry3.connect(masterDry); wet3.connect(reverb); - + // Start the sources now. source1.start(0); - source2.start(0); + // MEMO: should be when parameter is 0 + // http://www.w3.org/TR/webaudio/#AudioBufferSourceNode + source2.start(); source3.start(0); + + // Stop the sources are 2 seconds later. + source1.stop(2); + // MEMO: should be when parameter is 0 + // http://www.w3.org/TR/webaudio/#AudioBufferSourceNode + source2.stop(); + source3.stop(2); }; ()=>{ diff --git a/webaudioapi/waa.d.ts b/webaudioapi/waa.d.ts index 43aa8c4ea..d6960bbb3 100644 --- a/webaudioapi/waa.d.ts +++ b/webaudioapi/waa.d.ts @@ -1,6 +1,6 @@ // Type definitions for Web Audio API // Project: http://www.w3.org/TR/webaudio/ -// Definitions by: Baruch Berger , Kon +// Definitions by: Baruch Berger , Kon , kubosho // Definitions: https://github.com/borisyankov/DefinitelyTyped /** @@ -545,14 +545,14 @@ interface AudioBufferSourceNode extends AudioSourceNode { * @param offset the offset time in the buffer (in seconds) where playback will begin. This parameter is optional with a default value of 0 (playing back from the beginning of the buffer). * @param duration the duration of the portion (in seconds) to be played. This parameter is optional, with the default value equal to the total duration of the AudioBuffer minus the offset parameter. Thus if neither offset nor duration are specified then the implied duration is the total duration of the AudioBuffer. */ - start(when: number, offset?: number, duration?: number): void; + start(when?: number, offset?: number, duration?: number): void; /** * Schedules a sound to stop playback at an exact time. Please see deprecation section for the old method name. * * The when parameter describes at what time (in seconds) the sound should stop playing. It is in the same time coordinate system as AudioContext.currentTime. If 0 is passed in for this value or if the value is less than currentTime, then the sound will stop playing immediately. stop must only be called one time and only after a call to start or stop, or an exception will be thrown. */ - stop(when: number): void; + stop(when?: number): void; } /*