mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-27 11:40:08 +08:00
Merge branch 'master' of https://github.com/borisyankov/DefinitelyTyped into baconjs-event-target
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "iojs-v2"
|
||||
|
||||
sudo: false
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="_debugger.d.ts"/>
|
||||
import _debugger = require("_debugger");
|
||||
var {Client} = _debugger;
|
||||
|
||||
var client = new Client();
|
||||
|
||||
client.connect(8888, 'localhost');
|
||||
client.listbreakpoints((err, res) => {
|
||||
|
||||
});
|
||||
Vendored
+135
@@ -0,0 +1,135 @@
|
||||
// Type definitions for Node.js debugger API
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Basarat Ali Syed <https://github.com/basarat>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module NodeJS {
|
||||
export module _debugger {
|
||||
export interface Packet {
|
||||
raw: string;
|
||||
headers: string[];
|
||||
body: Message;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
seq: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface RequestInfo {
|
||||
command: string;
|
||||
arguments: any;
|
||||
}
|
||||
|
||||
export interface Request extends Message, RequestInfo {
|
||||
}
|
||||
|
||||
export interface Event extends Message {
|
||||
event: string;
|
||||
body?: any;
|
||||
}
|
||||
|
||||
export interface Response extends Message {
|
||||
request_seq: number;
|
||||
success: boolean;
|
||||
/** Contains error message if success === false. */
|
||||
message?: string;
|
||||
/** Contains message body if success === true. */
|
||||
body?: any;
|
||||
}
|
||||
|
||||
export interface BreakpointMessageBody {
|
||||
type: string;
|
||||
target: number;
|
||||
line: number;
|
||||
}
|
||||
|
||||
export class Protocol {
|
||||
res: Packet;
|
||||
state: string;
|
||||
execute(data: string): void;
|
||||
serialize(rq: Request): string;
|
||||
onResponse: (pkt: Packet) => void;
|
||||
}
|
||||
|
||||
export var NO_FRAME: number;
|
||||
export var port: number;
|
||||
|
||||
export interface ScriptDesc {
|
||||
name: string;
|
||||
id: number;
|
||||
isNative?: boolean;
|
||||
handle?: number;
|
||||
type: string;
|
||||
lineOffset?: number;
|
||||
columnOffset?: number;
|
||||
lineCount?: number;
|
||||
}
|
||||
|
||||
export interface Breakpoint {
|
||||
id: number;
|
||||
scriptId: number;
|
||||
script: ScriptDesc;
|
||||
line: number;
|
||||
condition?: string;
|
||||
scriptReq?: string;
|
||||
}
|
||||
|
||||
export interface RequestHandler {
|
||||
(err: boolean, body: Message, res: Packet): void;
|
||||
request_seq?: number;
|
||||
}
|
||||
|
||||
export interface ResponseBodyHandler {
|
||||
(err: boolean, body?: any): void;
|
||||
request_seq?: number;
|
||||
}
|
||||
|
||||
export interface ExceptionInfo {
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface BreakResponse {
|
||||
script?: ScriptDesc;
|
||||
exception?: ExceptionInfo;
|
||||
sourceLine: number;
|
||||
sourceLineText: string;
|
||||
sourceColumn: number;
|
||||
}
|
||||
|
||||
export function SourceInfo(body: BreakResponse): string;
|
||||
|
||||
export interface ClientInstance extends EventEmitter {
|
||||
protocol: Protocol;
|
||||
scripts: ScriptDesc[];
|
||||
handles: ScriptDesc[];
|
||||
breakpoints: Breakpoint[];
|
||||
currentSourceLine: number;
|
||||
currentSourceColumn: number;
|
||||
currentSourceLineText: string;
|
||||
currentFrame: number;
|
||||
currentScript: string;
|
||||
|
||||
connect(port: number, host: string): void;
|
||||
req(req: any, cb: RequestHandler): void;
|
||||
reqFrameEval(code: string, frame: number, cb: RequestHandler): void;
|
||||
mirrorObject(obj: any, depth: number, cb: ResponseBodyHandler): void;
|
||||
setBreakpoint(rq: BreakpointMessageBody, cb: RequestHandler): void;
|
||||
clearBreakpoint(rq: Request, cb: RequestHandler): void;
|
||||
listbreakpoints(cb: RequestHandler): void;
|
||||
reqSource(from: number, to: number, cb: RequestHandler): void;
|
||||
reqScripts(cb: any): void;
|
||||
reqContinue(cb: RequestHandler): void;
|
||||
}
|
||||
|
||||
export var Client : {
|
||||
new (): ClientInstance
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "_debugger"{
|
||||
export = NodeJS._debugger;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path='acl-mongodbBackend.d.ts'/>
|
||||
/// <reference path='acl.d.ts'/>
|
||||
|
||||
// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
|
||||
import Acl = require('acl');
|
||||
@@ -14,4 +14,3 @@ acl.allow('guest', 'blogs', 'view');
|
||||
|
||||
// allow function accepts arrays as any parameter
|
||||
acl.allow('member', 'blogs', ['edit','view', 'delete']);
|
||||
|
||||
|
||||
Vendored
-22
@@ -1,22 +0,0 @@
|
||||
// Type definitions for node_acl 0.4.7
|
||||
// Project: https://github.com/optimalbits/node_acl
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="acl.d.ts" />
|
||||
/// <reference path="../mongodb/mongodb.d.ts" />
|
||||
|
||||
declare module "acl" {
|
||||
import mongo = require('mongodb');
|
||||
|
||||
interface AclStatic {
|
||||
mongodbBackend: MongodbBackendStatic;
|
||||
}
|
||||
|
||||
interface MongodbBackend extends Backend<Callback> { }
|
||||
interface MongodbBackendStatic {
|
||||
new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend;
|
||||
new(db: mongo.Db, prefix: string): MongodbBackend;
|
||||
new(db: mongo.Db): MongodbBackend;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path='acl-redisBackend.d.ts'/>
|
||||
/// <reference path='acl.d.ts'/>
|
||||
|
||||
// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
|
||||
import Acl = require('acl');
|
||||
|
||||
Vendored
-21
@@ -1,21 +0,0 @@
|
||||
// Type definitions for node_acl 0.4.7
|
||||
// Project: https://github.com/optimalbits/node_acl
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="acl.d.ts" />
|
||||
/// <reference path='../redis/redis.d.ts'/>
|
||||
|
||||
declare module "acl" {
|
||||
import redis = require('redis');
|
||||
|
||||
interface AclStatic {
|
||||
redisBackend: RedisBackendStatic;
|
||||
}
|
||||
|
||||
interface RedisBackend extends Backend<redis.RedisClient> { }
|
||||
interface RedisBackendStatic {
|
||||
new(redis: redis.RedisClient, prefix: string): RedisBackend;
|
||||
new(redis: redis.RedisClient): RedisBackend;
|
||||
}
|
||||
}
|
||||
Vendored
+30
@@ -6,6 +6,9 @@
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path='../node/node.d.ts'/>
|
||||
|
||||
/// <reference path='../redis/redis.d.ts'/>
|
||||
/// <reference path="../mongodb/mongodb.d.ts" />
|
||||
|
||||
declare module "acl" {
|
||||
import http = require('http');
|
||||
import Promise = require("bluebird");
|
||||
@@ -115,6 +118,33 @@ declare module "acl" {
|
||||
end: () => void;
|
||||
}
|
||||
|
||||
// for redis backend
|
||||
import redis = require('redis');
|
||||
|
||||
interface AclStatic {
|
||||
redisBackend: RedisBackendStatic;
|
||||
}
|
||||
|
||||
interface RedisBackend extends Backend<redis.RedisClient> { }
|
||||
interface RedisBackendStatic {
|
||||
new(redis: redis.RedisClient, prefix: string): RedisBackend;
|
||||
new(redis: redis.RedisClient): RedisBackend;
|
||||
}
|
||||
|
||||
// for mongodb backend
|
||||
import mongo = require('mongodb');
|
||||
|
||||
interface AclStatic {
|
||||
mongodbBackend: MongodbBackendStatic;
|
||||
}
|
||||
|
||||
interface MongodbBackend extends Backend<Callback> { }
|
||||
interface MongodbBackendStatic {
|
||||
new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend;
|
||||
new(db: mongo.Db, prefix: string): MongodbBackend;
|
||||
new(db: mongo.Db): MongodbBackend;
|
||||
}
|
||||
|
||||
var _: AclStatic;
|
||||
export = _;
|
||||
}
|
||||
|
||||
Vendored
-4
@@ -9,10 +9,6 @@ interface Window {
|
||||
token: string;
|
||||
}
|
||||
|
||||
interface Location {
|
||||
origin: string;
|
||||
}
|
||||
|
||||
/** This is the interface for the main Auth0 client. */
|
||||
interface Auth0Static {
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="batch-stream.d.ts" />
|
||||
|
||||
import fs = require('fs');
|
||||
import BatchStream = require('batch-stream');
|
||||
|
||||
var batch = new BatchStream({ size : 5 });
|
||||
var stream = fs.createReadStream('/etc/passwd');
|
||||
|
||||
stream
|
||||
.pipe(batch)
|
||||
.pipe(fs.createWriteStream('./test.out')); // deals with array input from pipe.
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for batch-stream 0.1.2
|
||||
// Project: https://github.com/segmentio/batch-stream
|
||||
// Definitions by: Nicholas Penree <http://github.com/drudge>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "batch-stream" {
|
||||
import stream = require('stream');
|
||||
|
||||
interface Options {
|
||||
size?: number;
|
||||
highWaterMark?: number;
|
||||
}
|
||||
|
||||
class BatchStream extends stream.Transform {
|
||||
size: number;
|
||||
batch: any[];
|
||||
|
||||
constructor(options: Options);
|
||||
}
|
||||
|
||||
export = BatchStream;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ function test_dom_element() {
|
||||
}
|
||||
|
||||
function test_dom_event() {
|
||||
var event = new CKEDITOR.dom.event(new Event());
|
||||
var event = new CKEDITOR.dom.event(new Event(""));
|
||||
alert(event.getKey());
|
||||
alert(event.getKeystroke() == 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/// <reference path="constant-case.d.ts" />
|
||||
|
||||
import constantCase = require('constant-case');
|
||||
|
||||
console.log(constantCase('string')); // => "STRING"
|
||||
console.log(constantCase('PascalCase')); // => "PASCAL_CASE"
|
||||
|
||||
console.log(constantCase('myString', 'tr')); // => "MY_STRİNG"
|
||||
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for constant-case
|
||||
// Project: https://github.com/blakeembrey/constant-case
|
||||
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "constant-case" {
|
||||
function constantCase(string: string, locale?: string): string;
|
||||
export = constantCase;
|
||||
}
|
||||
@@ -0,0 +1,502 @@
|
||||
/// <reference path="core-js.d.ts" />
|
||||
|
||||
interface Point { x: number; y: number; }
|
||||
interface Point3D extends Point { z: number; }
|
||||
|
||||
let a: any;
|
||||
let s: string;
|
||||
let i: number;
|
||||
let b: boolean;
|
||||
let f: () => void;
|
||||
let o: Object;
|
||||
let r: RegExp;
|
||||
let sym: symbol;
|
||||
let e: Error;
|
||||
let date: Date;
|
||||
let key: PropertyKey;
|
||||
let point: Point;
|
||||
let point3d: Point3D;
|
||||
let arrayOfPoint: Point[];
|
||||
let arrayOfPoint3D: Point3D[];
|
||||
let arrayOfSymbol: symbol[];
|
||||
let arrayOfPropertyKey: PropertyKey[];
|
||||
let arrayOfAny: any[];
|
||||
let arrayOfStringAny: [string, any][];
|
||||
let arrayLikeOfAny: ArrayLike<any>;
|
||||
let iterableOfPoint: Iterable<Point>;
|
||||
let iterableOfStringPoint: Iterable<[string, Point]>;
|
||||
let iterableOfPointPoint3D: Iterable<[Point, Point3D]>;
|
||||
let iterableIteratorOfPoint: IterableIterator<Point>;
|
||||
let iterableIteratorOfNumberPoint: IterableIterator<[number, Point]>;
|
||||
let iterableIteratorOfNumber: IterableIterator<number>;
|
||||
let iterableIteratorOfString: IterableIterator<string>;
|
||||
let iterableIteratorOfPointPoint: IterableIterator<[Point, Point]>;
|
||||
let iterableIteratorOfNode: IterableIterator<Node>;
|
||||
let iterableIteratorOfStringPoint: IterableIterator<[string, Point]>;
|
||||
let iterableIteratorOfAny: IterableIterator<any>;
|
||||
let iterableIteratorOfPropertyKey: IterableIterator<PropertyKey>;
|
||||
let iterableIteratorOfPropertyKeyPoint: IterableIterator<[PropertyKey, Point]>;
|
||||
let nodeList: NodeList;
|
||||
let pd: PropertyDescriptor;
|
||||
let pdm: PropertyDescriptorMap;
|
||||
let map: Map<string, Point>;
|
||||
let set: Set<Point>;
|
||||
let weakMap: WeakMap<Point, Point3D>;
|
||||
let weakSet: WeakSet<Point>;
|
||||
let $forOfPoint: $for<Point>;
|
||||
let $forOfPoint3D: $for<Point3D>;
|
||||
let promiseLikeOfPoint: PromiseLike<Point>;
|
||||
let promiseLikeOfPoint3D: PromiseLike<Point3D>;
|
||||
let promiseOfPoint: Promise<Point>;
|
||||
let promiseOfPoint3D: Promise<Point3D>;
|
||||
let promiseOfArrayOfPoint: Promise<Point[]>;
|
||||
let promiseOfVoid: Promise<void>;
|
||||
let dictOfPoint: Dict<Point>;
|
||||
let dictOfPoint3D: Dict<Point3D>;
|
||||
let dictOfAny: Dict<any>;
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Object & Function
|
||||
// Modules: es6.object.assign, es6.object.is, es6.object.set-prototype-of,
|
||||
// es6.object.to-string, es6.function.name and es6.function.has-instance.
|
||||
// #############################################################################################
|
||||
|
||||
point = Object.assign(point, point);
|
||||
b = Object.is(point, point);
|
||||
Object.setPrototypeOf(point, point);
|
||||
s = f.name;
|
||||
b = f[Symbol.hasInstance](point);
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Array
|
||||
// Modules: es6.array.from, es6.array.of, es6.array.copy-within, es6.array.fill, es6.array.find,
|
||||
// and es6.array.find-index
|
||||
// #############################################################################################
|
||||
|
||||
point = arrayOfPoint.find(p => b);
|
||||
i = arrayOfPoint.findIndex(p => b);
|
||||
arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length);
|
||||
arrayOfPoint = arrayOfPoint.copyWithin(i, i, i);
|
||||
a = arrayOfPoint[Symbol.unscopables];
|
||||
arrayOfPoint = Array.from(arrayOfPoint);
|
||||
arrayOfPoint = Array.from(iterableOfPoint);
|
||||
arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d);
|
||||
arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d, a);
|
||||
arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d);
|
||||
arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d, a);
|
||||
arrayOfPoint = Array.of(point, point);
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: String & RegExp
|
||||
// Modules: es6.string.from-code-point, es6.string.raw, es6.string.code-point-at,
|
||||
// es6.string.ends-with, es6.string.includes, es6.string.repeat,
|
||||
// es6.string.starts-with, and es6.regexp
|
||||
// #############################################################################################
|
||||
|
||||
i = s.codePointAt(i);
|
||||
b = s.includes(s, i);
|
||||
b = s.endsWith(s, i);
|
||||
s = s.repeat(i);
|
||||
b = s.startsWith(s, i);
|
||||
s = String.fromCodePoint(i, i);
|
||||
s = String.raw`abc`;
|
||||
s = r.flags;
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Number & Math
|
||||
// Modules: es6.number.constructor, es6.number.statics, and es6.math
|
||||
// #############################################################################################
|
||||
|
||||
i = Number.EPSILON;
|
||||
b = Number.isFinite(i);
|
||||
b = Number.isInteger(i);
|
||||
b = Number.isNaN(i);
|
||||
b = Number.isSafeInteger(i);
|
||||
i = Number.MAX_SAFE_INTEGER;
|
||||
i = Number.MIN_SAFE_INTEGER;
|
||||
i = Number.parseFloat(s);
|
||||
i = Number.parseInt(s);
|
||||
i = Number.parseInt(s, i);
|
||||
i = Math.clz32(i);
|
||||
i = Math.imul(i, i);
|
||||
i = Math.sign(i);
|
||||
i = Math.log10(i);
|
||||
i = Math.log2(i);
|
||||
i = Math.log1p(i);
|
||||
i = Math.expm1(i);
|
||||
i = Math.cosh(i);
|
||||
i = Math.sinh(i);
|
||||
i = Math.tanh(i);
|
||||
i = Math.acosh(i);
|
||||
i = Math.asinh(i);
|
||||
i = Math.atanh(i);
|
||||
i = Math.hypot(i, i);
|
||||
i = Math.trunc(i);
|
||||
i = Math.fround(i);
|
||||
i = Math.cbrt(i);
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Symbols
|
||||
// Modules: es6.symbol
|
||||
// #############################################################################################
|
||||
|
||||
sym = Symbol();
|
||||
sym = Symbol(s);
|
||||
sym = Symbol.for(s);
|
||||
s = Symbol.keyFor(sym);
|
||||
sym = Symbol.hasInstance;
|
||||
sym = Symbol.isConcatSpreadable;
|
||||
sym = Symbol.iterator;
|
||||
sym = Symbol.match;
|
||||
sym = Symbol.replace;
|
||||
sym = Symbol.search;
|
||||
sym = Symbol.species;
|
||||
sym = Symbol.split;
|
||||
sym = Symbol.toPrimitive;
|
||||
sym = Symbol.toStringTag;
|
||||
sym = Symbol.unscopables;
|
||||
b = o.hasOwnProperty(sym);
|
||||
b = o.hasOwnProperty(i);
|
||||
b = o.propertyIsEnumerable(sym);
|
||||
b = o.propertyIsEnumerable(i);
|
||||
arrayOfSymbol = Object.getOwnPropertySymbols(a);
|
||||
pd = Object.getOwnPropertyDescriptor(a, sym);
|
||||
pd = Object.getOwnPropertyDescriptor(a, i);
|
||||
Object.defineProperty(a, sym, pd);
|
||||
Object.defineProperty(a, i, pd);
|
||||
s = Math[Symbol.toStringTag];
|
||||
s = JSON[Symbol.toStringTag];
|
||||
|
||||
// Non-standard
|
||||
Symbol.useSimple();
|
||||
Symbol.userSetter();
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Collections
|
||||
// Modules: es6.map, es6.set, es6.weak-map, and es6.weak-set
|
||||
// #############################################################################################
|
||||
|
||||
map.clear();
|
||||
map.delete(s);
|
||||
map.forEach((value: Point, key: string) => { });
|
||||
point = map.get(s);
|
||||
b = map.has(s);
|
||||
map = map.set(s, point);
|
||||
i = map.size;
|
||||
map = new Map<string, Point>();
|
||||
map = new Map(iterableOfStringPoint);
|
||||
|
||||
set.clear();
|
||||
set.delete(point);
|
||||
set.forEach((value: Point, key: Point) => { });
|
||||
b = set.has(point);
|
||||
set = set.add(point);
|
||||
i = set.size;
|
||||
set = new Set<Point>();
|
||||
set = new Set(iterableOfPoint);
|
||||
|
||||
weakMap.delete(point);
|
||||
point3d = weakMap.get(point);
|
||||
b = weakMap.has(point);
|
||||
weakMap = weakMap.set(point, point3d);
|
||||
weakMap = new WeakMap<Point, Point3D>();
|
||||
weakMap = new WeakMap(iterableOfPointPoint3D);
|
||||
|
||||
weakSet.delete(point);
|
||||
weakSet = weakSet.add(point);
|
||||
b = weakSet.has(point);
|
||||
weakSet = new WeakSet<Point>();
|
||||
weakSet = new WeakSet(iterableOfPoint);
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Iterators
|
||||
// Modules: es6.string.iterator, es6.array.iterator, es6.map, es6.set, web.dom.iterable
|
||||
// #############################################################################################
|
||||
|
||||
iterableIteratorOfPoint = arrayOfPoint[Symbol.iterator]();
|
||||
iterableIteratorOfNumberPoint = arrayOfPoint.entries();
|
||||
iterableIteratorOfNumber = arrayOfPoint.keys();
|
||||
iterableIteratorOfPoint = arrayOfPoint.values();
|
||||
iterableIteratorOfStringPoint = map.entries();
|
||||
iterableIteratorOfString = map.keys();
|
||||
iterableIteratorOfPoint = map.values();
|
||||
iterableIteratorOfStringPoint = map[Symbol.iterator]();
|
||||
iterableIteratorOfPointPoint = set.entries();
|
||||
iterableIteratorOfPoint = set.keys();
|
||||
iterableIteratorOfPoint = set.values();
|
||||
iterableIteratorOfPoint = set[Symbol.iterator]();
|
||||
iterableIteratorOfNode = nodeList[Symbol.iterator]();
|
||||
|
||||
$for(iterableOfPoint).of((value: Point) => { });
|
||||
arrayOfPoint = $for(iterableOfPoint).array();
|
||||
arrayOfPoint3D = $for(iterableOfPoint).array(p => point3d);
|
||||
$forOfPoint = $for(iterableOfPoint).filter(p => b);
|
||||
$forOfPoint3D = $for(iterableOfPoint).map(p => point3d);
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Promises
|
||||
// Modules: es6.promise
|
||||
// #############################################################################################
|
||||
|
||||
promiseLikeOfPoint.then((point: Point) => { });
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then();
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => point);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => point);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => promiseLikeOfPoint);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { });
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { });
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => point3d);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { });
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { });
|
||||
promiseOfPoint.then((point: Point) => { });
|
||||
promiseOfPoint = promiseOfPoint.then();
|
||||
promiseOfPoint = promiseOfPoint.then(p => point);
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.then(p => point, e => point);
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => point);
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => point);
|
||||
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseLikeOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.then(p => point, e => { });
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { });
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { });
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { });
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { });
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { });
|
||||
promiseOfPoint = promiseOfPoint.catch(e => point);
|
||||
promiseOfPoint = promiseOfPoint.catch(e => promiseOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.catch(e => promiseLikeOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.catch(e => { });
|
||||
promiseOfPoint3D = promiseOfPoint.catch(e => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.catch(e => promiseOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.catch(e => promiseLikeOfPoint3D);
|
||||
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(point));
|
||||
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseOfPoint));
|
||||
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseLikeOfPoint));
|
||||
promiseOfPoint = new Promise<Point>((resolve, reject) => reject(e));
|
||||
promiseOfArrayOfPoint = Promise.all(arrayOfPoint);
|
||||
promiseOfArrayOfPoint = Promise.all(iterableOfPoint);
|
||||
promiseOfPoint = Promise.race(arrayOfPoint);
|
||||
promiseOfPoint = Promise.race(iterableOfPoint);
|
||||
promiseOfVoid = Promise.resolve();
|
||||
promiseOfPoint = Promise.resolve(point3d);
|
||||
promiseOfPoint = Promise.resolve(promiseOfPoint);
|
||||
promiseOfPoint = Promise.resolve(promiseLikeOfPoint);
|
||||
promiseOfVoid = Promise.reject(e);
|
||||
promiseOfPoint = Promise.reject<Point>(e);
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 6: Reflect
|
||||
// Modules: es6.reflect
|
||||
// #############################################################################################
|
||||
|
||||
a = Reflect.apply(f, a, arrayLikeOfAny);
|
||||
a = Reflect.construct(f, arrayLikeOfAny, a);
|
||||
b = Reflect.defineProperty(a, s, pd);
|
||||
b = Reflect.defineProperty(a, i, pd);
|
||||
b = Reflect.defineProperty(a, sym, pd);
|
||||
b = Reflect.deleteProperty(a, s);
|
||||
b = Reflect.deleteProperty(a, i);
|
||||
b = Reflect.deleteProperty(a, sym);
|
||||
iterableIteratorOfAny = Reflect.enumerate(a);
|
||||
a = Reflect.get(a, s, a);
|
||||
a = Reflect.get(a, i, a);
|
||||
a = Reflect.get(a, sym, a);
|
||||
pd = Reflect.getOwnPropertyDescriptor(a, s);
|
||||
pd = Reflect.getOwnPropertyDescriptor(a, i);
|
||||
pd = Reflect.getOwnPropertyDescriptor(a, sym);
|
||||
a = Reflect.getPrototypeOf(a);
|
||||
b = Reflect.has(a, s);
|
||||
b = Reflect.has(a, i);
|
||||
b = Reflect.has(a, sym);
|
||||
b = Reflect.isExtensible(a);
|
||||
arrayOfPropertyKey = Reflect.ownKeys(a);
|
||||
b = Reflect.preventExtensions(a);
|
||||
b = Reflect.set(a, s, a, a);
|
||||
b = Reflect.set(a, i, a, a);
|
||||
b = Reflect.set(a, sym, a, a);
|
||||
b = Reflect.setPrototypeOf(a, a);
|
||||
|
||||
// #############################################################################################
|
||||
// ECMAScript 7
|
||||
// Modules: es7.array.includes, es7.string.at, es7.string.lpad, es7.string.rpad,
|
||||
// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape,
|
||||
// es7.map.to-json, and es7.set.to-json
|
||||
// #############################################################################################
|
||||
|
||||
b = arrayOfPoint.includes(point, i);
|
||||
s = s.at(i);
|
||||
s = s.lpad(i, s);
|
||||
s = s.rpad(i, s);
|
||||
arrayOfAny = Object.values(a);
|
||||
arrayOfStringAny = Object.entries(a);
|
||||
pdm = Object.getOwnPropertyDescriptors(a);
|
||||
s = RegExp.escape(s);
|
||||
a = map.toJSON();
|
||||
a = set.toJSON();
|
||||
|
||||
// #############################################################################################
|
||||
// Mozilla JavaScript: Array generics
|
||||
// Modules: js.array.statics
|
||||
// #############################################################################################
|
||||
|
||||
i = Array.push(arrayOfPoint, point, point);
|
||||
point = Array.pop(arrayOfPoint);
|
||||
arrayOfPoint = Array.concat(arrayOfPoint, arrayOfPoint);
|
||||
s = Array.join(arrayOfPoint, s);
|
||||
arrayOfPoint = Array.reverse(arrayOfPoint);
|
||||
point = Array.shift(arrayOfPoint);
|
||||
arrayOfPoint = Array.slice(arrayOfPoint, i, i);
|
||||
arrayOfPoint = Array.sort(arrayOfPoint, (a: Point, b: Point) => i);
|
||||
arrayOfPoint = Array.splice(arrayOfPoint, i);
|
||||
arrayOfPoint = Array.splice(arrayOfPoint, i, i, point, point);
|
||||
i = Array.unshift(arrayOfPoint, point, point);
|
||||
i = Array.indexOf(arrayOfPoint, point, i);
|
||||
i = Array.lastIndexOf(arrayOfPoint, point, i);
|
||||
b = Array.every(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a);
|
||||
b = Array.some(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a);
|
||||
Array.forEach(arrayOfPoint, (value: Point, index: number, array: Point[]) => { }, a);
|
||||
arrayOfPoint3D = Array.map(arrayOfPoint, (value: Point, index: number, array: Point[]) => point3d, a);
|
||||
arrayOfPoint = Array.filter(arrayOfPoint, (value: Point, index: number, array: Point[]) => b, a);
|
||||
point = Array.reduce(arrayOfPoint, (prev: Point, value: Point, index: number, array: Point[]) => point, point);
|
||||
point3d = Array.reduce(arrayOfPoint, (prev: Point3D, value: Point, index: number, array: Point[]) => point3d, point3d);
|
||||
point = Array.reduceRight(arrayOfPoint, (prev: Point, value: Point, index: number, array: Point[]) => point, point);
|
||||
point3d = Array.reduceRight(arrayOfPoint, (prev: Point3D, value: Point, index: number, array: Point[]) => point3d, point3d);
|
||||
iterableIteratorOfNumberPoint = Array.entries(arrayOfPoint);
|
||||
iterableIteratorOfNumber = Array.keys(arrayOfPoint);
|
||||
iterableIteratorOfPoint = Array.values(arrayOfPoint);
|
||||
point = Array.find(arrayOfPoint, p => b);
|
||||
i = Array.findIndex(arrayOfPoint, p => b);
|
||||
arrayOfPoint = Array.fill(arrayOfPoint, point, i, arrayOfPoint.length);
|
||||
arrayOfPoint = Array.copyWithin(arrayOfPoint, i, i, i);
|
||||
b = Array.includes(arrayOfPoint, point, i);
|
||||
arrayOfPoint = Array.turn(arrayOfPoint, (memo: Point[], value: Point, index: number, array: Point[]) => arrayOfPoint, arrayOfPoint);
|
||||
arrayOfPoint3D = Array.turn(arrayOfPoint, (memo: Point3D[], value: Point, index: number, array: Point[]) => arrayOfPoint3D, arrayOfPoint3D);
|
||||
|
||||
// #############################################################################################
|
||||
// Object - https://github.com/zloirock/core-js/#object
|
||||
// Modules: core.object
|
||||
// #############################################################################################
|
||||
|
||||
// Non-standard
|
||||
b = Object.isObject(a);
|
||||
s = Object.classof(a);
|
||||
point = Object.define(point, a);
|
||||
point = Object.make(point, a);
|
||||
|
||||
// #############################################################################################
|
||||
// Console - https://github.com/zloirock/core-js/#console
|
||||
// Modules: core.log
|
||||
// #############################################################################################
|
||||
|
||||
// Non-standard
|
||||
log(a, a, a);
|
||||
log.log(a, a, a);
|
||||
log.enable();
|
||||
log.disable();
|
||||
|
||||
// #############################################################################################
|
||||
// Dict - https://github.com/zloirock/core-js/#dict
|
||||
// Modules: core.dict
|
||||
// #############################################################################################
|
||||
|
||||
// Non-standard
|
||||
point = dictOfPoint[s];
|
||||
point = dictOfPoint[i];
|
||||
point = dictOfPoint[sym];
|
||||
dictOfPoint = new Dict(dictOfPoint);
|
||||
dictOfAny = new Dict(point);
|
||||
dictOfPoint = Dict(dictOfPoint);
|
||||
dictOfAny = Dict(point);
|
||||
b = Dict.isDict(a);
|
||||
iterableIteratorOfPoint = Dict.values(dictOfPoint);
|
||||
iterableIteratorOfPropertyKey = Dict.keys(dictOfPoint);
|
||||
iterableIteratorOfPropertyKeyPoint = Dict.entries(dictOfPoint);
|
||||
b = Dict.has(dictOfPoint, s);
|
||||
b = Dict.has(dictOfPoint, i);
|
||||
b = Dict.has(dictOfPoint, sym);
|
||||
point = Dict.get(dictOfPoint, s);
|
||||
point = Dict.get(dictOfPoint, i);
|
||||
point = Dict.get(dictOfPoint, sym);
|
||||
dictOfPoint = Dict.set(dictOfPoint, s, point);
|
||||
dictOfPoint = Dict.set(dictOfPoint, i, point);
|
||||
dictOfPoint = Dict.set(dictOfPoint, sym, point);
|
||||
Dict.forEach(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => { }, a);
|
||||
dictOfPoint3D = Dict.map(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => point3d, a);
|
||||
dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => [s, point3d], a);
|
||||
dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => [i, point3d], a);
|
||||
dictOfPoint3D = Dict.mapPairs(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => [sym, point3d], a);
|
||||
dictOfPoint = Dict.filter(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
|
||||
b = Dict.some(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
|
||||
b = Dict.every(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
|
||||
point = Dict.find(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
|
||||
key = Dict.findKey(dictOfPoint, (value: Point, key: PropertyKey, dict: Dict<Point>) => b, a);
|
||||
key = Dict.keyOf(dictOfPoint, point);
|
||||
b = Dict.includes(dictOfPoint, point);
|
||||
point = Dict.reduce(dictOfPoint, (prev: Point, value: Point, key: PropertyKey, dict: Dict<Point>) => point, point);
|
||||
point3d = Dict.reduce(dictOfPoint, (prev: Point3D, value: Point, key: PropertyKey, dict: Dict<Point>) => point3d, point3d);
|
||||
dictOfPoint = Dict.turn(dictOfPoint, (memo: Dict<Point>, value: Point, key: PropertyKey, dict: Dict<Point>) => { }, dictOfPoint);
|
||||
dictOfPoint3D = Dict.turn(dictOfPoint, (memo: Dict<Point3D>, value: Point, key: PropertyKey, dict: Dict<Point>) => { }, dictOfPoint3D);
|
||||
|
||||
// #############################################################################################
|
||||
// Partial application - https://github.com/zloirock/core-js/#partial-application
|
||||
// Modules: core.function.part
|
||||
// #############################################################################################
|
||||
|
||||
// Non-standard
|
||||
a = f.part(a, a);
|
||||
|
||||
// #############################################################################################
|
||||
// Date formatting - https://github.com/zloirock/core-js/#date-formatting
|
||||
// Modules: core.date
|
||||
// #############################################################################################
|
||||
|
||||
// Non-standard
|
||||
s = date.format(s, s);
|
||||
s = date.formatUTC(s, s);
|
||||
|
||||
// #############################################################################################
|
||||
// Array - https://github.com/zloirock/core-js/#array
|
||||
// Modules: core.array.turn
|
||||
// #############################################################################################
|
||||
|
||||
// Non-standard
|
||||
arrayOfPoint = arrayOfPoint.turn((memo: Point[], value: Point, key: PropertyKey, array: Point[]) => { }, arrayOfPoint);
|
||||
arrayOfPoint3D = arrayOfPoint.turn((memo: Point3D[], value: Point, key: PropertyKey, array: Point[]) => { }, arrayOfPoint3D);
|
||||
|
||||
// #############################################################################################
|
||||
// Number - https://github.com/zloirock/core-js/#number
|
||||
// Modules: core.number.iterator
|
||||
// #############################################################################################
|
||||
|
||||
iterableIteratorOfNumber = i[Symbol.iterator]();
|
||||
|
||||
// #############################################################################################
|
||||
// Escaping characters - https://github.com/zloirock/core-js/#escaping-characters
|
||||
// Modules: core.string.escape-html
|
||||
// #############################################################################################
|
||||
|
||||
s = s.escapeHTML();
|
||||
s = s.unescapeHTML();
|
||||
|
||||
// #############################################################################################
|
||||
// delay - https://github.com/zloirock/core-js/#delay
|
||||
// Modules: core.delay
|
||||
// #############################################################################################
|
||||
|
||||
promiseOfVoid = delay(i);
|
||||
Binary file not shown.
Vendored
+3037
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -2810,7 +2810,7 @@ declare module d3 {
|
||||
|
||||
nodes(root: T): T[];
|
||||
|
||||
links(nodes: T[]): cluster.Link<T>;
|
||||
links(nodes: T[]): cluster.Link<T>[];
|
||||
|
||||
children(): (node: T) => T[];
|
||||
children(accessor: (node: T) => T[]): Cluster<T>;
|
||||
|
||||
Vendored
+1
-1
@@ -23018,7 +23018,7 @@ declare module dojox {
|
||||
*/
|
||||
class PortletSettings extends dijit._Container implements dijit.layout.ContentPane {
|
||||
constructor(params?: Object, srcNodeRef?: HTMLElement);
|
||||
inherited: { (arguments: IArguments): any };
|
||||
inherited: { (args: IArguments): any };
|
||||
/**
|
||||
* Custom press, release, and click synthetic events
|
||||
* which trigger on a left mouse click, touch, or space/enter keyup.
|
||||
|
||||
+4
-4
@@ -25,10 +25,10 @@ d.destroy();
|
||||
d.element.appendChild(document.createElement("div"));
|
||||
d.tether.position();
|
||||
|
||||
d.on("open", () => null);
|
||||
d.on("close", () => null);
|
||||
d.once("close", () => null);
|
||||
d.off("close", () => null);
|
||||
d.on("open", () => false);
|
||||
d.on("close", () => false);
|
||||
d.once("close", () => false);
|
||||
d.off("close", () => false);
|
||||
d.off("open");
|
||||
|
||||
var e = new Drop({
|
||||
|
||||
Vendored
+1
-1
@@ -1420,7 +1420,7 @@ declare module Ember {
|
||||
Creates an instance of the class.
|
||||
@param arguments A hash containing values with which to initialize the newly instantiated object.
|
||||
**/
|
||||
static create<T extends Mixin>(...arguments: CoreObjectArguments[]): T;
|
||||
static create<T extends Mixin>(...args: CoreObjectArguments[]): T;
|
||||
detect(obj: any): boolean;
|
||||
reopen<T extends Mixin>(args?: {}): T;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ function FSTest(): void {
|
||||
FS.symlink('file', 'link');
|
||||
|
||||
FS.writeFile('forbidden', 'can\'t touch this');
|
||||
FS.chmod('forbidden', 0000);
|
||||
FS.chmod('forbidden', parseInt("0000", 8));
|
||||
|
||||
FS.writeFile('file', 'foobar');
|
||||
FS.truncate('file', 3);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/// <reference path="es6-collections.d.ts" />
|
||||
|
||||
interface Point { x: number; y: number; }
|
||||
let a: any;
|
||||
let s: string;
|
||||
let b: boolean;
|
||||
let i: number;
|
||||
let pt: Point;
|
||||
let arrayOfPoint: Point[];
|
||||
let arrayOfStringPoint: [string, Point][];
|
||||
let arrayOfPointString: [Point, string][];
|
||||
let map: Map<string, Point>;
|
||||
let set: Set<Point>;
|
||||
let weakMap: WeakMap<Point, string>;
|
||||
let weakSet: WeakSet<Point>;
|
||||
let iteratorOfString: Iterator<String>;
|
||||
let iteratorOfStringPoint: Iterator<[String, Point]>;
|
||||
let iteratorOfPoint: Iterator<Point>;
|
||||
let iteratorOfPointPoint: Iterator<[Point, Point]>;
|
||||
|
||||
map = new Map<string, Point>();
|
||||
map = new Map(arrayOfStringPoint);
|
||||
map.clear();
|
||||
b = map.delete(s);
|
||||
map.forEach((value: Point, key: string, map: Map<string, Point>) => { }, a);
|
||||
pt = map.get(s);
|
||||
b = map.has(s);
|
||||
map = map.set(s, pt);
|
||||
iteratorOfStringPoint = map.entries();
|
||||
iteratorOfString = map.keys();
|
||||
iteratorOfPoint = map.values();
|
||||
i = map.size;
|
||||
|
||||
set = new Set<Point>();
|
||||
set = new Set(arrayOfPoint);
|
||||
set.clear();
|
||||
b = set.delete(pt);
|
||||
set.forEach((value: Point, key: Point, set: Set<Point>) => { }, a);
|
||||
b = set.has(pt);
|
||||
set = set.add(pt);
|
||||
iteratorOfPointPoint = set.entries();
|
||||
iteratorOfPoint = set.keys();
|
||||
iteratorOfPoint = set.values();
|
||||
i = set.size;
|
||||
|
||||
weakMap = new WeakMap<Point, string>();
|
||||
weakMap = new WeakMap(arrayOfPointString);
|
||||
weakMap.clear();
|
||||
b = weakMap.delete(pt);
|
||||
s = weakMap.get(pt);
|
||||
b = weakMap.has(pt);
|
||||
weakMap = weakMap.set(pt, s);
|
||||
|
||||
weakSet = new WeakSet<Point>();
|
||||
weakSet = new WeakSet(arrayOfPoint);
|
||||
weakSet.clear();
|
||||
b = weakSet.delete(pt);
|
||||
b = weakSet.has(pt);
|
||||
weakSet = weakSet.add(pt);
|
||||
@@ -0,0 +1 @@
|
||||
--noImplicitAny --module commonjs --target es5
|
||||
Vendored
+113
@@ -0,0 +1,113 @@
|
||||
// Type definitions for es6-collections v0.5.1
|
||||
// Project: https://github.com/WebReflection/es6-collections/
|
||||
// Definitions by: Ron Buckton <http://github.com/rbuckton>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/* *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
interface IteratorResult<T> {
|
||||
done: boolean;
|
||||
value?: T;
|
||||
}
|
||||
|
||||
interface Iterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
return?(value?: any): IteratorResult<T>;
|
||||
throw?(e?: any): IteratorResult<T>;
|
||||
}
|
||||
|
||||
interface ForEachable<T> {
|
||||
forEach(callbackfn: (value: T) => void): void;
|
||||
}
|
||||
|
||||
interface Map<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
|
||||
get(key: K): V;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value?: V): Map<K, V>;
|
||||
entries(): Iterator<[K, V]>;
|
||||
keys(): Iterator<K>;
|
||||
values(): Iterator<V>;
|
||||
size: number;
|
||||
}
|
||||
|
||||
interface MapConstructor {
|
||||
new <K, V>(): Map<K, V>;
|
||||
new <K, V>(iterable: ForEachable<[K, V]>): Map<K, V>;
|
||||
prototype: Map<any, any>;
|
||||
}
|
||||
|
||||
declare var Map: MapConstructor;
|
||||
|
||||
interface Set<T> {
|
||||
add(value: T): Set<T>;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
|
||||
has(value: T): boolean;
|
||||
entries(): Iterator<[T, T]>;
|
||||
keys(): Iterator<T>;
|
||||
values(): Iterator<T>;
|
||||
size: number;
|
||||
}
|
||||
|
||||
interface SetConstructor {
|
||||
new <T>(): Set<T>;
|
||||
new <T>(iterable: ForEachable<T>): Set<T>;
|
||||
prototype: Set<any>;
|
||||
}
|
||||
|
||||
declare var Set: SetConstructor;
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
delete(key: K): boolean;
|
||||
clear(): void;
|
||||
get(key: K): V;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value?: V): WeakMap<K, V>;
|
||||
}
|
||||
|
||||
interface WeakMapConstructor {
|
||||
new <K, V>(): WeakMap<K, V>;
|
||||
new <K, V>(iterable: ForEachable<[K, V]>): WeakMap<K, V>;
|
||||
prototype: WeakMap<any, any>;
|
||||
}
|
||||
|
||||
declare var WeakMap: WeakMapConstructor;
|
||||
|
||||
interface WeakSet<T> {
|
||||
delete(value: T): boolean;
|
||||
clear(): void;
|
||||
add(value: T): WeakSet<T>;
|
||||
has(value: T): boolean;
|
||||
}
|
||||
|
||||
interface WeakSetConstructor {
|
||||
new <T>(): WeakSet<T>;
|
||||
new <T>(iterable: ForEachable<T>): WeakSet<T>;
|
||||
prototype: WeakSet<any>;
|
||||
}
|
||||
|
||||
declare var WeakSet: WeakSetConstructor;
|
||||
|
||||
declare module "es6-collections" {
|
||||
var Map: MapConstructor;
|
||||
var Set: SetConstructor;
|
||||
var WeakMap: WeakMapConstructor;
|
||||
var WeakSet: WeakSetConstructor;
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
/// <reference path="es6-shim.d.ts" />
|
||||
|
||||
interface Point { x: number; y: number; }
|
||||
interface Point3D extends Point { z: number; }
|
||||
|
||||
let a: any;
|
||||
let s: string;
|
||||
let i: number;
|
||||
let b: boolean;
|
||||
let f: () => void;
|
||||
let o: Object;
|
||||
let r: RegExp;
|
||||
let sym: symbol;
|
||||
let e: Error;
|
||||
let date: Date;
|
||||
let key: PropertyKey;
|
||||
let point: Point;
|
||||
let point3d: Point3D;
|
||||
let arrayOfPoint: Point[];
|
||||
let arrayOfPoint3D: Point3D[];
|
||||
let arrayOfSymbol: symbol[];
|
||||
let arrayOfPropertyKey: PropertyKey[];
|
||||
let arrayOfAny: any[];
|
||||
let arrayOfStringAny: [string, any][];
|
||||
let arrayLikeOfAny: ArrayLike<any>;
|
||||
let iterableOfPoint: IterableShim<Point>;
|
||||
let iterableOfStringPoint: IterableShim<[string, Point]>;
|
||||
let iterableOfPointPoint3D: IterableShim<[Point, Point3D]>;
|
||||
let iterableIteratorOfPoint: IterableIteratorShim<Point>;
|
||||
let iterableIteratorOfNumberPoint: IterableIteratorShim<[number, Point]>;
|
||||
let iterableIteratorOfNumber: IterableIteratorShim<number>;
|
||||
let iterableIteratorOfString: IterableIteratorShim<string>;
|
||||
let iterableIteratorOfPointPoint: IterableIteratorShim<[Point, Point]>;
|
||||
let iterableIteratorOfNode: IterableIteratorShim<Node>;
|
||||
let iterableIteratorOfStringPoint: IterableIteratorShim<[string, Point]>;
|
||||
let iterableIteratorOfAny: IterableIteratorShim<any>;
|
||||
let iterableIteratorOfPropertyKey: IterableIteratorShim<PropertyKey>;
|
||||
let iterableIteratorOfPropertyKeyPoint: IterableIteratorShim<[PropertyKey, Point]>;
|
||||
let nodeList: NodeList;
|
||||
let pd: PropertyDescriptor;
|
||||
let pdm: PropertyDescriptorMap;
|
||||
let map: Map<string, Point>;
|
||||
let set: Set<Point>;
|
||||
let weakMap: WeakMap<Point, Point3D>;
|
||||
let weakSet: WeakSet<Point>;
|
||||
let promiseLikeOfPoint: PromiseLike<Point>;
|
||||
let promiseLikeOfPoint3D: PromiseLike<Point3D>;
|
||||
let promiseOfPoint: Promise<Point>;
|
||||
let promiseOfPoint3D: Promise<Point3D>;
|
||||
let promiseOfArrayOfPoint: Promise<Point[]>;
|
||||
let promiseOfVoid: Promise<void>;
|
||||
|
||||
point = Object.assign(point, point);
|
||||
b = Object.is(point, point);
|
||||
Object.setPrototypeOf(point, point);
|
||||
point = arrayOfPoint.find(p => b);
|
||||
i = arrayOfPoint.findIndex(p => b);
|
||||
arrayOfPoint = arrayOfPoint.fill(point, i, arrayOfPoint.length);
|
||||
arrayOfPoint = arrayOfPoint.copyWithin(i, i, i);
|
||||
arrayOfPoint = Array.from(arrayOfPoint);
|
||||
arrayOfPoint = Array.from(iterableOfPoint);
|
||||
arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d);
|
||||
arrayOfPoint3D = Array.from(arrayOfPoint, point => point3d, a);
|
||||
arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d);
|
||||
arrayOfPoint3D = Array.from(iterableOfPoint, point => point3d, a);
|
||||
arrayOfPoint = Array.of(point, point);
|
||||
i = s.codePointAt(i);
|
||||
b = s.includes(s, i);
|
||||
b = s.endsWith(s, i);
|
||||
s = s.repeat(i);
|
||||
b = s.startsWith(s, i);
|
||||
s = String.fromCodePoint(i, i);
|
||||
s = String.raw`abc`;
|
||||
s = r.flags;
|
||||
i = Number.EPSILON;
|
||||
b = Number.isFinite(i);
|
||||
b = Number.isInteger(i);
|
||||
b = Number.isNaN(i);
|
||||
b = Number.isSafeInteger(i);
|
||||
i = Number.MAX_SAFE_INTEGER;
|
||||
i = Number.MIN_SAFE_INTEGER;
|
||||
i = Number.parseFloat(s);
|
||||
i = Number.parseInt(s);
|
||||
i = Number.parseInt(s, i);
|
||||
i = Math.clz32(i);
|
||||
i = Math.imul(i, i);
|
||||
i = Math.sign(i);
|
||||
i = Math.log10(i);
|
||||
i = Math.log2(i);
|
||||
i = Math.log1p(i);
|
||||
i = Math.expm1(i);
|
||||
i = Math.cosh(i);
|
||||
i = Math.sinh(i);
|
||||
i = Math.tanh(i);
|
||||
i = Math.acosh(i);
|
||||
i = Math.asinh(i);
|
||||
i = Math.atanh(i);
|
||||
i = Math.hypot(i, i);
|
||||
i = Math.trunc(i);
|
||||
i = Math.fround(i);
|
||||
i = Math.cbrt(i);
|
||||
map.clear();
|
||||
map.delete(s);
|
||||
map.forEach((value: Point, key: string) => { });
|
||||
point = map.get(s);
|
||||
b = map.has(s);
|
||||
map = map.set(s, point);
|
||||
i = map.size;
|
||||
map = new Map<string, Point>();
|
||||
map = new Map(iterableOfStringPoint);
|
||||
set.clear();
|
||||
set.delete(point);
|
||||
set.forEach((value: Point, key: Point) => { });
|
||||
b = set.has(point);
|
||||
set = set.add(point);
|
||||
i = set.size;
|
||||
set = new Set<Point>();
|
||||
set = new Set(iterableOfPoint);
|
||||
weakMap.delete(point);
|
||||
point3d = weakMap.get(point);
|
||||
b = weakMap.has(point);
|
||||
weakMap = weakMap.set(point, point3d);
|
||||
weakMap = new WeakMap<Point, Point3D>();
|
||||
weakMap = new WeakMap(iterableOfPointPoint3D);
|
||||
weakSet.delete(point);
|
||||
weakSet = weakSet.add(point);
|
||||
b = weakSet.has(point);
|
||||
weakSet = new WeakSet<Point>();
|
||||
weakSet = new WeakSet(iterableOfPoint);
|
||||
iterableIteratorOfNumberPoint = arrayOfPoint.entries();
|
||||
iterableIteratorOfNumber = arrayOfPoint.keys();
|
||||
iterableIteratorOfPoint = arrayOfPoint.values();
|
||||
iterableIteratorOfPointPoint = set.entries();
|
||||
iterableIteratorOfPoint = set.keys();
|
||||
iterableIteratorOfPoint = set.values();
|
||||
promiseLikeOfPoint.then((point: Point) => { });
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then();
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => point);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => point);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => promiseLikeOfPoint);
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { });
|
||||
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { });
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => point3d);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { });
|
||||
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { });
|
||||
promiseOfPoint.then((point: Point) => { });
|
||||
promiseOfPoint = promiseOfPoint.then();
|
||||
promiseOfPoint = promiseOfPoint.then(p => point);
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.then(p => point, e => point);
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => point);
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => point);
|
||||
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseLikeOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.then(p => point, e => { });
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { });
|
||||
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { });
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { });
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { });
|
||||
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { });
|
||||
promiseOfPoint = promiseOfPoint.catch(e => point);
|
||||
promiseOfPoint = promiseOfPoint.catch(e => promiseOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.catch(e => promiseLikeOfPoint);
|
||||
promiseOfPoint = promiseOfPoint.catch(e => { });
|
||||
promiseOfPoint3D = promiseOfPoint.catch(e => point3d);
|
||||
promiseOfPoint3D = promiseOfPoint.catch(e => promiseOfPoint3D);
|
||||
promiseOfPoint3D = promiseOfPoint.catch(e => promiseLikeOfPoint3D);
|
||||
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(point));
|
||||
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseOfPoint));
|
||||
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseLikeOfPoint));
|
||||
promiseOfPoint = new Promise<Point>((resolve, reject) => reject(e));
|
||||
promiseOfArrayOfPoint = Promise.all(arrayOfPoint);
|
||||
promiseOfArrayOfPoint = Promise.all(iterableOfPoint);
|
||||
promiseOfPoint = Promise.race(arrayOfPoint);
|
||||
promiseOfPoint = Promise.race(iterableOfPoint);
|
||||
promiseOfVoid = Promise.resolve();
|
||||
promiseOfPoint = Promise.resolve(point3d);
|
||||
promiseOfPoint = Promise.resolve(promiseOfPoint);
|
||||
promiseOfPoint = Promise.resolve(promiseLikeOfPoint);
|
||||
promiseOfVoid = Promise.reject(e);
|
||||
promiseOfPoint = Promise.reject<Point>(e);
|
||||
a = Reflect.apply(f, a, arrayLikeOfAny);
|
||||
a = Reflect.construct(f, arrayLikeOfAny);
|
||||
b = Reflect.defineProperty(a, s, pd);
|
||||
b = Reflect.defineProperty(a, i, pd);
|
||||
b = Reflect.defineProperty(a, sym, pd);
|
||||
b = Reflect.deleteProperty(a, s);
|
||||
b = Reflect.deleteProperty(a, i);
|
||||
b = Reflect.deleteProperty(a, sym);
|
||||
iterableIteratorOfAny = Reflect.enumerate(a);
|
||||
a = Reflect.get(a, s, a);
|
||||
a = Reflect.get(a, i, a);
|
||||
a = Reflect.get(a, sym, a);
|
||||
pd = Reflect.getOwnPropertyDescriptor(a, s);
|
||||
pd = Reflect.getOwnPropertyDescriptor(a, i);
|
||||
pd = Reflect.getOwnPropertyDescriptor(a, sym);
|
||||
a = Reflect.getPrototypeOf(a);
|
||||
b = Reflect.has(a, s);
|
||||
b = Reflect.has(a, i);
|
||||
b = Reflect.has(a, sym);
|
||||
b = Reflect.isExtensible(a);
|
||||
arrayOfPropertyKey = Reflect.ownKeys(a);
|
||||
b = Reflect.preventExtensions(a);
|
||||
b = Reflect.set(a, s, a, a);
|
||||
b = Reflect.set(a, i, a, a);
|
||||
b = Reflect.set(a, sym, a, a);
|
||||
b = Reflect.setPrototypeOf(a, a);
|
||||
@@ -0,0 +1 @@
|
||||
--noImplicitAny --module commonjs --target es5
|
||||
Vendored
+673
@@ -0,0 +1,673 @@
|
||||
// Type definitions for es6-shim v0.31.2
|
||||
// Project: https://github.com/paulmillr/es6-shim
|
||||
// Definitions by: Ron Buckton <http://github.com/rbuckton>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
|
||||
interface IteratorResult<T> {
|
||||
done: boolean;
|
||||
value?: T;
|
||||
}
|
||||
|
||||
interface IterableShim<T> {
|
||||
/**
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): Iterator<T>;
|
||||
}
|
||||
|
||||
interface Iterator<T> {
|
||||
next(value?: any): IteratorResult<T>;
|
||||
return?(value?: any): IteratorResult<T>;
|
||||
throw?(e?: any): IteratorResult<T>;
|
||||
}
|
||||
|
||||
interface IterableIteratorShim<T> extends IterableShim<T>, Iterator<T> {
|
||||
/**
|
||||
* Shim for an ES6 iterable iterator. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): IterableIteratorShim<T>;
|
||||
}
|
||||
|
||||
interface StringConstructor {
|
||||
/**
|
||||
* Return the String value whose elements are, in order, the elements in the List elements.
|
||||
* If length is 0, the empty string is returned.
|
||||
*/
|
||||
fromCodePoint(...codePoints: number[]): string;
|
||||
|
||||
/**
|
||||
* String.raw is intended for use as a tag function of a Tagged Template String. When called
|
||||
* as such the first argument will be a well formed template call site object and the rest
|
||||
* parameter will contain the substitution values.
|
||||
* @param template A well-formed template string call site representation.
|
||||
* @param substitutions A set of substitution values.
|
||||
*/
|
||||
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
|
||||
}
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
|
||||
* value of the UTF-16 encoded code point starting at the string element at position pos in
|
||||
* the String resulting from converting this object to a String.
|
||||
* If there is no element at that position, the result is undefined.
|
||||
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
|
||||
*/
|
||||
codePointAt(pos: number): number;
|
||||
|
||||
/**
|
||||
* Returns true if searchString appears as a substring of the result of converting this
|
||||
* object to a String, at one or more positions that are
|
||||
* greater than or equal to position; otherwise, returns false.
|
||||
* @param searchString search string
|
||||
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
|
||||
*/
|
||||
includes(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* endPosition – length(this). Otherwise returns false.
|
||||
*/
|
||||
endsWith(searchString: string, endPosition?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a String value that is made from count copies appended together. If count is 0,
|
||||
* T is the empty String is returned.
|
||||
* @param count number of copies to append
|
||||
*/
|
||||
repeat(count: number): string;
|
||||
|
||||
/**
|
||||
* Returns true if the sequence of elements of searchString converted to a String is the
|
||||
* same as the corresponding elements of this object (converted to a String) starting at
|
||||
* position. Otherwise returns false.
|
||||
*/
|
||||
startsWith(searchString: string, position?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns an <a> HTML anchor element and sets the name attribute to the text value
|
||||
* @param name
|
||||
*/
|
||||
anchor(name: string): string;
|
||||
|
||||
/** Returns a <big> HTML element */
|
||||
big(): string;
|
||||
|
||||
/** Returns a <blink> HTML element */
|
||||
blink(): string;
|
||||
|
||||
/** Returns a <b> HTML element */
|
||||
bold(): string;
|
||||
|
||||
/** Returns a <tt> HTML element */
|
||||
fixed(): string
|
||||
|
||||
/** Returns a <font> HTML element and sets the color attribute value */
|
||||
fontcolor(color: string): string
|
||||
|
||||
/** Returns a <font> HTML element and sets the size attribute value */
|
||||
fontsize(size: number): string;
|
||||
|
||||
/** Returns a <font> HTML element and sets the size attribute value */
|
||||
fontsize(size: string): string;
|
||||
|
||||
/** Returns an <i> HTML element */
|
||||
italics(): string;
|
||||
|
||||
/** Returns an <a> HTML element and sets the href attribute value */
|
||||
link(url: string): string;
|
||||
|
||||
/** Returns a <small> HTML element */
|
||||
small(): string;
|
||||
|
||||
/** Returns a <strike> HTML element */
|
||||
strike(): string;
|
||||
|
||||
/** Returns a <sub> HTML element */
|
||||
sub(): string;
|
||||
|
||||
/** Returns a <sup> HTML element */
|
||||
sup(): string;
|
||||
|
||||
/**
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): IterableIteratorShim<string>;
|
||||
}
|
||||
|
||||
interface ArrayLike<T> {
|
||||
length: number;
|
||||
[n: number]: T;
|
||||
}
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
* @param arrayLike An array-like object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;
|
||||
|
||||
/**
|
||||
* Creates an array from an iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
* @param mapfn A mapping function to call on every element of the array.
|
||||
* @param thisArg Value of 'this' used to invoke the mapfn.
|
||||
*/
|
||||
from<T, U>(iterable: IterableShim<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;
|
||||
|
||||
/**
|
||||
* Creates an array from an array-like object.
|
||||
* @param arrayLike An array-like object to convert to an array.
|
||||
*/
|
||||
from<T>(arrayLike: ArrayLike<T>): Array<T>;
|
||||
|
||||
/**
|
||||
* Creates an array from an iterable object.
|
||||
* @param iterable An iterable object to convert to an array.
|
||||
*/
|
||||
from<T>(iterable: IterableShim<T>): Array<T>;
|
||||
|
||||
/**
|
||||
* Returns a new array from a set of elements.
|
||||
* @param items A set of elements to include in the new array object.
|
||||
*/
|
||||
of<T>(...items: T[]): Array<T>;
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill(value: T, start?: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin(target: number, start: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries(): IterableIteratorShim<[number, T]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys(): IterableIteratorShim<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values(): IterableIteratorShim<T>;
|
||||
|
||||
/**
|
||||
* Shim for an ES6 iterable. Not intended for direct use by user code.
|
||||
*/
|
||||
"_es6-shim iterator_"(): IterableIteratorShim<T>;
|
||||
}
|
||||
|
||||
interface NumberConstructor {
|
||||
/**
|
||||
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
|
||||
* that is representable as a Number value, which is approximately:
|
||||
* 2.2204460492503130808472633361816 x 10−16.
|
||||
*/
|
||||
EPSILON: number;
|
||||
|
||||
/**
|
||||
* Returns true if passed value is finite.
|
||||
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
|
||||
* number. Only finite values of the type number, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isFinite(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value passed is an integer, false otherwise.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
|
||||
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
|
||||
* to a number. Only values of the type number, that are also NaN, result in true.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isNaN(number: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the value passed is a safe integer.
|
||||
* @param number A numeric value.
|
||||
*/
|
||||
isSafeInteger(number: number): boolean;
|
||||
|
||||
/**
|
||||
* The value of the largest integer n such that n and n + 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1.
|
||||
*/
|
||||
MAX_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* The value of the smallest integer n such that n and n − 1 are both exactly representable as
|
||||
* a Number value.
|
||||
* The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)).
|
||||
*/
|
||||
MIN_SAFE_INTEGER: number;
|
||||
|
||||
/**
|
||||
* Converts a string to a floating-point number.
|
||||
* @param string A string that contains a floating-point number.
|
||||
*/
|
||||
parseFloat(string: string): number;
|
||||
|
||||
/**
|
||||
* Converts A string to an integer.
|
||||
* @param s A string to convert into a number.
|
||||
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
|
||||
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
|
||||
* All other strings are considered decimal.
|
||||
*/
|
||||
parseInt(string: string, radix?: number): number;
|
||||
}
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
* @param target The target object to copy to.
|
||||
* @param sources One or more source objects to copy properties from.
|
||||
*/
|
||||
assign(target: any, ...sources: any[]): any;
|
||||
|
||||
/**
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* @param value1 The first value.
|
||||
* @param value2 The second value.
|
||||
*/
|
||||
is(value1: any, value2: any): boolean;
|
||||
|
||||
/**
|
||||
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
|
||||
* @param o The object to change its prototype.
|
||||
* @param proto The value of the new prototype or null.
|
||||
* @remarks Requires `__proto__` support.
|
||||
*/
|
||||
setPrototypeOf(o: any, proto: any): any;
|
||||
}
|
||||
|
||||
interface RegExp {
|
||||
/**
|
||||
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
|
||||
* The characters in this string are sequenced and concatenated in the following order:
|
||||
*
|
||||
* - "g" for global
|
||||
* - "i" for ignoreCase
|
||||
* - "m" for multiline
|
||||
* - "u" for unicode
|
||||
* - "y" for sticky
|
||||
*
|
||||
* If no flags are set, the value is the empty string.
|
||||
*/
|
||||
flags: string;
|
||||
}
|
||||
|
||||
interface Math {
|
||||
/**
|
||||
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
clz32(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of 32-bit multiplication of two numbers.
|
||||
* @param x First number
|
||||
* @param y Second number
|
||||
*/
|
||||
imul(x: number, y: number): number;
|
||||
|
||||
/**
|
||||
* Returns the sign of the x, indicating whether x is positive, negative or zero.
|
||||
* @param x The numeric expression to test
|
||||
*/
|
||||
sign(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the base 10 logarithm of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
log10(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the base 2 logarithm of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
log2(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the natural logarithm of 1 + x.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
log1p(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
|
||||
* the natural logarithms).
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
expm1(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the hyperbolic cosine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
cosh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the hyperbolic sine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
sinh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the hyperbolic tangent of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
tanh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the inverse hyperbolic cosine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
acosh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the inverse hyperbolic sine of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
asinh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the inverse hyperbolic tangent of a number.
|
||||
* @param x A numeric expression that contains an angle measured in radians.
|
||||
*/
|
||||
atanh(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the square root of the sum of squares of its arguments.
|
||||
* @param values Values to compute the square root for.
|
||||
* If no arguments are passed, the result is +0.
|
||||
* If there is only one argument, the result is the absolute value.
|
||||
* If any argument is +Infinity or -Infinity, the result is +Infinity.
|
||||
* If any argument is NaN, the result is NaN.
|
||||
* If all arguments are either +0 or −0, the result is +0.
|
||||
*/
|
||||
hypot(...values: number[]): number;
|
||||
|
||||
/**
|
||||
* Returns the integral part of the a numeric expression, x, removing any fractional digits.
|
||||
* If x is already an integer, the result is x.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
trunc(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns the nearest single precision float representation of a number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
fround(x: number): number;
|
||||
|
||||
/**
|
||||
* Returns an implementation-dependent approximation to the cube root of number.
|
||||
* @param x A numeric expression.
|
||||
*/
|
||||
cbrt(x: number): number;
|
||||
}
|
||||
|
||||
interface PromiseLike<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
*/
|
||||
interface Promise<T> {
|
||||
/**
|
||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of which ever callback is executed.
|
||||
*/
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
|
||||
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Attaches a callback for only the rejection of the Promise.
|
||||
* @param onrejected The callback to execute when the Promise is rejected.
|
||||
* @returns A Promise for the completion of the callback.
|
||||
*/
|
||||
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
|
||||
catch(onrejected?: (reason: any) => void): Promise<T>;
|
||||
}
|
||||
|
||||
interface PromiseConstructor {
|
||||
/**
|
||||
* A reference to the prototype.
|
||||
*/
|
||||
prototype: Promise<any>;
|
||||
|
||||
/**
|
||||
* Creates a new Promise.
|
||||
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
|
||||
* a resolve callback used resolve the promise with a value or the result of another promise,
|
||||
* and a reject callback used to reject the promise with a provided reason or error.
|
||||
*/
|
||||
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
||||
* resolve, or rejected when any Promise is rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
|
||||
* or rejected.
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
race<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
* @param reason The reason the promise was rejected.
|
||||
* @returns A new rejected Promise.
|
||||
*/
|
||||
reject(reason: any): Promise<void>;
|
||||
|
||||
/**
|
||||
* Creates a new rejected promise for the provided reason.
|
||||
* @param reason The reason the promise was rejected.
|
||||
* @returns A new rejected Promise.
|
||||
*/
|
||||
reject<T>(reason: any): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise for the provided value.
|
||||
* @param value A promise.
|
||||
* @returns A promise whose internal state matches the provided promise.
|
||||
*/
|
||||
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a new resolved promise .
|
||||
* @returns A resolved promise.
|
||||
*/
|
||||
resolve(): Promise<void>;
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
|
||||
interface Map<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
|
||||
get(key: K): V;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value?: V): Map<K, V>;
|
||||
size: number;
|
||||
entries(): IterableIteratorShim<[K, V]>;
|
||||
keys(): IterableIteratorShim<K>;
|
||||
values(): IterableIteratorShim<V>;
|
||||
}
|
||||
|
||||
interface MapConstructor {
|
||||
new <K, V>(): Map<K, V>;
|
||||
new <K, V>(iterable: IterableShim<[K, V]>): Map<K, V>;
|
||||
prototype: Map<any, any>;
|
||||
}
|
||||
|
||||
declare var Map: MapConstructor;
|
||||
|
||||
interface Set<T> {
|
||||
add(value: T): Set<T>;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
|
||||
has(value: T): boolean;
|
||||
size: number;
|
||||
entries(): IterableIteratorShim<[T, T]>;
|
||||
keys(): IterableIteratorShim<T>;
|
||||
values(): IterableIteratorShim<T>;
|
||||
}
|
||||
|
||||
interface SetConstructor {
|
||||
new <T>(): Set<T>;
|
||||
new <T>(iterable: IterableShim<T>): Set<T>;
|
||||
prototype: Set<any>;
|
||||
}
|
||||
|
||||
declare var Set: SetConstructor;
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V;
|
||||
has(key: K): boolean;
|
||||
set(key: K, value?: V): WeakMap<K, V>;
|
||||
}
|
||||
|
||||
interface WeakMapConstructor {
|
||||
new <K, V>(): WeakMap<K, V>;
|
||||
new <K, V>(iterable: IterableShim<[K, V]>): WeakMap<K, V>;
|
||||
prototype: WeakMap<any, any>;
|
||||
}
|
||||
|
||||
declare var WeakMap: WeakMapConstructor;
|
||||
|
||||
interface WeakSet<T> {
|
||||
add(value: T): WeakSet<T>;
|
||||
delete(value: T): boolean;
|
||||
has(value: T): boolean;
|
||||
}
|
||||
|
||||
interface WeakSetConstructor {
|
||||
new <T>(): WeakSet<T>;
|
||||
new <T>(iterable: IterableShim<T>): WeakSet<T>;
|
||||
prototype: WeakSet<any>;
|
||||
}
|
||||
|
||||
declare var WeakSet: WeakSetConstructor;
|
||||
|
||||
declare module Reflect {
|
||||
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
|
||||
function construct(target: Function, argumentsList: ArrayLike<any>): any;
|
||||
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
|
||||
function enumerate(target: any): IterableIteratorShim<any>;
|
||||
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
|
||||
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
function getPrototypeOf(target: any): any;
|
||||
function has(target: any, propertyKey: PropertyKey): boolean;
|
||||
function isExtensible(target: any): boolean;
|
||||
function ownKeys(target: any): Array<PropertyKey>;
|
||||
function preventExtensions(target: any): boolean;
|
||||
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
|
||||
declare module "es6-shim" {
|
||||
var String: StringConstructor;
|
||||
var Array: ArrayConstructor;
|
||||
var Number: NumberConstructor;
|
||||
var Math: Math;
|
||||
var Object: ObjectConstructor;
|
||||
var Map: MapConstructor;
|
||||
var Set: SetConstructor;
|
||||
var WeakMap: WeakMapConstructor;
|
||||
var WeakSet: WeakSetConstructor;
|
||||
var Promise: PromiseConstructor;
|
||||
module Reflect {
|
||||
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
|
||||
function construct(target: Function, argumentsList: ArrayLike<any>): any;
|
||||
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
|
||||
function enumerate(target: any): Iterator<any>;
|
||||
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
|
||||
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
function getPrototypeOf(target: any): any;
|
||||
function has(target: any, propertyKey: PropertyKey): boolean;
|
||||
function isExtensible(target: any): boolean;
|
||||
function ownKeys(target: any): Array<PropertyKey>;
|
||||
function preventExtensions(target: any): boolean;
|
||||
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
}
|
||||
@@ -740,7 +740,7 @@ function sample8() {
|
||||
}
|
||||
|
||||
for (var i = activeObjectButtons.length; i--;) {
|
||||
activeObjectButtons[i].disabled = true;
|
||||
activeObjectButtons[i];
|
||||
}
|
||||
|
||||
canvas.on('object:selected', onObjectSelected);
|
||||
@@ -750,7 +750,7 @@ function sample8() {
|
||||
var selectedObject = e.target;
|
||||
|
||||
for (var i = activeObjectButtons.length; i--;) {
|
||||
activeObjectButtons[i].disabled = false;
|
||||
activeObjectButtons[i];
|
||||
}
|
||||
|
||||
lockHorizontallyEl.innerHTML = (selectedObject.lockMovementX ? 'Unlock horizontal movement' : 'Lock horizontal movement');
|
||||
@@ -762,7 +762,7 @@ function sample8() {
|
||||
|
||||
canvas.on('selection:cleared', function(e) {
|
||||
for (var i = activeObjectButtons.length; i--;) {
|
||||
activeObjectButtons[i].disabled = true;
|
||||
activeObjectButtons[i];
|
||||
}
|
||||
});
|
||||
|
||||
@@ -889,7 +889,6 @@ function sample8() {
|
||||
var cmdUnderlineBtn = document.getElementById('text-cmd-underline');
|
||||
if (cmdUnderlineBtn) {
|
||||
activeObjectButtons.push(cmdUnderlineBtn);
|
||||
cmdUnderlineBtn.disabled = true;
|
||||
cmdUnderlineBtn.onclick = function() {
|
||||
var activeObject = <fabric.IText>canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
@@ -903,7 +902,6 @@ function sample8() {
|
||||
var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough');
|
||||
if (cmdLinethroughBtn) {
|
||||
activeObjectButtons.push(cmdLinethroughBtn);
|
||||
cmdLinethroughBtn.disabled = true;
|
||||
cmdLinethroughBtn.onclick = function() {
|
||||
var activeObject = <fabric.IText>canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
@@ -917,7 +915,6 @@ function sample8() {
|
||||
var cmdOverlineBtn = document.getElementById('text-cmd-overline');
|
||||
if (cmdOverlineBtn) {
|
||||
activeObjectButtons.push(cmdOverlineBtn);
|
||||
cmdOverlineBtn.disabled = true;
|
||||
cmdOverlineBtn.onclick = function() {
|
||||
var activeObject = <fabric.IText>canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
@@ -931,7 +928,6 @@ function sample8() {
|
||||
var cmdBoldBtn = document.getElementById('text-cmd-bold');
|
||||
if (cmdBoldBtn) {
|
||||
activeObjectButtons.push(cmdBoldBtn);
|
||||
cmdBoldBtn.disabled = true;
|
||||
cmdBoldBtn.onclick = function() {
|
||||
var activeObject = <fabric.IText>canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
@@ -945,7 +941,6 @@ function sample8() {
|
||||
var cmdItalicBtn = document.getElementById('text-cmd-italic');
|
||||
if (cmdItalicBtn) {
|
||||
activeObjectButtons.push(cmdItalicBtn);
|
||||
cmdItalicBtn.disabled = true;
|
||||
cmdItalicBtn.onclick = function() {
|
||||
var activeObject = <fabric.IText>canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
@@ -959,7 +954,6 @@ function sample8() {
|
||||
var cmdShadowBtn = document.getElementById('text-cmd-shadow');
|
||||
if (cmdShadowBtn) {
|
||||
activeObjectButtons.push(cmdShadowBtn);
|
||||
cmdShadowBtn.disabled = true;
|
||||
cmdShadowBtn.onclick = function() {
|
||||
var activeObject = <fabric.IText>canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
@@ -973,7 +967,6 @@ function sample8() {
|
||||
var textAlignSwitch = document.getElementById('text-align');
|
||||
if (textAlignSwitch) {
|
||||
activeObjectButtons.push(textAlignSwitch);
|
||||
textAlignSwitch.disabled = true;
|
||||
textAlignSwitch.onchange = function() {
|
||||
var activeObject = <fabric.IText>canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
@@ -986,7 +979,6 @@ function sample8() {
|
||||
var fontFamilySwitch = document.getElementById('font-family');
|
||||
if (fontFamilySwitch) {
|
||||
activeObjectButtons.push(fontFamilySwitch);
|
||||
fontFamilySwitch.disabled = true;
|
||||
fontFamilySwitch.onchange = function() {
|
||||
var activeObject = <fabric.IText>canvas.getActiveObject();
|
||||
if (activeObject && activeObject.type === 'text') {
|
||||
|
||||
Vendored
+12
-12
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Yuichi Murata <https://github.com/mrk21>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../react/legacy/react-0.12.d.ts' />
|
||||
///<reference path='../react/react.d.ts' />
|
||||
///<reference path='../eventemitter3/eventemitter3.d.ts' />
|
||||
|
||||
declare module Fluxxor {
|
||||
@@ -14,7 +14,7 @@ declare module Fluxxor {
|
||||
doDispatchLoop(action: Function): void;
|
||||
waitForStores(store: Store, stores: string[], fn: Function): void;
|
||||
}
|
||||
|
||||
|
||||
class Flux extends EventEmitter3.EventEmitter {
|
||||
constructor(stores: any, actions: any);
|
||||
addActions(actions: any): void;
|
||||
@@ -26,40 +26,40 @@ declare module Fluxxor {
|
||||
stores: any;
|
||||
actions: any;
|
||||
}
|
||||
|
||||
|
||||
interface Store extends EventEmitter3.EventEmitter {
|
||||
bindActions(...args: Array<string|Function>): void;
|
||||
bindActions(args: Array<string|Function>): void;
|
||||
waitFor(stores: string[], fn: Function): void;
|
||||
}
|
||||
|
||||
|
||||
interface StoreSpec {
|
||||
initialize?(instance?: any, options?: {}): void;
|
||||
actions?: any;
|
||||
}
|
||||
|
||||
|
||||
interface StoreClass {
|
||||
new (options?: {}): any;
|
||||
}
|
||||
|
||||
|
||||
interface Context {
|
||||
flux: Flux;
|
||||
}
|
||||
|
||||
|
||||
interface FluxMixin {
|
||||
getFlux(): Flux;
|
||||
}
|
||||
|
||||
|
||||
interface FluxChildMixin {
|
||||
getFlux(): Flux;
|
||||
}
|
||||
|
||||
|
||||
interface StoreWatchMixin<StoreState> {
|
||||
getStateFromFlux(): StoreState;
|
||||
}
|
||||
|
||||
function FluxMixin(React: React.Exports): FluxMixin;
|
||||
function FluxChildMixin(React: React.Exports): FluxChildMixin;
|
||||
|
||||
function FluxMixin(React: typeof __React): FluxMixin;
|
||||
function FluxChildMixin(React: typeof __React): FluxChildMixin;
|
||||
function StoreWatchMixin<StoreState>(...storeNames: string[]): StoreWatchMixin<StoreState>;
|
||||
function createStore(spec: StoreSpec): StoreClass;
|
||||
var version: string;
|
||||
|
||||
Vendored
+2121
-2122
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,6 @@ gulp.task("concat:newLine", () => {
|
||||
|
||||
gulp.task("concat:vinyl", () => {
|
||||
gulp.src(["file*.txt"])
|
||||
.pipe(concat({ path: "file.txt", stat: { mode: 0666 } }))
|
||||
.pipe(concat({ path: "file.txt", stat: { mode: parseInt("0666", 8) } }))
|
||||
.pipe(gulp.dest("build"));
|
||||
});
|
||||
|
||||
@@ -11,11 +11,11 @@ function tests() {
|
||||
hello: 'world'
|
||||
};
|
||||
hooker.hook(objectToHook, 'hello', () => { });
|
||||
hooker.hook(objectToHook, 'hello', () => {
|
||||
hooker.hook(objectToHook, 'hello', (): any => {
|
||||
return null;
|
||||
});
|
||||
hooker.hook(objectToHook, ['hello', 'foo'], () => { });
|
||||
hooker.hook(objectToHook, ['hello', 'bar'], () => {
|
||||
hooker.hook(objectToHook, ['hello', 'bar'], (): any => {
|
||||
return null;
|
||||
});
|
||||
hooker.hook(objectToHook, 'bar', () => {
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/// <reference path="jquery-knob.d.ts"/>
|
||||
|
||||
// create from html attrs
|
||||
$('<input type="text" name="knob" value="50" data-min="0" data-max="100">').knob();
|
||||
|
||||
// create with object
|
||||
$('<input type="text" name="knob-2">').knob({
|
||||
min: 0,
|
||||
max: 100,
|
||||
angleArc: 270
|
||||
});
|
||||
|
||||
// hooks
|
||||
var hookKnob = $('<input type="text" name="knob-2">').knob({
|
||||
release: function(value) {
|
||||
console.log(value);
|
||||
},
|
||||
change: function(value) {
|
||||
console.log(value);
|
||||
},
|
||||
draw: function() {
|
||||
console.log(this);
|
||||
},
|
||||
cancel: function() {
|
||||
console.log(this);
|
||||
},
|
||||
format: function(value) {
|
||||
console.log(value);
|
||||
}
|
||||
});
|
||||
|
||||
// trigger
|
||||
hookKnob.trigger('release');
|
||||
hookKnob.trigger('change');
|
||||
hookKnob.trigger('draw');
|
||||
hookKnob.trigger('cancel');
|
||||
hookKnob.trigger('format');
|
||||
Vendored
+116
@@ -0,0 +1,116 @@
|
||||
// Type definitions for jQuery Knob 1.2.11
|
||||
// Project: http://anthonyterrien.com/knob/
|
||||
// Definitions by: Iain Buchanan <https://github.com/iain8/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module JQueryKnob {
|
||||
export interface JQueryKnobOptions {
|
||||
/**
|
||||
* min value | default=0
|
||||
*/
|
||||
min?: number;
|
||||
/**
|
||||
* max value | default=100
|
||||
*/
|
||||
max?: number;
|
||||
/**
|
||||
* step size | default=1
|
||||
*/
|
||||
step?: number;
|
||||
/**
|
||||
* starting angle in degrees | default=0
|
||||
*/
|
||||
angleOffset?: number;
|
||||
/**
|
||||
* arc size in degrees | default=360
|
||||
*/
|
||||
angleArc?: number;
|
||||
/**
|
||||
* stop at min & max on keydown/mousewheel | default=true
|
||||
*/
|
||||
stopper?: boolean;
|
||||
/**
|
||||
* disable input and events | default=false
|
||||
*/
|
||||
readOnly?: boolean;
|
||||
/**
|
||||
* direction of progression | default=clockwise
|
||||
*/
|
||||
rotation?: string;
|
||||
/**
|
||||
* display mode "cursor", cursor size could be changed passing a
|
||||
* numeric value to the option, default width is used when passing
|
||||
* boolean value "true" | default=gauge
|
||||
*/
|
||||
cursor?: string | boolean;
|
||||
/**
|
||||
* gauge thickness
|
||||
*/
|
||||
thickness?: number;
|
||||
/**
|
||||
* gauge stroke endings | default=butt, round=rounded line endings
|
||||
*/
|
||||
lineCap?: string;
|
||||
/**
|
||||
* dial width
|
||||
*/
|
||||
width?: number;
|
||||
/**
|
||||
* default=true | false=hide input
|
||||
*/
|
||||
displayInput?: boolean;
|
||||
/**
|
||||
* default=false | true=displays the previous value with transparency
|
||||
*/
|
||||
displayPrevious?: boolean;
|
||||
/**
|
||||
* foreground color
|
||||
*/
|
||||
fgColor?: string;
|
||||
/**
|
||||
* input value (number) color
|
||||
*/
|
||||
inputColor?: string;
|
||||
/**
|
||||
* font family
|
||||
*/
|
||||
font?: string;
|
||||
/**
|
||||
* font weight
|
||||
*/
|
||||
fontWeight?: string;
|
||||
/**
|
||||
* background color
|
||||
*/
|
||||
bgColor?: string;
|
||||
/**
|
||||
* executed on release
|
||||
*/
|
||||
release?: (value: number) => void;
|
||||
/**
|
||||
* executed at each change of the value
|
||||
*/
|
||||
change?: (value: number) => void;
|
||||
/**
|
||||
* when drawing the canvas
|
||||
*/
|
||||
draw?: () => void;
|
||||
/**
|
||||
* triggered on [esc] keydown
|
||||
*/
|
||||
cancel?: () => void;
|
||||
/**
|
||||
* allows to format output (add unit %, ms...)
|
||||
*/
|
||||
format?: (value: number) => void;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Create a knob for the given input field, with optional options
|
||||
*/
|
||||
knob(options?: JQueryKnob.JQueryKnobOptions): JQuery;
|
||||
}
|
||||
@@ -1618,7 +1618,7 @@ function test_spinner() {
|
||||
},
|
||||
_parse: function (value) {
|
||||
if (typeof value === "string") {
|
||||
if (Number(value) == value) {
|
||||
if (Number(value) == <any>value) {
|
||||
return Number(value);
|
||||
}
|
||||
return 123;
|
||||
@@ -1822,4 +1822,4 @@ function test_widget() {
|
||||
var isDisabled = $(".selector").jQuery.Widget("option", "disabled");
|
||||
$(".selector").jQuery.Widget("option", "disabled", true);
|
||||
$(".selector").jQuery.Widget("option", { disabled: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,15 +135,11 @@ result = <string>_('test').toString();
|
||||
result = <string>_([1, 2, 3]).toString();
|
||||
result = <string>_({ 'key1': 'test1', 'key2': 'test2' }).toString();
|
||||
|
||||
result = <string>_('test').valueOf();
|
||||
result = <number[]>_([1, 2, 3]).valueOf();
|
||||
result = <_.Dictionary<string>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).valueOf();
|
||||
|
||||
// _.value (aliases: _.run, _.toJSON, _.valueOf)
|
||||
result = <string>_('test').value();
|
||||
result = <number[]>_([1, 2, 3]).value();
|
||||
result = <_.Dictionary<string>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).value();
|
||||
|
||||
result = <_.Dictionary<number>>_({ a: 1, b: 2}).mapValues(function(num: number) { return num * 2; }).value();
|
||||
result = <number[]>_([1, 2, 3]).run();
|
||||
result = <_.Dictionary<string>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).toJSON();
|
||||
result = <_.Dictionary<number>>_({ a: 1, b: 2}).mapValues(function(num: number) { return num * 2; }).valueOf();
|
||||
|
||||
// /*************
|
||||
// * Arrays *
|
||||
@@ -1082,6 +1078,9 @@ result = <HasName>_.pick({ 'name': 'moe', '_userid': 'moe1' }, function (value,
|
||||
return key.charAt(0) != '_';
|
||||
});
|
||||
|
||||
|
||||
result = <{ a: { b: { c: number; }}[]}>_.set({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c', 4);
|
||||
|
||||
result = <number[]>_.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function (r: number[], num: number) {
|
||||
num *= num;
|
||||
if (num % 2) {
|
||||
|
||||
Vendored
+31
-7
@@ -177,15 +177,25 @@ declare module _ {
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* Extracts the wrapped value.
|
||||
* @return The wrapped value.
|
||||
**/
|
||||
valueOf(): T;
|
||||
|
||||
/**
|
||||
* @see valueOf
|
||||
* Executes the chained sequence to extract the unwrapped value.
|
||||
* @return Returns the resolved unwrapped value.
|
||||
**/
|
||||
value(): T;
|
||||
|
||||
/**
|
||||
* @see _.value
|
||||
**/
|
||||
run(): T;
|
||||
|
||||
/**
|
||||
* @see _.value
|
||||
**/
|
||||
toJSON(): T;
|
||||
|
||||
/**
|
||||
* @see _.value
|
||||
**/
|
||||
valueOf(): T;
|
||||
}
|
||||
|
||||
interface LoDashWrapper<T> extends LoDashWrapperBase<T, LoDashWrapper<T>> { }
|
||||
@@ -6249,6 +6259,20 @@ declare module _ {
|
||||
thisArg?: any): Picked;
|
||||
}
|
||||
|
||||
//_.set
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Sets the property value of path on object. If a portion of path does not exist it is created.
|
||||
* @param object The object to augment.
|
||||
* @param path The path of the property to set.
|
||||
* @param value The value to set.
|
||||
* @return Returns object.
|
||||
**/
|
||||
set<T>(object: T,
|
||||
path: string|string[],
|
||||
value: any): T;
|
||||
}
|
||||
|
||||
//_.transform
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
@@ -54,14 +54,14 @@ function BaseClassExtensions_Error_Tests() {
|
||||
}
|
||||
else if (isNaN(input)) {
|
||||
var msg = "A number was not entered. ";
|
||||
msg += (<MicrosoftAjaxBaseTypeExtensions.String>String).format("Please enter a number between {0} and {1}.", min, max);
|
||||
msg += (<MicrosoftAjaxBaseTypeExtensions.String><any>String).format("Please enter a number between {0} and {1}.", min, max);
|
||||
|
||||
var err = (<MicrosoftAjaxBaseTypeExtensions.Error>Error).create(msg);
|
||||
throw err;
|
||||
}
|
||||
else if (input < min || input > max) {
|
||||
msg = "The number entered was outside the acceptable range. ";
|
||||
msg += (<MicrosoftAjaxBaseTypeExtensions.String>String).format("Please enter a number between {0} and {1}.", min, max);
|
||||
msg += (<MicrosoftAjaxBaseTypeExtensions.String><any>String).format("Please enter a number between {0} and {1}.", min, max);
|
||||
|
||||
var err = (<MicrosoftAjaxBaseTypeExtensions.Error>Error).create(msg);
|
||||
|
||||
@@ -82,12 +82,12 @@ function BaseClassExtensions_Error_Tests() {
|
||||
|
||||
function BaseClassExtensions_String_Tests() {
|
||||
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String>String).format("Please enter a number between {0} and {1}.", 1, 2);
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String>String).endsWith("test");
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String>String).localeFormat("Please enter a number between {0} and {1}", 1, 2);
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String>String).trim();
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String>String).trimEnd();
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String>String).trimStart();
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).format("Please enter a number between {0} and {1}.", 1, 2);
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).endsWith("test");
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).localeFormat("Please enter a number between {0} and {1}", 1, 2);
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).trim();
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).trimEnd();
|
||||
(<MicrosoftAjaxBaseTypeExtensions.String><any>String).trimStart();
|
||||
}
|
||||
|
||||
function BaseClassExtensions_Function_Tests() {
|
||||
@@ -150,7 +150,7 @@ function BaseClassExtensions_Date_Tests() {
|
||||
|
||||
function BaseClassExtensions_Boolean_Tests() {
|
||||
|
||||
(<MicrosoftAjaxBaseTypeExtensions.Boolean>Boolean).parse("false");
|
||||
(<MicrosoftAjaxBaseTypeExtensions.Boolean><any>Boolean).parse("false");
|
||||
}
|
||||
|
||||
function BaseClassExtensions_Number_Tests() {
|
||||
|
||||
@@ -50,7 +50,7 @@ function d() {
|
||||
function e() {
|
||||
mock({
|
||||
'some/dir': mock.directory({
|
||||
mode: 0755,
|
||||
mode: parseInt("0755", 8),
|
||||
items: {
|
||||
file1: 'file one content',
|
||||
file2: new Buffer([8, 6, 7, 5, 3, 0, 9])
|
||||
|
||||
Vendored
+12
-4
@@ -9,6 +9,14 @@
|
||||
* *
|
||||
************************************************/
|
||||
|
||||
// compat for TypeScript 1.5.3
|
||||
// if you use with --target es3 or --target es5 and use below definitions,
|
||||
// use the lib.es6.d.ts that is bundled with TypeScript 1.5.3.
|
||||
interface MapConstructor {}
|
||||
interface WeakMapConstructor {}
|
||||
interface SetConstructor {}
|
||||
interface WeakSetConstructor {}
|
||||
|
||||
/************************************************
|
||||
* *
|
||||
* GLOBAL *
|
||||
@@ -271,7 +279,7 @@ declare module NodeJS {
|
||||
Int8Array: typeof Int8Array;
|
||||
Intl: typeof Intl;
|
||||
JSON: typeof JSON;
|
||||
Map: typeof Map;
|
||||
Map: MapConstructor;
|
||||
Math: typeof Math;
|
||||
NaN: typeof NaN;
|
||||
Number: typeof Number;
|
||||
@@ -280,7 +288,7 @@ declare module NodeJS {
|
||||
RangeError: typeof RangeError;
|
||||
ReferenceError: typeof ReferenceError;
|
||||
RegExp: typeof RegExp;
|
||||
Set: typeof Set;
|
||||
Set: SetConstructor;
|
||||
String: typeof String;
|
||||
Symbol: Function;
|
||||
SyntaxError: typeof SyntaxError;
|
||||
@@ -290,8 +298,8 @@ declare module NodeJS {
|
||||
Uint32Array: typeof Uint32Array;
|
||||
Uint8Array: typeof Uint8Array;
|
||||
Uint8ClampedArray: Function;
|
||||
WeakMap: typeof WeakMap;
|
||||
WeakSet: Function;
|
||||
WeakMap: WeakMapConstructor;
|
||||
WeakSet: WeakSetConstructor;
|
||||
clearImmediate: (immediateId: any) => void;
|
||||
clearInterval: (intervalId: NodeJS.Timer) => void;
|
||||
clearTimeout: (timeoutId: NodeJS.Timer) => void;
|
||||
|
||||
Generated
+121
-59
@@ -8,39 +8,39 @@
|
||||
"resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.2.0.tgz",
|
||||
"dependencies": {
|
||||
"bluebird": {
|
||||
"version": "2.7.1",
|
||||
"from": "bluebird@^2.5.3",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.7.1.tgz"
|
||||
"version": "2.9.34",
|
||||
"from": "bluebird@>=2.5.3 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.34.tgz"
|
||||
},
|
||||
"definition-header": {
|
||||
"version": "0.1.0",
|
||||
"from": "definition-header@^0.1.0",
|
||||
"from": "definition-header@>=0.1.0 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz",
|
||||
"dependencies": {
|
||||
"joi": {
|
||||
"version": "4.9.0",
|
||||
"from": "joi@^4.0.0",
|
||||
"from": "joi@>=4.0.0 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz",
|
||||
"dependencies": {
|
||||
"hoek": {
|
||||
"version": "2.11.0",
|
||||
"from": "hoek@^2.2.x",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.11.0.tgz"
|
||||
"version": "2.14.0",
|
||||
"from": "hoek@>=2.2.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.14.0.tgz"
|
||||
},
|
||||
"topo": {
|
||||
"version": "1.0.2",
|
||||
"from": "topo@1.x.x",
|
||||
"from": "topo@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/topo/-/topo-1.0.2.tgz"
|
||||
},
|
||||
"isemail": {
|
||||
"version": "1.1.1",
|
||||
"from": "isemail@1.x.x",
|
||||
"from": "isemail@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isemail/-/isemail-1.1.1.tgz"
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.9.0",
|
||||
"from": "moment@2.x.x",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.9.0.tgz"
|
||||
"version": "2.10.3",
|
||||
"from": "moment@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.10.3.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -50,76 +50,138 @@
|
||||
"resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz",
|
||||
"dependencies": {
|
||||
"assertion-error": {
|
||||
"version": "1.0.0",
|
||||
"from": "assertion-error@^1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.0.tgz"
|
||||
"version": "1.0.1",
|
||||
"from": "assertion-error@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parsimmon": {
|
||||
"version": "0.5.1",
|
||||
"from": "parsimmon@^0.5.0",
|
||||
"from": "parsimmon@>=0.5.0 <0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz",
|
||||
"dependencies": {
|
||||
"pjs": {
|
||||
"version": "5.1.1",
|
||||
"from": "pjs@5.x",
|
||||
"from": "pjs@>=5.0.0 <6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xregexp": {
|
||||
"version": "2.0.0",
|
||||
"from": "xregexp@~2.0.0",
|
||||
"from": "xregexp@>=2.0.0 <2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"findup-sync": {
|
||||
"version": "0.2.1",
|
||||
"from": "findup-sync@~0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.2.1.tgz"
|
||||
"from": "findup-sync@>=0.2.1 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.2.1.tgz",
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
"version": "4.3.5",
|
||||
"from": "glob@>=4.3.0 <4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz",
|
||||
"dependencies": {
|
||||
"inflight": {
|
||||
"version": "1.0.4",
|
||||
"from": "inflight@>=1.0.4 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz",
|
||||
"dependencies": {
|
||||
"wrappy": {
|
||||
"version": "1.0.1",
|
||||
"from": "wrappy@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"from": "inherits@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "2.0.9",
|
||||
"from": "minimatch@>=2.0.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.9.tgz",
|
||||
"dependencies": {
|
||||
"brace-expansion": {
|
||||
"version": "1.1.0",
|
||||
"from": "brace-expansion@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz",
|
||||
"dependencies": {
|
||||
"balanced-match": {
|
||||
"version": "0.2.0",
|
||||
"from": "balanced-match@>=0.2.0 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz"
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"from": "concat-map@0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.3.2",
|
||||
"from": "once@>=1.3.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz",
|
||||
"dependencies": {
|
||||
"wrappy": {
|
||||
"version": "1.0.1",
|
||||
"from": "wrappy@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"git-wrapper": {
|
||||
"version": "0.1.1",
|
||||
"from": "git-wrapper@~0.1.1",
|
||||
"from": "git-wrapper@>=0.1.1 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz"
|
||||
},
|
||||
"glob": {
|
||||
"version": "4.3.5",
|
||||
"from": "glob@^4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz",
|
||||
"version": "4.5.3",
|
||||
"from": "glob@>=4.3.2 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz",
|
||||
"dependencies": {
|
||||
"inflight": {
|
||||
"version": "1.0.4",
|
||||
"from": "inflight@^1.0.4",
|
||||
"from": "inflight@>=1.0.4 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz",
|
||||
"dependencies": {
|
||||
"wrappy": {
|
||||
"version": "1.0.1",
|
||||
"from": "wrappy@1",
|
||||
"from": "wrappy@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"from": "inherits@2",
|
||||
"from": "inherits@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "2.0.1",
|
||||
"from": "minimatch@^2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.1.tgz",
|
||||
"version": "2.0.9",
|
||||
"from": "minimatch@>=2.0.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.9.tgz",
|
||||
"dependencies": {
|
||||
"brace-expansion": {
|
||||
"version": "1.1.0",
|
||||
"from": "brace-expansion@^1.0.0",
|
||||
"from": "brace-expansion@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz",
|
||||
"dependencies": {
|
||||
"balanced-match": {
|
||||
"version": "0.2.0",
|
||||
"from": "balanced-match@^0.2.0",
|
||||
"from": "balanced-match@>=0.2.0 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz"
|
||||
},
|
||||
"concat-map": {
|
||||
@@ -132,13 +194,13 @@
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.3.1",
|
||||
"from": "once@^1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.3.1.tgz",
|
||||
"version": "1.3.2",
|
||||
"from": "once@>=1.3.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz",
|
||||
"dependencies": {
|
||||
"wrappy": {
|
||||
"version": "1.0.1",
|
||||
"from": "wrappy@1",
|
||||
"from": "wrappy@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
@@ -147,17 +209,17 @@
|
||||
},
|
||||
"lazy.js": {
|
||||
"version": "0.4.0",
|
||||
"from": "lazy.js@~0.4.0",
|
||||
"from": "lazy.js@>=0.4.0 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.0.tgz"
|
||||
},
|
||||
"manticore": {
|
||||
"version": "0.2.4",
|
||||
"from": "manticore@^0.2.4",
|
||||
"from": "manticore@>=0.2.4 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz",
|
||||
"dependencies": {
|
||||
"JSONStream": {
|
||||
"version": "0.8.4",
|
||||
"from": "JSONStream@^0.8.4",
|
||||
"from": "JSONStream@>=0.8.4 <0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
|
||||
"dependencies": {
|
||||
"jsonparse": {
|
||||
@@ -166,30 +228,30 @@
|
||||
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz"
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.6",
|
||||
"from": "through@>=2.2.7 <3",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.6.tgz"
|
||||
"version": "2.3.8",
|
||||
"from": "through@>=2.2.7 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "1.2.4",
|
||||
"from": "bluebird@^1.2.4",
|
||||
"from": "bluebird@>=1.2.4 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz"
|
||||
},
|
||||
"through2": {
|
||||
"version": "0.5.1",
|
||||
"from": "through2@^0.5.1",
|
||||
"from": "through2@>=0.5.1 <0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz",
|
||||
"dependencies": {
|
||||
"readable-stream": {
|
||||
"version": "1.0.33",
|
||||
"from": "readable-stream@~1.0.17",
|
||||
"from": "readable-stream@>=1.0.17 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
|
||||
"dependencies": {
|
||||
"core-util-is": {
|
||||
"version": "1.0.1",
|
||||
"from": "core-util-is@~1.0.0",
|
||||
"from": "core-util-is@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
|
||||
},
|
||||
"isarray": {
|
||||
@@ -199,43 +261,43 @@
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"from": "string_decoder@~0.10.x",
|
||||
"from": "string_decoder@>=0.10.0 <0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"from": "inherits@~2.0.1",
|
||||
"from": "inherits@>=2.0.1 <2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xtend": {
|
||||
"version": "3.0.0",
|
||||
"from": "xtend@~3.0.0",
|
||||
"from": "xtend@>=3.0.0 <3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type-detect": {
|
||||
"version": "0.1.2",
|
||||
"from": "type-detect@^0.1.2",
|
||||
"from": "type-detect@>=0.1.2 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optimist": {
|
||||
"version": "0.6.1",
|
||||
"from": "optimist@~0.6.1",
|
||||
"from": "optimist@>=0.6.1 <0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
|
||||
"dependencies": {
|
||||
"wordwrap": {
|
||||
"version": "0.0.2",
|
||||
"from": "wordwrap@~0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz"
|
||||
"version": "0.0.3",
|
||||
"from": "wordwrap@>=0.0.2 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz"
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.10",
|
||||
"from": "minimist@~0.0.1",
|
||||
"from": "minimist@>=0.0.1 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz"
|
||||
}
|
||||
}
|
||||
@@ -243,9 +305,9 @@
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "1.4.1",
|
||||
"from": "typescript@1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-1.4.1.tgz"
|
||||
"version": "1.5.3",
|
||||
"from": "typescript@1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-1.5.3.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+62
-60
@@ -1,63 +1,65 @@
|
||||
// Type definitions for oboe v2.0.3
|
||||
// Project: https://github.com/jimhigson/oboe.js
|
||||
// Definitions by: Jared Klopper <https://github.com/optical>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "oboe" {
|
||||
import stream = require('stream');
|
||||
|
||||
function oboe(url: string): oboe.Oboe;
|
||||
function oboe(options: oboe.Options): oboe.Oboe;
|
||||
function oboe(stream: stream.Readable) : oboe.Oboe;
|
||||
|
||||
module oboe {
|
||||
|
||||
var drop: {};
|
||||
|
||||
interface Oboe {
|
||||
done(callback: (result: any) => void): Oboe;
|
||||
|
||||
fail(callback: (result: FailReason) => void): Oboe;
|
||||
|
||||
node(pattern: string, callback: CallbackSignature): Oboe;
|
||||
|
||||
on(event: string, pattern: string, callback: CallbackSignature): Oboe;
|
||||
on(eventPattern: string, callback: CallbackSignature): Oboe;
|
||||
|
||||
path(pattern: string, callback: CallbackSignature): Oboe;
|
||||
path(listeners: any): Oboe;
|
||||
|
||||
removeListener(eventPattern: string, callback: CallbackSignature): Oboe;
|
||||
removeListener(event: string, pattern: string, callback: CallbackSignature): Oboe;
|
||||
|
||||
start(callback: (status: number, headers: Object) => void): Oboe;
|
||||
|
||||
source: string;
|
||||
}
|
||||
|
||||
interface CallbackSignature {
|
||||
(node: any, pathOrHeaders: any, ancestors: Object[]): any;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
url: string;
|
||||
method?: string;
|
||||
headers?: Object;
|
||||
body?: any;
|
||||
cached?: boolean;
|
||||
withCredentials?: boolean;
|
||||
}
|
||||
|
||||
interface FailReason {
|
||||
thrown?: Error;
|
||||
statusCode?: number;
|
||||
body?: string;
|
||||
jsonBody?: Object;
|
||||
}
|
||||
}
|
||||
|
||||
export = oboe;
|
||||
}
|
||||
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "oboe" {
|
||||
import stream = require('stream');
|
||||
|
||||
function oboe(url: string): oboe.Oboe;
|
||||
function oboe(options: oboe.Options): oboe.Oboe;
|
||||
function oboe(stream: stream.Readable) : oboe.Oboe;
|
||||
|
||||
module oboe {
|
||||
|
||||
var drop: {};
|
||||
|
||||
interface Oboe {
|
||||
done(callback: (result: any) => void): Oboe;
|
||||
|
||||
fail(callback: (result: FailReason) => void): Oboe;
|
||||
|
||||
node(pattern: string, callback: CallbackSignature): Oboe;
|
||||
|
||||
on(event: string, pattern: string, callback: CallbackSignature): Oboe;
|
||||
on(eventPattern: string, callback: CallbackSignature): Oboe;
|
||||
|
||||
path(pattern: string, callback: CallbackSignature): Oboe;
|
||||
path(listeners: any): Oboe;
|
||||
|
||||
removeListener(eventPattern: string, callback: CallbackSignature): Oboe;
|
||||
removeListener(event: string, pattern: string, callback: CallbackSignature): Oboe;
|
||||
|
||||
start(callback: (status: number, headers: Object) => void): Oboe;
|
||||
|
||||
abort():void;
|
||||
|
||||
source: string;
|
||||
}
|
||||
|
||||
interface CallbackSignature {
|
||||
(node: any, pathOrHeaders: any, ancestors: Object[]): any;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
url: string;
|
||||
method?: string;
|
||||
headers?: Object;
|
||||
body?: any;
|
||||
cached?: boolean;
|
||||
withCredentials?: boolean;
|
||||
}
|
||||
|
||||
interface FailReason {
|
||||
thrown?: Error;
|
||||
statusCode?: number;
|
||||
body?: string;
|
||||
jsonBody?: Object;
|
||||
}
|
||||
}
|
||||
|
||||
export = oboe;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,6 +36,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"definition-tester": "0.2.0",
|
||||
"typescript": "1.4.1"
|
||||
"typescript": "1.5.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class User implements IUser {
|
||||
//#endregion
|
||||
|
||||
// Sample from https://github.com/jaredhanson/passport-local#configure-strategy
|
||||
passport.use(new local.Strategy(function (username, password, done) {
|
||||
passport.use(new local.Strategy((username: any, password: any, done: any) => {
|
||||
User.findOne({ username: username }, function (err, user) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
|
||||
@@ -556,7 +556,7 @@ function test_globalization() {
|
||||
|
||||
function test_inAppBrowser() {
|
||||
var ref = window.open('http://apache.org', '_blank', 'location=yes');
|
||||
ref.addEventListener('loadstart', function () { alert(event.url); });
|
||||
ref.addEventListener('loadstart', function () { alert(event); });
|
||||
ref.removeEventListener('loadstart', null);
|
||||
ref.close();
|
||||
}
|
||||
@@ -716,4 +716,4 @@ function test_storage() {
|
||||
var value = window.localStorage.getItem("key");
|
||||
window.localStorage.removeItem("key");
|
||||
window.localStorage.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ var customizedAssert2 = assert.customize({
|
||||
circular: '#@Circular#',
|
||||
lineSeparator: '\n',
|
||||
ambiguousEastAsianCharWidth: 2,
|
||||
widthOf: () => null,
|
||||
stringify: () => null,
|
||||
diff: () => null,
|
||||
widthOf: () => false,
|
||||
stringify: () => false,
|
||||
diff: () => false,
|
||||
writerClass: null,
|
||||
renderers: [
|
||||
'./built-in/file',
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
///<reference path='../../react/legacy/react-0.12.d.ts' />
|
||||
|
||||
declare module 'react-0.12' {
|
||||
var exports: React.Exports;
|
||||
export = exports;
|
||||
}
|
||||
@@ -1,347 +0,0 @@
|
||||
///<reference path='react-router-0.12-test.d.ts' />
|
||||
///<reference path="react-router-0.12.d.ts" />
|
||||
"use strict";
|
||||
|
||||
import React = require('react-0.12');
|
||||
import Router = ReactRouter;
|
||||
|
||||
// Mixin
|
||||
class NavigationTest<T extends Router.Navigation> {
|
||||
v: T;
|
||||
|
||||
makePath() {
|
||||
var v1: string = this.v.makePath('to');
|
||||
var v2: string = this.v.makePath('to', {id: 1});
|
||||
var v3: string = this.v.makePath('to', {id: 1}, {type: 'json'});
|
||||
}
|
||||
makeHref() {
|
||||
var v1: string = this.v.makeHref('to');
|
||||
var v2: string = this.v.makeHref('to', {id: 1});
|
||||
var v3: string = this.v.makeHref('to', {id: 1}, {type: 'json'});
|
||||
}
|
||||
transitionTo() {
|
||||
var v1: void = this.v.transitionTo('to');
|
||||
var v2: void = this.v.transitionTo('to', {id: 1});
|
||||
var v3: void = this.v.transitionTo('to', {id: 1}, {type: 'json'});
|
||||
}
|
||||
replaceWith() {
|
||||
var v1: void = this.v.replaceWith('to');
|
||||
var v2: void = this.v.replaceWith('to', {id: 1});
|
||||
var v3: void = this.v.replaceWith('to', {id: 1}, {type: 'json'});
|
||||
}
|
||||
goBack() {
|
||||
var v1: void = this.v.goBack();
|
||||
}
|
||||
}
|
||||
|
||||
class StateTest<T extends Router.State> {
|
||||
v: T;
|
||||
|
||||
getPath() {
|
||||
var v1: string = this.v.getPath();
|
||||
}
|
||||
|
||||
getRoutes() {
|
||||
var v1: Router.Route[] = this.v.getRoutes();
|
||||
}
|
||||
|
||||
getPathname() {
|
||||
var v1: string = this.v.getPathname();
|
||||
}
|
||||
|
||||
getParams() {
|
||||
var v1: {} = this.v.getParams();
|
||||
}
|
||||
|
||||
getQuery() {
|
||||
var v1: {} = this.v.getQuery();
|
||||
}
|
||||
|
||||
isActive() {
|
||||
var v1: boolean = this.v.isActive('to');
|
||||
var v2: boolean = this.v.isActive('to', {id: 1});
|
||||
var v3: boolean = this.v.isActive('to', {id: 1}, {type: 'json'});
|
||||
}
|
||||
}
|
||||
|
||||
class RouteHandlerMixinTest<T extends Router.RouteHandlerMixin> {
|
||||
v: T;
|
||||
|
||||
getRouteDepth() {
|
||||
var v1: number = this.v.getRouteDepth();
|
||||
}
|
||||
|
||||
createChildRouteHandler() {
|
||||
var v1: Router.RouteHandler = this.v.createChildRouteHandler({ref: 'hoge'});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Location
|
||||
class LocationTest<T extends Router.LocationBase> {
|
||||
v: T;
|
||||
|
||||
push() {
|
||||
var v1: void = this.v.push('path/to/hoge');
|
||||
}
|
||||
|
||||
replace() {
|
||||
var v1: void = this.v.replace('path/to/hoge');
|
||||
}
|
||||
|
||||
pop() {
|
||||
var v1: void = this.v.pop();
|
||||
}
|
||||
|
||||
getCurrentPath() {
|
||||
var v1: void = this.v.getCurrentPath();
|
||||
}
|
||||
}
|
||||
new LocationTest<Router.HashLocation>();
|
||||
new LocationTest<Router.HistoryLocation>();
|
||||
new LocationTest<Router.RefreshLocation>();
|
||||
|
||||
class LocationListenerTest<T extends Router.LocationListener> {
|
||||
v: T;
|
||||
|
||||
addChangeListener() {
|
||||
var v1: void = this.v.addChangeListener(() => console.log(1));
|
||||
}
|
||||
|
||||
removeChangeListener() {
|
||||
var v1: void = this.v.removeChangeListener(() => console.log(1));
|
||||
}
|
||||
}
|
||||
new LocationListenerTest<Router.HashLocation>();
|
||||
new LocationListenerTest<Router.HistoryLocation>();
|
||||
|
||||
|
||||
// Behavior
|
||||
class ScrollBehaviorTest<T extends Router.ScrollBehaviorBase> {
|
||||
v: T;
|
||||
|
||||
updateScrollPosition() {
|
||||
var v1: void = this.v.updateScrollPosition({x: 33, y: 102}, 'scrollTop');
|
||||
}
|
||||
}
|
||||
new ScrollBehaviorTest<Router.ImitateBrowserBehavior>();
|
||||
new ScrollBehaviorTest<Router.ScrollToTopBehavior>();
|
||||
|
||||
|
||||
// Component
|
||||
class DefaultRouteTest {
|
||||
v: Router.DefaultRoute;
|
||||
|
||||
props() {
|
||||
var name: string = this.v.props.name;
|
||||
var handler: React.ComponentClass<any> = this.v.props.handler;
|
||||
}
|
||||
|
||||
createElement() {
|
||||
var Handler: React.ComponentClass<any>;
|
||||
React.createElement(Router.DefaultRoute, null);
|
||||
React.createElement(Router.DefaultRoute, {name: 'name', handler: Handler});
|
||||
}
|
||||
}
|
||||
|
||||
class LinkTest {
|
||||
v: Router.Link;
|
||||
|
||||
constructor() {
|
||||
new NavigationTest<Router.Link>();
|
||||
new StateTest<Router.Link>();
|
||||
}
|
||||
|
||||
props() {
|
||||
var activeClassName: string = this.v.props.activeClassName;
|
||||
var to: string = this.v.props.to;
|
||||
var params: {} = this.v.props.params;
|
||||
var query: {} = this.v.props.query;
|
||||
var onClick: Function = this.v.props.onClick;
|
||||
}
|
||||
|
||||
getHref() {
|
||||
var v1: string = this.v.getHref();
|
||||
}
|
||||
|
||||
getClassName() {
|
||||
var v1: string = this.v.getClassName();
|
||||
}
|
||||
|
||||
createElement() {
|
||||
React.createElement(Router.Link, null);
|
||||
React.createElement(Router.Link, {to: 'home'});
|
||||
React.createElement(Router.Link, {
|
||||
activeClassName: 'name',
|
||||
to: 'home',
|
||||
params: {},
|
||||
query: {},
|
||||
onClick: () => console.log(1)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class NotFoundRouteTest {
|
||||
v: Router.NotFoundRoute;
|
||||
|
||||
props() {
|
||||
var name: string = this.v.props.name;
|
||||
var handler: React.ComponentClass<any> = this.v.props.handler;
|
||||
}
|
||||
|
||||
createElement() {
|
||||
var Handler: React.ComponentClass<any>;
|
||||
React.createElement(Router.NotFoundRoute, null);
|
||||
React.createElement(Router.NotFoundRoute, {handler: Handler});
|
||||
React.createElement(Router.NotFoundRoute, {handler: Handler, name: "home"});
|
||||
}
|
||||
}
|
||||
|
||||
class RedirectTest {
|
||||
v: Router.Redirect;
|
||||
|
||||
props() {
|
||||
var path: string = this.v.props.path;
|
||||
var from: string = this.v.props.from;
|
||||
var to: string = this.v.props.to;
|
||||
}
|
||||
|
||||
createElement() {
|
||||
React.createElement(Router.Redirect, null);
|
||||
React.createElement(Router.Redirect, {});
|
||||
React.createElement(Router.Redirect, {path: 'a', from: 'a', to: 'b'});
|
||||
}
|
||||
}
|
||||
|
||||
class RouteTest {
|
||||
v: Router.Route;
|
||||
|
||||
props() {
|
||||
var name: string = this.v.props.name;
|
||||
var path: string = this.v.props.path;
|
||||
var handler: React.ComponentClass<any> = this.v.props.handler;
|
||||
var ignoreScrollBehavior: boolean = this.v.props.ignoreScrollBehavior;
|
||||
}
|
||||
|
||||
createElement() {
|
||||
var Handler: React.ComponentClass<any>;
|
||||
React.createElement(Router.Route, null);
|
||||
React.createElement(Router.Route, {});
|
||||
React.createElement(Router.Route, {name: "home", path: "/", handler: Handler, ignoreScrollBehavior: true});
|
||||
}
|
||||
}
|
||||
|
||||
class RouteHandlerTest {
|
||||
v: Router.RouteHandler;
|
||||
|
||||
constructor() {
|
||||
new RouteHandlerMixinTest<Router.RouteHandler>();
|
||||
}
|
||||
|
||||
createElement() {
|
||||
React.createElement(Router.RouteHandler, null);
|
||||
React.createElement(Router.RouteHandler, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// History
|
||||
class HistoryTest {
|
||||
v: Router.History;
|
||||
|
||||
length() {
|
||||
var v1: number = this.v.length;
|
||||
}
|
||||
|
||||
back() {
|
||||
var v1: void = this.v.back();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Router
|
||||
class CreateTest {
|
||||
v: Router.Router;
|
||||
|
||||
constructor() {
|
||||
// React.createElement() version
|
||||
this.v = Router.create({
|
||||
routes: React.createElement(Router.Route, null)
|
||||
});
|
||||
this.v = Router.create({
|
||||
routes: React.createElement(Router.Route, null),
|
||||
location: Router.HistoryLocation,
|
||||
scrollBehavior: Router.ImitateBrowserBehavior
|
||||
});
|
||||
|
||||
// React.createFactory() version
|
||||
this.v = Router.create({
|
||||
routes: React.createFactory(Router.Route)()
|
||||
});
|
||||
this.v = Router.create({
|
||||
routes: React.createFactory(Router.Route)(),
|
||||
location: Router.HistoryLocation,
|
||||
scrollBehavior: Router.ImitateBrowserBehavior
|
||||
});
|
||||
}
|
||||
|
||||
run() {
|
||||
this.v.run((Handler) => console.log(Handler));
|
||||
this.v.run((Handler, state) => console.log(Handler, state));
|
||||
}
|
||||
}
|
||||
|
||||
class RunTest {
|
||||
constructor() {
|
||||
// React.createElement() version
|
||||
var v1: Router.Router = Router.run(React.createElement(Router.Route, null), (Handler) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
var v2: Router.Router = Router.run(React.createElement(Router.Route, null), Router.HistoryLocation, (Handler, state) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
|
||||
// React.createFactory() version
|
||||
var v3: Router.Router = Router.run(React.createFactory(Router.Route)(), (Handler) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
var v4: Router.Router = Router.run(React.createFactory(Router.Route)(), Router.HistoryLocation, (Handler, state) => {
|
||||
React.render(React.createElement(Handler, null), document.body);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Transition
|
||||
class TransitionTest {
|
||||
constructor() {
|
||||
var v1: Router.TransitionStaticLifecycle = {
|
||||
willTransitionTo: (transition, params, query, callback) => {
|
||||
transition.abort();
|
||||
transition.redirect('to');
|
||||
transition.redirect('to', {id: 1});
|
||||
transition.redirect('to', {id: 1}, {type: 'json'});
|
||||
transition.retry();
|
||||
},
|
||||
willTransitionFrom: (transition, component, callback) => {}
|
||||
};
|
||||
var v2: Router.TransitionStaticLifecycle = {
|
||||
willTransitionTo: (transition, params, query) => {},
|
||||
willTransitionFrom: (transition, component) => {}
|
||||
};
|
||||
var v3: Router.TransitionStaticLifecycle = {
|
||||
willTransitionTo: (transition, params) => {},
|
||||
willTransitionFrom: (transition) => {}
|
||||
};
|
||||
var v4: Router.TransitionStaticLifecycle = {
|
||||
willTransitionTo: (transition) => {},
|
||||
willTransitionFrom: () => {}
|
||||
};
|
||||
var v5: Router.TransitionStaticLifecycle = {
|
||||
willTransitionTo: () => {}
|
||||
};
|
||||
var v6: Router.TransitionStaticLifecycle = {
|
||||
willTransitionFrom: () => {}
|
||||
};
|
||||
}
|
||||
}
|
||||
-277
@@ -1,277 +0,0 @@
|
||||
// Type definitions for React Router 0.12.0
|
||||
// Project: https://github.com/rackt/react-router
|
||||
// Definitions by: Yuichi Murata <https://github.com/mrk21>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../../react/legacy/react-0.12.d.ts' />
|
||||
|
||||
declare module ReactRouter {
|
||||
//
|
||||
// Mixin
|
||||
// ----------------------------------------------------------------------
|
||||
interface Navigation {
|
||||
makePath(to: string, params?: {}, query?: {}): string;
|
||||
makeHref(to: string, params?: {}, query?: {}): string;
|
||||
transitionTo(to: string, params?: {}, query?: {}): void;
|
||||
replaceWith(to: string, params?: {}, query?: {}): void;
|
||||
goBack(): void;
|
||||
}
|
||||
|
||||
interface RouteHandlerMixin {
|
||||
getRouteDepth(): number;
|
||||
createChildRouteHandler(props: {}): RouteHandler;
|
||||
}
|
||||
|
||||
interface State {
|
||||
getPath(): string;
|
||||
getRoutes(): Route[];
|
||||
getPathname(): string;
|
||||
getParams(): {};
|
||||
getQuery(): {};
|
||||
isActive(to: string, params?: {}, query?: {}): boolean;
|
||||
}
|
||||
|
||||
var Navigation: Navigation;
|
||||
var State: State;
|
||||
var RouteHandlerMixin: RouteHandlerMixin;
|
||||
|
||||
|
||||
//
|
||||
// Component
|
||||
// ----------------------------------------------------------------------
|
||||
// DefaultRoute
|
||||
interface DefaultRouteProp {
|
||||
name?: string;
|
||||
handler: React.ComponentClass<any>;
|
||||
}
|
||||
interface DefaultRoute extends React.ReactElement<DefaultRouteProp> {
|
||||
__react_router_default_route__: any; // dummy
|
||||
}
|
||||
interface DefaultRouteClass extends React.ComponentClass<DefaultRouteProp> {
|
||||
__react_router_default_route__: any; // dummy
|
||||
}
|
||||
|
||||
// Link
|
||||
interface LinkProp {
|
||||
activeClassName?: string;
|
||||
to: string;
|
||||
params?: {};
|
||||
query?: {};
|
||||
onClick?: Function;
|
||||
}
|
||||
interface Link extends React.ReactElement<LinkProp>, Navigation, State {
|
||||
__react_router_link__: any; // dummy
|
||||
|
||||
getHref(): string;
|
||||
getClassName(): string;
|
||||
}
|
||||
interface LinkClass extends React.ComponentClass<LinkProp> {
|
||||
__react_router_link__: any; // dummy
|
||||
}
|
||||
|
||||
// NotFoundRoute
|
||||
interface NotFoundRouteProp {
|
||||
name?: string;
|
||||
handler: React.ComponentClass<any>;
|
||||
}
|
||||
interface NotFoundRoute extends React.ReactElement<NotFoundRouteProp> {
|
||||
__react_router_not_found_route__: any; // dummy
|
||||
}
|
||||
interface NotFoundRouteClass extends React.ComponentClass<NotFoundRouteProp> {
|
||||
__react_router_not_found_route__: any; // dummy
|
||||
}
|
||||
|
||||
// Redirect
|
||||
interface RedirectProp {
|
||||
path?: string;
|
||||
from?: string;
|
||||
to?: string;
|
||||
}
|
||||
interface Redirect extends React.ReactElement<RedirectProp> {
|
||||
__react_router_redirect__: any; // dummy
|
||||
}
|
||||
interface RedirectClass extends React.ComponentClass<RedirectProp> {
|
||||
__react_router_redirect__: any; // dummy
|
||||
}
|
||||
|
||||
// Route
|
||||
interface RouteProp {
|
||||
name?: string;
|
||||
path?: string;
|
||||
handler?: React.ComponentClass<any>;
|
||||
ignoreScrollBehavior?: boolean;
|
||||
}
|
||||
interface Route extends React.ReactElement<RouteProp> {
|
||||
__react_router_route__: any; // dummy
|
||||
}
|
||||
interface RouteClass extends React.ComponentClass<RouteProp> {
|
||||
__react_router_route__: any; // dummy
|
||||
}
|
||||
|
||||
// RouteHandler
|
||||
interface RouteHandlerProp {}
|
||||
interface RouteHandler extends React.ReactElement<RouteHandlerProp>, RouteHandlerMixin {
|
||||
__react_router_route_handler__: any; // dummy
|
||||
}
|
||||
interface RouteHandlerClass extends React.ReactElement<RouteHandlerProp> {
|
||||
__react_router_route_handler__: any; // dummy
|
||||
}
|
||||
|
||||
var DefaultRoute: DefaultRouteClass;
|
||||
var Link: LinkClass;
|
||||
var NotFoundRoute: NotFoundRouteClass;
|
||||
var Redirect: RedirectClass;
|
||||
var Route: RouteClass;
|
||||
var RouteHandler: RouteHandlerClass;
|
||||
|
||||
|
||||
//
|
||||
// Location
|
||||
// ----------------------------------------------------------------------
|
||||
interface LocationBase {
|
||||
push(path: string): void;
|
||||
replace(path: string): void;
|
||||
pop(): void;
|
||||
getCurrentPath(): void;
|
||||
}
|
||||
|
||||
interface LocationListener {
|
||||
addChangeListener(listener: Function): void;
|
||||
removeChangeListener(listener: Function): void;
|
||||
}
|
||||
|
||||
interface HashLocation extends LocationBase, LocationListener {}
|
||||
interface HistoryLocation extends LocationBase, LocationListener {}
|
||||
interface RefreshLocation extends LocationBase {}
|
||||
|
||||
var HashLocation: HashLocation;
|
||||
var HistoryLocation: HistoryLocation;
|
||||
var RefreshLocation: RefreshLocation;
|
||||
|
||||
|
||||
//
|
||||
// Behavior
|
||||
// ----------------------------------------------------------------------
|
||||
interface ScrollBehaviorBase {
|
||||
updateScrollPosition(position: {x: number; y: number;}, actionType: string): void;
|
||||
}
|
||||
interface ImitateBrowserBehavior extends ScrollBehaviorBase {}
|
||||
interface ScrollToTopBehavior extends ScrollBehaviorBase {}
|
||||
|
||||
var ImitateBrowserBehavior: ImitateBrowserBehavior;
|
||||
var ScrollToTopBehavior: ScrollToTopBehavior;
|
||||
|
||||
|
||||
//
|
||||
// Router
|
||||
// ----------------------------------------------------------------------
|
||||
interface Router extends React.ReactElement<any> {
|
||||
run(callback: RouterRunCallback): void;
|
||||
}
|
||||
|
||||
interface RouterState {
|
||||
path: string;
|
||||
action: string;
|
||||
pathname: string;
|
||||
params: {};
|
||||
query: {};
|
||||
routes : Route[];
|
||||
}
|
||||
|
||||
interface RouterCreateOption {
|
||||
routes: React.ReactElement<RouteProp>;
|
||||
location?: LocationBase;
|
||||
scrollBehavior?: ScrollBehaviorBase;
|
||||
}
|
||||
|
||||
type RouterRunCallback = (Handler: Router, state: RouterState) => void;
|
||||
|
||||
function create(options: RouterCreateOption): Router;
|
||||
function run(routes: React.ReactElement<RouteProp>, callback: RouterRunCallback): Router;
|
||||
function run(routes: React.ReactElement<RouteProp>, location: LocationBase, callback: RouterRunCallback): Router;
|
||||
|
||||
|
||||
//
|
||||
// History
|
||||
// ----------------------------------------------------------------------
|
||||
interface History {
|
||||
back(): void;
|
||||
length: number;
|
||||
}
|
||||
var History: History;
|
||||
|
||||
|
||||
//
|
||||
// Transition
|
||||
// ----------------------------------------------------------------------
|
||||
interface Transition {
|
||||
abort(): void;
|
||||
redirect(to: string, params?: {}, query?: {}): void;
|
||||
retry(): void;
|
||||
}
|
||||
|
||||
interface TransitionStaticLifecycle {
|
||||
willTransitionTo?(
|
||||
transition: Transition,
|
||||
params: {},
|
||||
query: {},
|
||||
callback: Function
|
||||
): void;
|
||||
|
||||
willTransitionFrom?(
|
||||
transition: Transition,
|
||||
component: React.ReactElement<any>,
|
||||
callback: Function
|
||||
): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'react-router' {
|
||||
export = ReactRouter;
|
||||
}
|
||||
|
||||
declare module React {
|
||||
interface TopLevelAPI {
|
||||
// for DefaultRoute
|
||||
createElement(
|
||||
type: ReactRouter.DefaultRouteClass,
|
||||
props: ReactRouter.DefaultRouteProp,
|
||||
...children: ReactNode[]
|
||||
): ReactRouter.DefaultRoute;
|
||||
|
||||
// for Link
|
||||
createElement(
|
||||
type: ReactRouter.LinkClass,
|
||||
props: ReactRouter.LinkProp,
|
||||
...children: ReactNode[]
|
||||
): ReactRouter.Link;
|
||||
|
||||
// for NotFoundRoute
|
||||
createElement(
|
||||
type: ReactRouter.NotFoundRouteClass,
|
||||
props: ReactRouter.NotFoundRouteProp,
|
||||
...children: ReactNode[]
|
||||
): ReactRouter.NotFoundRoute;
|
||||
|
||||
// for Redirect
|
||||
createElement(
|
||||
type: ReactRouter.RedirectClass,
|
||||
props: ReactRouter.RedirectProp,
|
||||
...children: ReactNode[]
|
||||
): ReactRouter.Redirect;
|
||||
|
||||
// for Route
|
||||
createElement(
|
||||
type: ReactRouter.RouteClass,
|
||||
props: ReactRouter.RouteProp,
|
||||
...children: ReactNode[]
|
||||
): ReactRouter.Route;
|
||||
|
||||
// for RouteHandler
|
||||
createElement(
|
||||
type: ReactRouter.RouteHandlerClass,
|
||||
props: ReactRouter.RouteHandlerProp,
|
||||
...children: ReactNode[]
|
||||
): ReactRouter.RouteHandler;
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/// <reference path="react-0.11.d.ts" />
|
||||
import React = require("react-0.11");
|
||||
|
||||
var PropTypesSpecification: React.Specification<any, any> = {
|
||||
propTypes: {
|
||||
// You can declare that a prop is a specific JS primitive. By default, these
|
||||
// are all optional.
|
||||
optionalArray: React.PropTypes.array,
|
||||
optionalBool: React.PropTypes.bool,
|
||||
optionalFunc: React.PropTypes.func,
|
||||
optionalNumber: React.PropTypes.number,
|
||||
optionalObject: React.PropTypes.object,
|
||||
optionalString: React.PropTypes.string,
|
||||
|
||||
// Anything that can be rendered: numbers, strings, components or an array
|
||||
// containing these types.
|
||||
optionalRenderable: React.PropTypes.renderable,
|
||||
|
||||
// A React component.
|
||||
optionalComponent: React.PropTypes.component,
|
||||
|
||||
// You can also declare that a prop is an instance of a class. This uses
|
||||
// JS's instanceof operator.
|
||||
optionalMessage: React.PropTypes.instanceOf(Date),
|
||||
|
||||
// You can ensure that your prop is limited to specific values by treating
|
||||
// it as an enum.
|
||||
optionalEnum: React.PropTypes.oneOf(['News', 'Photos']),
|
||||
|
||||
// An object that could be one of many types
|
||||
optionalUnion: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.number,
|
||||
React.PropTypes.instanceOf(Date)
|
||||
]),
|
||||
|
||||
// An array of a certain type
|
||||
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
|
||||
|
||||
// An object with property values of a certain type
|
||||
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
|
||||
|
||||
// An object taking on a particular shape
|
||||
optionalObjectWithShape: React.PropTypes.shape({
|
||||
color: React.PropTypes.string,
|
||||
fontSize: React.PropTypes.number
|
||||
}),
|
||||
|
||||
// You can chain any of the above with `isRequired` to make sure a warning
|
||||
// is shown if the prop isn't provided.
|
||||
requiredFunc: React.PropTypes.func.isRequired,
|
||||
|
||||
// A value of any data type
|
||||
requiredAny: React.PropTypes.any.isRequired,
|
||||
|
||||
// You can also specify a custom validator. It should return an Error
|
||||
// object if the validation fails. Don't `console.warn` or throw, as this
|
||||
// won't work inside `oneOfType`.
|
||||
customProp: function(props, propName, componentName) {
|
||||
if (!/matchme/.test(props[propName])) {
|
||||
return new Error('Validation failed!');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
render: (): React.Descriptor<any> => {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
React.createClass(PropTypesSpecification);
|
||||
|
||||
var mountNode: Element;
|
||||
|
||||
var HelloMessage = React.createClass({displayName: 'HelloMessage',
|
||||
render: function() {
|
||||
return React.DOM.div(null, "Hello ", (<React.Component<{name: string}, any>>this).props.name);
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(HelloMessage({name: "John"}), mountNode);
|
||||
|
||||
var Timer = React.createClass({displayName: 'Timer',
|
||||
getInitialState: function() {
|
||||
return {secondsElapsed: 0};
|
||||
},
|
||||
tick: function() {
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).setState({
|
||||
secondsElapsed: (<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed + 1
|
||||
});
|
||||
},
|
||||
componentDidMount: function() {
|
||||
this.interval = setInterval(this.tick, 1000);
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
clearInterval(this.interval);
|
||||
},
|
||||
render: function() {
|
||||
return React.DOM.div(
|
||||
null,
|
||||
"Seconds Elapsed: ",
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(Timer(null), mountNode);
|
||||
Vendored
-553
@@ -1,553 +0,0 @@
|
||||
// Type definitions for React 0.11.2
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "react-0.11" {
|
||||
export = React;
|
||||
}
|
||||
|
||||
declare module React {
|
||||
export function createClass<P, S>(specification: Specification<P, S>): Factory<P>;
|
||||
|
||||
export function renderComponent<P>(component: Descriptor<P>, container: Element, callback?: () => void): Descriptor<P>;
|
||||
|
||||
export function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
export function renderComponentToString(component: Descriptor<any>): string;
|
||||
|
||||
export function renderComponentToStaticMarkup(component: Descriptor<any>): string;
|
||||
|
||||
export function isValidClass(factory: Factory<any>): boolean;
|
||||
|
||||
export function isValidComponent(component: Descriptor<any>): boolean;
|
||||
|
||||
export function initializeTouchEvents(shouldUseTouch: boolean): void;
|
||||
|
||||
export interface Descriptor<P> {
|
||||
props: P;
|
||||
}
|
||||
|
||||
export interface Factory<P> {
|
||||
(properties?: P, ...children: any[]): Descriptor<P>;
|
||||
}
|
||||
|
||||
export interface Mixin<P, S> {
|
||||
componentWillMount?(): void;
|
||||
componentDidMount?(): void;
|
||||
componentWillReceiveProps?(nextProps: P): void;
|
||||
shouldComponentUpdate?(nextProps: P, nextState: S): boolean;
|
||||
componentWillUpdate?(nextProps: P, nextState: S): void;
|
||||
componentDidUpdate?(prevProps: P, prevState: S): void;
|
||||
componentWillUnmount?(): void;
|
||||
}
|
||||
|
||||
export interface Specification<P, S> extends Mixin<P, S> {
|
||||
displayName?: string;
|
||||
mixins?: Mixin<P, S>[];
|
||||
statics?: {
|
||||
[key: string]: Function;
|
||||
};
|
||||
propTypes?: ValidationMap<P>;
|
||||
getDefaultProps?(): P;
|
||||
getInitialState?(): S;
|
||||
render(): Descriptor<any>;
|
||||
}
|
||||
|
||||
export interface DomReferencer {
|
||||
getDOMNode(): Element;
|
||||
}
|
||||
|
||||
export interface Component<P, S> extends DomReferencer {
|
||||
refs: {
|
||||
[key: string]: DomReferencer
|
||||
};
|
||||
props: P;
|
||||
state: S;
|
||||
setState(nextState: S, callback?: () => void): void;
|
||||
replaceState(nextState: S, callback?: () => void): void;
|
||||
forceUpdate(callback?: () => void): void;
|
||||
isMounted(): boolean;
|
||||
transferPropsTo(target: Factory<P>): Descriptor<P>;
|
||||
setProps(nextProps: P, callback?: () => void): void;
|
||||
replaceProps(nextProps: P, callback?: () => void): void;
|
||||
}
|
||||
|
||||
export interface Constructable {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
export interface Validator<P> {
|
||||
(props: P, propName: string, componentName: string): Error;
|
||||
}
|
||||
|
||||
export interface Requireable<P> extends Validator<P> {
|
||||
isRequired: Validator<P>;
|
||||
}
|
||||
|
||||
export interface ValidationMap<P> {
|
||||
[key: string]: Validator<P>;
|
||||
}
|
||||
|
||||
export var PropTypes: {
|
||||
any: Requireable<any>;
|
||||
array: Requireable<any>;
|
||||
bool: Requireable<any>;
|
||||
func: Requireable<any>;
|
||||
number: Requireable<any>;
|
||||
object: Requireable<any>;
|
||||
string: Requireable<any>;
|
||||
renderable: Requireable<any>;
|
||||
component: Requireable<any>;
|
||||
instanceOf: (clazz: Constructable) => Requireable<any>;
|
||||
oneOf: (types: any[]) => Requireable<any>
|
||||
oneOfType: (types: Validator<any>[]) => Requireable<any>;
|
||||
arrayOf: (type: Validator<any>) => Requireable<any>;
|
||||
objectOf: (type: Validator<any>) => Requireable<any>;
|
||||
shape: (type: ValidationMap<any>) => Requireable<any>;
|
||||
};
|
||||
|
||||
export var Children: {
|
||||
map(children: any[], fn: (child: any) => any): any[];
|
||||
forEach(children: any[], fn: (child: any) => any): void;
|
||||
count(children: any[]): number;
|
||||
only(children: any[]): any;
|
||||
};
|
||||
|
||||
// Browser Interfaces
|
||||
// Taken from https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
|
||||
export interface AbstractView {
|
||||
styleMedia: StyleMedia;
|
||||
document: Document;
|
||||
}
|
||||
|
||||
export interface Touch {
|
||||
identifier: number;
|
||||
target: EventTarget;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
|
||||
export interface TouchList {
|
||||
[index: number]: Touch;
|
||||
length: number;
|
||||
item(index: number): Touch;
|
||||
identifiedTouch(identifier: number): Touch;
|
||||
}
|
||||
|
||||
// Events
|
||||
export interface SyntheticEvent {
|
||||
bubbles: boolean;
|
||||
cancelable: boolean;
|
||||
currentTarget: EventTarget;
|
||||
defaultPrevented: boolean;
|
||||
eventPhase: number;
|
||||
nativeEvent: Event;
|
||||
preventDefault(): void;
|
||||
stopPropagation(): void;
|
||||
target: EventTarget;
|
||||
timeStamp: Date;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface ClipboardEvent extends SyntheticEvent {
|
||||
clipboardData: DataTransfer;
|
||||
}
|
||||
|
||||
export interface KeyboardEvent extends SyntheticEvent {
|
||||
altKey: boolean;
|
||||
charCode: number;
|
||||
ctrlKey: boolean;
|
||||
getModifierState(key: string): boolean;
|
||||
key: string;
|
||||
keyCode: number;
|
||||
locale: string;
|
||||
location: number;
|
||||
metaKey: boolean;
|
||||
repeat: boolean;
|
||||
shiftKey: boolean;
|
||||
which: number;
|
||||
}
|
||||
|
||||
export interface FocusEvent extends SyntheticEvent {
|
||||
relatedTarget: EventTarget;
|
||||
}
|
||||
|
||||
export interface MouseEvent extends SyntheticEvent {
|
||||
altKey: boolean;
|
||||
button: number;
|
||||
buttons: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
ctrlKey: boolean;
|
||||
getModifierState(key: string): boolean;
|
||||
metaKey: boolean;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
relatedTarget: EventTarget;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
|
||||
export interface TouchEvent extends SyntheticEvent {
|
||||
altKey: boolean;
|
||||
changedTouches: TouchList;
|
||||
ctrlKey: boolean;
|
||||
getModifierState(key: string): boolean;
|
||||
metaKey: boolean;
|
||||
shiftKey: boolean;
|
||||
targetTouches: TouchList;
|
||||
touches: TouchList;
|
||||
}
|
||||
|
||||
export interface UiEvent extends SyntheticEvent {
|
||||
detail: number;
|
||||
view: AbstractView;
|
||||
}
|
||||
|
||||
export interface WheelEvent extends SyntheticEvent {
|
||||
deltaMode: number;
|
||||
deltaX: number;
|
||||
deltaY: number;
|
||||
deltaZ: number;
|
||||
}
|
||||
|
||||
// Attributes
|
||||
export interface EventAttributes {
|
||||
onCopy?: (event: ClipboardEvent) => void;
|
||||
onCut?: (event: ClipboardEvent) => void;
|
||||
onPaste?: (event: ClipboardEvent) => void;
|
||||
onKeyDown?: (event: KeyboardEvent) => void;
|
||||
onKeyPress?: (event: KeyboardEvent) => void;
|
||||
onKeyUp?: (event: KeyboardEvent) => void;
|
||||
onFocus?: (event: FocusEvent) => void;
|
||||
onBlur?: (event: FocusEvent) => void;
|
||||
onChange?: (event: SyntheticEvent) => void;
|
||||
onInput?: (event: SyntheticEvent) => void;
|
||||
onSubmit?: (event: SyntheticEvent) => void;
|
||||
onClick?: (event: MouseEvent) => void;
|
||||
onDoubleClick?: (event: MouseEvent) => void;
|
||||
onDrag?: (event: MouseEvent) => void;
|
||||
onDragEnd?: (event: MouseEvent) => void;
|
||||
onDragEnter?: (event: MouseEvent) => void;
|
||||
onDragExit?: (event: MouseEvent) => void;
|
||||
onDragLeave?: (event: MouseEvent) => void;
|
||||
onDragOver?: (event: MouseEvent) => void;
|
||||
onDragStart?: (event: MouseEvent) => void;
|
||||
onDrop?: (event: MouseEvent) => void;
|
||||
onMouseDown?: (event: MouseEvent) => void;
|
||||
onMouseEnter?: (event: MouseEvent) => void;
|
||||
onMouseLeave?: (event: MouseEvent) => void;
|
||||
onMouseMove?: (event: MouseEvent) => void;
|
||||
onMouseOut?: (event: MouseEvent) => void;
|
||||
onMouseOver?: (event: MouseEvent) => void;
|
||||
onMouseUp?: (event: MouseEvent) => void;
|
||||
onTouchCancel?: (event: TouchEvent) => void;
|
||||
onTouchEnd?: (event: TouchEvent) => void;
|
||||
onTouchMove?: (event: TouchEvent) => void;
|
||||
onTouchStart?: (event: TouchEvent) => void;
|
||||
onScroll?: (event: UiEvent) => void;
|
||||
onWheel?: (event: WheelEvent) => void;
|
||||
}
|
||||
|
||||
export interface ReactAttributes {
|
||||
dangerouslySetInnerHTML?: {
|
||||
__html: string;
|
||||
};
|
||||
children?: any[];
|
||||
key?: string;
|
||||
ref?: string;
|
||||
}
|
||||
|
||||
export interface DomAttributes extends EventAttributes, ReactAttributes {
|
||||
// HTML Attributes
|
||||
accept?: any;
|
||||
accessKey?: any;
|
||||
action?: any;
|
||||
allowFullScreen?: any;
|
||||
allowTransparency?: any;
|
||||
alt?: any;
|
||||
async?: any;
|
||||
autoCapitalize?: any;
|
||||
autoComplete?: any;
|
||||
autoCorrect?: any;
|
||||
autoFocus?: any;
|
||||
autoPlay?: any;
|
||||
cellPadding?: any;
|
||||
cellSpacing?: any;
|
||||
charSet?: any;
|
||||
checked?: any;
|
||||
className?: any;
|
||||
cols?: any;
|
||||
colSpan?: any;
|
||||
content?: any;
|
||||
contentEditable?: any;
|
||||
contextMenu?: any;
|
||||
controls?: any;
|
||||
coords?: any;
|
||||
crossOrigin?: any;
|
||||
data?: any;
|
||||
dateTime?: any;
|
||||
defer?: any;
|
||||
dir?: any;
|
||||
disabled?: any;
|
||||
download?: any;
|
||||
draggable?: any;
|
||||
encType?: any;
|
||||
form?: any;
|
||||
formNoValidate?: any;
|
||||
frameBorder?: any;
|
||||
height?: any;
|
||||
hidden?: any;
|
||||
href?: any;
|
||||
hrefLang?: any;
|
||||
htmlFor?: any;
|
||||
httpEquiv?: any;
|
||||
icon?: any;
|
||||
id?: any;
|
||||
itemProp?: any;
|
||||
itemScope?: any;
|
||||
itemType?: any;
|
||||
label?: any;
|
||||
lang?: any;
|
||||
list?: any;
|
||||
loop?: any;
|
||||
max?: any;
|
||||
maxLength?: any;
|
||||
mediaGroup?: any;
|
||||
method?: any;
|
||||
min?: any;
|
||||
multiple?: any;
|
||||
muted?: any;
|
||||
name?: any;
|
||||
noValidate?: any;
|
||||
open?: any;
|
||||
pattern?: any;
|
||||
placeholder?: any;
|
||||
poster?: any;
|
||||
preload?: any;
|
||||
property?: any;
|
||||
radioGroup?: any;
|
||||
readOnly?: any;
|
||||
rel?: any;
|
||||
required?: any;
|
||||
role?: any;
|
||||
rows?: any;
|
||||
rowSpan?: any;
|
||||
sandbox?: any;
|
||||
scope?: any;
|
||||
scrollLeft?: any;
|
||||
scrolling?: any;
|
||||
scrollTop?: any;
|
||||
seamless?: any;
|
||||
selected?: any;
|
||||
shape?: any;
|
||||
size?: any;
|
||||
span?: any;
|
||||
spellCheck?: any;
|
||||
src?: any;
|
||||
srcDoc?: any;
|
||||
srcSet?: any;
|
||||
start?: any;
|
||||
step?: any;
|
||||
style?: any;
|
||||
tabIndex?: any;
|
||||
target?: any;
|
||||
title?: any;
|
||||
type?: any;
|
||||
useMap?: any;
|
||||
value?: any;
|
||||
width?: any;
|
||||
wmode?: any;
|
||||
}
|
||||
|
||||
export interface SvgAttributes extends EventAttributes, ReactAttributes {
|
||||
cx?: any;
|
||||
cy?: any;
|
||||
d?: any;
|
||||
dx?: any;
|
||||
dy?: any;
|
||||
fill?: any;
|
||||
fillOpacity?: any;
|
||||
fontFamily?: any;
|
||||
fontSize?: any;
|
||||
fx?: any;
|
||||
fy?: any;
|
||||
gradientTransform?: any;
|
||||
gradientUnits?: any;
|
||||
markerEnd?: any;
|
||||
markerMid?: any;
|
||||
markerStart?: any;
|
||||
offset?: any;
|
||||
opacity?: any;
|
||||
patternContentUnits?: any;
|
||||
patternUnits?: any;
|
||||
points?: any;
|
||||
preserveAspectRatio?: any;
|
||||
r?: any;
|
||||
rx?: any;
|
||||
ry?: any;
|
||||
spreadMethod?: any;
|
||||
stopColor?: any;
|
||||
stopOpacity?: any;
|
||||
stroke?: any;
|
||||
strokeDasharray?: any;
|
||||
strokeLinecap?: any;
|
||||
strokeOpacity?: any;
|
||||
strokeWidth?: any;
|
||||
textAnchor?: any;
|
||||
transform?: any;
|
||||
version?: any;
|
||||
viewBox?: any;
|
||||
x1?: any;
|
||||
x2?: any;
|
||||
x?: any;
|
||||
y1?: any;
|
||||
y2?: any;
|
||||
y?: any;
|
||||
}
|
||||
|
||||
export interface DomElement extends Factory<DomAttributes> {
|
||||
}
|
||||
|
||||
export interface SvgElement extends Factory<SvgAttributes> {
|
||||
}
|
||||
|
||||
export var DOM: {
|
||||
// HTML
|
||||
a: DomElement;
|
||||
abbr: DomElement;
|
||||
address: DomElement;
|
||||
area: DomElement;
|
||||
article: DomElement;
|
||||
aside: DomElement;
|
||||
audio: DomElement;
|
||||
b: DomElement;
|
||||
base: DomElement;
|
||||
bdi: DomElement;
|
||||
bdo: DomElement;
|
||||
big: DomElement;
|
||||
blockquote: DomElement;
|
||||
body: DomElement;
|
||||
br: DomElement;
|
||||
button: DomElement;
|
||||
canvas: DomElement;
|
||||
caption: DomElement;
|
||||
cite: DomElement;
|
||||
code: DomElement;
|
||||
col: DomElement;
|
||||
colgroup: DomElement;
|
||||
data: DomElement;
|
||||
datalist: DomElement;
|
||||
dd: DomElement;
|
||||
del: DomElement;
|
||||
details: DomElement;
|
||||
dfn: DomElement;
|
||||
dialog: DomElement;
|
||||
div: DomElement;
|
||||
dl: DomElement;
|
||||
dt: DomElement;
|
||||
em: DomElement;
|
||||
embed: DomElement;
|
||||
fieldset: DomElement;
|
||||
figcaption: DomElement;
|
||||
figure: DomElement;
|
||||
footer: DomElement;
|
||||
form: DomElement;
|
||||
h1: DomElement;
|
||||
h2: DomElement;
|
||||
h3: DomElement;
|
||||
h4: DomElement;
|
||||
h5: DomElement;
|
||||
h6: DomElement;
|
||||
head: DomElement;
|
||||
header: DomElement;
|
||||
hr: DomElement;
|
||||
html: DomElement;
|
||||
i: DomElement;
|
||||
iframe: DomElement;
|
||||
img: DomElement;
|
||||
input: DomElement;
|
||||
ins: DomElement;
|
||||
kbd: DomElement;
|
||||
keygen: DomElement;
|
||||
label: DomElement;
|
||||
legend: DomElement;
|
||||
li: DomElement;
|
||||
link: DomElement;
|
||||
main: DomElement;
|
||||
map: DomElement;
|
||||
mark: DomElement;
|
||||
menu: DomElement;
|
||||
menuitem: DomElement;
|
||||
meta: DomElement;
|
||||
meter: DomElement;
|
||||
nav: DomElement;
|
||||
noscript: DomElement;
|
||||
object: DomElement;
|
||||
ol: DomElement;
|
||||
optgroup: DomElement;
|
||||
option: DomElement;
|
||||
output: DomElement;
|
||||
p: DomElement;
|
||||
param: DomElement;
|
||||
pre: DomElement;
|
||||
progress: DomElement;
|
||||
q: DomElement;
|
||||
rp: DomElement;
|
||||
rt: DomElement;
|
||||
ruby: DomElement;
|
||||
s: DomElement;
|
||||
samp: DomElement;
|
||||
script: DomElement;
|
||||
section: DomElement;
|
||||
select: DomElement;
|
||||
small: DomElement;
|
||||
source: DomElement;
|
||||
span: DomElement;
|
||||
strong: DomElement;
|
||||
style: DomElement;
|
||||
sub: DomElement;
|
||||
summary: DomElement;
|
||||
sup: DomElement;
|
||||
table: DomElement;
|
||||
tbody: DomElement;
|
||||
td: DomElement;
|
||||
textarea: DomElement;
|
||||
tfoot: DomElement;
|
||||
th: DomElement;
|
||||
thead: DomElement;
|
||||
time: DomElement;
|
||||
title: DomElement;
|
||||
tr: DomElement;
|
||||
track: DomElement;
|
||||
u: DomElement;
|
||||
ul: DomElement;
|
||||
"var": DomElement;
|
||||
video: DomElement;
|
||||
wbr: DomElement;
|
||||
// SVG
|
||||
circle: SvgElement;
|
||||
defs: SvgElement;
|
||||
ellipse: SvgElement;
|
||||
g: SvgElement;
|
||||
line: SvgElement;
|
||||
linearGradient: SvgElement;
|
||||
mask: SvgElement;
|
||||
path: SvgElement;
|
||||
pattern: SvgElement;
|
||||
polygon: SvgElement;
|
||||
polyline: SvgElement;
|
||||
radialGradient: SvgElement;
|
||||
rect: SvgElement;
|
||||
stop: SvgElement;
|
||||
svg: SvgElement;
|
||||
text: SvgElement;
|
||||
tspan: SvgElement;
|
||||
};
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
/// <reference path="react-0.12.d.ts" />
|
||||
import React = require("react");
|
||||
|
||||
interface Props {
|
||||
hello: string;
|
||||
world?: string;
|
||||
foo: number;
|
||||
bar: boolean;
|
||||
}
|
||||
|
||||
interface State {
|
||||
inputValue?: string;
|
||||
seconds?: number;
|
||||
}
|
||||
|
||||
interface MyComponent extends React.CompositeComponent<Props, State> {
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
var props: Props = {
|
||||
key: 42,
|
||||
ref: "myComponent42",
|
||||
hello: "world",
|
||||
foo: 42,
|
||||
bar: true
|
||||
};
|
||||
|
||||
var container: Element;
|
||||
var INPUT_REF: string = "input";
|
||||
|
||||
//
|
||||
// Top-Level API
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var reactClass: React.ComponentClass<Props> = React.createClass<Props>({
|
||||
getDefaultProps: () => {
|
||||
return <Props>{
|
||||
hello: undefined,
|
||||
world: "peace",
|
||||
foo: undefined,
|
||||
bar: undefined
|
||||
};
|
||||
},
|
||||
getInitialState: () => {
|
||||
return {
|
||||
inputValue: "React.js",
|
||||
seconds: 0
|
||||
};
|
||||
},
|
||||
reset: () => {
|
||||
this.replaceState(this.getInitialState());
|
||||
},
|
||||
render: () => {
|
||||
return React.DOM.div(null,
|
||||
React.DOM.input({
|
||||
ref: INPUT_REF,
|
||||
value: this.state.inputValue
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
var reactElement: React.ReactElement<Props> =
|
||||
React.createElement<Props>(reactClass, props);
|
||||
|
||||
var reactFactory: React.ComponentFactory<Props> =
|
||||
React.createFactory<Props>(reactClass);
|
||||
|
||||
var component: React.Component<Props> =
|
||||
React.render<Props>(reactElement, container);
|
||||
|
||||
var unmounted: boolean = React.unmountComponentAtNode(container);
|
||||
var str: string = React.renderToString(reactElement);
|
||||
var markup: string = React.renderToStaticMarkup(reactElement);
|
||||
var notValid: boolean = React.isValidElement(props); // false
|
||||
var isValid = React.isValidElement(reactElement); // true
|
||||
React.initializeTouchEvents(true);
|
||||
|
||||
//
|
||||
// React Elements
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var type = reactElement.type;
|
||||
var elementProps: Props = reactElement.props;
|
||||
var key = reactElement.key;
|
||||
var ref: string = reactElement.ref;
|
||||
var factoryElement: React.ReactElement<Props> = reactFactory(elementProps);
|
||||
|
||||
//
|
||||
// React Components
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var displayName: string = reactClass.displayName;
|
||||
var defaultProps: Props = reactClass.getDefaultProps();
|
||||
var propTypes: React.ValidationMap<Props> = reactClass.propTypes;
|
||||
|
||||
//
|
||||
// Component API
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var htmlElement: Element = component.getDOMNode();
|
||||
var divElement: HTMLDivElement = component.getDOMNode<HTMLDivElement>();
|
||||
var isMounted: boolean = component.isMounted();
|
||||
component.setProps(elementProps);
|
||||
component.replaceProps(props);
|
||||
|
||||
var compComponent: React.CompositeComponent<Props, State> =
|
||||
<React.CompositeComponent<Props, State>>component;
|
||||
var initialState: State = compComponent.state;
|
||||
compComponent.setState({ inputValue: "!!!" });
|
||||
compComponent.replaceState({ inputValue: "???", seconds: 60 });
|
||||
compComponent.forceUpdate();
|
||||
|
||||
var inputRef: React.HTMLComponent =
|
||||
<React.HTMLComponent>compComponent.refs[INPUT_REF];
|
||||
var value: string = inputRef.getDOMNode<HTMLInputElement>().value;
|
||||
|
||||
var myComponent = <MyComponent>compComponent;
|
||||
myComponent.reset();
|
||||
|
||||
//
|
||||
// Attributes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var children = ["Hello world", [null], React.DOM.span(null)];
|
||||
var divStyle = { // CSSProperties
|
||||
flex: "1 1 main-size",
|
||||
backgroundImage: "url('hello.png')"
|
||||
};
|
||||
var htmlAttr: React.HTMLAttributes = {
|
||||
key: 36,
|
||||
ref: "htmlComponent",
|
||||
children: children,
|
||||
className: "test-attr",
|
||||
style: divStyle,
|
||||
onClick: (event: React.MouseEvent) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
},
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: "<strong>STRONG</strong>"
|
||||
}
|
||||
};
|
||||
React.DOM.div(htmlAttr);
|
||||
React.DOM.span(htmlAttr);
|
||||
React.DOM.input(htmlAttr);
|
||||
|
||||
//
|
||||
// React.PropTypes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var PropTypesSpecification: React.ComponentSpec<any, any> = {
|
||||
propTypes: {
|
||||
optionalArray: React.PropTypes.array,
|
||||
optionalBool: React.PropTypes.bool,
|
||||
optionalFunc: React.PropTypes.func,
|
||||
optionalNumber: React.PropTypes.number,
|
||||
optionalObject: React.PropTypes.object,
|
||||
optionalString: React.PropTypes.string,
|
||||
optionalNode: React.PropTypes.node,
|
||||
optionalElement: React.PropTypes.element,
|
||||
optionalMessage: React.PropTypes.instanceOf(Date),
|
||||
optionalEnum: React.PropTypes.oneOf(["News", "Photos"]),
|
||||
optionalUnion: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.number,
|
||||
React.PropTypes.instanceOf(Date)
|
||||
]),
|
||||
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
|
||||
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
|
||||
optionalObjectWithShape: React.PropTypes.shape({
|
||||
color: React.PropTypes.string,
|
||||
fontSize: React.PropTypes.number
|
||||
}),
|
||||
requiredFunc: React.PropTypes.func.isRequired,
|
||||
requiredAny: React.PropTypes.any.isRequired,
|
||||
customProp: function(props: any, propName: string, componentName: string) {
|
||||
if (!/matchme/.test(props[propName])) {
|
||||
return new Error("Validation failed!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
render: (): React.ReactHTMLElement => {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// React.Children
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var childMap: { [key: string]: number } =
|
||||
React.Children.map<number>(children, (child) => { return 42; });
|
||||
React.Children.forEach(children, (child) => {});
|
||||
var nChildren: number = React.Children.count(children);
|
||||
var onlyChild = React.Children.only([null, [[["Hallo"], true]], false]);
|
||||
|
||||
//
|
||||
// Example from http://facebook.github.io/react/
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
interface TimerState {
|
||||
secondsElapsed: number;
|
||||
}
|
||||
interface Timer extends React.CompositeComponent<{}, TimerState> {
|
||||
}
|
||||
var Timer = React.createClass({
|
||||
displayName: "Timer",
|
||||
getInitialState: () => {
|
||||
return { secondsElapsed: 0 };
|
||||
},
|
||||
tick: () => {
|
||||
var me = <Timer>this;
|
||||
me.setState({
|
||||
secondsElapsed: me.state.secondsElapsed + 1
|
||||
});
|
||||
},
|
||||
componentDidMount: () => {
|
||||
this.interval = setInterval(this.tick, 1000);
|
||||
},
|
||||
componentWillUnmount: () => {
|
||||
clearInterval(this.interval);
|
||||
},
|
||||
render: () => {
|
||||
var me = <Timer>this;
|
||||
return React.DOM.div(
|
||||
null,
|
||||
"Seconds Elapsed: ",
|
||||
me.state.secondsElapsed
|
||||
);
|
||||
}
|
||||
});
|
||||
var mountNode: Element;
|
||||
React.render(React.createElement(Timer, null), mountNode);
|
||||
|
||||
Vendored
-934
@@ -1,934 +0,0 @@
|
||||
// Type definitions for React 0.12.1
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module React {
|
||||
//
|
||||
// React Elements
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type ReactType = ComponentClass<any> | string;
|
||||
|
||||
interface ReactElement<P> {
|
||||
type: ComponentClass<P> | string;
|
||||
props: P;
|
||||
key: number | string;
|
||||
ref: string;
|
||||
}
|
||||
|
||||
interface ReactHTMLElement extends ReactElement<HTMLAttributes> {}
|
||||
interface ReactSVGElement extends ReactElement<SVGAttributes> {}
|
||||
|
||||
//
|
||||
// React Nodes
|
||||
// http://facebook.github.io/react/docs/glossary.html
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
type ReactText = string | number;
|
||||
type ReactChild = ReactElement<any> | ReactText;
|
||||
|
||||
// Should be Array<ReactNode> but type aliases cannot be recursive
|
||||
type ReactFragment = Array<ReactChild | any[] | boolean>;
|
||||
type ReactNode = ReactChild | ReactFragment | boolean;
|
||||
|
||||
//
|
||||
// React Components
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface ComponentStatics<P> {
|
||||
displayName?: string;
|
||||
getDefaultProps?(): P;
|
||||
propTypes?: ValidationMap<P>;
|
||||
}
|
||||
|
||||
interface ComponentClass<P> extends ComponentStatics<P> {
|
||||
// Deprecated in 0.12. See http://fb.me/react-legacyfactory
|
||||
// new(props: P): ReactElement<P>;
|
||||
// (props: P): ReactElement<P>;
|
||||
}
|
||||
|
||||
//
|
||||
// ReactElement Factories
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface ComponentFactory<P> {
|
||||
(props?: P, ...children: ReactNode[]): ReactElement<P>;
|
||||
}
|
||||
|
||||
interface HTMLFactory extends ComponentFactory<HTMLAttributes> {}
|
||||
interface SVGFactory extends ComponentFactory<SVGAttributes> {}
|
||||
|
||||
//
|
||||
// Top-Level API
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface TopLevelAPI {
|
||||
createClass<P>(spec: ComponentSpec<P, any>): ComponentClass<P>;
|
||||
createElement<P>(type: ComponentClass<P> | string, props: P, ...children: ReactNode[]): ReactElement<P>;
|
||||
createFactory<P>(componentClass: ComponentClass<P>): ComponentFactory<P>;
|
||||
render<P>(element: ReactElement<P>, container: Element, callback?: () => any): Component<P>;
|
||||
unmountComponentAtNode(container: Element): boolean;
|
||||
renderToString(element: ReactElement<any>): string;
|
||||
renderToStaticMarkup(element: ReactElement<any>): string;
|
||||
isValidElement(object: {}): boolean;
|
||||
initializeTouchEvents(shouldUseTouch: boolean): void;
|
||||
}
|
||||
|
||||
//
|
||||
// Component API
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface Component<P> {
|
||||
// Use this overload to cast the returned element to a more specific type.
|
||||
// Eg: var name = this.refs['name'].getDOMNode<HTMLInputElement>().value;
|
||||
getDOMNode<TElement extends Element>(): TElement;
|
||||
getDOMNode(): Element;
|
||||
isMounted(): boolean;
|
||||
|
||||
props: P;
|
||||
setProps(nextProps: P, callback?: () => any): void;
|
||||
replaceProps(nextProps: P, callback?: () => any): void;
|
||||
}
|
||||
|
||||
interface DOMComponent<P> extends Component<P> {
|
||||
tagName: string;
|
||||
}
|
||||
|
||||
interface HTMLComponent extends DOMComponent<HTMLAttributes> {}
|
||||
interface SVGComponent extends DOMComponent<SVGAttributes> {}
|
||||
|
||||
interface CompositeComponent<P, S> extends Component<P>, ComponentSpec<P, S> {
|
||||
state: S;
|
||||
setState(nextState: S, callback?: () => any): void;
|
||||
replaceState(nextState: S, callback?: () => any): void;
|
||||
forceUpdate(callback?: () => any): void;
|
||||
refs: {
|
||||
[key: string]: Component<any>
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// Component Specs and Lifecycle
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface Mixin<P, S> extends ComponentStatics<P> {
|
||||
mixins?: Mixin<P, S>;
|
||||
statics?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
// Definition methods
|
||||
getInitialState?(): S;
|
||||
|
||||
// Delegate methods
|
||||
componentWillMount?(): void;
|
||||
componentDidMount?(): void;
|
||||
componentWillReceiveProps?(nextProps: P): void;
|
||||
shouldComponentUpdate?(nextProps: P, nextState: S): boolean;
|
||||
componentWillUpdate?(nextProps: P, nextState: S): void;
|
||||
componentDidUpdate?(prevProps: P, prevState: S): void;
|
||||
componentWillUnmount?(): void;
|
||||
}
|
||||
|
||||
interface ComponentSpec<P, S> extends Mixin<P, S> {
|
||||
render(): ReactElement<any>;
|
||||
}
|
||||
|
||||
//
|
||||
// Event System
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface SyntheticEvent {
|
||||
bubbles: boolean;
|
||||
cancelable: boolean;
|
||||
currentTarget: EventTarget;
|
||||
defaultPrevented: boolean;
|
||||
eventPhase: number;
|
||||
isTrusted: boolean;
|
||||
nativeEvent: Event;
|
||||
preventDefault(): void;
|
||||
stopPropagation(): void;
|
||||
target: EventTarget;
|
||||
timeStamp: Date;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface ClipboardEvent extends SyntheticEvent {
|
||||
clipboardData: DataTransfer;
|
||||
}
|
||||
|
||||
interface KeyboardEvent extends SyntheticEvent {
|
||||
altKey: boolean;
|
||||
charCode: number;
|
||||
ctrlKey: boolean;
|
||||
getModifierState(key: string): boolean;
|
||||
key: string;
|
||||
keyCode: number;
|
||||
locale: string;
|
||||
location: number;
|
||||
metaKey: boolean;
|
||||
repeat: boolean;
|
||||
shiftKey: boolean;
|
||||
which: number;
|
||||
}
|
||||
|
||||
interface FocusEvent extends SyntheticEvent {
|
||||
relatedTarget: EventTarget;
|
||||
}
|
||||
|
||||
interface FormEvent extends SyntheticEvent {
|
||||
}
|
||||
|
||||
interface MouseEvent extends SyntheticEvent {
|
||||
altKey: boolean;
|
||||
button: number;
|
||||
buttons: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
ctrlKey: boolean;
|
||||
getModifierState(key: string): boolean;
|
||||
metaKey: boolean;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
relatedTarget: EventTarget;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
|
||||
interface TouchEvent extends SyntheticEvent {
|
||||
altKey: boolean;
|
||||
changedTouches: TouchList;
|
||||
ctrlKey: boolean;
|
||||
getModifierState(key: string): boolean;
|
||||
metaKey: boolean;
|
||||
shiftKey: boolean;
|
||||
targetTouches: TouchList;
|
||||
touches: TouchList;
|
||||
}
|
||||
|
||||
interface UIEvent extends SyntheticEvent {
|
||||
detail: number;
|
||||
view: AbstractView;
|
||||
}
|
||||
|
||||
interface WheelEvent extends SyntheticEvent {
|
||||
deltaMode: number;
|
||||
deltaX: number;
|
||||
deltaY: number;
|
||||
deltaZ: number;
|
||||
}
|
||||
|
||||
//
|
||||
// Event Handler Types
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface EventHandler<E extends SyntheticEvent> {
|
||||
(event: E): void;
|
||||
}
|
||||
|
||||
interface ClipboardEventHandler extends EventHandler<ClipboardEvent> {}
|
||||
interface KeyboardEventHandler extends EventHandler<KeyboardEvent> {}
|
||||
interface FocusEventHandler extends EventHandler<FocusEvent> {}
|
||||
interface FormEventHandler extends EventHandler<FormEvent> {}
|
||||
interface MouseEventHandler extends EventHandler<MouseEvent> {}
|
||||
interface TouchEventHandler extends EventHandler<TouchEvent> {}
|
||||
interface UIEventHandler extends EventHandler<UIEvent> {}
|
||||
interface WheelEventHandler extends EventHandler<WheelEvent> {}
|
||||
|
||||
//
|
||||
// Attributes
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface ReactAttributes {
|
||||
children?: ReactNode;
|
||||
key?: number | string;
|
||||
ref?: string;
|
||||
|
||||
// Event Attributes
|
||||
onCopy?: ClipboardEventHandler;
|
||||
onCut?: ClipboardEventHandler;
|
||||
onPaste?: ClipboardEventHandler;
|
||||
onKeyDown?: KeyboardEventHandler;
|
||||
onKeyPress?: KeyboardEventHandler;
|
||||
onKeyUp?: KeyboardEventHandler;
|
||||
onFocus?: FocusEventHandler;
|
||||
onBlur?: FocusEventHandler;
|
||||
onChange?: FormEventHandler;
|
||||
onInput?: FormEventHandler;
|
||||
onSubmit?: FormEventHandler;
|
||||
onClick?: MouseEventHandler;
|
||||
onDoubleClick?: MouseEventHandler;
|
||||
onDrag?: MouseEventHandler;
|
||||
onDragEnd?: MouseEventHandler;
|
||||
onDragEnter?: MouseEventHandler;
|
||||
onDragExit?: MouseEventHandler;
|
||||
onDragLeave?: MouseEventHandler;
|
||||
onDragOver?: MouseEventHandler;
|
||||
onDragStart?: MouseEventHandler;
|
||||
onDrop?: MouseEventHandler;
|
||||
onMouseDown?: MouseEventHandler;
|
||||
onMouseEnter?: MouseEventHandler;
|
||||
onMouseLeave?: MouseEventHandler;
|
||||
onMouseMove?: MouseEventHandler;
|
||||
onMouseOut?: MouseEventHandler;
|
||||
onMouseOver?: MouseEventHandler;
|
||||
onMouseUp?: MouseEventHandler;
|
||||
onTouchCancel?: TouchEventHandler;
|
||||
onTouchEnd?: TouchEventHandler;
|
||||
onTouchMove?: TouchEventHandler;
|
||||
onTouchStart?: TouchEventHandler;
|
||||
onScroll?: UIEventHandler;
|
||||
onWheel?: WheelEventHandler;
|
||||
|
||||
dangerouslySetInnerHTML?: {
|
||||
__html: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface CSSProperties {
|
||||
columnCount?: number;
|
||||
flex?: number | string;
|
||||
flexGrow?: number;
|
||||
flexShrink?: number;
|
||||
fontWeight?: number;
|
||||
lineClamp?: number;
|
||||
lineHeight?: number;
|
||||
opacity?: number;
|
||||
order?: number;
|
||||
orphans?: number;
|
||||
widows?: number;
|
||||
zIndex?: number;
|
||||
zoom?: number;
|
||||
|
||||
// SVG-related properties
|
||||
fillOpacity?: number;
|
||||
strokeOpacity?: number;
|
||||
}
|
||||
|
||||
interface HTMLAttributes extends ReactAttributes {
|
||||
accept?: string;
|
||||
acceptCharset?: string;
|
||||
accessKey?: string;
|
||||
action?: string;
|
||||
allowFullScreen?: boolean;
|
||||
allowTransparency?: boolean;
|
||||
alt?: string;
|
||||
async?: boolean;
|
||||
autoComplete?: boolean;
|
||||
autoFocus?: boolean;
|
||||
autoPlay?: boolean;
|
||||
cellPadding?: number | string;
|
||||
cellSpacing?: number | string;
|
||||
charSet?: string;
|
||||
checked?: boolean;
|
||||
classID?: string;
|
||||
className?: string;
|
||||
cols?: number;
|
||||
colSpan?: number;
|
||||
content?: string;
|
||||
contentEditable?: boolean;
|
||||
contextMenu?: string;
|
||||
controls?: any;
|
||||
coords?: string;
|
||||
crossOrigin?: string;
|
||||
data?: string;
|
||||
dateTime?: string;
|
||||
defer?: boolean;
|
||||
dir?: string;
|
||||
disabled?: boolean;
|
||||
download?: any;
|
||||
draggable?: boolean;
|
||||
encType?: string;
|
||||
form?: string;
|
||||
formNoValidate?: boolean;
|
||||
frameBorder?: number | string;
|
||||
height?: number | string;
|
||||
hidden?: boolean;
|
||||
href?: string;
|
||||
hrefLang?: string;
|
||||
htmlFor?: string;
|
||||
httpEquiv?: string;
|
||||
icon?: string;
|
||||
id?: string;
|
||||
label?: string;
|
||||
lang?: string;
|
||||
list?: string;
|
||||
loop?: boolean;
|
||||
manifest?: string;
|
||||
max?: number | string;
|
||||
maxLength?: number;
|
||||
media?: string;
|
||||
mediaGroup?: string;
|
||||
method?: string;
|
||||
min?: number | string;
|
||||
multiple?: boolean;
|
||||
muted?: boolean;
|
||||
name?: string;
|
||||
noValidate?: boolean;
|
||||
open?: boolean;
|
||||
pattern?: string;
|
||||
placeholder?: string;
|
||||
poster?: string;
|
||||
preload?: string;
|
||||
radioGroup?: string;
|
||||
readOnly?: boolean;
|
||||
rel?: string;
|
||||
required?: boolean;
|
||||
role?: string;
|
||||
rows?: number;
|
||||
rowSpan?: number;
|
||||
sandbox?: string;
|
||||
scope?: string;
|
||||
scrollLeft?: number;
|
||||
scrolling?: string;
|
||||
scrollTop?: number;
|
||||
seamless?: boolean;
|
||||
selected?: boolean;
|
||||
shape?: string;
|
||||
size?: number;
|
||||
sizes?: string;
|
||||
span?: number;
|
||||
spellCheck?: boolean;
|
||||
src?: string;
|
||||
srcDoc?: string;
|
||||
srcSet?: string;
|
||||
start?: number;
|
||||
step?: number | string;
|
||||
style?: CSSProperties;
|
||||
tabIndex?: number;
|
||||
target?: string;
|
||||
title?: string;
|
||||
type?: string;
|
||||
useMap?: string;
|
||||
value?: string;
|
||||
width?: number | string;
|
||||
wmode?: string;
|
||||
|
||||
// Non-standard Attributes
|
||||
autoCapitalize?: boolean;
|
||||
autoCorrect?: boolean;
|
||||
property?: string;
|
||||
itemProp?: string;
|
||||
itemScope?: boolean;
|
||||
itemType?: string;
|
||||
}
|
||||
|
||||
interface SVGAttributes extends ReactAttributes {
|
||||
cx?: SVGLength | SVGAnimatedLength;
|
||||
cy?: any;
|
||||
d?: string;
|
||||
dx?: SVGLength | SVGAnimatedLength;
|
||||
dy?: SVGLength | SVGAnimatedLength;
|
||||
fill?: any; // SVGPaint | string
|
||||
fillOpacity?: number | string;
|
||||
fontFamily?: string;
|
||||
fontSize?: number | string;
|
||||
fx?: SVGLength | SVGAnimatedLength;
|
||||
fy?: SVGLength | SVGAnimatedLength;
|
||||
gradientTransform?: SVGTransformList | SVGAnimatedTransformList;
|
||||
gradientUnits?: string;
|
||||
markerEnd?: string;
|
||||
markerMid?: string;
|
||||
markerStart?: string;
|
||||
offset?: number | string;
|
||||
opacity?: number | string;
|
||||
patternContentUnits?: string;
|
||||
patternUnits?: string;
|
||||
points?: string;
|
||||
preserveAspectRatio?: string;
|
||||
r?: SVGLength | SVGAnimatedLength;
|
||||
rx?: SVGLength | SVGAnimatedLength;
|
||||
ry?: SVGLength | SVGAnimatedLength;
|
||||
spreadMethod?: string;
|
||||
stopColor?: any; // SVGColor | string
|
||||
stopOpacity?: number | string;
|
||||
stroke?: any; // SVGPaint
|
||||
strokeDasharray?: string;
|
||||
strokeLinecap?: string;
|
||||
strokeOpacity?: number | string;
|
||||
strokeWidth?: SVGLength | SVGAnimatedLength;
|
||||
textAnchor?: string;
|
||||
transform?: SVGTransformList | SVGAnimatedTransformList;
|
||||
version?: string;
|
||||
viewBox?: string;
|
||||
x1?: SVGLength | SVGAnimatedLength;
|
||||
x2?: SVGLength | SVGAnimatedLength;
|
||||
x?: SVGLength | SVGAnimatedLength;
|
||||
y1?: SVGLength | SVGAnimatedLength;
|
||||
y2?: SVGLength | SVGAnimatedLength
|
||||
y?: SVGLength | SVGAnimatedLength;
|
||||
}
|
||||
|
||||
//
|
||||
// React.DOM
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface ReactDOM {
|
||||
// HTML
|
||||
a: HTMLFactory;
|
||||
abbr: HTMLFactory;
|
||||
address: HTMLFactory;
|
||||
area: HTMLFactory;
|
||||
article: HTMLFactory;
|
||||
aside: HTMLFactory;
|
||||
audio: HTMLFactory;
|
||||
b: HTMLFactory;
|
||||
base: HTMLFactory;
|
||||
bdi: HTMLFactory;
|
||||
bdo: HTMLFactory;
|
||||
big: HTMLFactory;
|
||||
blockquote: HTMLFactory;
|
||||
body: HTMLFactory;
|
||||
br: HTMLFactory;
|
||||
button: HTMLFactory;
|
||||
canvas: HTMLFactory;
|
||||
caption: HTMLFactory;
|
||||
cite: HTMLFactory;
|
||||
code: HTMLFactory;
|
||||
col: HTMLFactory;
|
||||
colgroup: HTMLFactory;
|
||||
data: HTMLFactory;
|
||||
datalist: HTMLFactory;
|
||||
dd: HTMLFactory;
|
||||
del: HTMLFactory;
|
||||
details: HTMLFactory;
|
||||
dfn: HTMLFactory;
|
||||
dialog: HTMLFactory;
|
||||
div: HTMLFactory;
|
||||
dl: HTMLFactory;
|
||||
dt: HTMLFactory;
|
||||
em: HTMLFactory;
|
||||
embed: HTMLFactory;
|
||||
fieldset: HTMLFactory;
|
||||
figcaption: HTMLFactory;
|
||||
figure: HTMLFactory;
|
||||
footer: HTMLFactory;
|
||||
form: HTMLFactory;
|
||||
h1: HTMLFactory;
|
||||
h2: HTMLFactory;
|
||||
h3: HTMLFactory;
|
||||
h4: HTMLFactory;
|
||||
h5: HTMLFactory;
|
||||
h6: HTMLFactory;
|
||||
head: HTMLFactory;
|
||||
header: HTMLFactory;
|
||||
hr: HTMLFactory;
|
||||
html: HTMLFactory;
|
||||
i: HTMLFactory;
|
||||
iframe: HTMLFactory;
|
||||
img: HTMLFactory;
|
||||
input: HTMLFactory;
|
||||
ins: HTMLFactory;
|
||||
kbd: HTMLFactory;
|
||||
keygen: HTMLFactory;
|
||||
label: HTMLFactory;
|
||||
legend: HTMLFactory;
|
||||
li: HTMLFactory;
|
||||
link: HTMLFactory;
|
||||
main: HTMLFactory;
|
||||
map: HTMLFactory;
|
||||
mark: HTMLFactory;
|
||||
menu: HTMLFactory;
|
||||
menuitem: HTMLFactory;
|
||||
meta: HTMLFactory;
|
||||
meter: HTMLFactory;
|
||||
nav: HTMLFactory;
|
||||
noscript: HTMLFactory;
|
||||
object: HTMLFactory;
|
||||
ol: HTMLFactory;
|
||||
optgroup: HTMLFactory;
|
||||
option: HTMLFactory;
|
||||
output: HTMLFactory;
|
||||
p: HTMLFactory;
|
||||
param: HTMLFactory;
|
||||
picture: HTMLFactory;
|
||||
pre: HTMLFactory;
|
||||
progress: HTMLFactory;
|
||||
q: HTMLFactory;
|
||||
rp: HTMLFactory;
|
||||
rt: HTMLFactory;
|
||||
ruby: HTMLFactory;
|
||||
s: HTMLFactory;
|
||||
samp: HTMLFactory;
|
||||
script: HTMLFactory;
|
||||
section: HTMLFactory;
|
||||
select: HTMLFactory;
|
||||
small: HTMLFactory;
|
||||
source: HTMLFactory;
|
||||
span: HTMLFactory;
|
||||
strong: HTMLFactory;
|
||||
style: HTMLFactory;
|
||||
sub: HTMLFactory;
|
||||
summary: HTMLFactory;
|
||||
sup: HTMLFactory;
|
||||
table: HTMLFactory;
|
||||
tbody: HTMLFactory;
|
||||
td: HTMLFactory;
|
||||
textarea: HTMLFactory;
|
||||
tfoot: HTMLFactory;
|
||||
th: HTMLFactory;
|
||||
thead: HTMLFactory;
|
||||
time: HTMLFactory;
|
||||
title: HTMLFactory;
|
||||
tr: HTMLFactory;
|
||||
track: HTMLFactory;
|
||||
u: HTMLFactory;
|
||||
ul: HTMLFactory;
|
||||
"var": HTMLFactory;
|
||||
video: HTMLFactory;
|
||||
wbr: HTMLFactory;
|
||||
|
||||
// SVG
|
||||
circle: SVGFactory;
|
||||
defs: SVGFactory;
|
||||
ellipse: SVGFactory;
|
||||
g: SVGFactory;
|
||||
line: SVGFactory;
|
||||
linearGradient: SVGFactory;
|
||||
mask: SVGFactory;
|
||||
path: SVGFactory;
|
||||
pattern: SVGFactory;
|
||||
polygon: SVGFactory;
|
||||
polyline: SVGFactory;
|
||||
radialGradient: SVGFactory;
|
||||
rect: SVGFactory;
|
||||
stop: SVGFactory;
|
||||
svg: SVGFactory;
|
||||
text: SVGFactory;
|
||||
tspan: SVGFactory;
|
||||
}
|
||||
|
||||
//
|
||||
// React.PropTypes
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface Validator<T> {
|
||||
(object: T, key: string, componentName: string): Error;
|
||||
}
|
||||
|
||||
interface Requireable<T> extends Validator<T> {
|
||||
isRequired: Validator<T>;
|
||||
}
|
||||
|
||||
interface ValidationMap<T> {
|
||||
[key: string]: Validator<T>;
|
||||
}
|
||||
|
||||
interface ReactPropTypes {
|
||||
any: Requireable<any>;
|
||||
array: Requireable<any>;
|
||||
bool: Requireable<any>;
|
||||
func: Requireable<any>;
|
||||
number: Requireable<any>;
|
||||
object: Requireable<any>;
|
||||
string: Requireable<any>;
|
||||
node: Requireable<any>;
|
||||
element: Requireable<any>;
|
||||
instanceOf(expectedClass: {}): Requireable<any>;
|
||||
oneOf(types: any[]): Requireable<any>;
|
||||
oneOfType(types: Validator<any>[]): Requireable<any>;
|
||||
arrayOf(type: Validator<any>): Requireable<any>;
|
||||
objectOf(type: Validator<any>): Requireable<any>;
|
||||
shape(type: ValidationMap<any>): Requireable<any>;
|
||||
}
|
||||
|
||||
//
|
||||
// React.Children
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface ReactChildren {
|
||||
map<T>(children: ReactNode, fn: (child: ReactChild) => T): { [key:string]: T };
|
||||
forEach(children: ReactNode, fn: (child: ReactChild) => any): void;
|
||||
count(children: ReactNode): number;
|
||||
only(children: ReactNode): ReactChild;
|
||||
}
|
||||
|
||||
//
|
||||
// React.addons
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface ClassSet {
|
||||
[key: string]: boolean;
|
||||
}
|
||||
|
||||
//
|
||||
// React.addons (Transitions)
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface TransitionGroupProps {
|
||||
component?: ReactType;
|
||||
childFactory?: (child: ReactElement<any>) => ReactElement<any>;
|
||||
}
|
||||
|
||||
interface CSSTransitionGroupProps extends TransitionGroupProps {
|
||||
transitionName: string;
|
||||
transitionAppear?: boolean;
|
||||
transitionEnter?: boolean;
|
||||
transitionLeave?: boolean;
|
||||
}
|
||||
|
||||
interface CSSTransitionGroup extends ComponentClass<CSSTransitionGroupProps> {}
|
||||
interface TransitionGroup extends ComponentClass<TransitionGroupProps> {}
|
||||
|
||||
//
|
||||
// React.addons (Mixins)
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface ReactLink<T> {
|
||||
value: T;
|
||||
requestChange(newValue: T): void;
|
||||
}
|
||||
|
||||
interface LinkedStateMixin extends Mixin<any, any> {
|
||||
linkState<T>(key: string): ReactLink<T>;
|
||||
}
|
||||
|
||||
interface PureRenderMixin extends Mixin<any, any> {
|
||||
}
|
||||
|
||||
//
|
||||
// Reat.addons.update
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface UpdateSpec {
|
||||
$set: any;
|
||||
$merge: {};
|
||||
$apply(value: any): any;
|
||||
// [key: string]: UpdateSpec;
|
||||
}
|
||||
|
||||
interface UpdateArraySpec extends UpdateSpec {
|
||||
$push?: any[];
|
||||
$unshift?: any[];
|
||||
$splice?: any[][];
|
||||
}
|
||||
|
||||
//
|
||||
// React.addons.Perf
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface ComponentPerfContext {
|
||||
current: string;
|
||||
owner: string;
|
||||
}
|
||||
|
||||
interface NumericPerfContext {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
interface Measurements {
|
||||
exclusive: NumericPerfContext;
|
||||
inclusive: NumericPerfContext;
|
||||
render: NumericPerfContext;
|
||||
counts: NumericPerfContext;
|
||||
writes: NumericPerfContext;
|
||||
displayNames: {
|
||||
[key: string]: ComponentPerfContext;
|
||||
};
|
||||
totalTime: number;
|
||||
}
|
||||
|
||||
interface ReactPerf {
|
||||
start(): void;
|
||||
stop(): void;
|
||||
printInclusive(measurements: Measurements[]): void;
|
||||
printExclusive(measurements: Measurements[]): void;
|
||||
printWasted(measurements: Measurements[]): void;
|
||||
printDOM(measurements: Measurements[]): void;
|
||||
getLastMeasurements(): Measurements[];
|
||||
}
|
||||
|
||||
//
|
||||
// React.addons.TestUtils
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface MockedComponentClass {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
interface ReactTestUtils {
|
||||
Simulate: Simulate;
|
||||
|
||||
renderIntoDocument<P>(element: ReactElement<P>): Component<P>;
|
||||
renderIntoDocument<C extends Component<any>>(element: ReactElement<any>): C;
|
||||
|
||||
mockComponent(mocked: MockedComponentClass, mockTagName?: string): ReactTestUtils;
|
||||
|
||||
isElementOfType(element: ReactElement<any>, type: ReactType): boolean;
|
||||
isDOMComponent(instance: Component<any>): boolean;
|
||||
isCompositeComponent(instance: Component<any>): boolean;
|
||||
isCompositeComponentWithType(instance: Component<any>, type: ComponentClass<any>): boolean;
|
||||
isTextComponent(instance: Component<any>): boolean;
|
||||
|
||||
findAllInRenderedTree(tree: Component<any>, fn: (i: Component<any>) => boolean): Component<any>;
|
||||
|
||||
scryRenderedDOMComponentsWithClass(tree: Component<any>, className: string): DOMComponent<any>[];
|
||||
findRenderedDOMComponentWithClass(tree: Component<any>, className: string): DOMComponent<any>;
|
||||
|
||||
scryRenderedDOMComponentsWithTag(tree: Component<any>, tagName: string): DOMComponent<any>[];
|
||||
findRenderedDOMComponentWithTag(tree: Component<any>, tagName: string): DOMComponent<any>;
|
||||
|
||||
scryRenderedComponentsWithType<P, S>(
|
||||
tree: Component<any>, type: ComponentClass<P>): CompositeComponent<P, S>[];
|
||||
scryRenderedComponentsWithType<C extends CompositeComponent<any, any>>(
|
||||
tree: Component<any>, type: ComponentClass<any>): C[];
|
||||
|
||||
findRenderedComponentWithType<P, S>(
|
||||
tree: Component<any>, type: ComponentClass<P>): CompositeComponent<P, S>;
|
||||
findRenderedComponentWithType<C extends CompositeComponent<any, any>>(
|
||||
tree: Component<any>, type: ComponentClass<any>): C;
|
||||
}
|
||||
|
||||
interface SyntheticEventData {
|
||||
altKey?: boolean;
|
||||
button?: number;
|
||||
buttons?: number;
|
||||
clientX?: number;
|
||||
clientY?: number;
|
||||
changedTouches?: TouchList;
|
||||
charCode?: boolean;
|
||||
clipboardData?: DataTransfer;
|
||||
ctrlKey?: boolean;
|
||||
deltaMode?: number;
|
||||
deltaX?: number;
|
||||
deltaY?: number;
|
||||
deltaZ?: number;
|
||||
detail?: number;
|
||||
getModifierState?(key: string): boolean;
|
||||
key?: string;
|
||||
keyCode?: number;
|
||||
locale?: string;
|
||||
location?: number;
|
||||
metaKey?: boolean;
|
||||
pageX?: number;
|
||||
pageY?: number;
|
||||
relatedTarget?: EventTarget;
|
||||
repeat?: boolean;
|
||||
screenX?: number;
|
||||
screenY?: number;
|
||||
shiftKey?: boolean;
|
||||
targetTouches?: TouchList;
|
||||
touches?: TouchList;
|
||||
view?: AbstractView;
|
||||
which?: number;
|
||||
}
|
||||
|
||||
interface EventSimulator {
|
||||
(element: Element, eventData?: SyntheticEventData): void;
|
||||
(descriptor: Component<any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
interface Simulate {
|
||||
blur: EventSimulator;
|
||||
change: EventSimulator;
|
||||
click: EventSimulator;
|
||||
cut: EventSimulator;
|
||||
doubleClick: EventSimulator;
|
||||
drag: EventSimulator;
|
||||
dragEnd: EventSimulator;
|
||||
dragEnter: EventSimulator;
|
||||
dragExit: EventSimulator;
|
||||
dragLeave: EventSimulator;
|
||||
dragOver: EventSimulator;
|
||||
dragStart: EventSimulator;
|
||||
drop: EventSimulator;
|
||||
focus: EventSimulator;
|
||||
input: EventSimulator;
|
||||
keyDown: EventSimulator;
|
||||
keyPress: EventSimulator;
|
||||
keyUp: EventSimulator;
|
||||
mouseDown: EventSimulator;
|
||||
mouseEnter: EventSimulator;
|
||||
mouseLeave: EventSimulator;
|
||||
mouseMove: EventSimulator;
|
||||
mouseOut: EventSimulator;
|
||||
mouseOver: EventSimulator;
|
||||
mouseUp: EventSimulator;
|
||||
paste: EventSimulator;
|
||||
scroll: EventSimulator;
|
||||
submit: EventSimulator;
|
||||
touchCancel: EventSimulator;
|
||||
touchEnd: EventSimulator;
|
||||
touchMove: EventSimulator;
|
||||
touchStart: EventSimulator;
|
||||
wheel: EventSimulator;
|
||||
}
|
||||
|
||||
//
|
||||
// react Exports
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface Exports extends TopLevelAPI {
|
||||
DOM: ReactDOM;
|
||||
PropTypes: ReactPropTypes;
|
||||
Children: ReactChildren;
|
||||
}
|
||||
|
||||
//
|
||||
// react/addons Exports
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface AddonsExports extends Exports {
|
||||
addons: {
|
||||
CSSTransitionGroup: CSSTransitionGroup;
|
||||
LinkedStateMixin: LinkedStateMixin;
|
||||
PureRenderMixin: PureRenderMixin;
|
||||
TransitionGroup: TransitionGroup;
|
||||
|
||||
batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||
batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||
batchedUpdates(callback: () => any): void;
|
||||
|
||||
classSet(cx: ClassSet): string;
|
||||
cloneWithProps<P>(element: ReactElement<P>, props: P): ReactElement<P>;
|
||||
|
||||
update(value: any[], spec: UpdateArraySpec): any[];
|
||||
update(value: {}, spec: UpdateSpec): any;
|
||||
|
||||
// Development tools
|
||||
Perf: ReactPerf;
|
||||
TestUtils: ReactTestUtils;
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// Browser Interfaces
|
||||
// https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
interface AbstractView {
|
||||
styleMedia: StyleMedia;
|
||||
document: Document;
|
||||
}
|
||||
|
||||
interface Touch {
|
||||
identifier: number;
|
||||
target: EventTarget;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
|
||||
interface TouchList {
|
||||
[index: number]: Touch;
|
||||
length: number;
|
||||
item(index: number): Touch;
|
||||
identifiedTouch(identifier: number): Touch;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "react" {
|
||||
var exports: React.Exports;
|
||||
export = exports;
|
||||
}
|
||||
|
||||
declare module "react/addons" {
|
||||
var exports: React.AddonsExports;
|
||||
export = exports;
|
||||
}
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
/// <reference path="react-addons-0.11.d.ts" />
|
||||
import React = require("react/addons-0.11");
|
||||
|
||||
var PropTypesSpecification: React.Specification<any, any> = {
|
||||
propTypes: {
|
||||
// You can declare that a prop is a specific JS primitive. By default, these
|
||||
// are all optional.
|
||||
optionalArray: React.PropTypes.array,
|
||||
optionalBool: React.PropTypes.bool,
|
||||
optionalFunc: React.PropTypes.func,
|
||||
optionalNumber: React.PropTypes.number,
|
||||
optionalObject: React.PropTypes.object,
|
||||
optionalString: React.PropTypes.string,
|
||||
|
||||
// Anything that can be rendered: numbers, strings, components or an array
|
||||
// containing these types.
|
||||
optionalRenderable: React.PropTypes.renderable,
|
||||
|
||||
// A React component.
|
||||
optionalComponent: React.PropTypes.component,
|
||||
|
||||
// You can also declare that a prop is an instance of a class. This uses
|
||||
// JS's instanceof operator.
|
||||
optionalMessage: React.PropTypes.instanceOf(Date),
|
||||
|
||||
// You can ensure that your prop is limited to specific values by treating
|
||||
// it as an enum.
|
||||
optionalEnum: React.PropTypes.oneOf(['News', 'Photos']),
|
||||
|
||||
// An object that could be one of many types
|
||||
optionalUnion: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
React.PropTypes.number,
|
||||
React.PropTypes.instanceOf(Date)
|
||||
]),
|
||||
|
||||
// An array of a certain type
|
||||
optionalArrayOf: React.PropTypes.arrayOf(React.PropTypes.number),
|
||||
|
||||
// An object with property values of a certain type
|
||||
optionalObjectOf: React.PropTypes.objectOf(React.PropTypes.number),
|
||||
|
||||
// An object taking on a particular shape
|
||||
optionalObjectWithShape: React.PropTypes.shape({
|
||||
color: React.PropTypes.string,
|
||||
fontSize: React.PropTypes.number
|
||||
}),
|
||||
|
||||
// You can chain any of the above with `isRequired` to make sure a warning
|
||||
// is shown if the prop isn't provided.
|
||||
requiredFunc: React.PropTypes.func.isRequired,
|
||||
|
||||
// A value of any data type
|
||||
requiredAny: React.PropTypes.any.isRequired,
|
||||
|
||||
// You can also specify a custom validator. It should return an Error
|
||||
// object if the validation fails. Don't `console.warn` or throw, as this
|
||||
// won't work inside `oneOfType`.
|
||||
customProp: function(props, propName, componentName) {
|
||||
if (!/matchme/.test(props[propName])) {
|
||||
return new Error('Validation failed!');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
},
|
||||
render: (): React.Descriptor<any> => {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
React.createClass(PropTypesSpecification);
|
||||
|
||||
var mountNode: Element;
|
||||
|
||||
var HelloMessage = React.createClass({displayName: 'HelloMessage',
|
||||
render: function() {
|
||||
return React.DOM.div(null, "Hello ", (<React.Component<{name: string}, any>>this).props.name);
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(HelloMessage({name: "John"}), mountNode);
|
||||
|
||||
var Timer = React.createClass({displayName: 'Timer',
|
||||
getInitialState: function() {
|
||||
return {secondsElapsed: 0};
|
||||
},
|
||||
tick: function() {
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).setState({
|
||||
secondsElapsed: (<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed + 1
|
||||
});
|
||||
},
|
||||
componentDidMount: function() {
|
||||
this.interval = setInterval(this.tick, 1000);
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
clearInterval(this.interval);
|
||||
},
|
||||
render: function() {
|
||||
return React.DOM.div(
|
||||
null,
|
||||
"Seconds Elapsed: ",
|
||||
(<React.Component<any, {secondsElapsed: number}>>this).state.secondsElapsed
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
React.renderComponent(Timer(null), mountNode);
|
||||
|
||||
// TestUtils
|
||||
var that: React.Component<any, any>;
|
||||
var node = that.refs['input'].getDOMNode();
|
||||
React.addons.TestUtils.Simulate.click(node);
|
||||
React.addons.TestUtils.Simulate.change(node);
|
||||
React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"});
|
||||
|
||||
var GoodbyeMessage = React.createClass({displayName: 'GoodbyeMessage',
|
||||
render: function() {
|
||||
return React.DOM.div(null, "Goodbye ", (<React.Component<{name: string}, any>>this).props.name);
|
||||
}
|
||||
});
|
||||
React.addons.TestUtils.renderIntoDocument(GoodbyeMessage({name: "John"}));
|
||||
|
||||
var isImportant: boolean;
|
||||
var isRead: boolean;
|
||||
var cx = React.addons.classSet;
|
||||
var classes = cx({
|
||||
'message': true,
|
||||
'message-important': isImportant,
|
||||
'message-read': isRead
|
||||
});
|
||||
|
||||
|
||||
|
||||
Vendored
-172
@@ -1,172 +0,0 @@
|
||||
// Type definitions for React with Addons 0.11.2
|
||||
// Project: http://facebook.github.io/react/
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="react-0.11.d.ts" />
|
||||
|
||||
declare module "react/addons-0.11" {
|
||||
export = React;
|
||||
}
|
||||
|
||||
declare module React {
|
||||
export var addons: {
|
||||
classSet: (classes: {[key: string]: boolean}) => string;
|
||||
cloneWithProps: CloneWithProps<any>;
|
||||
CSSTransitionGroup: Factory<CSSTransitionGroupProps>;
|
||||
LinkedStateMixin: LinkedStateMixin<any, any>;
|
||||
Perf: Perf;
|
||||
PureRenderMixin: Mixin<any, any>;
|
||||
TestUtils: TestUtils;
|
||||
TransitionGroup: Factory<any>;
|
||||
update(object: Object, changes: Object): Object;
|
||||
};
|
||||
|
||||
export interface CloneWithProps<P> {
|
||||
(instance: Descriptor<P>, extraProps?: P): Descriptor<P>;
|
||||
}
|
||||
|
||||
export interface ReactLink<T> {
|
||||
value: T;
|
||||
requestChange(newValue: T): void;
|
||||
}
|
||||
|
||||
export interface LinkedStateMixin<P, S> extends Mixin<P, S> {
|
||||
linkState<T>(key: string): ReactLink<T>;
|
||||
}
|
||||
|
||||
export interface ComponentPerfContext {
|
||||
current: string;
|
||||
owner: string;
|
||||
}
|
||||
|
||||
export interface CSSTransitionGroupProps {
|
||||
transitionName: string;
|
||||
}
|
||||
|
||||
export interface TransitionsSpecification<P, S> extends Specification<P, S> {
|
||||
componentWillEnter?(callback: () => void): void;
|
||||
componentDidEnter?(): void;
|
||||
componentWillLeave?(callback: () => void): void;
|
||||
componentDidLeave?(): void;
|
||||
}
|
||||
|
||||
export interface NumericPerfContext {
|
||||
[key: string]: number;
|
||||
}
|
||||
|
||||
export interface Measurements {
|
||||
exclusive: NumericPerfContext;
|
||||
inclusive: NumericPerfContext;
|
||||
render: NumericPerfContext;
|
||||
counts: NumericPerfContext;
|
||||
writes: NumericPerfContext;
|
||||
displayNames: {
|
||||
[key: string]: ComponentPerfContext;
|
||||
};
|
||||
totalTime: number;
|
||||
}
|
||||
|
||||
export interface Perf {
|
||||
start(): void;
|
||||
stop(): void;
|
||||
printInclusive(measurements: Measurements[]): void;
|
||||
printExclusive(measurements: Measurements[]): void;
|
||||
printWasted(measurements: Measurements[]): void;
|
||||
printDOM(measurements: Measurements[]): void;
|
||||
getLastMeasurements(): Measurements[];
|
||||
}
|
||||
|
||||
export interface TestUtils {
|
||||
Simulate: Simulate;
|
||||
renderIntoDocument(instance: Descriptor<any>): Descriptor<any>;
|
||||
mockComponent(componentClass: Factory<any>, mockTagName?: string): TestUtils;
|
||||
isDescriptorOfType(descriptor: Descriptor<any>, componentClass: Factory<any>): boolean;
|
||||
isDOMComponent(instance: Descriptor<any>): boolean;
|
||||
isCompositeComponent(instance: Descriptor<any>): boolean;
|
||||
isCompositeComponentWithType(instance: Descriptor<any>, componentClass: Function): boolean;
|
||||
isTextComponent(instance: Descriptor<any>): boolean;
|
||||
findAllInRenderedTree(tree: Descriptor<any>, test: Function): Descriptor<any>[];
|
||||
scryRenderedDOMComponentsWithClass(tree: Descriptor<any>, className: string): Descriptor<any>[];
|
||||
findRenderedDOMComponentWithClass(tree: Descriptor<any>, className: string): Descriptor<any>;
|
||||
scryRenderedDOMComponentsWithTag(tree: Descriptor<any>, className: string): Descriptor<any>[];
|
||||
findRenderedDOMComponentWithTag(tree: Descriptor<any>, tagName: string): Descriptor<any>;
|
||||
scryFindRenderedComponentsWithTag(tree: Descriptor<any>, componentClass: Function): Descriptor<any>[];
|
||||
findRenderedComponentWithType(tree: Descriptor<any>, componentClass: Function): Descriptor<any>;
|
||||
}
|
||||
|
||||
export interface SyntheticEventData {
|
||||
altKey?: boolean;
|
||||
button?: number;
|
||||
buttons?: number;
|
||||
clientX?: number;
|
||||
clientY?: number;
|
||||
changedTouches?: TouchList;
|
||||
charCode?: boolean;
|
||||
clipboardData?: DataTransfer;
|
||||
ctrlKey?: boolean;
|
||||
deltaMode?: number;
|
||||
deltaX?: number;
|
||||
deltaY?: number;
|
||||
deltaZ?: number;
|
||||
detail?: number;
|
||||
getModifierState?(key: string): boolean;
|
||||
key?: string;
|
||||
keyCode?: number;
|
||||
locale?: string;
|
||||
location?: number;
|
||||
metaKey?: boolean;
|
||||
pageX?: number;
|
||||
pageY?: number;
|
||||
relatedTarget?: EventTarget;
|
||||
repeat?: boolean;
|
||||
screenX?: number;
|
||||
screenY?: number;
|
||||
shiftKey?: boolean;
|
||||
targetTouches?: TouchList;
|
||||
touches?: TouchList;
|
||||
view?: AbstractView;
|
||||
which?: number;
|
||||
}
|
||||
|
||||
export interface EventSimulator {
|
||||
(element: Element, eventData?: SyntheticEventData): void;
|
||||
(descriptor: Descriptor<any>, eventData?: SyntheticEventData): void;
|
||||
}
|
||||
|
||||
export interface Simulate {
|
||||
blur: EventSimulator;
|
||||
change: EventSimulator;
|
||||
click: EventSimulator;
|
||||
cut: EventSimulator;
|
||||
doubleClick: EventSimulator;
|
||||
drag: EventSimulator;
|
||||
dragEnd: EventSimulator;
|
||||
dragEnter: EventSimulator;
|
||||
dragExit: EventSimulator;
|
||||
dragLeave: EventSimulator;
|
||||
dragOver: EventSimulator;
|
||||
dragStart: EventSimulator;
|
||||
drop: EventSimulator;
|
||||
focus: EventSimulator;
|
||||
input: EventSimulator;
|
||||
keyDown: EventSimulator;
|
||||
keyPress: EventSimulator;
|
||||
keyUp: EventSimulator;
|
||||
mouseDown: EventSimulator;
|
||||
mouseEnter: EventSimulator;
|
||||
mouseLeave: EventSimulator;
|
||||
mouseMove: EventSimulator;
|
||||
mouseOut: EventSimulator;
|
||||
mouseOver: EventSimulator;
|
||||
mouseUp: EventSimulator;
|
||||
paste: EventSimulator;
|
||||
scroll: EventSimulator;
|
||||
submit: EventSimulator;
|
||||
touchCancel: EventSimulator;
|
||||
touchEnd: EventSimulator;
|
||||
touchMove: EventSimulator;
|
||||
touchStart: EventSimulator;
|
||||
wheel: EventSimulator;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/// <reference path="react-0.12.d.ts" />
|
||||
import React = require("react/addons");
|
||||
|
||||
var isImportant: boolean;
|
||||
var isRead: boolean;
|
||||
var classSet: React.ClassSet = {
|
||||
"message": true,
|
||||
"message-important": isImportant,
|
||||
"message-read": isRead
|
||||
};
|
||||
var cx = React.addons.classSet;
|
||||
var classes: string = cx(classSet);
|
||||
|
||||
//
|
||||
// React.addons (Transitions)
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
React.createFactory(React.addons.TransitionGroup)({ component: "div" });
|
||||
React.createFactory(React.addons.CSSTransitionGroup)({
|
||||
component: React.createClass({
|
||||
render: (): React.ReactElement<any> => null
|
||||
}),
|
||||
childFactory: (c) => c,
|
||||
transitionName: "transition",
|
||||
transitionAppear: false,
|
||||
transitionEnter: true,
|
||||
transitionLeave: true
|
||||
});
|
||||
|
||||
//
|
||||
// React.addons.TestUtils
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var that: React.CompositeComponent<any, any>;
|
||||
var node = that.refs["input"].getDOMNode();
|
||||
React.addons.TestUtils.Simulate.click(node);
|
||||
React.addons.TestUtils.Simulate.change(node);
|
||||
React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter"});
|
||||
|
||||
interface GreetingProps {
|
||||
name: string;
|
||||
}
|
||||
interface GreetingState {
|
||||
morning: boolean;
|
||||
}
|
||||
interface Greeting extends React.CompositeComponent<GreetingProps, GreetingState> {
|
||||
}
|
||||
var Greeting = React.createClass({
|
||||
displayName: "Greeting",
|
||||
getInitialState: function() {
|
||||
return {morning: true};
|
||||
},
|
||||
render: function() {
|
||||
var me = <Greeting>this;
|
||||
return React.DOM.div(
|
||||
null,
|
||||
me.state.morning ? "Hello " : "Goodbye ",
|
||||
me.props.name);
|
||||
}
|
||||
});
|
||||
|
||||
var root = React.addons.TestUtils.renderIntoDocument(
|
||||
React.createElement(Greeting, {name: "John"}));
|
||||
var greeting = <Greeting>React.addons.TestUtils
|
||||
.findRenderedComponentWithType(root, Greeting);
|
||||
greeting.setState({
|
||||
morning: false
|
||||
});
|
||||
@@ -203,7 +203,7 @@ myComponent.reset();
|
||||
// Attributes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var children = ["Hello world", [null], React.DOM.span(null)];
|
||||
var children: any[] = ["Hello world", [null], React.DOM.span(null)];
|
||||
var divStyle = { // CSSProperties
|
||||
flex: "1 1 main-size",
|
||||
backgroundImage: "url('hello.png')"
|
||||
|
||||
@@ -201,7 +201,7 @@ myComponent.reset();
|
||||
// Attributes
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
var children = ["Hello world", [null], React.DOM.span(null)];
|
||||
var children: any[] = ["Hello world", [null], React.DOM.span(null)];
|
||||
var divStyle = { // CSSProperties
|
||||
flex: "1 1 main-size",
|
||||
backgroundImage: "url('hello.png')"
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/// <reference path="socket.io-client-1.2.0.d.ts"/>
|
||||
|
||||
function testUsingWithNodeHTTPServer() {
|
||||
var socket = io('http://localhost');
|
||||
socket.on('news', function (data: any) {
|
||||
console.log(data);
|
||||
socket.emit('my other event', { my: 'data' });
|
||||
});
|
||||
}
|
||||
|
||||
function testUsingWithExpress() {
|
||||
var socket = io.connect('http://localhost');
|
||||
socket.on('news', function (data: any) {
|
||||
console.log(data);
|
||||
socket.emit('my other event', { my: 'data' });
|
||||
});
|
||||
}
|
||||
|
||||
function testUsingWithTheExpressFramework() {
|
||||
var socket = io.connect('http://localhost');
|
||||
socket.on('news', function (data: any) {
|
||||
console.log(data);
|
||||
socket.emit('my other event', { my: 'data' });
|
||||
});
|
||||
}
|
||||
|
||||
function testRestrictingYourselfToANamespace() {
|
||||
var chat = io.connect('http://localhost/chat')
|
||||
, news = io.connect('http://localhost/news');
|
||||
|
||||
chat.on('connect', function () {
|
||||
chat.emit('hi!');
|
||||
});
|
||||
|
||||
news.on('news', function () {
|
||||
news.emit('woot');
|
||||
});
|
||||
}
|
||||
|
||||
function testSendingAndGettingData() {
|
||||
var socket = io();
|
||||
socket.on('connect', function () {
|
||||
socket.emit('ferret', 'tobi', function (data: any) {
|
||||
console.log(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testUsingItJustAsACrossBrowserWebSocket() {
|
||||
var socket = io('http://localhost/');
|
||||
socket.on('connect', function () {
|
||||
socket.emit('hi');
|
||||
|
||||
socket.on('message', function (msg: any) {
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Type definitions for socket.io-client 1.2.0
|
||||
// Project: http://socket.io/
|
||||
// Definitions by: PROGRE <https://github.com/progre/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var io: SocketIOClientStatic;
|
||||
|
||||
declare module 'socket.io-client' {
|
||||
export = io;
|
||||
}
|
||||
|
||||
interface SocketIOClientStatic {
|
||||
(host: string, details?: any): SocketIOClient.Socket;
|
||||
(details?: any): SocketIOClient.Socket;
|
||||
connect(host: string, details?: any): SocketIOClient.Socket;
|
||||
connect(details?: any): SocketIOClient.Socket;
|
||||
protocol: number;
|
||||
Socket: { new (...args: any[]): SocketIOClient.Socket };
|
||||
Manager: SocketIOClient.ManagerStatic;
|
||||
}
|
||||
|
||||
declare module SocketIOClient {
|
||||
interface Socket {
|
||||
on(event: string, fn: Function): Socket;
|
||||
once(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 {
|
||||
(url: string, opts: any): SocketIOClient.Manager;
|
||||
new (url: string, opts: any): SocketIOClient.Manager;
|
||||
}
|
||||
|
||||
interface Manager {
|
||||
reconnection(v: boolean): Manager;
|
||||
reconnectionAttempts(v: boolean): Manager;
|
||||
reconnectionDelay(v: boolean): Manager;
|
||||
reconnectionDelayMax(v: boolean): Manager;
|
||||
timeout(v: boolean): Manager;
|
||||
}
|
||||
}
|
||||
+641
-31
@@ -1,46 +1,656 @@
|
||||
// Type definitions for socket.io-client 1.2.0
|
||||
// Type definitions for socket.io-client 1.3.5
|
||||
// Project: http://socket.io/
|
||||
// Definitions by: PROGRE <https://github.com/progre/>
|
||||
// Definitions by: PROGRE <https://github.com/progre/>, Damian Connolly <https://github.com/divillysausages/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var io: SocketIOClientStatic;
|
||||
|
||||
declare module 'socket.io-client' {
|
||||
export = io;
|
||||
export = io;
|
||||
}
|
||||
|
||||
interface SocketIOClientStatic {
|
||||
(host: string, details?: any): SocketIOClient.Socket;
|
||||
(details?: any): SocketIOClient.Socket;
|
||||
connect(host: string, details?: any): SocketIOClient.Socket;
|
||||
connect(details?: any): SocketIOClient.Socket;
|
||||
protocol: number;
|
||||
Socket: { new (...args: any[]): SocketIOClient.Socket };
|
||||
Manager: SocketIOClient.ManagerStatic;
|
||||
|
||||
/**
|
||||
* Looks up an existing 'Manager' for multiplexing. If the user summons:
|
||||
* 'io( 'http://localhost/a' );'
|
||||
* 'io( 'http://localhost/b' );'
|
||||
*
|
||||
* We reuse the existing instance based on the same scheme/port/host, and
|
||||
* we initialize sockets for each namespace. If autoConnect isn't set to
|
||||
* false in the options, then we'll automatically connect
|
||||
* @param uri The uri that we'll connect to, including the namespace, where '/' is the default one (e.g. http://localhost:4000/somenamespace)
|
||||
* @opts Any connect options that we want to pass along
|
||||
* @return A Socket object
|
||||
*/
|
||||
( uri: string, opts?: SocketIOClient.ConnectOpts ): SocketIOClient.Socket;
|
||||
|
||||
/**
|
||||
* Auto-connects to the window location and defalt namespace.
|
||||
* E.g. window.protocol + '//' + window.host + ':80/'
|
||||
* @opts Any connect options that we want to pass along
|
||||
* @return A Socket object
|
||||
*/
|
||||
( opts?: SocketIOClient.ConnectOpts ): SocketIOClient.Socket;
|
||||
|
||||
/**
|
||||
* @see the default constructor (io(uri, opts))
|
||||
*/
|
||||
connect( uri: string, opts?: SocketIOClient.ConnectOpts ): SocketIOClient.Socket;
|
||||
|
||||
/**
|
||||
* @see the default constructor (io(opts))
|
||||
*/
|
||||
connect( opts?: SocketIOClient.ConnectOpts ): SocketIOClient.Socket;
|
||||
|
||||
/**
|
||||
* The socket.io protocol revision number this client works with
|
||||
* @default 4
|
||||
*/
|
||||
protocol: number;
|
||||
|
||||
/**
|
||||
* Socket constructor - exposed for the standalone build
|
||||
*/
|
||||
Socket: SocketIOClient.Socket;
|
||||
|
||||
/**
|
||||
* Manager constructor - exposed for the standalone build
|
||||
*/
|
||||
Manager: SocketIOClient.ManagerStatic;
|
||||
}
|
||||
|
||||
declare module SocketIOClient {
|
||||
interface Socket {
|
||||
on(event: string, fn: Function): Socket;
|
||||
once(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;
|
||||
disconnect(): void;
|
||||
connected: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base emiter class, used by Socket and Manager
|
||||
*/
|
||||
interface Emitter {
|
||||
/**
|
||||
* Adds a listener for a particular event. Calling multiple times will add
|
||||
* multiple listeners
|
||||
* @param event The event that we're listening for
|
||||
* @param fn The function to call when we get the event. Parameters depend on the
|
||||
* event in question
|
||||
* @return This Emitter
|
||||
*/
|
||||
on( event: string, fn: Function ):Emitter;
|
||||
|
||||
/**
|
||||
* @see on( event, fn )
|
||||
*/
|
||||
addEventListener( event: string, fn: Function ):Emitter;
|
||||
|
||||
/**
|
||||
* Adds a listener for a particular event that will be invoked
|
||||
* a single time before being automatically removed
|
||||
* @param event The event that we're listening for
|
||||
* @param fn The function to call when we get the event. Parameters depend on
|
||||
* the event in question
|
||||
* @return This Emitter
|
||||
*/
|
||||
once( event: string, fn: Function ):Emitter;
|
||||
|
||||
/**
|
||||
* Removes a listener for a particular type of event. This will either
|
||||
* remove a specific listener, or all listeners for this type of event
|
||||
* @param event The event that we want to remove the listener of
|
||||
* @param fn The function to remove, or null if we want to remove all functions
|
||||
* @return This Emitter
|
||||
*/
|
||||
off( event: string, fn?: Function ):Emitter;
|
||||
|
||||
/**
|
||||
* @see off( event, fn )
|
||||
*/
|
||||
removeListener( event: string, fn?: Function ):Emitter;
|
||||
|
||||
/**
|
||||
* @see off( event, fn )
|
||||
*/
|
||||
removeEventListener( event: string, fn?: Function ):Emitter;
|
||||
|
||||
/**
|
||||
* Removes all event listeners on this object
|
||||
* @return This Emitter
|
||||
*/
|
||||
removeAllListeners():Emitter;
|
||||
|
||||
/**
|
||||
* Emits 'event' with the given args
|
||||
* @param event The event that we want to emit
|
||||
* @param args Optional arguments to emit with the event
|
||||
* @return Emitter
|
||||
*/
|
||||
emit( event: string, ...args: any[] ):Emitter;
|
||||
|
||||
/**
|
||||
* Returns all the callbacks for a particular event
|
||||
* @param event The event that we're looking for the callbacks of
|
||||
* @return An array of callback Functions, or an empty array if we don't have any
|
||||
*/
|
||||
listeners( event: string ):Function[];
|
||||
|
||||
/**
|
||||
* Returns if we have listeners for a particular event
|
||||
* @param event The event that we want to check if we've listeners for
|
||||
* @return True if we have listeners for this event, false otherwise
|
||||
*/
|
||||
hasListeners( event: string ):boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Socket static interface
|
||||
*/
|
||||
interface SocketStatic {
|
||||
|
||||
/**
|
||||
* Creates a new Socket, used for communicating with a specific namespace
|
||||
* @param io The Manager that's controlling this socket
|
||||
* @param nsp The namespace that this socket is for (@default '/')
|
||||
* @return A new Socket
|
||||
*/
|
||||
( io: SocketIOClient.Manager, nsp: string ): Socket;
|
||||
|
||||
/**
|
||||
* Creates a new Socket, used for communicating with a specific namespace
|
||||
* @param io The Manager that's controlling this socket
|
||||
* @param nsp The namespace that this socket is for (@default '/')
|
||||
* @return A new Socket
|
||||
*/
|
||||
new ( url: string, opts: any ): SocketIOClient.Manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Socket that we use to connect to a Namespace on the server
|
||||
*/
|
||||
interface Socket extends Emitter {
|
||||
|
||||
/**
|
||||
* The Manager that's controller this socket
|
||||
*/
|
||||
io: SocketIOClient.Manager;
|
||||
|
||||
/**
|
||||
* The namespace that this socket is for
|
||||
* @default '/'
|
||||
*/
|
||||
nsp: string;
|
||||
|
||||
/**
|
||||
* The ID of the socket; matches the server ID and is set when we're connected, and cleared
|
||||
* when we're disconnected
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Are we currently connected?
|
||||
* @default false
|
||||
*/
|
||||
connected: boolean;
|
||||
|
||||
/**
|
||||
* Are we currently disconnected?
|
||||
* @default true
|
||||
*/
|
||||
disconnected: boolean;
|
||||
|
||||
/**
|
||||
* Opens our socket so that it connects. If the 'autoConnect' option for io is
|
||||
* true (default), then this is called automatically when the Socket is created
|
||||
*/
|
||||
open(): Socket;
|
||||
|
||||
/**
|
||||
* @see open();
|
||||
*/
|
||||
connect(): Socket;
|
||||
|
||||
/**
|
||||
* Sends a 'message' event
|
||||
* @param args Any optional arguments that we want to send
|
||||
* @see emit
|
||||
* @return This Socket
|
||||
*/
|
||||
send( ...args: any[] ):Socket;
|
||||
|
||||
/**
|
||||
* An override of the base emit. If the event is one of:
|
||||
* connect
|
||||
* connect_error
|
||||
* connect_timeout
|
||||
* disconnect
|
||||
* error
|
||||
* reconnect
|
||||
* reconnect_attempt
|
||||
* reconnect_failed
|
||||
* reconnect_error
|
||||
* reconnecting
|
||||
* then the event is emitted normally. Otherwise, if we're connected, the
|
||||
* event is sent. Otherwise, it's buffered.
|
||||
*
|
||||
* If the last argument is a function, then it will be called
|
||||
* as an 'ack' when the response is received. The parameter(s) of the
|
||||
* ack will be whatever data is returned from the event
|
||||
* @param event The event that we're emitting
|
||||
* @param args Optional arguments to send with the event
|
||||
* @return This Socket
|
||||
*/
|
||||
emit( event: string, ...args: any[] ):Socket;
|
||||
|
||||
/**
|
||||
* Disconnects the socket manually
|
||||
* @return This Socket
|
||||
*/
|
||||
close():Socket;
|
||||
|
||||
/**
|
||||
* @see close()
|
||||
*/
|
||||
disconnect():Socket;
|
||||
}
|
||||
|
||||
interface ManagerStatic {
|
||||
(url: string, opts: any): SocketIOClient.Manager;
|
||||
new (url: string, opts: any): SocketIOClient.Manager;
|
||||
}
|
||||
/**
|
||||
* The Manager static interface
|
||||
*/
|
||||
interface ManagerStatic {
|
||||
/**
|
||||
* Creates a new Manager
|
||||
* @param uri The URI that we're connecting to (e.g. http://localhost:4000)
|
||||
* @param opts Any connection options that we want to use (and pass to engine.io)
|
||||
* @return A Manager
|
||||
*/
|
||||
( uri: string, opts?: SocketIOClient.ConnectOpts ): SocketIOClient.Manager;
|
||||
|
||||
/**
|
||||
* Creates a new Manager with the default URI (window host)
|
||||
* @param opts Any connection options that we want to use (and pass to engine.io)
|
||||
*/
|
||||
( opts: SocketIOClient.ConnectOpts ):SocketIOClient.Manager;
|
||||
|
||||
/**
|
||||
* @see default constructor
|
||||
*/
|
||||
new ( uri: string, opts?: SocketIOClient.ConnectOpts ): SocketIOClient.Manager;
|
||||
|
||||
/**
|
||||
* @see default constructor
|
||||
*/
|
||||
new ( opts: SocketIOClient.ConnectOpts ):SocketIOClient.Manager;
|
||||
}
|
||||
|
||||
interface Manager {
|
||||
reconnection(v: boolean): Manager;
|
||||
reconnectionAttempts(v: boolean): Manager;
|
||||
reconnectionDelay(v: boolean): Manager;
|
||||
reconnectionDelayMax(v: boolean): Manager;
|
||||
timeout(v: boolean): Manager;
|
||||
}
|
||||
/**
|
||||
* The Manager class handles all the Namespaces and Sockets that we're using
|
||||
*/
|
||||
interface Manager extends Emitter {
|
||||
|
||||
/**
|
||||
* All the namespaces currently controlled by this Manager, and the Sockets
|
||||
* that we're using to communicate with them
|
||||
*/
|
||||
nsps: { [namespace:string]: Socket };
|
||||
|
||||
/**
|
||||
* The connect options that we used when creating this Manager
|
||||
*/
|
||||
opts: SocketIOClient.ConnectOpts;
|
||||
|
||||
/**
|
||||
* The state of the Manager. Either 'closed', 'opening', or 'open'
|
||||
*/
|
||||
readyState: string;
|
||||
|
||||
/**
|
||||
* The URI that this manager is for (host + port), e.g. 'http://localhost:4000'
|
||||
*/
|
||||
uri: string;
|
||||
|
||||
/**
|
||||
* The currently connected sockets
|
||||
*/
|
||||
connected: Socket[];
|
||||
|
||||
/**
|
||||
* If we should auto connect (also used when creating Sockets). Set via the
|
||||
* opts object
|
||||
*/
|
||||
autoConnect: boolean;
|
||||
|
||||
/**
|
||||
* Gets if we should reconnect automatically
|
||||
* @default true
|
||||
*/
|
||||
reconnection(): boolean;
|
||||
|
||||
/**
|
||||
* Sets if we should reconnect automatically
|
||||
* @param v True if we should reconnect automatically, false otherwise
|
||||
* @default true
|
||||
* @return This Manager
|
||||
*/
|
||||
reconnection( v: boolean ): Manager;
|
||||
|
||||
/**
|
||||
* Gets the number of reconnection attempts we should try before giving up
|
||||
* @default Infinity
|
||||
*/
|
||||
reconnectionAttempts(): number;
|
||||
|
||||
/**
|
||||
* Sets the number of reconnection attempts we should try before giving up
|
||||
* @param v The number of attempts we should do before giving up
|
||||
* @default Infinity
|
||||
* @return This Manager
|
||||
*/
|
||||
reconnectionAttempts( v: number ): Manager;
|
||||
|
||||
/**
|
||||
* Gets the delay in milliseconds between each reconnection attempt
|
||||
* @default 1000
|
||||
*/
|
||||
reconnectionDelay(): number;
|
||||
|
||||
/**
|
||||
* Sets the delay in milliseconds between each reconnection attempt
|
||||
* @param v The delay in milliseconds
|
||||
* @default 1000
|
||||
* @return This Manager
|
||||
*/
|
||||
reconnectionDelay( v: number ): Manager;
|
||||
|
||||
/**
|
||||
* Gets the max reconnection delay in milliseconds between each reconnection
|
||||
* attempt
|
||||
* @default 5000
|
||||
*/
|
||||
reconnectionDelayMax(): number;
|
||||
|
||||
/**
|
||||
* Sets the max reconnection delay in milliseconds between each reconnection
|
||||
* attempt
|
||||
* @param v The max reconnection dleay in milliseconds
|
||||
* @return This Manager
|
||||
*/
|
||||
reconnectionDelayMax( v: number ): Manager;
|
||||
|
||||
/**
|
||||
* Gets the randomisation factor used in the exponential backoff jitter
|
||||
* when reconnecting
|
||||
* @default 0.5
|
||||
*/
|
||||
randomizationFactor(): number;
|
||||
|
||||
/**
|
||||
* Sets the randomisation factor used in the exponential backoff jitter
|
||||
* when reconnecting
|
||||
* @param The reconnection randomisation factor
|
||||
* @default 0.5
|
||||
* @return This Manager
|
||||
*/
|
||||
randomizationFactor( v: number ): Manager;
|
||||
|
||||
/**
|
||||
* Gets the timeout in milliseconds for our connection attempts
|
||||
* @default 20000
|
||||
*/
|
||||
timeout(): number;
|
||||
|
||||
/**
|
||||
* Sets the timeout in milliseconds for our connection attempts
|
||||
* @param The connection timeout milliseconds
|
||||
* @return This Manager
|
||||
*/
|
||||
timeout(v: boolean): Manager;
|
||||
|
||||
/**
|
||||
* Sets the current transport socket and opens our connection
|
||||
* @param fn An optional callback to call when our socket has either opened, or
|
||||
* failed. It can take one optional parameter of type Error
|
||||
* @return This Manager
|
||||
*/
|
||||
open( fn?: (err?: any) => void ): Manager;
|
||||
|
||||
/**
|
||||
* @see open( fn );
|
||||
*/
|
||||
connect( fn?: (err?: any) => void ): Manager;
|
||||
|
||||
/**
|
||||
* Creates a new Socket for the given namespace
|
||||
* @param nsp The namespace that this Socket is for
|
||||
* @return A new Socket, or if one has already been created for this namespace,
|
||||
* an existing one
|
||||
*/
|
||||
socket( nsp: string ): Socket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options we can pass to the socket when connecting
|
||||
*/
|
||||
interface ConnectOpts {
|
||||
|
||||
/**
|
||||
* Should we force a new Manager for this connection?
|
||||
* @default false
|
||||
*/
|
||||
forceNew?: boolean;
|
||||
|
||||
/**
|
||||
* Should we multiplex our connection (reuse existing Manager) ?
|
||||
* @default true
|
||||
*/
|
||||
multiplex?: boolean;
|
||||
|
||||
/**
|
||||
* The path to get our client file from, in the case of the server
|
||||
* serving it
|
||||
* @default '/socket.io'
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
/**
|
||||
* Should we allow reconnections?
|
||||
* @default true
|
||||
*/
|
||||
reconnection?: boolean;
|
||||
|
||||
/**
|
||||
* How many reconnection attempts should we try?
|
||||
* @default Infinity
|
||||
*/
|
||||
reconnectionAttempts?: boolean;
|
||||
|
||||
/**
|
||||
* The time delay in milliseconds between reconnection attempts
|
||||
* @default 1000
|
||||
*/
|
||||
reconnectionDelay?: number;
|
||||
|
||||
/**
|
||||
* The max time delay in milliseconds between reconnection attempts
|
||||
* @default 5000
|
||||
*/
|
||||
reconnectionDelayMax?: number;
|
||||
|
||||
/**
|
||||
* Used in the exponential backoff jitter when reconnecting
|
||||
* @default 0.5
|
||||
*/
|
||||
randomizationFactor?: number;
|
||||
|
||||
/**
|
||||
* The timeout in milliseconds for our connection attempt
|
||||
* @default 20000
|
||||
*/
|
||||
timeout?: number;
|
||||
|
||||
/**
|
||||
* Should we automically connect?
|
||||
* @default true
|
||||
*/
|
||||
autoConnect?: boolean;
|
||||
|
||||
/**
|
||||
* The host that we're connecting to. Set from the URI passed when connecting
|
||||
*/
|
||||
host?: string;
|
||||
|
||||
/**
|
||||
* The hostname for our connection. Set from the URI passed when connecting
|
||||
*/
|
||||
hostname?: string;
|
||||
|
||||
/**
|
||||
* If this is a secure connection. Set from the URI passed when connecting
|
||||
*/
|
||||
secure?: boolean;
|
||||
|
||||
/**
|
||||
* The port for our connection. Set from the URI passed when connecting
|
||||
*/
|
||||
port?: string;
|
||||
|
||||
/**
|
||||
* Any query parameters in our uri. Set from the URI passed when connecting
|
||||
*/
|
||||
query?: Object;
|
||||
|
||||
/**
|
||||
* `http.Agent` to use, defaults to `false` (NodeJS only)
|
||||
*/
|
||||
agent?: string|boolean;
|
||||
|
||||
/**
|
||||
* Whether the client should try to upgrade the transport from
|
||||
* long-polling to something better.
|
||||
* @default true
|
||||
*/
|
||||
upgrade?: boolean;
|
||||
|
||||
/**
|
||||
* Forces JSONP for polling transport.
|
||||
*/
|
||||
forceJSONP?: boolean;
|
||||
|
||||
/**
|
||||
* Determines whether to use JSONP when necessary for polling. If
|
||||
* disabled (by settings to false) an error will be emitted (saying
|
||||
* "No transports available") if no other transports are available.
|
||||
* If another transport is available for opening a connection (e.g.
|
||||
* WebSocket) that transport will be used instead.
|
||||
* @default true
|
||||
*/
|
||||
jsonp?: boolean;
|
||||
|
||||
/**
|
||||
* Forces base 64 encoding for polling transport even when XHR2
|
||||
* responseType is available and WebSocket even if the used standard
|
||||
* supports binary.
|
||||
*/
|
||||
forceBase64?: boolean;
|
||||
|
||||
/**
|
||||
* Enables XDomainRequest for IE8 to avoid loading bar flashing with
|
||||
* click sound. default to `false` because XDomainRequest has a flaw
|
||||
* of not sending cookie.
|
||||
* @default false
|
||||
*/
|
||||
enablesXDR?: boolean;
|
||||
|
||||
/**
|
||||
* The param name to use as our timestamp key
|
||||
* @default 't'
|
||||
*/
|
||||
timestampParam?: string;
|
||||
|
||||
/**
|
||||
* Whether to add the timestamp with each transport request. Note: this
|
||||
* is ignored if the browser is IE or Android, in which case requests
|
||||
* are always stamped
|
||||
* @default false
|
||||
*/
|
||||
timestampRequests?: boolean;
|
||||
|
||||
/**
|
||||
* A list of transports to try (in order). Engine.io always attempts to
|
||||
* connect directly with the first one, provided the feature detection test
|
||||
* for it passes.
|
||||
* @default ['polling','websocket']
|
||||
*/
|
||||
transports?: string[];
|
||||
|
||||
/**
|
||||
* The port the policy server listens on
|
||||
* @default 843
|
||||
*/
|
||||
policyPost?: number;
|
||||
|
||||
/**
|
||||
* If true and if the previous websocket connection to the server succeeded,
|
||||
* the connection attempt will bypass the normal upgrade process and will
|
||||
* initially try websocket. A connection attempt following a transport error
|
||||
* will use the normal upgrade process. It is recommended you turn this on
|
||||
* only when using SSL/TLS connections, or if you know that your network does
|
||||
* not block websockets.
|
||||
* @default false
|
||||
*/
|
||||
rememberUpgrade?: boolean;
|
||||
|
||||
/**
|
||||
* Are we only interested in transports that support binary?
|
||||
*/
|
||||
onlyBinaryUpgrades?: boolean;
|
||||
|
||||
/**
|
||||
* (SSL) Certificate, Private key and CA certificates to use for SSL.
|
||||
* Can be used in Node.js client environment to manually specify
|
||||
* certificate information.
|
||||
*/
|
||||
pfx?: string;
|
||||
|
||||
/**
|
||||
* (SSL) Private key to use for SSL. Can be used in Node.js client
|
||||
* environment to manually specify certificate information.
|
||||
*/
|
||||
key?: string;
|
||||
|
||||
/**
|
||||
* (SSL) A string or passphrase for the private key or pfx. Can be
|
||||
* used in Node.js client environment to manually specify certificate
|
||||
* information.
|
||||
*/
|
||||
passphrase?: string
|
||||
|
||||
/**
|
||||
* (SSL) Public x509 certificate to use. Can be used in Node.js client
|
||||
* environment to manually specify certificate information.
|
||||
*/
|
||||
cert?: string;
|
||||
|
||||
/**
|
||||
* (SSL) An authority certificate or array of authority certificates to
|
||||
* check the remote host against.. Can be used in Node.js client
|
||||
* environment to manually specify certificate information.
|
||||
*/
|
||||
ca?: string|string[];
|
||||
|
||||
/**
|
||||
* (SSL) A string describing the ciphers to use or exclude. Consult the
|
||||
* [cipher format list]
|
||||
* (http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for
|
||||
* details on the format.. Can be used in Node.js client environment to
|
||||
* manually specify certificate information.
|
||||
*/
|
||||
ciphers?: string;
|
||||
|
||||
/**
|
||||
* (SSL) If true, the server certificate is verified against the list of
|
||||
* supplied CAs. An 'error' event is emitted if verification fails.
|
||||
* Verification happens at the connection level, before the HTTP request
|
||||
* is sent. Can be used in Node.js client environment to manually specify
|
||||
* certificate information.
|
||||
*/
|
||||
rejectUnauthorized?: boolean;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
/// <reference path="socket.io-1.2.0.d.ts"/>
|
||||
|
||||
import socketIO = require('socket.io-1.2.0');
|
||||
|
||||
function testUsingWithNodeHTTPServer() {
|
||||
var app = require('http').createServer(handler);
|
||||
var io = socketIO(app);
|
||||
var fs = require('fs');
|
||||
|
||||
app.listen(80);
|
||||
|
||||
function handler(req: any, res: any) {
|
||||
fs.readFile(__dirname + '/index.html',
|
||||
function (err: any, data: any) {
|
||||
if (err) {
|
||||
res.writeHead(500);
|
||||
return res.end('Error loading index.html');
|
||||
}
|
||||
|
||||
res.writeHead(200);
|
||||
res.end(data);
|
||||
});
|
||||
}
|
||||
|
||||
io.on('connection', function (socket) {
|
||||
socket.emit('news', { hello: 'world' });
|
||||
socket.on('my other event', function (data: any) {
|
||||
console.log(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testUsingWithExpress() {
|
||||
var app = require('express')();
|
||||
var server = require('http').Server(app);
|
||||
var io = socketIO(server);
|
||||
|
||||
server.listen(80);
|
||||
|
||||
app.get('/', function (req: any, res: any) {
|
||||
res.sendfile(__dirname + '/index.html');
|
||||
});
|
||||
|
||||
io.on('connection', function (socket) {
|
||||
socket.emit('news', { hello: 'world' });
|
||||
socket.on('my other event', function (data: any) {
|
||||
console.log(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testUsingWithTheExpressFramework() {
|
||||
var app = require('express').createServer();
|
||||
var io = socketIO(app);
|
||||
|
||||
app.listen(80);
|
||||
|
||||
app.get('/', function (req: any, res: any) {
|
||||
res.sendfile(__dirname + '/index.html');
|
||||
});
|
||||
|
||||
io.on('connection', function (socket) {
|
||||
socket.emit('news', { hello: 'world' });
|
||||
socket.on('my other event', function (data: any) {
|
||||
console.log(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testSendingAndReceivingEvents() {
|
||||
var io = socketIO(80);
|
||||
|
||||
io.on('connection', function (socket) {
|
||||
io.emit('this', { will: 'be received by everyone' });
|
||||
|
||||
socket.on('private message', function (from: any, msg: any) {
|
||||
console.log('I received a private message by ', from, ' saying ', msg);
|
||||
});
|
||||
|
||||
socket.on('disconnect', function () {
|
||||
io.sockets.emit('user disconnected');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testRestrictingYourselfToANamespace() {
|
||||
var io = socketIO.listen(80);
|
||||
var chat = io
|
||||
.of('/chat')
|
||||
.on('connection', function (socket) {
|
||||
socket.emit('a message', {
|
||||
that: 'only'
|
||||
, '/chat': 'will get'
|
||||
});
|
||||
chat.emit('a message', {
|
||||
everyone: 'in'
|
||||
, '/chat': 'will get'
|
||||
});
|
||||
});
|
||||
|
||||
var news = io
|
||||
.of('/news')
|
||||
.on('connection', function (socket) {
|
||||
socket.emit('item', { news: 'item' });
|
||||
});
|
||||
}
|
||||
|
||||
function testSendingVolatileMessages() {
|
||||
var io = socketIO.listen(80);
|
||||
|
||||
io.sockets.on('connection', function (socket) {
|
||||
var tweets = setInterval(function () {
|
||||
socket.volatile.emit('bieber tweet', {});
|
||||
}, 100);
|
||||
|
||||
socket.on('disconnect', function () {
|
||||
clearInterval(tweets);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testSendingAndGettingData() {
|
||||
var io = socketIO.listen(80);
|
||||
|
||||
io.sockets.on('connection', function (socket) {
|
||||
socket.on('ferret', function (name: any, fn: any) {
|
||||
fn('woot');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function testBroadcastingMessages() {
|
||||
var io = socketIO.listen(80);
|
||||
|
||||
io.sockets.on('connection', function (socket) {
|
||||
socket.broadcast.emit('user connected');
|
||||
});
|
||||
}
|
||||
|
||||
function testUsingItJustAsACrossBrowserWebSocket() {
|
||||
var io = socketIO.listen(80);
|
||||
|
||||
io.sockets.on('connection', function (socket) {
|
||||
socket.on('message', function () { });
|
||||
socket.on('disconnect', function () { });
|
||||
});
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
// Type definitions for socket.io 1.2.0
|
||||
// Project: http://socket.io/
|
||||
// Definitions by: PROGRE <https://github.com/progre/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../../node/node.d.ts' />
|
||||
|
||||
declare module 'socket.io-1.2.0' {
|
||||
var server: SocketIOStatic;
|
||||
|
||||
export = server;
|
||||
}
|
||||
|
||||
interface SocketIOStatic {
|
||||
(): SocketIO.Server;
|
||||
(srv: any, opts?: any): SocketIO.Server;
|
||||
(port: number, opts?: any): SocketIO.Server;
|
||||
(opts: any): SocketIO.Server;
|
||||
|
||||
listen: SocketIOStatic;
|
||||
}
|
||||
|
||||
declare module SocketIO {
|
||||
interface Server {
|
||||
serveClient(v: boolean): Server;
|
||||
path(v: string): Server;
|
||||
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;
|
||||
bind(srv: any): Server;
|
||||
onconnection(socket: any): Server;
|
||||
of(nsp: string): Namespace;
|
||||
emit(name: string, ...args: any[]): Socket;
|
||||
use(fn: Function): Namespace;
|
||||
|
||||
on(event: 'connection', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: 'connect', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: string, listener: Function): Namespace;
|
||||
}
|
||||
|
||||
interface Namespace extends NodeJS.EventEmitter {
|
||||
name: string;
|
||||
connected: { [id: string]: Socket };
|
||||
use(fn: Function): Namespace;
|
||||
in(room: string): Namespace;
|
||||
|
||||
on(event: 'connection', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: 'connect', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: string, listener: Function): Namespace;
|
||||
}
|
||||
|
||||
interface Socket {
|
||||
rooms: string[];
|
||||
client: Client;
|
||||
conn: any;
|
||||
request: any;
|
||||
id: string;
|
||||
handshake: {
|
||||
headers: any;
|
||||
time: string;
|
||||
address: any;
|
||||
xdomain: boolean;
|
||||
secure: boolean;
|
||||
issued: number;
|
||||
url: string;
|
||||
query: any;
|
||||
};
|
||||
|
||||
emit(name: string, ...args: any[]): Socket;
|
||||
join(name: string, fn?: Function): Socket;
|
||||
leave(name: string, fn?: Function): Socket;
|
||||
to(room: string): Socket;
|
||||
in(room: string): Socket;
|
||||
send(...args: any[]): Socket;
|
||||
write(...args: any[]): Socket;
|
||||
|
||||
on(event: string, listener: Function): Socket;
|
||||
once(event: string, listener: Function): Socket;
|
||||
removeListener(event: string, listener: Function): Socket;
|
||||
removeAllListeners(event: string): Socket;
|
||||
broadcast: Socket;
|
||||
volatile: Socket;
|
||||
connected: boolean;
|
||||
disconnect(close?: boolean): Socket;
|
||||
}
|
||||
|
||||
interface Client {
|
||||
conn: any;
|
||||
request: any;
|
||||
id: string;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
/// <reference path="socket.io.d.ts"/>
|
||||
|
||||
import socketIO = require('socket.io');
|
||||
|
||||
function testUsingWithNodeHTTPServer() {
|
||||
|
||||
Vendored
+802
-75
@@ -1,96 +1,823 @@
|
||||
// Type definitions for socket.io 1.2.0
|
||||
// Type definitions for socket.io 1.3.5
|
||||
// Project: http://socket.io/
|
||||
// Definitions by: PROGRE <https://github.com/progre/>
|
||||
// Definitions by: PROGRE <https://github.com/progre/>, Damian Connolly <https://github.com/divillysausages/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../node/node.d.ts' />
|
||||
|
||||
declare module 'socket.io' {
|
||||
var server: SocketIOStatic;
|
||||
var server: SocketIOStatic;
|
||||
|
||||
export = server;
|
||||
export = server;
|
||||
}
|
||||
|
||||
interface SocketIOStatic {
|
||||
(): SocketIO.Server;
|
||||
(srv: any, opts?: any): SocketIO.Server;
|
||||
(port: number, opts?: any): SocketIO.Server;
|
||||
(opts: any): SocketIO.Server;
|
||||
/**
|
||||
* Default Server constructor
|
||||
*/
|
||||
(): SocketIO.Server;
|
||||
|
||||
/**
|
||||
* Creates a new Server
|
||||
* @param srv The HTTP server that we're going to bind to
|
||||
* @param opts An optional parameters object
|
||||
*/
|
||||
(srv: any, opts?: SocketIO.ServerOptions): SocketIO.Server;
|
||||
|
||||
/**
|
||||
* Creates a new Server
|
||||
* @param port A port to bind to, as a number, or a string
|
||||
* @param An optional parameters object
|
||||
*/
|
||||
(port: string|number, opts?: SocketIO.ServerOptions): SocketIO.Server;
|
||||
|
||||
/**
|
||||
* Creates a new Server
|
||||
* @param A parameters object
|
||||
*/
|
||||
(opts: SocketIO.ServerOptions): SocketIO.Server;
|
||||
|
||||
/**
|
||||
* Backwards compatibility
|
||||
* @see io().listen()
|
||||
*/
|
||||
listen: SocketIOStatic;
|
||||
}
|
||||
|
||||
declare module SocketIO {
|
||||
interface Server {
|
||||
serveClient(v: boolean): Server;
|
||||
path(v: string): Server;
|
||||
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;
|
||||
bind(srv: any): Server;
|
||||
onconnection(socket: any): Server;
|
||||
of(nsp: string): Namespace;
|
||||
emit(name: string, ...args: any[]): Socket;
|
||||
use(fn: Function): Namespace;
|
||||
|
||||
interface Server {
|
||||
|
||||
/**
|
||||
* A dictionary of all the namespaces currently on this Server
|
||||
*/
|
||||
nsps: {[namespace: string]: Namespace};
|
||||
|
||||
/**
|
||||
* The default '/' Namespace
|
||||
*/
|
||||
sockets: Namespace;
|
||||
|
||||
/**
|
||||
* Sets the 'json' flag when emitting an event
|
||||
*/
|
||||
json: Server;
|
||||
|
||||
/**
|
||||
* Server request verification function, that checks for allowed origins
|
||||
* @param req The http.IncomingMessage request
|
||||
* @param fn The callback to be called. It should take one parameter, err,
|
||||
* which will be null if there was no problem, and one parameter, success,
|
||||
* of type boolean
|
||||
*/
|
||||
checkRequest( req:any, fn:( err: any, success: boolean ) => void ):void;
|
||||
|
||||
/**
|
||||
* Gets whether we're serving the client.js file or not
|
||||
* @default true
|
||||
*/
|
||||
serveClient(): boolean;
|
||||
|
||||
/**
|
||||
* Sets whether we're serving the client.js file or not
|
||||
* @param v True if we want to serve the file, false otherwise
|
||||
* @default true
|
||||
* @return This Server
|
||||
*/
|
||||
serveClient( v: boolean ): Server;
|
||||
|
||||
/**
|
||||
* Gets the client serving path
|
||||
* @default '/socket.io'
|
||||
*/
|
||||
path(): string;
|
||||
|
||||
/**
|
||||
* Sets the client serving path
|
||||
* @param v The path to serve the client file on
|
||||
* @default '/socket.io'
|
||||
* @return This Server
|
||||
*/
|
||||
path( v: string ): Server;
|
||||
|
||||
/**
|
||||
* Gets the adapter that we're going to use for handling rooms
|
||||
* @default typeof Adapter
|
||||
*/
|
||||
adapter(): any;
|
||||
|
||||
/**
|
||||
* Sets the adapter (class) that we're going to use for handling rooms
|
||||
* @param v The class for the adapter to create
|
||||
* @default typeof Adapter
|
||||
* @return This Server
|
||||
*/
|
||||
adapter( v: any ): Server;
|
||||
|
||||
/**
|
||||
* Gets the allowed origins for requests
|
||||
* @default "*:*"
|
||||
*/
|
||||
origins(): string;
|
||||
|
||||
/**
|
||||
* Sets the allowed origins for requests
|
||||
* @param v The allowed origins, in host:port form
|
||||
* @default "*:*"
|
||||
* return This Server
|
||||
*/
|
||||
origins( v: string ): Server;
|
||||
|
||||
/**
|
||||
* Attaches socket.io to a server
|
||||
* @param srv The http.Server that we want to attach to
|
||||
* @param opts An optional parameters object
|
||||
* @return This Server
|
||||
*/
|
||||
attach( srv: any, opts?: ServerOptions ): Server;
|
||||
|
||||
/**
|
||||
* Attaches socket.io to a port
|
||||
* @param port The port that we want to attach to
|
||||
* @param opts An optional parameters object
|
||||
* @return This Server
|
||||
*/
|
||||
attach( port: number, opts?: ServerOptions ): Server;
|
||||
|
||||
/**
|
||||
* @see attach( srv, opts )
|
||||
*/
|
||||
listen( srv: any, opts?: ServerOptions ): Server;
|
||||
|
||||
/**
|
||||
* @see attach( port, opts )
|
||||
*/
|
||||
listen( port: number, opts?: ServerOptions ): Server;
|
||||
|
||||
/**
|
||||
* Binds socket.io to an engine.io intsance
|
||||
* @param src The Engine.io (or compatible) server to bind to
|
||||
* @return This Server
|
||||
*/
|
||||
bind( srv: any ): Server;
|
||||
|
||||
/**
|
||||
* Called with each incoming connection
|
||||
* @param socket The Engine.io Socket
|
||||
* @return This Server
|
||||
*/
|
||||
onconnection( socket: any ): Server;
|
||||
|
||||
/**
|
||||
* Looks up/creates a Namespace
|
||||
* @param nsp The name of the NameSpace to look up/create. Should start
|
||||
* with a '/'
|
||||
* @return The Namespace
|
||||
*/
|
||||
of( nsp: string ): Namespace;
|
||||
|
||||
/**
|
||||
* Closes the server connection
|
||||
*/
|
||||
close():void;
|
||||
|
||||
on(event: 'connection', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: 'connect', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: string, listener: Function): Namespace;
|
||||
}
|
||||
/**
|
||||
* The event fired when we get a new connection
|
||||
* @param event The event being fired: 'connection'
|
||||
* @param listener A listener that should take one parameter of type Socket
|
||||
* @return The default '/' Namespace
|
||||
*/
|
||||
on( event: 'connection', listener: ( socket: Socket ) => void ): Namespace;
|
||||
|
||||
/**
|
||||
* @see on( 'connection', listener )
|
||||
*/
|
||||
on( event: 'connect', listener: ( socket: Socket ) => void ): Namespace;
|
||||
|
||||
/**
|
||||
* Base 'on' method to add a listener for an event
|
||||
* @param event The event that we want to add a listener for
|
||||
* @param listener The callback to call when we get the event. The parameters
|
||||
* for the callback depend on the event
|
||||
* @return The default '/' Namespace
|
||||
*/
|
||||
on( event: string, listener: Function ): Namespace;
|
||||
|
||||
/**
|
||||
* Targets a room when emitting to the default '/' Namespace
|
||||
* @param room The name of the room that we're targeting
|
||||
* @return The default '/' Namespace
|
||||
*/
|
||||
to( room: string ): Namespace;
|
||||
|
||||
/**
|
||||
* @see to( room )
|
||||
*/
|
||||
in( room: string ): Namespace;
|
||||
|
||||
/**
|
||||
* Registers a middleware function, which is a function that gets executed
|
||||
* for every incoming Socket, on the default '/' Namespace
|
||||
* @param fn The function to call when we get a new incoming socket. It should
|
||||
* take one parameter of type Socket, and one callback function to call to
|
||||
* execute the next middleware function. The callback can take one optional
|
||||
* parameter, err, if there was an error. Errors passed to middleware callbacks
|
||||
* are sent as special 'error' packets to clients
|
||||
* @return The default '/' Namespace
|
||||
*/
|
||||
use( fn: ( socket:Socket, fn: ( err?: any ) => void ) =>void ): Namespace;
|
||||
|
||||
/**
|
||||
* Emits an event to the default Namespace
|
||||
* @param event The event that we want to emit
|
||||
* @param args Any number of optional arguments to pass with the event. If the
|
||||
* last argument is a function, it will be called as an ack. The ack should
|
||||
* take whatever data was sent with the packet
|
||||
* @return The default '/' Namespace
|
||||
*/
|
||||
emit( event: string, ...args: any[]): Namespace;
|
||||
|
||||
/**
|
||||
* Sends a 'message' event
|
||||
* @see emit( event, ...args )
|
||||
* @return The default '/' Namespace
|
||||
*/
|
||||
send( ...args: any[] ): Namespace;
|
||||
|
||||
/**
|
||||
* @see send( ...args )
|
||||
*/
|
||||
write( ...args: any[] ): Namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options to pass to our server when creating it
|
||||
*/
|
||||
interface ServerOptions {
|
||||
|
||||
/**
|
||||
* The path to server the client file to
|
||||
* @default '/socket.io'
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
/**
|
||||
* Should we serve the client file?
|
||||
* @default true
|
||||
*/
|
||||
serveClient?: boolean;
|
||||
|
||||
/**
|
||||
* The adapter to use for handling rooms. NOTE: this should be a class,
|
||||
* not an object
|
||||
* @default typeof Adapter
|
||||
*/
|
||||
adapter?: Adapter;
|
||||
|
||||
/**
|
||||
* Accepted origins
|
||||
* @default '*:*'
|
||||
*/
|
||||
origins?: string;
|
||||
|
||||
/**
|
||||
* How many milliseconds without a pong packed to consider the connection closed (engine.io)
|
||||
* @default 60000
|
||||
*/
|
||||
pingTimeout?: number;
|
||||
|
||||
/**
|
||||
* How many milliseconds before sending a new ping packet (keep-alive) (engine.io)
|
||||
* @default 25000
|
||||
*/
|
||||
pingInterval?: number;
|
||||
|
||||
/**
|
||||
* How many bytes or characters a message can be when polling, before closing the session
|
||||
* (to avoid Dos) (engine.io)
|
||||
* @default 10E7
|
||||
*/
|
||||
maxHttpBufferSize?: number;
|
||||
|
||||
/**
|
||||
* A function that receives a given handshake or upgrade request as its first parameter,
|
||||
* and can decide whether to continue or not. The second argument is a function that needs
|
||||
* to be called with the decided information: fn( err, success ), where success is a boolean
|
||||
* value where false means that the request is rejected, and err is an error code (engine.io)
|
||||
* @default null
|
||||
*/
|
||||
allowRequest?: (request:any, callback: (err: number, success: boolean) => void) => void;
|
||||
|
||||
/**
|
||||
* Transports to allow connections to (engine.io)
|
||||
* @default ['polling','websocket']
|
||||
*/
|
||||
transports?: string[];
|
||||
|
||||
/**
|
||||
* Whether to allow transport upgrades (engine.io)
|
||||
* @default true
|
||||
*/
|
||||
allowUpgrades?: boolean;
|
||||
|
||||
/**
|
||||
* parameters of the WebSocket permessage-deflate extension (see ws module).
|
||||
* Set to false to disable (engine.io)
|
||||
* @default true
|
||||
*/
|
||||
perMessageDeflate?: Object|boolean;
|
||||
|
||||
/**
|
||||
* Parameters of the http compression for the polling transports (see zlib).
|
||||
* Set to false to disable, or set an object with parameter "threshold:number"
|
||||
* to only compress data if the byte size is above this value (1024) (engine.io)
|
||||
* @default true|1024
|
||||
*/
|
||||
httpCompression?: Object|boolean;
|
||||
|
||||
/**
|
||||
* Name of the HTTP cookie that contains the client sid to send as part of
|
||||
* handshake response headers. Set to false to not send one (engine.io)
|
||||
* @default "io"
|
||||
*/
|
||||
cookie?: string|boolean;
|
||||
}
|
||||
|
||||
interface Namespace extends NodeJS.EventEmitter {
|
||||
name: string;
|
||||
connected: { [id: string]: Socket };
|
||||
use(fn: Function): Namespace;
|
||||
in(room: string): Namespace;
|
||||
/**
|
||||
* The Namespace, sandboxed environments for sockets, each connection
|
||||
* to a Namespace requires a new Socket
|
||||
*/
|
||||
interface Namespace extends NodeJS.EventEmitter {
|
||||
|
||||
/**
|
||||
* The name of the NameSpace
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* The controller Server for this Namespace
|
||||
*/
|
||||
server: Server;
|
||||
|
||||
/**
|
||||
* A list of all the Sockets connected to this Namespace
|
||||
*/
|
||||
sockets: Socket[];
|
||||
|
||||
/**
|
||||
* A dictionary of all the Sockets connected to this Namespace, where
|
||||
* the Socket ID is the key
|
||||
*/
|
||||
connected: { [id: string]: Socket };
|
||||
|
||||
/**
|
||||
* The Adapter that we're using to handle dealing with rooms etc
|
||||
*/
|
||||
adapter: Adapter;
|
||||
|
||||
/**
|
||||
* Sets the 'json' flag when emitting an event
|
||||
*/
|
||||
json: Namespace;
|
||||
|
||||
/**
|
||||
* Registers a middleware function, which is a function that gets executed
|
||||
* for every incoming Socket
|
||||
* @param fn The function to call when we get a new incoming socket. It should
|
||||
* take one parameter of type Socket, and one callback function to call to
|
||||
* execute the next middleware function. The callback can take one optional
|
||||
* parameter, err, if there was an error. Errors passed to middleware callbacks
|
||||
* are sent as special 'error' packets to clients
|
||||
* @return This Namespace
|
||||
*/
|
||||
use( fn: ( socket:Socket, fn: ( err?: any ) => void ) =>void ): Namespace;
|
||||
|
||||
/**
|
||||
* Targets a room when emitting
|
||||
* @param room The name of the room that we're targeting
|
||||
* @return This Namespace
|
||||
*/
|
||||
to( room: string ): Namespace;
|
||||
|
||||
/**
|
||||
* @see to( room )
|
||||
*/
|
||||
in( room: string ): Namespace;
|
||||
|
||||
/**
|
||||
* Sends a 'message' event
|
||||
* @see emit( event, ...args )
|
||||
* @return This Namespace
|
||||
*/
|
||||
send( ...args: any[] ): Namespace;
|
||||
|
||||
/**
|
||||
* @see send( ...args )
|
||||
*/
|
||||
write( ...args: any[] ): Namespace;
|
||||
|
||||
on(event: 'connection', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: 'connect', listener: (socket: Socket) => void): Namespace;
|
||||
on(event: string, listener: Function): Namespace;
|
||||
}
|
||||
/**
|
||||
* The event fired when we get a new connection
|
||||
* @param event The event being fired: 'connection'
|
||||
* @param listener A listener that should take one parameter of type Socket
|
||||
* @return This Namespace
|
||||
*/
|
||||
on( event: 'connection', listener: ( socket: Socket ) => void ): Namespace;
|
||||
|
||||
/**
|
||||
* @see on( 'connection', listener )
|
||||
*/
|
||||
on( event: 'connect', listener: ( socket: Socket ) => void ): Namespace;
|
||||
|
||||
/**
|
||||
* Base 'on' method to add a listener for an event
|
||||
* @param event The event that we want to add a listener for
|
||||
* @param listener The callback to call when we get the event. The parameters
|
||||
* for the callback depend on the event
|
||||
* @ This Namespace
|
||||
*/
|
||||
on( event: string, listener: Function ): Namespace;
|
||||
}
|
||||
|
||||
interface Socket {
|
||||
rooms: string[];
|
||||
client: Client;
|
||||
conn: any;
|
||||
request: any;
|
||||
id: string;
|
||||
handshake: {
|
||||
headers: any;
|
||||
time: string;
|
||||
address: any;
|
||||
xdomain: boolean;
|
||||
secure: boolean;
|
||||
issued: number;
|
||||
url: string;
|
||||
query: any;
|
||||
};
|
||||
/**
|
||||
* The socket, which handles our connection for a namespace. NOTE: while
|
||||
* we technically extend NodeJS.EventEmitter, we're not putting it here
|
||||
* as we have a problem with the emit() event (as it's overridden with a
|
||||
* different return)
|
||||
*/
|
||||
interface Socket {
|
||||
|
||||
/**
|
||||
* The namespace that this socket is for
|
||||
*/
|
||||
nsp: Namespace;
|
||||
|
||||
/**
|
||||
* The Server that our namespace is in
|
||||
*/
|
||||
server: Server;
|
||||
|
||||
/**
|
||||
* The Adapter that we use to handle our rooms
|
||||
*/
|
||||
adapter: Adapter;
|
||||
|
||||
/**
|
||||
* The unique ID for this Socket. Regenerated at every connection. This is
|
||||
* also the name of the room that the Socket automatically joins on connection
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The http.IncomingMessage request sent with the connection. Useful
|
||||
* for recovering headers etc
|
||||
*/
|
||||
request: any;
|
||||
|
||||
/**
|
||||
* The Client associated with this Socket
|
||||
*/
|
||||
client: Client;
|
||||
|
||||
/**
|
||||
* The underlying Engine.io Socket instance
|
||||
*/
|
||||
conn: {
|
||||
|
||||
/**
|
||||
* The ID for this socket - matches Client.id
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The Engine.io Server for this socket
|
||||
*/
|
||||
server: any;
|
||||
|
||||
/**
|
||||
* The ready state for the client. Either 'opening', 'open', 'closing', or 'closed'
|
||||
*/
|
||||
readyState: string;
|
||||
|
||||
/**
|
||||
* The remote IP for this connection
|
||||
*/
|
||||
remoteAddress: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* The list of rooms that this Socket is currently in
|
||||
*/
|
||||
rooms: string[];
|
||||
|
||||
/**
|
||||
* Is the Socket currently connected?
|
||||
*/
|
||||
connected: boolean;
|
||||
|
||||
/**
|
||||
* Is the Socket currently disconnected?
|
||||
*/
|
||||
disconnected: boolean;
|
||||
|
||||
/**
|
||||
* The object used when negociating the handshake
|
||||
*/
|
||||
handshake: {
|
||||
/**
|
||||
* The headers passed along with the request. e.g. 'host',
|
||||
* 'connection', 'accept', 'referer', 'cookie'
|
||||
*/
|
||||
headers: any;
|
||||
|
||||
/**
|
||||
* The current time, as a string
|
||||
*/
|
||||
time: string;
|
||||
|
||||
/**
|
||||
* The remote address of the connection request
|
||||
*/
|
||||
address: string;
|
||||
|
||||
/**
|
||||
* Is this a cross-domain request?
|
||||
*/
|
||||
xdomain: boolean;
|
||||
|
||||
/**
|
||||
* Is this a secure request?
|
||||
*/
|
||||
secure: boolean;
|
||||
|
||||
/**
|
||||
* The timestamp for when this was issued
|
||||
*/
|
||||
issued: number;
|
||||
|
||||
/**
|
||||
* The request url
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* Any query string parameters in the request url
|
||||
*/
|
||||
query: any;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the 'json' flag when emitting an event
|
||||
*/
|
||||
json: Socket;
|
||||
|
||||
/**
|
||||
* Sets the 'volatile' flag when emitting an event. Volatile messages are
|
||||
* messages that can be dropped because of network issues and the like. Use
|
||||
* for high-volume/real-time messages where you don't need to receive *all*
|
||||
* of them
|
||||
*/
|
||||
volatile: Socket;
|
||||
|
||||
/**
|
||||
* Sets the 'broadcast' flag when emitting an event. Broadcasting an event
|
||||
* will send it to all the other sockets in the namespace except for yourself
|
||||
*/
|
||||
broadcast: Socket;
|
||||
|
||||
/**
|
||||
* Emits an event to this client. If the 'broadcast' flag was set, this will
|
||||
* emit to all other clients, except for this one
|
||||
* @param event The event that we want to emit
|
||||
* @param args Any number of optional arguments to pass with the event. If the
|
||||
* last argument is a function, it will be called as an ack. The ack should
|
||||
* take whatever data was sent with the packet
|
||||
* @return This Socket
|
||||
*/
|
||||
emit( event: string, ...args: any[]): Socket;
|
||||
|
||||
/**
|
||||
* Targets a room when broadcasting
|
||||
* @param room The name of the room that we're targeting
|
||||
* @return This Socket
|
||||
*/
|
||||
to( room: string ): Socket;
|
||||
|
||||
/**
|
||||
* @see to( room )
|
||||
*/
|
||||
in( room: string ): Socket;
|
||||
|
||||
/**
|
||||
* Sends a 'message' event
|
||||
* @see emit( event, ...args )
|
||||
*/
|
||||
send( ...args: any[] ): Socket;
|
||||
|
||||
/**
|
||||
* @see send( ...args )
|
||||
*/
|
||||
write( ...args: any[] ): Socket;
|
||||
|
||||
/**
|
||||
* Joins a room. You can join multiple rooms, and by default, on connection,
|
||||
* you join a room with the same name as your ID
|
||||
* @param name The name of the room that we want to join
|
||||
* @param fn An optional callback to call when we've joined the room. It should
|
||||
* take an optional parameter, err, of a possible error
|
||||
* @return This Socket
|
||||
*/
|
||||
join( name: string, fn?: ( err?: any ) => void ): Socket;
|
||||
|
||||
/**
|
||||
* Leaves a room
|
||||
* @param name The name of the room to leave
|
||||
* @param fn An optional callback to call when we've left the room. It should
|
||||
* take on optional parameter, err, of a possible error
|
||||
*/
|
||||
leave( name: string, fn?: Function ): Socket;
|
||||
|
||||
/**
|
||||
* Leaves all the rooms that we've joined
|
||||
*/
|
||||
leaveAll(): void;
|
||||
|
||||
/**
|
||||
* Disconnects this Socket
|
||||
* @param close If true, also closes the underlying connection
|
||||
* @return This Socket
|
||||
*/
|
||||
disconnect( close: boolean ): Socket;
|
||||
|
||||
/**
|
||||
* Adds a listener for a particular event. Calling multiple times will add
|
||||
* multiple listeners
|
||||
* @param event The event that we're listening for
|
||||
* @param fn The function to call when we get the event. Parameters depend on the
|
||||
* event in question
|
||||
* @return This Socket
|
||||
*/
|
||||
on( event: string, fn: Function ): Socket;
|
||||
|
||||
/**
|
||||
* @see on( event, fn )
|
||||
*/
|
||||
addListener( event: string, fn: Function ): Socket;
|
||||
|
||||
/**
|
||||
* Adds a listener for a particular event that will be invoked
|
||||
* a single time before being automatically removed
|
||||
* @param event The event that we're listening for
|
||||
* @param fn The function to call when we get the event. Parameters depend on
|
||||
* the event in question
|
||||
* @return This Socket
|
||||
*/
|
||||
once( event: string, fn: Function ): Socket;
|
||||
|
||||
/**
|
||||
* Removes a listener for a particular type of event. This will either
|
||||
* remove a specific listener, or all listeners for this type of event
|
||||
* @param event The event that we want to remove the listener of
|
||||
* @param fn The function to remove, or null if we want to remove all functions
|
||||
* @return This Socket
|
||||
*/
|
||||
removeListener( event: string, fn?: Function ): Socket;
|
||||
|
||||
/**
|
||||
* Removes all event listeners on this object
|
||||
* @return This Socket
|
||||
*/
|
||||
removeAllListeners(): Socket;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of listeners this instance can have
|
||||
* @param n The max number of listeners we can add to this emitter
|
||||
* @return This Socket
|
||||
*/
|
||||
setMaxListeners( n: number ): Socket;
|
||||
|
||||
/**
|
||||
* Returns all the callbacks for a particular event
|
||||
* @param event The event that we're looking for the callbacks of
|
||||
* @return An array of callback Functions, or an empty array if we don't have any
|
||||
*/
|
||||
listeners( event: string ):Function[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface used when dealing with rooms etc
|
||||
*/
|
||||
interface Adapter extends NodeJS.EventEmitter {
|
||||
|
||||
/**
|
||||
* The namespace that this adapter is for
|
||||
*/
|
||||
nsp: Namespace;
|
||||
|
||||
/**
|
||||
* A dictionary of all the rooms that we have in this namespace, each room
|
||||
* a dictionary of all the sockets currently in that room
|
||||
*/
|
||||
rooms: {[room: string]: {[id: string]: boolean }};
|
||||
|
||||
/**
|
||||
* A dictionary of all the socket ids that we're dealing with, and all
|
||||
* the rooms that the socket is currently in
|
||||
*/
|
||||
sids: {[id: string]: {[room: string]: boolean}};
|
||||
|
||||
/**
|
||||
* Adds a socket to a room. If the room doesn't exist, it's created
|
||||
* @param id The ID of the socket to add
|
||||
* @param room The name of the room to add the socket to
|
||||
* @param callback An optional callback to call when the socket has been
|
||||
* added. It should take an optional parameter, error, if there was a problem
|
||||
*/
|
||||
add( id: string, room: string, callback?: ( err?: any ) => void ): void;
|
||||
|
||||
/**
|
||||
* Removes a socket from a room. If there are no more sockets in the room,
|
||||
* the room is deleted
|
||||
* @param id The ID of the socket that we're removing
|
||||
* @param room The name of the room to remove the socket from
|
||||
* @param callback An optional callback to call when the socket has been
|
||||
* removed. It should take on optional parameter, error, if there was a problem
|
||||
*/
|
||||
del( id: string, room: string, callback?: ( err?: any ) => void ): void;
|
||||
|
||||
/**
|
||||
* Removes a socket from all the rooms that it's joined
|
||||
* @param id The ID of the socket that we're removing
|
||||
*/
|
||||
delAll( id: string ):void;
|
||||
|
||||
/**
|
||||
* Broadcasts a packet
|
||||
* @param packet The packet to broadcast
|
||||
* @param opts Any options to send along:
|
||||
* - rooms: An optional list of rooms to broadcast to. If empty, the packet is broadcast to all sockets
|
||||
* - except: A list of Socket IDs to exclude
|
||||
* - flags: Any flags that we want to send along ('json', 'volatile', 'broadcast')
|
||||
*/
|
||||
broadcast( packet: any, opts: { rooms?: string[]; except?: string[]; flags?: {[flag: string]: boolean} } ):void;
|
||||
}
|
||||
|
||||
emit(name: string, ...args: any[]): Socket;
|
||||
join(name: string, fn?: Function): Socket;
|
||||
leave(name: string, fn?: Function): Socket;
|
||||
to(room: string): Socket;
|
||||
in(room: string): Socket;
|
||||
send(...args: any[]): Socket;
|
||||
write(...args: any[]): Socket;
|
||||
|
||||
on(event: string, listener: Function): Socket;
|
||||
once(event: string, listener: Function): Socket;
|
||||
removeListener(event: string, listener: Function): Socket;
|
||||
removeAllListeners(event: string): Socket;
|
||||
broadcast: Socket;
|
||||
volatile: Socket;
|
||||
connected: boolean;
|
||||
disconnect(close?: boolean): Socket;
|
||||
}
|
||||
|
||||
interface Client {
|
||||
conn: any;
|
||||
request: any;
|
||||
id: string;
|
||||
}
|
||||
/**
|
||||
* The client behind each socket (can have multiple sockets)
|
||||
*/
|
||||
interface Client {
|
||||
/**
|
||||
* The Server that this client belongs to
|
||||
*/
|
||||
server: Server;
|
||||
|
||||
/**
|
||||
* The underlying Engine.io Socket instance
|
||||
*/
|
||||
conn: {
|
||||
|
||||
/**
|
||||
* The ID for this socket - matches Client.id
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The Engine.io Server for this socket
|
||||
*/
|
||||
server: any;
|
||||
|
||||
/**
|
||||
* The ready state for the client. Either 'opening', 'open', 'closing', or 'closed'
|
||||
*/
|
||||
readyState: string;
|
||||
|
||||
/**
|
||||
* The remote IP for this connection
|
||||
*/
|
||||
remoteAddress: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* The ID for this client. Regenerated at every connection
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The http.IncomingMessage request sent with the connection. Useful
|
||||
* for recovering headers etc
|
||||
*/
|
||||
request: any;
|
||||
|
||||
/**
|
||||
* The list of sockets currently connect via this client (i.e. to different
|
||||
* namespaces)
|
||||
*/
|
||||
sockets: Socket[];
|
||||
|
||||
/**
|
||||
* A dictionary of all the namespaces for this client, with the Socket that
|
||||
* deals with that namespace
|
||||
*/
|
||||
nsps: {[nsp: string]: Socket};
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-26
@@ -3,29 +3,4 @@
|
||||
// Definitions by: Kevin Barabash <https://github.com/kevinb7>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface TouchEvent extends UIEvent {
|
||||
touches: TouchList;
|
||||
targetTouches: TouchList;
|
||||
changedTouches: TouchList;
|
||||
altKey: boolean;
|
||||
metaKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
|
||||
interface TouchList {
|
||||
length: number;
|
||||
item: (index: number) => Touch;
|
||||
[index: number]: Touch;
|
||||
}
|
||||
|
||||
interface Touch {
|
||||
identifier: number;
|
||||
target: EventTarget;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
// DEPRECATED: use TypeScript 1.5.3
|
||||
|
||||
-6
@@ -592,12 +592,6 @@ declare module TypeScript.Collections {
|
||||
function createHashTable<TKey, TValue>(capacity?: number, hash?: (k: TKey) => number): HashTable<TKey, TValue>;
|
||||
function identityHashCode(value: any): number;
|
||||
}
|
||||
declare class Enumerator {
|
||||
public atEnd(): boolean;
|
||||
public moveNext(): boolean;
|
||||
public item(): any;
|
||||
constructor(o: any);
|
||||
}
|
||||
declare module TypeScript {
|
||||
var nodeMakeDirectoryTime: number;
|
||||
var nodeCreateBufferTime: number;
|
||||
|
||||
@@ -534,7 +534,7 @@ describe('dest stream', function () {
|
||||
|
||||
|
||||
|
||||
// This test is from
|
||||
// This test is from
|
||||
|
||||
|
||||
var chmodSpy = spies.chmodSpy;
|
||||
@@ -909,4 +909,4 @@ describe('symlink stream', function () {
|
||||
stream.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
-250
@@ -1,250 +0,0 @@
|
||||
// Type definitions for Web Audio API
|
||||
// Project: http://www.w3.org/TR/2012/WD-webaudio-20120802/
|
||||
// Definitions by: Baruch Berger <https://github.com/bbss>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Conforms to the: http://www.w3.org/TR/2012/WD-webaudio-20120802/ specification
|
||||
// Currently only implemented in WebKit browsers
|
||||
|
||||
interface webkitAudioContext {
|
||||
destination: AudioDestinationNode;
|
||||
sampleRate: number;
|
||||
currentTime: number;
|
||||
listener: AudioListener;
|
||||
activeSourceCount: number;
|
||||
|
||||
createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;
|
||||
createBuffer(buffer: ArrayBuffer, mixToMono: boolean): AudioBuffer;
|
||||
|
||||
decodeAudioData(audioData: ArrayBuffer, successCallback: any, errorCallback?: any): void;
|
||||
|
||||
createBufferSource(): AudioBufferSourceNode;
|
||||
|
||||
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
|
||||
|
||||
createMediaStreamSource(mediaStream: any): MediaStreamAudioSourceNode;
|
||||
|
||||
createAnalyser(): RealtimeAnalyserNode;
|
||||
createGainNode(): AudioGainNode;
|
||||
createDelayNode(maxDelayTime?: number): DelayNode;
|
||||
createBiquadFilter(): BiquadFilterNode;
|
||||
createPanner():AudioPannerNode;
|
||||
createConvolver(): ConvolverNode;
|
||||
|
||||
createChannelSplitter(numberOfOutputs?: number):AudioChannelSplitter;
|
||||
createChannelMerger(numberOfInputs?: number): AudioChannelMerger;
|
||||
|
||||
createDynamicsCompressor(): DynamicsCompressorNode;
|
||||
|
||||
createOscillator(): Oscillator;
|
||||
createWaveTable(real: any,imag: any): WaveTable;
|
||||
}
|
||||
|
||||
declare var webkitAudioContext: {
|
||||
|
||||
new (): webkitAudioContext;
|
||||
|
||||
}
|
||||
|
||||
interface Oscillator extends AudioSourceNode {
|
||||
|
||||
type: number;
|
||||
playbackState: number;
|
||||
frequency: AudioParam;
|
||||
detune: AudioParam;
|
||||
noteOn(when: number): void;
|
||||
noteOff(when: number): void;
|
||||
setWaveTable(waveTable: WaveTable): void;
|
||||
|
||||
}
|
||||
|
||||
interface AudioDestinationNode extends AudioNode {
|
||||
|
||||
maxNumberOfChannels: number;
|
||||
numberOfChannels: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioNode {
|
||||
|
||||
connect(destination: AudioNode, output?: number, input?: number): void;
|
||||
connect(destination: AudioParam, output?: number): void;
|
||||
disconnect(output?: number): void;
|
||||
context: webkitAudioContext;
|
||||
numberOfInputs: number;
|
||||
numberOfOutputs: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioSourceNode extends AudioNode {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface AudioParam {
|
||||
|
||||
value: number;
|
||||
minValue: number;
|
||||
maxValue: number;
|
||||
defaultValue: number;
|
||||
setValueAtTime(value: number, time: number): void;
|
||||
linearRampToValueAtTime(value: number, time: number): void;
|
||||
exponentialRampToValueAtTime(value: number, time: number): void;
|
||||
setTargetValueAtTime(targetValue: number,time: number, timeConstant: number): void;
|
||||
setValueCurveAtTime(values: number[], time: number, duration: number): void;
|
||||
cancelScheduledValues(startTime: number): void;
|
||||
|
||||
}
|
||||
|
||||
interface AudioGain extends AudioParam {
|
||||
|
||||
}
|
||||
|
||||
interface AudioGainNode extends AudioNode {
|
||||
|
||||
gain: AudioGain;
|
||||
|
||||
}
|
||||
|
||||
interface DelayNode extends AudioNode {
|
||||
|
||||
delayTime: AudioParam;
|
||||
|
||||
}
|
||||
|
||||
interface AudioBuffer {
|
||||
|
||||
sampleRate: number;
|
||||
length: number;
|
||||
duration: number;
|
||||
numberOfChannels: number;
|
||||
getChannelData(channel: number): any;
|
||||
|
||||
}
|
||||
|
||||
interface AudioBufferSourceNode extends AudioSourceNode {
|
||||
|
||||
playbackState: number;
|
||||
buffer: AudioBuffer;
|
||||
playbackRate: AudioParam;
|
||||
loop: boolean;
|
||||
noteOn(when: number): void;
|
||||
noteGrainOn(when: number, grainOffset: number, grainDuration: number): void;
|
||||
noteOff(when: number): void;
|
||||
|
||||
}
|
||||
|
||||
interface MediaElementAudioSourceNode extends AudioSourceNode {
|
||||
|
||||
}
|
||||
|
||||
interface JavaScriptAudioNode extends AudioNode {
|
||||
|
||||
onaudioprocess: EventListener;
|
||||
bufferSize: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioProcessingEvent extends Event {
|
||||
|
||||
node: JavaScriptAudioNode;
|
||||
playbackTime: number;
|
||||
inputBuffer: AudioBuffer;
|
||||
outputBuffer: AudioBuffer;
|
||||
|
||||
}
|
||||
|
||||
interface AudioPannerNode extends AudioNode {
|
||||
|
||||
panningModel: number;
|
||||
setPosition(x: number, y: number, z: number): void;
|
||||
setOrientation(x: number, y: number, z: number): void;
|
||||
setVelocity(x: number, y: number, z: number): void;
|
||||
distanceModel: number;
|
||||
refDistance: number;
|
||||
maxDistance: number;
|
||||
rolloffFactor: number;
|
||||
coneInnerAngle: number;
|
||||
coneOuterAngle: number;
|
||||
coneOuterGain: number;
|
||||
distanceGain: AudioGain;
|
||||
coneGain: AudioGain;
|
||||
|
||||
}
|
||||
|
||||
interface AudioListener {
|
||||
|
||||
dopplerFactor: number;
|
||||
speedOfSound: number;
|
||||
setPosition(x: number, y: number, z: number): void;
|
||||
setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;
|
||||
setVelocity(x: number, y: number, z: number): void;
|
||||
|
||||
}
|
||||
|
||||
interface RealtimeAnalyserNode extends AudioNode {
|
||||
|
||||
getFloatFrequencyData(array: any): void;
|
||||
getByteFrequencyData(array: any): void;
|
||||
getByteTimeDomainData(array: any): void;
|
||||
fftSize: number;
|
||||
frequencyBinCount: number;
|
||||
minDecibels: number;
|
||||
maxDecibels: number;
|
||||
smoothingTimeConstant: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioChannelSplitter extends AudioNode {
|
||||
|
||||
}
|
||||
|
||||
interface AudioChannelMerger extends AudioNode {
|
||||
|
||||
}
|
||||
|
||||
interface DynamicsCompressorNode extends AudioNode {
|
||||
|
||||
threshold: AudioParam;
|
||||
knee: AudioParam;
|
||||
ratio: AudioParam;
|
||||
reduction: AudioParam;
|
||||
attack: AudioParam;
|
||||
release: AudioParam;
|
||||
|
||||
}
|
||||
|
||||
interface BiquadFilterNode extends AudioNode {
|
||||
|
||||
type: number;
|
||||
frequency: AudioParam;
|
||||
Q: AudioParam;
|
||||
gain: AudioParam;
|
||||
|
||||
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
|
||||
|
||||
}
|
||||
|
||||
interface WaveShaperNode extends AudioNode {
|
||||
|
||||
curve: any;
|
||||
|
||||
}
|
||||
|
||||
interface MediaStreamAudioSourceNode extends AudioSourceNode {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface ConvolverNode extends AudioNode {
|
||||
|
||||
buffer: AudioBuffer;
|
||||
normalize: boolean;
|
||||
|
||||
}
|
||||
|
||||
interface WaveTable {
|
||||
|
||||
}
|
||||
Vendored
-253
@@ -1,253 +0,0 @@
|
||||
// Type definitions for Web Audio API (nightly)
|
||||
// Project: http://www.w3.org/TR/2012/WD-webaudio-20120802/
|
||||
// Definitions by: Baruch Berger <https://github.com/bbss>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Conforms to the: http://www.w3.org/TR/2012/WD-webaudio-20120802/ specification
|
||||
// Currently only implemented in WebKit browsers (nightly builds)
|
||||
|
||||
interface webkitAudioContext {
|
||||
|
||||
destination: AudioDestinationNode;
|
||||
sampleRate: number;
|
||||
currentTime: number;
|
||||
listener: AudioListener;
|
||||
activeSourceCount: number;
|
||||
|
||||
createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;
|
||||
|
||||
createBuffer(buffer: ArrayBuffer, mixToMono: boolean): AudioBuffer;
|
||||
|
||||
decodeAudioData(audioData: ArrayBuffer, successCallback: any, errorCallback?: any): void;
|
||||
createBufferSource(): AudioBufferSourceNode;
|
||||
|
||||
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
|
||||
createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode;
|
||||
createScriptProcessor(bufferSize: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode;
|
||||
createAnalyser(): AnalyserNode;
|
||||
createGain(): GainNode;
|
||||
createDelay(maxDelayTime?: number): DelayNode;
|
||||
createBiquadFilter(): BiquadFilterNode;
|
||||
createWaveShaper(): WaveShaperNode;
|
||||
createPanner(): PannerNode;
|
||||
createConvolver(): ConvolverNode;
|
||||
createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode;
|
||||
createChannelMerger(numberOfInputs?: number): ChannelMergerNode;
|
||||
createDynamicsCompressor(): DynamicsCompressorNode;
|
||||
createOscillator(): OscillatorNode;
|
||||
createWaveTable(real: any, imag: any): WaveTable;
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare var webkitAudioContext: {
|
||||
|
||||
new (value?: any): webkitAudioContext;
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface AudioNode {
|
||||
|
||||
connect(destination: AudioNode, output?: number, input?: number): void;
|
||||
connect(destination: AudioParam, output?: number): void;
|
||||
disconnect(output?: number): void;
|
||||
context: webkitAudioContext;
|
||||
numberOfInputs: number;
|
||||
numberOfOutputs: number;
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface AudioSourceNode extends AudioNode {
|
||||
|
||||
}
|
||||
|
||||
interface AudioDestinationNode extends AudioNode {
|
||||
|
||||
maxNumberOfChannels: number;
|
||||
numberOfChannels: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioParam {
|
||||
|
||||
value: number;
|
||||
computedValue: number;
|
||||
minValue: number;
|
||||
maxValue: number;
|
||||
defaultValue: number;
|
||||
setValueAtTime(value: number, startTime: number): void;
|
||||
linearRampToValueAtTime(value: number, endTime: number): void;
|
||||
exponentialRampToValueAtTime(value: number, endTime: number): void;
|
||||
setTargetAtTime(target: number, startTime: number, timeConstant: number): void;
|
||||
setValueCurveAtTime(values: any, startTime: number, duration: number): void;
|
||||
cancelScheduledValues(startTime: number): void;
|
||||
|
||||
}
|
||||
|
||||
interface GainNode extends AudioNode {
|
||||
|
||||
gain: AudioParam;
|
||||
|
||||
}
|
||||
|
||||
interface DelayNode extends AudioNode {
|
||||
|
||||
delayTime: AudioParam;
|
||||
|
||||
}
|
||||
|
||||
interface AudioBuffer {
|
||||
|
||||
sampleRate: number;
|
||||
length: number;
|
||||
duration: number;
|
||||
numberOfChannels: number;
|
||||
getChannelData(channel): any;
|
||||
|
||||
}
|
||||
|
||||
interface AudioBufferSourceNode extends AudioSourceNode {
|
||||
//actually enum
|
||||
playbackState: number;
|
||||
|
||||
buffer: AudioBuffer;
|
||||
playbackRate: AudioParam;
|
||||
loop: boolean;
|
||||
loopStart: number;
|
||||
loopEnd: number;
|
||||
start(when: number, offset?: number, duration?: number): void;
|
||||
stop(when: number): void;
|
||||
|
||||
}
|
||||
|
||||
interface MediaElementAudioSourceNode extends AudioSourceNode {
|
||||
|
||||
}
|
||||
|
||||
interface ScriptProcessorNode extends AudioNode {
|
||||
|
||||
onaudioproces: EventListener;
|
||||
bufferSize: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioProcessingEvent extends Event {
|
||||
|
||||
node: ScriptProcessorNode;
|
||||
playbackTime: number;
|
||||
inputBuffer: AudioBuffer;
|
||||
outputBuffer: AudioBuffer;
|
||||
|
||||
}
|
||||
|
||||
interface PannerNode extends AudioNode {
|
||||
//actually enum
|
||||
panningModel: number;
|
||||
distanceModel: number;
|
||||
|
||||
setPosition(x: number, y: number, z: number): void;
|
||||
setOrientation(x: number, y: number, z: number): void;
|
||||
setVelocity(x: number, y: number, z: number): void;
|
||||
refDistance: number;
|
||||
maxDistance: number;
|
||||
rolloffFactor: number;
|
||||
coneInnerAngle: number;
|
||||
coneOuterAngle: number;
|
||||
coneOuterGain: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioListener {
|
||||
|
||||
dopplerFactor: number;
|
||||
speedOfSound: number;
|
||||
setPosition(x: number, y: number, z: number): void;
|
||||
setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;
|
||||
setVelocity(x: number, y: number, z: number): void;
|
||||
|
||||
}
|
||||
|
||||
interface ConvolverNode extends AudioNode {
|
||||
|
||||
buffer: AudioBuffer;
|
||||
normalize: boolean;
|
||||
|
||||
}
|
||||
|
||||
interface AnalyserNode extends AudioNode {
|
||||
|
||||
getFloatFrequencyData(array: any): void;
|
||||
getByteFrequencyData(array: any): void;
|
||||
getByteTimeDomainData(array: any): void;
|
||||
fftSize: number;
|
||||
frequencyBinCount: number;
|
||||
minDecibels: number;
|
||||
maxDecibels: number;
|
||||
smoothingTimeConstant: number;
|
||||
|
||||
}
|
||||
|
||||
interface ChannelSplitterNode extends AudioNode {
|
||||
|
||||
}
|
||||
|
||||
interface ChannelMergerNode extends AudioNode {
|
||||
|
||||
}
|
||||
|
||||
interface DynamicsCompressorNode extends AudioNode {
|
||||
|
||||
threshold: AudioParam;
|
||||
knee: AudioParam;
|
||||
ratio: AudioParam;
|
||||
reduction: AudioParam;
|
||||
attack: AudioParam;
|
||||
release: AudioParam;
|
||||
|
||||
}
|
||||
|
||||
interface BiquadFilterNode extends AudioNode {
|
||||
|
||||
//actually enum
|
||||
type: number;
|
||||
|
||||
frequency: AudioParam;
|
||||
Q: AudioParam;
|
||||
gain: AudioParam;
|
||||
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
|
||||
|
||||
}
|
||||
|
||||
interface WaveShaperNode extends AudioNode {
|
||||
|
||||
curve: any;
|
||||
|
||||
}
|
||||
|
||||
interface OscillatorNode extends AudioSourceNode {
|
||||
|
||||
//actually enums
|
||||
type: number;
|
||||
playbackState: number;
|
||||
|
||||
frequency: AudioParam;
|
||||
detune: AudioParam;
|
||||
start(when: number): void;
|
||||
stop(when: number): void;
|
||||
setWaveTable(waveTable: WaveTable): void;
|
||||
|
||||
}
|
||||
|
||||
interface WaveTable {
|
||||
|
||||
}
|
||||
|
||||
interface MediaStreamAudioSourceNode extends AudioSourceNode {
|
||||
|
||||
}
|
||||
|
||||
interface MediaStream {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
Vendored
+2
-1036
File diff suppressed because it is too large
Load Diff
Vendored
+1
-8
@@ -3,11 +3,4 @@
|
||||
// Definitions by: Lucas Dixon <https://github.com/iislucas/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module crypto {
|
||||
|
||||
// A cryptographically strong pseudo-random number generator seeded with
|
||||
// truly random values. The buffer passed in is modified, and a reference to
|
||||
// argument is returned for convenience.
|
||||
function getRandomValues(array: ArrayBufferView) : ArrayBufferView
|
||||
|
||||
}
|
||||
// DEPRECATED: use TypeScript 1.5.3
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# WebCrypto Definition Notes
|
||||
|
||||
## The WebCrypto specification
|
||||
|
||||
The WebCrypto specification is for performing basic cryptographic operations in
|
||||
web applications, such as hashing, signature generation and verification, and
|
||||
encryption and decryption. The API is also for applications to generate and/or
|
||||
manage the keying material necessary to perform these operations. Uses for this
|
||||
API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.
|
||||
|
||||
The latest version of the specification can be found at: http://www.w3.org/TR/WebCryptoAPI/
|
||||
|
||||
## Adding the reference to your project
|
||||
|
||||
```
|
||||
/// <reference path="WebCrypto.d.ts" />
|
||||
```
|
||||
Reference in New Issue
Block a user