Merge remote-tracking branch 'DefinitelyTyped/master' into material-ui-v014

This commit is contained in:
Nathan Brown
2016-02-26 11:04:18 -07:00
92 changed files with 5702 additions and 2289 deletions
+1
View File
@@ -1596,4 +1596,5 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](scroller/scroller.d.ts) [Zynga Scroller](https://github.com/zynga/scroller) by [Boris Yankov](https://github.com/borisyankov)
* [:link:](zynga-scroller/zynga-scroller.d.ts) [Zynga Scroller](http://zynga.github.com/scroller) by [Marcelo Haskell Camargo](https://github.com/haskellcamargo)
* [:link:](viewporter/viewporter.d.ts) [Zynga Viewporter](https://github.com/zynga/viewporter) by [Boris Yankov](https://github.com/borisyankov)
* [:link:](flickity/flickity.d.ts) [Flickity](https://github.com/metafizzy/flickity) by [Chris McGrath](https://github.com/clmcgrath)
+61
View File
@@ -0,0 +1,61 @@
/// <reference path="HubSpot-pace.d.ts" />
pace.start({
document: false
});
pace.start();
pace.restart();
pace.stop();
var paceOptions: HubSpotPaceInterfaces.PaceOptions;
paceOptions = {
// Disable the 'elements' source
elements: false,
// Only show the progress on regular and ajax-y page navigation,
// not every request
restartOnRequestAfter: false
}
paceOptions = {
ajax: false, // disabled
document: false, // disabled
eventLag: false, // disabled
elements: {
selectors: ['.my-page']
}
};
paceOptions = {
elements: {
selectors: ['.timeline,.timeline-error', '.user-profile,.profile-error']
}
}
paceOptions = {
restartOnPushState: false
}
paceOptions = {
restartOnRequestAfter: false
}
pace.options = {
restartOnRequestAfter: false
}
pace.ignore(function(){
});
pace.track(function(){
});
pace.options = {
ajax: {
ignoreURLs: ['some-substring', /some-regexp/]
}
};
+115
View File
@@ -0,0 +1,115 @@
// Type definitions for pace v0.7.5
// Project: https://github.com/HubSpot/pace
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module HubSpotPaceInterfaces {
interface PaceOptions {
/**
* How long should it take for the bar to animate to a new point after receiving it
*/
catchupTime?: number;
/**
* How quickly should the bar be moving before it has any progress info from a new source in %/ms
*/
initialRate?: number;
/**
* What is the minimum amount of time the bar should be on the screen. Irrespective of this number, the bar will always be on screen for 33 * (100 / maxProgressPerFrame) + ghostTime ms.
*/
minTime?: number;
/**
* What is the minimum amount of time the bar should sit after the last update before disappearing
*/
ghostTime?: number;
/**
* Its easy for a bunch of the bar to be eaten in the first few frames before we know how much there is to load. This limits how much of the bar can be used per frame
*/
maxProgressPerFrame?: number;
/**
* This tweaks the animation easing
*/
easeFactor?: number;
/**
* Should pace automatically start when the page is loaded, or should it wait for `start` to be called? Always false if pace is loaded with AMD or CommonJS.
*/
startOnPageLoad?: boolean;
/**
* Should we restart the browser when pushState or replaceState is called? (Generally means ajax navigation has occured)
*/
restartOnPushState?: boolean;
/**
* Should we show the progress bar for every ajax request (not just regular or ajax-y page navigation)? Set to false to disable. If so, how many ms does the request have to be running for before we show the progress?
*/
restartOnRequestAfter?: boolean | number;
/**
* What element should the pace element be appended to on the page?
*/
target?: string;
document?: boolean | string;
elements?: boolean | PaceElementsOptions;
eventLag?: boolean | PaceEventLagOptions;
ajax?: boolean | PaceAjaxOptions;
}
interface PaceElementsOptions {
/**
* How frequently in ms should we check for the elements being tested for using the element monitor?
*/
checkInterval?: number;
/**
* What elements should we wait for before deciding the page is fully loaded (not required)
*/
selectors?: string[];
}
interface PaceEventLagOptions {
/**
* When we first start measuring event lag, not much is going on in the browser yet, so it's not uncommon for the numbers to be abnormally low for the first few samples. This configures how many samples we need before we consider a low number to mean completion.
*/
minSamples?: number;
/**
* How many samples should we average to decide what the current lag is?
*/
sampleCount?: number;
/**
* Above how many ms of lag is the CPU considered busy?
*/
lagThreshold?: number;
}
interface PaceAjaxOptions {
/**
* Which HTTP methods should we track?
*/
trackMethods?: string[];
/**
* Should we track web socket connections?
*/
trackWebSockets?: boolean;
/**
* A list of regular expressions or substrings of URLS we should ignore (for both tracking and restarting)
*/
ignoreURLs?: (string | RegExp)[];
}
interface Pace {
options: PaceOptions;
start(options?: PaceOptions): void;
restart(): void;
stop(): void;
track(fn: () => void, ...args: any[]): void;
ignore(fn: () => void, ...args: any[]): void;
on(event: string, handler: (...args: any[]) => void, context?: any): void;
off(event: string, handler?: (...args: any[]) => void): void;
once(event: string, handler: (...args: any[]) => void, context?: any): void;
}
enum PaceEvent { start, stop, restart, done, hide }
}
declare var pace: HubSpotPaceInterfaces.Pace;
declare module "HubSpot-pace" {
export = pace;
}
+12 -4
View File
@@ -21,7 +21,9 @@ declare module AngularFormly {
}
interface IFieldGroup {
data?: Object;
data?: {
[key: string]: any;
};
className?: string;
elementAttributes?: string;
fieldGroup?: IFieldArray;
@@ -37,7 +39,9 @@ declare module AngularFormly {
interface IFormOptionsAPI {
data?: Object;
data?: {
[key: string]: any;
};
fieldTransform?: Function;
formState?: Object;
removeChromeAutoComplete?: boolean;
@@ -177,7 +181,9 @@ declare module AngularFormly {
*
* see http://docs.angular-formly.com/docs/field-configuration-object#data-object
*/
data?: Object;
data?: {
[key: string]: any;
};
/**
@@ -536,7 +542,9 @@ declare module AngularFormly {
apiCheckOptions?: Object;
defaultOptions?: IFieldConfigurationObject | Function;
controller?: Function | string | any[];
data?: Object;
data?: {
[key: string]: any;
};
extends?: string;
link?: ng.IDirectiveLinkFn;
overwriteOk?: boolean;
+10 -10
View File
@@ -96,44 +96,44 @@ declare module "apn" {
/**
* Emitted when an error occurs during initialisation of the module, usually due to a problem with the keys and certificates.
*/
on(event: "error", listener: (error:Error) => void):Connection;
on(event: "error", listener: (error:Error) => void):this;
/**
* Emitted when the connection socket experiences an error. This may be useful for debugging but no action should be necessary.
*/
on(event: "socketError", listener: (error:Error) => void):Connection;
on(event: "socketError", listener: (error:Error) => void):this;
/**
* Emitted when a notification has been sent to Apple - not a guarantee that it has been accepted by Apple, an error relating to it may occur later on. A notification may also be "transmitted" several times if a preceding notification caused an error requiring retransmission.
*/
on(event: "transmitted", listener: (notification:Notification, decive:Device) => void):Connection;
on(event: "transmitted", listener: (notification:Notification, decive:Device) => void):this;
/**
* Emitted when all pending notifications have been transmitted to Apple and the pending queue is empty. This may be called more than once if a notification error occurs and notifications must be re-sent.
*/
on(event: "completed", listener: () => void):Connection;
on(event: "completed", listener: () => void):this;
/**
* Emitted when Apple returns a notification as invalid but the notification has already been expunged from the cache - usually due to high throughput and indicates that notifications will be getting lost. The parameter is an estimate of how many notifications have been lost. You should experiment with increasing the cache size or enabling ```autoAdjustCache``` if you see this frequently.
*
* **Note**: With ```autoAdjustCache``` enabled this event will still be emitted when an adjustment is triggered.
*/
on(event: "cacheTooSmall", listener: (sizeDifference:number) => void):Connection;
on(event: "cacheTooSmall", listener: (sizeDifference:number) => void):this;
/**
* Emitted when a connection to Apple is successfully established. The parameter indicates the number of open connections. No action is required as the connection is managed internally.
*/
on(event: "connected", listener: (openSockets:net.Socket[]) => void):Connection;
on(event: "connected", listener: (openSockets:net.Socket[]) => void):this;
/**
* Emitted when the connection to Apple has been closed, this could be for numerous reasons, for example an error has occurred or the connection has timed out. The parameter is the same as for `connected` and again, no action is required.
*/
on(event: "disconnected", listener: (openSockets:net.Socket[]) => void):Connection;
on(event: "disconnected", listener: (openSockets:net.Socket[]) => void):this;
/**
* Emitted when the connectionTimeout option has been specified and no activity has occurred on a socket for a specified duration. The socket will be closed immediately after this event and a `disconnected` event will also be emitted.
*/
on(event: "timeout", listener: () => void):Connection;
on(event: "timeout", listener: () => void):this;
/**
* Emitted when a message has been received from Apple stating that a notification was invalid or if an internal error occurred before that notification could be pushed to Apple. If the notification is still in the cache it will be passed as the second argument, otherwise null. Where possible the associated `Device` object will be passed as a third parameter, however in cases where the token supplied to the module cannot be parsed into a `Buffer` the supplied value will be returned.
* Error codes smaller than 512 correspond to those returned by Apple as per their [docs][errors]. Other errors are applicable to `node-apn` itself. Definitions can be found in `lib/errors.js`.
*/
on(event: "transmissionError", listener: (errorCode:number, notification:Notification, device:Device|Buffer) => void):Connection;
on(event: string, listener: Function):Connection;
on(event: "transmissionError", listener: (errorCode:number, notification:Notification, device:Device|Buffer) => void):this;
on(event: string, listener: Function):this;
}
export interface NotificationAlertOptions {
title?:string;
+15 -15
View File
@@ -9,25 +9,25 @@ declare module "browser-harness" {
import _events = require('events');
interface HarnessEvents extends _events.EventEmitter {
once(event: string, listener: (driver: Driver) => void): _events.EventEmitter;
once(event: 'ready', listener: (driver: Driver) => void): _events.EventEmitter;
once(event: string, listener: (driver: Driver) => void): this;
once(event: 'ready', listener: (driver: Driver) => void): this;
on(event: string, listener: (driver: Driver) => void): _events.EventEmitter;
on(event: 'ready', listener: (driver: Driver) => void): _events.EventEmitter;
on(event: string, listener: (driver: Driver) => void): this;
on(event: 'ready', listener: (driver: Driver) => void): this;
}
interface DriverEvents extends _events.EventEmitter {
once(event: string, listener: (text: string) => void): _events.EventEmitter;
once(event: 'console.log', listener: (text: string) => void): _events.EventEmitter;
once(event: 'console.warn', listener: (text: string) => void): _events.EventEmitter;
once(event: 'console.error', listener: (text: string) => void): _events.EventEmitter;
once(event: 'window.onerror', listener: (text: string) => void): _events.EventEmitter;
once(event: string, listener: (text: string) => void): this;
once(event: 'console.log', listener: (text: string) => void): this;
once(event: 'console.warn', listener: (text: string) => void): this;
once(event: 'console.error', listener: (text: string) => void): this;
once(event: 'window.onerror', listener: (text: string) => void): this;
on(event: string, listener: (text: string) => void): _events.EventEmitter;
on(event: 'console.log', listener: (text: string) => void): _events.EventEmitter;
on(event: 'console.warn', listener: (text: string) => void): _events.EventEmitter;
on(event: 'console.error', listener: (text: string) => void): _events.EventEmitter;
on(event: 'window.onerror', listener: (text: string) => void): _events.EventEmitter;
on(event: string, listener: (text: string) => void): this;
on(event: 'console.log', listener: (text: string) => void): this;
on(event: 'console.warn', listener: (text: string) => void): this;
on(event: 'console.error', listener: (text: string) => void): this;
on(event: 'window.onerror', listener: (text: string) => void): this;
}
export interface Driver {
@@ -130,4 +130,4 @@ declare module "browser-harness" {
timeoutMS: number;
retryMS: number;
};
}
}
+6 -6
View File
@@ -149,25 +149,25 @@ declare module Browserify {
* When a file is resolved for the bundle, the bundle emits a 'file' event with the full file path, the id string passed to require(), and the parent object used by browser-resolve.
* You could use the file event to implement a file watcher to regenerate bundles when files change.
*/
on(event: 'file', listener: (file: string, id: string, parent: any) => any): BrowserifyObject;
on(event: 'file', listener: (file: string, id: string, parent: any) => any): this;
/**
* When a package.json file is read, this event fires with the contents.
* The package directory is available at pkg.__dirname.
*/
on(event: 'package', listener: (pkg: any) => any): BrowserifyObject;
on(event: 'package', listener: (pkg: any) => any): this;
/**
* When .bundle() is called, this event fires with the bundle output stream.
*/
on(event: 'bundle', listener: (bundle: NodeJS.ReadableStream) => any): BrowserifyObject;
on(event: 'bundle', listener: (bundle: NodeJS.ReadableStream) => any): this;
/**
* When the .reset() method is called or implicitly called by another call to .bundle(), this event fires.
*/
on(event: 'reset', listener: () => any): BrowserifyObject;
on(event: 'reset', listener: () => any): this;
/**
* When a transform is applied to a file, the 'transform' event fires on the bundle stream with the transform stream tr and the file that the transform is being applied to.
*/
on(event: 'transform', listener: (tr: NodeJS.ReadWriteStream, file: string) => any): BrowserifyObject;
on(event: string, listener: Function): BrowserifyObject;
on(event: 'transform', listener: (tr: NodeJS.ReadWriteStream, file: string) => any): this;
on(event: string, listener: Function): this;
/**
* Set to any until substack/labeled-stream-splicer is defined
+7
View File
@@ -4,6 +4,7 @@ import chalk = require('chalk');
var str: string;
var bool: boolean;
var chain: chalk.ChalkChain;
chalk.enabled = bool;
str = chalk.stripColor(str);
@@ -28,3 +29,9 @@ console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') );
// nest styles of the same type even (color, underline, background)
console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') );
chain = chalk.green;
chain = chain.underline;
str = chain('someString');
chalk.enabled = chalk.supportsColor = bool;
+103 -74
View File
@@ -1,93 +1,122 @@
// Type definitions for chalk v0.4.0
// Project: https://github.com/sindresorhus/chalk
// Definitions by: Diullei Gomes <https://github.com/Diullei>, Bart van der Schoor <https://github.com/Bartvds>
// Definitions by: Diullei Gomes <https://github.com/Diullei>, Bart van der Schoor <https://github.com/Bartvds>, Nico Jansen <https://github.com/nicojs>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Chalk {
export interface ChalkModule extends ChalkStyle {
enabled: boolean;
supportsColor: boolean;
styles: ChalkStyleMap;
stripColor(value: string): any;
hasColor(str: string): boolean;
}
export var enabled: boolean;
export var supportsColor: boolean;
export var styles: ChalkStyleMap;
export interface ChalkChain extends ChalkStyle {
(...text: string[]): ChalkChain;
}
export function stripColor(value: string): any;
export function hasColor(str: string): boolean;
export interface ChalkStyleElement {
open: string;
close: string;
}
export interface ChalkChain extends ChalkStyle {
(...text: string[]): string;
}
export interface ChalkStyle {
// General
reset: ChalkChain;
bold: ChalkChain;
italic: ChalkChain;
underline: ChalkChain;
inverse: ChalkChain;
strikethrough: ChalkChain;
export interface ChalkStyleElement {
open: string;
close: string;
}
// Text colors
black: ChalkChain;
red: ChalkChain;
green: ChalkChain;
yellow: ChalkChain;
blue: ChalkChain;
magenta: ChalkChain;
cyan: ChalkChain;
white: ChalkChain;
gray: ChalkChain;
grey: ChalkChain;
// General
export var reset: ChalkChain;
export var bold: ChalkChain;
export var italic: ChalkChain;
export var underline: ChalkChain;
export var inverse: ChalkChain;
export var strikethrough: ChalkChain;
// Background colors
bgBlack: ChalkChain;
bgRed: ChalkChain;
bgGreen: ChalkChain;
bgYellow: ChalkChain;
bgBlue: ChalkChain;
bgMagenta: ChalkChain;
bgCyan: ChalkChain;
bgWhite: ChalkChain;
}
// Text colors
export var black: ChalkChain;
export var red: ChalkChain;
export var green: ChalkChain;
export var yellow: ChalkChain;
export var blue: ChalkChain;
export var magenta: ChalkChain;
export var cyan: ChalkChain;
export var white: ChalkChain;
export var gray: ChalkChain;
export var grey: ChalkChain;
export interface ChalkStyleMap {
// General
reset: ChalkStyleElement;
bold: ChalkStyleElement;
italic: ChalkStyleElement;
underline: ChalkStyleElement;
inverse: ChalkStyleElement;
strikethrough: ChalkStyleElement;
// Background colors
export var bgBlack: ChalkChain;
export var bgRed: ChalkChain;
export var bgGreen: ChalkChain;
export var bgYellow: ChalkChain;
export var bgBlue: ChalkChain;
export var bgMagenta: ChalkChain;
export var bgCyan: ChalkChain;
export var bgWhite: ChalkChain;
// Text colors
black: ChalkStyleElement;
red: ChalkStyleElement;
green: ChalkStyleElement;
yellow: ChalkStyleElement;
blue: ChalkStyleElement;
magenta: ChalkStyleElement;
cyan: ChalkStyleElement;
white: ChalkStyleElement;
gray: ChalkStyleElement;
// Background colors
bgBlack: ChalkStyleElement;
bgRed: ChalkStyleElement;
bgGreen: ChalkStyleElement;
bgYellow: ChalkStyleElement;
bgBlue: ChalkStyleElement;
bgMagenta: ChalkStyleElement;
bgCyan: ChalkStyleElement;
bgWhite: ChalkStyleElement;
}
export interface ChalkStyle {
// General
reset: ChalkChain;
bold: ChalkChain;
italic: ChalkChain;
underline: ChalkChain;
inverse: ChalkChain;
strikethrough: ChalkChain;
// Text colors
black: ChalkChain;
red: ChalkChain;
green: ChalkChain;
yellow: ChalkChain;
blue: ChalkChain;
magenta: ChalkChain;
cyan: ChalkChain;
white: ChalkChain;
gray: ChalkChain;
grey: ChalkChain;
// Background colors
bgBlack: ChalkChain;
bgRed: ChalkChain;
bgGreen: ChalkChain;
bgYellow: ChalkChain;
bgBlue: ChalkChain;
bgMagenta: ChalkChain;
bgCyan: ChalkChain;
bgWhite: ChalkChain;
}
export interface ChalkStyleMap {
// General
reset: ChalkStyleElement;
bold: ChalkStyleElement;
italic: ChalkStyleElement;
underline: ChalkStyleElement;
inverse: ChalkStyleElement;
strikethrough: ChalkStyleElement;
// Text colors
black: ChalkStyleElement;
red: ChalkStyleElement;
green: ChalkStyleElement;
yellow: ChalkStyleElement;
blue: ChalkStyleElement;
magenta: ChalkStyleElement;
cyan: ChalkStyleElement;
white: ChalkStyleElement;
gray: ChalkStyleElement;
// Background colors
bgBlack: ChalkStyleElement;
bgRed: ChalkStyleElement;
bgGreen: ChalkStyleElement;
bgYellow: ChalkStyleElement;
bgBlue: ChalkStyleElement;
bgMagenta: ChalkStyleElement;
bgCyan: ChalkStyleElement;
bgWhite: ChalkStyleElement;
}
}
declare module "chalk" {
var ch: Chalk.ChalkModule;
export = ch;
export = Chalk;
}
+86 -1
View File
@@ -85,7 +85,7 @@ declare module chrome.app.window {
frame?: any; // string ("none", "chrome") or FrameOptions
bounds?: ContentBounds;
alphaEnabled?: boolean;
state?: string; // "normal", "fullscreen", "maximized", "minimized"
state?: string; // "normal", "fullscreen", "maximized", "minimized"
hidden?: boolean;
resizable?: boolean;
singleton?: boolean;
@@ -347,6 +347,91 @@ declare module chrome.sockets.tcpServer {
var onAcceptError: chrome.events.Event<(args: AcceptErrorEventArgs) => void>;
}
////////////////////
// System Display
////////////////////
/**
* Use the system.display API to query display metadata.
* Permissions: "system.display"
* @since Chrome 30.
*/
declare module chrome.system.display {
interface Bounds {
/** The x-coordinate of the upper-left corner. */
left: number;
/** The y-coordinate of the upper-left corner. */
top: number;
/** The width of the display in pixels. */
width: number;
/** The height of the display in pixels. */
height: number;
}
interface Insets {
/** The x-axis distance from the left bound. */
left: number;
/** The y-axis distance from the top bound. */
top: number;
/** The x-axis distance from the right bound. */
right: number;
/** The y-axis distance from the bottom bound. */
bottom: number;
}
interface DisplayInfo {
/** The unique identifier of the display. */
id: string;
/** The user-friendly name (e.g. "HP LCD monitor"). */
name: string;
/** Identifier of the display that is being mirrored on the display unit. If mirroring is not in progress, set to an empty string. Currently exposed only on ChromeOS. Will be empty string on other platforms. */
mirroringSourceId: string;
/** True if this is the primary display. */
isPrimary: boolean;
/** True if this is an internal display. */
isInternal: boolean;
/** True if this display is enabled. */
isEnabled: boolean;
/** The number of pixels per inch along the x-axis. */
dpiX: number;
/** The number of pixels per inch along the y-axis. */
dpiY: number;
/** The display's clockwise rotation in degrees relative to the vertical position. Currently exposed only on ChromeOS. Will be set to 0 on other platforms. */
rotation: number;
/** The display's logical bounds. */
bounds: Bounds;
/** The display's insets within its screen's bounds. Currently exposed only on ChromeOS. Will be set to empty insets on other platforms. */
overscan: Insets;
/** The usable work area of the display within the display bounds. The work area excludes areas of the display reserved for OS, for example taskbar and launcher. */
workArea: Bounds;
}
/** The information about display properties that should be changed. A property will be changed only if a new value for it is specified in |info|. */
interface DisplayProps {
/** If set and not empty, starts mirroring between this and the display with the provided id (the system will determine which of the displays is actually mirrored). If set and not empty, stops mirroring between this and the display with the specified id (if mirroring is in progress). If set, no other parameter may be set. */
mirroringSourceId?: string;
/** If set to true, makes the display primary. No-op if set to false. */
isPrimary?: boolean;
/** If set, sets the display's overscan insets to the provided values. Note that overscan values may not be negative or larger than a half of the screen's size. Overscan cannot be changed on the internal monitor. It's applied after isPrimary parameter. */
overscan?: Insets;
/** If set, updates the display's rotation. Legal values are [0, 90, 180, 270]. The rotation is set clockwise, relative to the display's vertical position. It's applied after overscan paramter. */
rotation?: number;
/** If set, updates the display's logical bounds origin along x-axis. Applied together with boundsOriginY, if boundsOriginY is set. Note that, when updating the display origin, some constraints will be applied, so the final bounds origin may be different than the one set. The final bounds can be retrieved using getInfo. The bounds origin is applied after rotation. The bounds origin cannot be changed on the primary display. Note that is also invalid to set bounds origin values if isPrimary is also set (as isPrimary parameter is applied first). */
boundsOriginX?: number;
/** If set, updates the display's logical bounds origin along y-axis. See documentation for boundsOriginX parameter. */
boundsOriginY?: number;
}
interface DisplayChangedEvent extends chrome.events.Event<() => void> { }
/** Queries basic CPU information of the system. */
export function getInfo(callback: (info: DisplayInfo[]) => void): void;
/** Updates the properties for the display specified by |id|, according to the information provided in |info|. On failure, runtime.lastError will be set. */
export function setDisplayProperties(id: string, info: DisplayInfo, callback?: () => void): void;
export var onDisplayChanged: DisplayChangedEvent;
}
////////////////////
// System - Network
////////////////////
+1522 -1522
View File
File diff suppressed because it is too large Load Diff
+34
View File
@@ -0,0 +1,34 @@
/// <reference path="cldr.js.d.ts" />
/// <reference path="cldr.js-event.d.ts" />
Cldr.on("get", (path, value) => {
console.log(path);
console.log(value);
});
Cldr.once("get", (path, value) => {
console.log(path);
console.log(value);
});
Cldr.off("get", (path, value) => {
console.log(path);
console.log(value);
});
const cldr = new Cldr("en");
cldr.on("get", (path, value) => {
console.log(path);
console.log(value);
});
cldr.once("get", (path, value) => {
console.log(path);
console.log(value);
});
cldr.off("get", (path, value) => {
console.log(path);
console.log(value);
});
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for Cldr.js 0.4.4
// Project: https://github.com/rxaviers/cldrjs
// Definitions by: Raman But-Husaim <https://github.com/RamanBut-Husaim>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// The definition file for event module.
declare module cldr {
interface CldrStatic {
on(event:string, listener:(path:string, value:any) => void): void;
once(event:string, listener:(path:string, value:any) => void): void;
off(event:string, listener:(path:string, value:any) => void): void;
}
interface CldrFactory {
on(event:string, listener:(path:string, value:any) => void): void;
once(event:string, listener:(path:string, value:any) => void): void;
off(event:string, listener:(path:string, value:any) => void): void;
}
}
declare module "cldr/event" {
export = cldr;
}
+19
View File
@@ -0,0 +1,19 @@
/// <reference path="cldr.js.d.ts" />
/// <reference path="cldr.js-supplemental.d.ts" />
const cldr = new Cldr("en");
const supplemental = cldr.supplemental;
const supplementalPath = supplemental("plurals-type-cardinal/{languageId}/pluralRule-count-one");
const supplementalPathByArray = supplemental(["plurals-type-cardinal", "{languageId}/pluralRule-count-one"]);
const timeData = supplemental.timeData;
const allowed = timeData.allowed();
const preferred = timeData.preferred();
const weekData = supplemental.weekData;
const firstDay = weekData.firstDay();
const minDays = weekData.minDays();
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for Cldr.js 0.4.4
// Project: https://github.com/rxaviers/cldrjs
// Definitions by: Raman But-Husaim <https://github.com/RamanBut-Husaim>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// The definition file for supplemental module.
declare module cldr {
interface TimeDataStatic {
allowed(): string;
preferred(): string;
}
interface WeekDataStatic {
firstDay(): string;
minDays(): number;
}
interface SupplementalStatic {
timeData: TimeDataStatic;
weekData: WeekDataStatic;
(path:string): any;
(paths:string[]): any;
}
interface CldrStatic {
supplemental: SupplementalStatic;
}
}
declare module "cldr/supplemental" {
export = cldr;
}
+164
View File
@@ -0,0 +1,164 @@
/// <reference path="cldr.js.d.ts" />
Cldr.load({
"main": {
"en": {
"identity": {
"version": {
"_cldrVersion": "25",
"_number": "$Revision: 91 $"
},
"generation": {
"_date": "$Date: 2014-03-13 22:27:12 -0500 (Thu, 13 Mar 2014) $"
},
"language": "en"
},
"dates": {
"calendars": {
"gregorian": {
"months": {
"format": {
"abbreviated": {
"1": "Jan",
"2": "Feb",
"3": "Mar",
"4": "Apr",
"5": "May",
"6": "Jun",
"7": "Jul",
"8": "Aug",
"9": "Sep",
"10": "Oct",
"11": "Nov",
"12": "Dec"
}
}
},
"dayPeriods": {
"format": {
"wide": {
"am": "AM",
"am-alt-variant": "am",
"noon": "noon",
"pm": "PM",
"pm-alt-variant": "pm"
}
}
},
"dateFormats": {
"medium": "MMM d, y"
},
"timeFormats": {
"medium": "h:mm:ss a",
},
"dateTimeFormats": {
"medium": "{1}, {0}"
}
}
},
"fields": {
"second": {
"displayName": "Second",
"relative-type-0": "now",
"relativeTime-type-future": {
"relativeTimePattern-count-one": "in {0} second",
"relativeTimePattern-count-other": "in {0} seconds"
},
"relativeTime-type-past": {
"relativeTimePattern-count-one": "{0} second ago",
"relativeTimePattern-count-other": "{0} seconds ago"
}
}
}
},
"numbers": {
"currencies": {
"USD": {
"symbol": "$"
}
},
"defaultNumberingSystem": "latn",
"symbols-numberSystem-latn": {
"decimal": ".",
"exponential": "E",
"group": ",",
"infinity": "∞",
"minusSign": "-",
"nan": "NaN",
"percentSign": "%",
"perMille": "‰",
"plusSign": "+",
"timeSeparator": ":"
},
"decimalFormats-numberSystem-latn": {
"standard": "#,##0.###"
},
"currencyFormats-numberSystem-latn": {
"currencySpacing": {
"beforeCurrency": {
"currencyMatch": "[:^S:]",
"surroundingMatch": "[:digit:]",
"insertBetween": " "
},
"afterCurrency": {
"currencyMatch": "[:^S:]",
"surroundingMatch": "[:digit:]",
"insertBetween": " "
}
},
"standard": "¤#,##0.00"
}
},
"units": {
"short": {
"per": {
"compoundUnitPattern": "{0}/{1}"
},
"speed-mile-per-hour": {
"displayName": "miles/hour",
"unitPattern-count-one": "{0} mph",
"unitPattern-count-other": "{0} mph"
}
}
}
}
},
"supplemental": {
"version": {
"_cldrVersion": "25",
"_number": "$Revision: 91 $"
},
"currencyData": {
"fractions": {
"DEFAULT": {
"_rounding": "0",
"_digits": "2"
}
}
},
"likelySubtags": {
"en": "en-Latn-US",
},
"plurals-type-cardinal": {
"en": {
"pluralRule-count-one": "i = 1 and v = 0 @integer 1",
"pluralRule-count-other": " @integer 0, 2~16, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …"
}
}
}
});
const cldr = new Cldr("en");
const getDecimalSeparator = cldr.get("/cldr/main/{languageId}/numbers/symbols-numberSystem-latn/decimal");
const getDecimalSeparatorByArray = cldr.get(["/cldr/main", "{languageId}/numbers/symbols-numberSystem-latn", "decimal"]);
const mainDecimalSeparator = cldr.main("/{languageId}/numbers/symbols-numberSystem-latn/decimal");
const mainDecimalSeparatorByArray = cldr.main(["/{languageId}/numbers", "/symbols-numberSystem-latn/decimal"]);
const locale = cldr.locale;
const attributes = cldr.attributes;
const language = attributes.language;
const script = attributes.script;
const region = attributes.region;
const territory = attributes.territory;
const languageId = attributes.languageId;
const maxLanguageId = attributes.maxLanguageId;
+239
View File
@@ -0,0 +1,239 @@
// Type definitions for Cldr.js 0.4.4
// Project: https://github.com/rxaviers/cldrjs
// Definitions by: Raman But-Husaim <https://github.com/RamanBut-Husaim>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module cldr {
/**
* @name Attributes
* @memberof cldr
* @kind interface
*
* @description
* The object created during instance initialization and used internally by .get()
* to replace dynamic parts of an item path.
*/
interface Attributes {
/**
* @name language
* @memberof cldr.Attributes
* @kind property
* @access public
*
* @type {any}
*
* @description
* Language subtag {@link http://www.unicode.org/reports/tr35/#Language_Locale_Field_Definitions}
*/
language: any;
/**
* @name script
* @memberof cldr.Attributes
* @kind property
* @access public
*
* @type {any}
*
* @description
* Script subtag {@link http://www.unicode.org/reports/tr35/#Language_Locale_Field_Definitions}
*/
script: any;
/**
* @name region
* @memberof cldr.Attributes
* @kind property
* @access public
*
* @type {any}
*
* @description
* Region subtag {@link http://www.unicode.org/reports/tr35/#Language_Locale_Field_Definitions}
*/
region: any;
/**
* @name territory
* @memberof cldr.Attributes
* @kind property
* @access public
*
* @type {any}
*
* @description
* Region subtag (territory variant) {@link http://www.unicode.org/reports/tr35/#Language_Locale_Field_Definitions}
*/
territory: any;
/**
* @name languageId
* @memberof cldr.Attributes
* @kind property
* @access public
*
* @type {any}
*
* @description
* Language Id {@link http://www.unicode.org/reports/tr35/#Unicode_language_identifier}
*/
languageId: any;
/**
* @name maxLanguageId
* @memberof cldr.Attributes
* @kind property
* @access public
*
* @type {any}
*
* @description
* Maximized Language Id {@link http://www.unicode.org/reports/tr35/#Likely_Subtags}
*/
maxLanguageId: any;
}
/**
* @name CldrStatic
* @memberof cldr
* @kind interface
*
* @description
* The cldr class definition.
*/
interface CldrStatic {
/**
* @name get
* @memberof cldr.CldrStatic
* @kind function
* @access public
*
* @description
* Get the item data given its path, or 'undefined' if missing.
*
* @param {string} path The path to the cldr member.
*
* @returns {any} The cldr member.
*/
get(path: string) : any;
/**
* @name get
* @memberof cldr.CldrStatic
* @kind function
* @access public
*
* @description
* Get the item data given its path, or 'undefined' if missing.
*
* @param {Array<string>} paths The array with path parts to the cldr member.
*
* @returns {any} The cldr member.
*/
get(paths: string[]): any;
/**
* @name main
* @memberof cldr.CldrStatic
* @kind function
* @access public
*
* @description
* It's an alias for .get(["main/{languageId}, ...])"
*
* @param {string} path The path to the cldr member.
*
* @returns {any} The cldr member.
*/
main(path: string): any;
/**
* @name main
* @memberof cldr.CldrStatic
* @kind function
* @access public
*
* @declaration
* It's an alias for .get(["main/{languageId}, ...])"
*
* @param {Array<string>} paths The array with path parts to the cldr member.
*
* @returns {any} The cldr member.
*/
main(paths: string[]): any;
/**
* @name locale
* @memberof cldr.CldrStatic
* @kind property
* @access public
*
* @type {string}
*
* @declaration
* The locale string.
*/
locale: string;
/**
* @name attributes
* @memberof cldr.CldrStatic
* @kind property
* @access public
*
* @type {cldr.Attributes}
*
* @declaration
* The object created during instance initialization and used internally by .get()
* to replace dynamic parts of an item path.
*/
attributes: Attributes;
}
/**
* @name CldrFactory
* @memberof cldr
* @kind inteface
*
* @description
* The factory for {@link cldr.CldrStatic} class.
*/
interface CldrFactory {
/**
* @name load
* @memberof cldr.CldrFactory
* @kind function
* @access public
*
* @description
* Load the CLDR content in the form of JSON.
*
* @param {any} json The json content.
* @param {Array<any>} otherJson Optional. The parts of the JSON.
*
* @returns {void}
*/
load(json: any, ...otherJson: any[]): void;
/**
* @name constructor
* @memberof cldr.CldrFactory
* @kind function
* @access public
*
* @description
* The constructor function for {@link cldr.CldrStatic} class.
*
* @param {string} locale The locale name that was previously loaded.
*
* @returns {cldr.CldrStatic} The instance of {@link cldr.CldrStatic} class.
*/
new (locale: string): CldrStatic;
}
}
declare module "cldr" {
export = cldr;
}
declare var Cldr: cldr.CldrFactory;
+4
View File
@@ -46,3 +46,7 @@ var annotation: CodeMirror.Annotation = {
message: "test",
severity: "warning"
};
myCodeMirror.getValue();
myCodeMirror.getValue("foo")
myCodeMirror.setValue("bar");
+4
View File
@@ -145,7 +145,11 @@ declare module CodeMirror {
/** Attach a new document to the editor. Returns the old document, which is now no longer associated with an editor. */
swapDoc(doc: CodeMirror.Doc): CodeMirror.Doc;
/** Get the content of the current editor document. You can pass it an optional argument to specify the string to be used to separate lines (defaults to "\n"). */
getValue(seperator?: string): string;
/** Set the content of the current editor document. */
setValue(content: string): void;
/** Sets the gutter marker for the given gutter (identified by its CSS class, see the gutters option) to the given value.
Value can be either null, to clear the marker, or a DOM element, to set it. The DOM element will be shown in the specified gutter next to the specified line. */
+35
View File
@@ -0,0 +1,35 @@
/// <reference path="express-minify.d.ts" />
import express = require('express');
import minify = require('express-minify');
import uglifyJS = require('uglify-js');
var app = express();
app.use(minify());
app.use(minify({
cache: false,
cssmin: require('cssmin'),
uglifyJS: require('uglify-js')
}));
app.get('/', function (req: express.Request, res: express.Response) {
res._skip = true;
res._no_minify = false;
res._no_cache = true;
res._uglifyMangle = false;
var outputOptions: uglifyJS.BeautifierOptions = {
beautify: true,
comments: false
};
res._uglifyOutput = outputOptions;
res._uglifyCompress = false;
var compressionOptions: uglifyJS.CompressorOptions = {
cascade: true
};
res._uglifyCompress = compressionOptions;
})
+109
View File
@@ -0,0 +1,109 @@
// Type definitions for express-minify v0.1.6
// Project: https://github.com/SummerWish/express-minify
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
/// <reference path="../uglify-js/uglify-js.d.ts" />
declare module Express {
interface Response extends ExpressMinifyInterfaces.ExpressMinifyResponse {}
}
declare module ExpressMinifyInterfaces {
interface ExpressMinifyOptions {
/**
* The directory for cache storage (must be writeable). Pass false to cache in the memory (not recommended).
*/
cache?: string | boolean;
/**
* Customize UglifyJS instance (require('uglify-js')).
*/
uglifyJS?: NodeRequire;
/**
* Customize cssmin instance (require('cssmin')).
*/
cssmin?: NodeRequire;
/**
* Handle compiling errors or minifying errors. You can determine what to respond when facing such errors.
*/
onerror?: Function;
/**
* Matches JavaScript content-type.
*/
js_match?: RegExp;
/**
* Matches CSS content-type.
*/
css_match?: RegExp;
/**
* Matches SASS content-type.
*/
sass_match?: RegExp;
/**
* Matches LESS content-type.
*/
less_match?: RegExp;
/**
* Matches Stylus content-type.
*/
stylus_match?: RegExp;
/**
* Matches CoffeeScript content-type.
*/
coffee_match?: RegExp;
/**
* Matches JSON content-type.
*/
json_match?: RegExp;
}
interface ExpressMinifyResponse {
/**
* Pass true to disable all kind of processing: no compiling, no minifying.
*/
_skip: boolean;
/**
* Pass true to disable minifying, suitable for already-minified contents.
*/
_no_minify: boolean;
/**
* Pass true to disable caching the response data, suitable for dynamic contents.
*/
_no_cache: boolean;
/**
* Pass false to disable mangling names
*/
_uglifyMangle: boolean;
/**
* Pass an object if you wish to specify additional UglifyJS
*/
_uglifyOutput: Object;
/**
* Pass an object to specify custom UglifyJS compressor options (pass false to skip).
*/
_uglifyCompress: Object | boolean;
}
}
declare module "express-minify" {
import express = require('express');
function minify(options?: ExpressMinifyInterfaces.ExpressMinifyOptions): express.RequestHandler;
export = minify;
}
+57
View File
@@ -0,0 +1,57 @@
// Event Constants for Flickity v1.1.1
// Project: http://flickity.metafizzy.co/
// Definitions by: Chris McGrath <https://www.github.com/clmcgrath>
// Definitions: https://github.com/clmcgrath/
class FlickityEvents {
/**
* Triggered when a cell is selected.
*/
static cellSelect: string = "cellSelect";
/**
* Triggered when the slider is settled at its end position.
*/
static settle: string = "settle";
/**
* Triggered when dragging starts and the slider starts moving.
*/
static dragStart: string = "dragStart";
/**
* Triggered when dragging moves and the slider moves.
*/
static dragMove: string = "dragMove";
/**
* Triggered when dragging ends.
*/
static dragEnd: string = "dragEnd";
/**
* Triggered when the user's pointer (mouse, touch, pointer) presses down.
*/
static pointerDown: string = "pointerDown";
/**
* Triggered when the user's pointer moves.
*/
static pointerMove: string = "pointerMove";
/**
* Triggered when the user's pointer unpresses.
*/
static pointerUp: string = "pointerUp";
/**
* Triggered when the user's pointer is pressed and unpressed and has not moved enough to start dragging.
* Info: click events are hard to detect with draggable UI, as they are triggered whenever a user drags. Flickity's staticClick event resolves this, as it is triggered when the user has not dragged.
*/
static staticClick: string = "staticClick";
/**
* Triggered after an image has been loaded with lazyLoad.
*/
static lazyLoad: string = "lazyLoad";
}
+137
View File
@@ -0,0 +1,137 @@
// Type definition tests for Flickity v1.1.1
// Project: http://flickity.metafizzy.co/
// Definitions by: Chris McGrath <https://www.github.com/clmcgrath>
// Definitions: https://github.com/clmcgrath/
///<reference path="../jquery/jquery.d.ts"/>
///<reference path="FlickityEvents.ts"/>
///<reference path="flickity.d.ts"/>
//jQuery tests
var $flickity : JQuery = $("#flickity-selector").flickity(
{
initialIndex: 0,
accessibility: true,
asNavFor: "#nav-bar",
autoPlay: true,
cellAlign: "left",
cellSelector: ".gallery-cell",
contain: true,
draggable: true,
freeScroll: false,
freeScrollFriction: 0.5,
friction: 0.8,
imagesLoaded: false,
lazyLoad: false,
pageDots: false,
arrowShape: "arrow.svg",
percentPosition: false,
prevNextButtons: false,
selectedAttraction: 0.050,
useSetGallerySize: true,
watchCSS: true,
wrapAround: true,
resize: true,
rightToLeft: false
});
$flickity.flickity("next")
.flickity('select', 4);
//Vanilla jQuery tests
var flikty : Flickity = new Flickity("#flickity-gallery");
var flikty2: Flickity =
new Flickity("#flickity-gallery",
{
initialIndex: 0,
accessibility: true,
asNavFor: "#nav-bar",
autoPlay: true,
cellAlign: "left",
cellSelector: ".gallery-cell",
contain: true,
draggable: true,
freeScroll: false,
freeScrollFriction: 0.5,
friction: 0.8,
imagesLoaded: false,
lazyLoad: false,
pageDots: false,
arrowShape: "arrow.svg",
percentPosition: false,
prevNextButtons: false,
selectedAttraction: 0.050,
useSetGallerySize: true,
watchCSS: true,
wrapAround: true,
resize: true,
rightToLeft: false
});
//ES6 element selector for tests
var element = document.querySelector("#gallery");
var nodeList = document.querySelectorAll("#gallery");
var cellElements: Array<Element> = flikty2.getCellElements();
flikty2.select(1, true);
flikty2.select(1);
flikty2.previous();
flikty2.previous(true);
flikty2.next();
flikty2.next(true);
flikty2.resize();
flikty2.reposition();
flikty2.prepend(element);
flikty2.append(element);
flikty2.append(nodeList);
flikty2.insert(element, 0);
flikty2.insert(nodeList, 0);
flikty2.insert(new Array<Element>(), 0);
flikty2.remove(element);
flikty2.remove(nodeList);
flikty2.remove(new Array<Element>());
flikty2.destroy();
flikty2.reloadCells();
//event handlers
flikty2.on(FlickityEvents.cellSelect, (evt, ele) => {
//do something
});
flikty2.off(FlickityEvents.cellSelect, (evt, ele, pntr , vctr) => {
//do something
});
flikty2.once(FlickityEvents.cellSelect, (evt, ele, pntr) => {
//do something
});
flikty2.listener("myCustomEvent", (evt : Event) => {
//do something
});
//static get data methods
var jQdata = jQuery.fn.data('flickity')();
jQdata = $.fn.data('flickity')();
var jsData = Flickity.data("#gallery");
jsData = Flickity.data("#gallery");
//property tests
var selectedIndex : number = flikty2.selectedIndex;
var selectedElement: Element = flikty2.selectedElement;
var cells : Array<Element> = flikty2.cells;
+410
View File
@@ -0,0 +1,410 @@
// Type definitions for Flickity v1.1.1
// Project: http://flickity.metafizzy.co/
// Definitions by: Chris McGrath <https://www.github.com/clmcgrath>
// Definitions: https://github.com/clmcgrath/
interface JQuery {
/**
* initialize fickity plugin
*/
flickity: FlickityJquery;
}
interface FlickityJquery {
(options?: FlickityOptions): JQuery;
(command: string, ...params: any[]): JQuery;
}
declare class Flickity {
/**
* Initializes an new instance of Flickity .
*
* @param element Element selector string
* @param options (IFlickityOptions) Flickity options
*/
constructor(selector: string, options?: FlickityOptions);
/**
* Initializes an new instance of Flickity .
*
* @param element Container Element to initialize Flickity on
* @param options (IFlickityOptions) Flickity options
*/
constructor(element: Element, options?: FlickityOptions);
//properties
/**
* @type integer
* The selected cell index.
*/
selectedIndex: number;
/**
* @type Element
* The selected cell element.
*/
selectedElement: Element;
/**
* @type Element[]
* The array of cells. Use cells.length for the total number of cells.
*/
cells: Element[];
// static methods
/**
* (static) Get the Flickity instance via selector.
*
* @param element Element selector string
*/
static data(element: string): Flickity;
/**
* (static) Get the Flickity instance via its element.
*
* @param element The element
*/
static data(element: Element): Flickity;
// instance methods
/**
* Select a cell.
*
* @param index Integer Zero-based index of the cell to select.
* @param isWrapped (Optional) If true, the last cell will be selected if at the first cell.
* @param isInstant (Optional) If true, immediately view the selected cell without animation.
*/
select(index: number, isWrapped?: boolean, isInstant?: boolean): void;
/**
* Select the previous cell.
*
* @param isWrapped (Optional) If true, the first cell will be selected if at the last cell.
*/
previous(isWrapped?: boolean): void;
/**
* Select the next cell.
* @param isWrapped (Optional) If true, the first cell will be selected if at the first cell.
*/
next(isWrapped?: boolean): void;
/**
* Resize the gallery and re-position cells.
*/
resize(): void;
/**
* Position cells at selected position.
* Trigger reposition after the size of a cell has been changed.
*/
reposition(): void;
/**
* Prepend elements and create cells to the beginning of the gallery.
*
* @param elements JQuery, Element[], Element, or NodeList
*/
prepend(elements: Element | NodeList): void;
/**
* Append elements and create cells to the end of the gallery.
*
* @param elements JQuery, Element[], Element, or NodeList
*/
append(elements: Element | NodeList): void;
/**
* Insert elements into the gallery and create cells.
*
* @param elements Element[], Element, or NodeList
* @param index Integer: Zero-based index to insert elements.
*/
insert(elements: Element[] | Element | NodeList, index: number): void;
/**
* Remove cells from gallery and remove elements from DOM.
*
* @param elements Element[], Element, or NodeList
*/
remove(elements: Element[] | Element | NodeList): void;
/**
* Remove Flickity functionality completely. destroy will return the element back to its pre-initialized state.
*/
destroy(): void;
/**
* Re-collect all cell elements in flickity-slider.
*/
reloadCells(): void;
/**
* Get the elements of the cells.
* @returns Element[]
*/
getCellElements() : Element[];
//event listeners
/**
* Add new classic event listener
*/
listener(...params: any[]): void;
/**
* bind event listener
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
on(eventname: string, callback: (eventt?: Event, cellElement?: Element) => any) : void;
/**
* bind event listener
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
on(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void;
/**
* bind event listener
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
on(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void;
/**
* bind event listener
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
on(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;
/**
* Remove event listener
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
off(eventname: string, callback: (event?: Event, cellElement?: Element) => any): void;
/**
* Remove event listener
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
off(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void;
/**
* Remove event listener
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void;
/**
* Remove event listener
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
off(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;
/**
* one time event handler
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
once(eventname: string, callback: (event?: Event, cellElement?: Element) => any): void;
/**
* one time event handler
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
once(eventname: string, callback: (event?: Event, pointer?: Element | Touch) => any): void;
/**
* one time event handler
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, moveVector?: Object) => any): void;
/**
* one time event handler
* @param eventName name of event (@see FlickityEvents class for filckity supported events)
* @param callback callback funtion to execute when event fires
*/
once(eventname: string, callback: (event?: Event, pointer?: Element | Touch, cellElement?: Element, cellIndex?: number) => any): void;
}
interface FlickityOptions {
/**
* Specify selector for cell elements. cellSelector is useful if you have other elements in your gallery elements that are not cells.
*
* default: '.gallery-cell'
*/
cellSelector?: string;
/**
* Zero-based index of the initial selected cell.
*
* default: 2
*/
initialIndex?: number;
/**
* Enable keyboard navigation. Users can tab to a Flickity gallery, and pressing left & right keys to change cells.
*
* default: true
*/
accessibility?: boolean;
/**
* Sets the height of the gallery to the height of the tallest cell. Set to false if you prefer to size the gallery with CSS, rather than using the size of cells.
*
* default: true
*/
useSetGallerySize?: boolean;
/**
* Adjusts sizes and positions when window is resized.
*
* default: true
*/
resize?: boolean;
/**
* Align cells within the gallery element.
* opttions: 'left', 'center', 'right'
*
* default: 'center'
*/
cellAlign?: string;
/**
* Contains cells to gallery element to prevent excess scroll at beginning or end. Has no effect if wrapAround is enabled
*
* default: true
*/
contain?: boolean;
/**
* Unloaded images have no size, which can throw off cell positions. To fix this, the imagesLoaded option re-positions cells once their images have loaded.
*
* default: true
*/
imagesLoaded?: boolean;
/**
* Sets positioning in percent values, rather than pixel values. If your cells do not have percent widths, we recommended percentPosition: false.
*
* default: false
*/
percentPosition?: boolean;
/**
* Enables right-to-left layout.
*
* default: false
*/
rightToLeft?: boolean;
/**
* Enables dragging and flicking
*
* default: true
*/
draggable?: boolean;
/**
* Enables content to be freely scrolled and flicked without aligning cells to an end position.
* Enable freeScroll and wrapAround and you can flick forever, man.
*
* default: false
*/
freeScroll?: boolean;
/**
* At the end of cells, wrap-around to the other end for infinite scrolling.
*
* default: false
*/
wrapAround?: boolean;
/**
* Loads cell images when a cell is selected.
* Set the image's URL to load with data-flickity-lazyload.
*
* default: false
*/
lazyLoad?: boolean | number;
/**
* Automatically advances to the next cell.
*
* default: false
*/
autoPlay?: boolean | number;
/**
* You can enable and disable Flickity with CSS. watchCSS option watches the content of :after of the gallery element. Flickity is enabled if :after content is 'flickity'.
* note: IE8 and Android 2.3 do not support watching :after. Flickity will be disabled when watchCSS: true. Set watchCSS: 'fallbackOn' to enable Flickity for these browsers.
*
* default: false
*/
watchCSS?: boolean | string;
/**
* Use one Flickity gallery as navigation for another.
*
* default: disabled
*/
asNavFor?: string;
/**
* selectedAttraction attracts the position of the slider to the selected cell. Higher attraction makes the slider move faster. Lower makes it move slower.
*
* default: 0.025
*/
selectedAttraction?: number;
/**
* riction slows the movement of slider. Higher friction makes the slider feel stickier and less bouncy. Lower friction makes the slider feel looser and more wobbly.
*
* default: 0.28
*/
friction?: number;
/**
* Slows movement of slider when freeScroll: true. Higher friction makes the slider feel stickier. Lower friction makes the slider feel looser.
*
* default: 0.75
*/
freeScrollFriction?: number;
/**
* Creates and enables previous & next buttons.
*
* default: true
*/
prevNextButtons?: boolean;
/**
* Creates and enables paging dots.
*
* default: true
*/
pageDots?: boolean;
/**
* Draws the shape of the arrows in the previous & next buttons.
* javascript dictionary of points or path to SVG file
*/
arrowShape?: any;
}
+48 -48
View File
@@ -97,12 +97,12 @@ declare module Electron {
}
class Screen implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): Screen;
on(event: string, listener: Function): Screen;
once(event: string, listener: Function): Screen;
removeListener(event: string, listener: Function): Screen;
removeAllListeners(event?: string): Screen;
setMaxListeners(n: number): Screen;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -134,12 +134,12 @@ declare module Electron {
* You can also create a window without chrome by using Frameless Window API.
*/
class BrowserWindow implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): WebContents;
on(event: string, listener: Function): WebContents;
once(event: string, listener: Function): WebContents;
removeListener(event: string, listener: Function): WebContents;
removeAllListeners(event?: string): WebContents;
setMaxListeners(n: number): WebContents;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -541,12 +541,12 @@ declare module Electron {
* A WebContents is responsible for rendering and controlling a web page.
*/
class WebContents implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): WebContents;
on(event: string, listener: Function): WebContents;
once(event: string, listener: Function): WebContents;
removeListener(event: string, listener: Function): WebContents;
removeAllListeners(event?: string): WebContents;
setMaxListeners(n: number): WebContents;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -959,12 +959,12 @@ declare module Electron {
}
class App implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): App;
on(event: string, listener: Function): App;
once(event: string, listener: Function): App;
removeListener(event: string, listener: Function): App;
removeAllListeners(event?: string): App;
setMaxListeners(n: number): App;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1166,12 +1166,12 @@ declare module Electron {
}
class AutoUpdater implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): AutoUpdater;
on(event: string, listener: Function): AutoUpdater;
once(event: string, listener: Function): AutoUpdater;
removeListener(event: string, listener: Function): AutoUpdater;
removeAllListeners(event?: string): AutoUpdater;
setMaxListeners(n: number): AutoUpdater;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1286,12 +1286,12 @@ declare module Electron {
}
class Tray implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): Tray;
on(event: string, listener: Function): Tray;
once(event: string, listener: Function): Tray;
removeListener(event: string, listener: Function): Tray;
removeAllListeners(event?: string): Tray;
setMaxListeners(n: number): Tray;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1478,12 +1478,12 @@ declare module Electron {
// Type definitions for renderer process
export class IpcRenderer implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): IpcRenderer;
on(event: string, listener: Function): IpcRenderer;
once(event: string, listener: Function): IpcRenderer;
removeListener(event: string, listener: Function): IpcRenderer;
removeAllListeners(event?: string): IpcRenderer;
setMaxListeners(n: number): IpcRenderer;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1510,16 +1510,16 @@ declare module Electron {
}
class IPCMain implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): IPCMain;
once(event: string, listener: Function): IPCMain;
removeListener(event: string, listener: Function): IPCMain;
removeAllListeners(event?: string): IPCMain;
setMaxListeners(n: number): IPCMain;
addListener(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
on(event: string, listener: (event: IPCMainEvent, ...args: any[]) => any): IPCMain;
on(event: string, listener: (event: IPCMainEvent, ...args: any[]) => any): this;
}
interface IPCMainEvent {
+6 -7
View File
@@ -72,12 +72,12 @@ declare module "gulp-nodemon" {
}
interface EventEmitter extends NodeJS.EventEmitter {
addListener(event: string, listener: Function): EventEmitter;
addListener(event: string, tasks: string[]): EventEmitter;
on(event: string, listener: Function): EventEmitter;
on(event: string, tasks: string[]): EventEmitter;
once(event: string, listener: Function): EventEmitter;
once(event: string, tasks: string[]): EventEmitter;
addListener(event: string, listener: Function): this;
addListener(event: string, tasks: string[]): this;
on(event: string, listener: Function): this;
on(event: string, tasks: string[]): this;
once(event: string, listener: Function): this;
once(event: string, tasks: string[]): this;
}
}
@@ -85,4 +85,3 @@ declare module "gulp-nodemon" {
export = nodemon;
}
+8 -1
View File
@@ -23,9 +23,16 @@ plugin.register.attributes = {
// optional options parameter
server.register({}, function (err) {});
// optional callback function with and without options
server.register({}).then((res: any) => {
console.log(res);
});
server.register({}, { select: "api", routes: { prefix: "/prefix" } }).then((res: any) => {
console.log(res);
});
// optional options.routes.vhost parameter
server.register({}, { select: 'api', routes: { prefix: '/prefix' } }, function (err) {});
server.register({}, { select: "api", routes: { prefix: "/prefix" } }, function (err) {});
//server.pack.register(plugin, (err: Object) => {
// if (err) { throw err; }
+65 -63
View File
@@ -959,40 +959,40 @@ declare module "hapi" {
}
export interface IServerInject {
(options: string | {
/** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/
method: string;
/** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/
url: string;
/** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/
headers?: IDictionary<string>;
/** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/
payload?: string | {} | Buffer;
/** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/
credentials?: any;
/** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/
artifacts?: any;
/** sets the initial value of request.app*/
app?: any;
/** sets the initial value of request.plugins*/
plugins?: any;
/** allows access to routes with config.isInternal set to true. Defaults to false.*/
allowInternals?: boolean;
/** sets the remote address for the incoming connection.*/
remoteAddress?: boolean;
/**object with options used to simulate client request stream conditions for testing:
error - if true, emits an 'error' event after payload transmission (if any). Defaults to false.
close - if true, emits a 'close' event after payload transmission (if any). Defaults to false.
end - if false, does not end the stream. Defaults to true.*/
simulate?: {
error: boolean;
close: boolean;
end: boolean;
};
},
callback?: (res: IServerInjectResponse) => void
): IPromise<IServerInjectResponse>;
(options: string | IServerInjectOptions, callback: (res: IServerInjectResponse) => void): void;
(options: string | IServerInjectOptions): IPromise<IServerInjectResponse>;
}
export interface IServerInjectOptions {
/** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/
method: string;
/** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/
url: string;
/** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/
headers?: IDictionary<string>;
/** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/
payload?: string | {} | Buffer;
/** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/
credentials?: any;
/** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/
artifacts?: any;
/** sets the initial value of request.app*/
app?: any;
/** sets the initial value of request.plugins*/
plugins?: any;
/** allows access to routes with config.isInternal set to true. Defaults to false.*/
allowInternals?: boolean;
/** sets the remote address for the incoming connection.*/
remoteAddress?: boolean;
/**object with options used to simulate client request stream conditions for testing:
error - if true, emits an 'error' event after payload transmission (if any). Defaults to false.
close - if true, emits a 'close' event after payload transmission (if any). Defaults to false.
end - if false, does not end the stream. Defaults to true.*/
simulate?: {
error: boolean;
close: boolean;
end: boolean;
};
}
@@ -2200,39 +2200,41 @@ Notes: 1. Default value. 2. Proposed code, not supported by all clients. */
next();
};*/
path(relativeTo: string): void;
/**server.register(plugins, [options], callback)
Registers a plugin where:
plugins - an object or array of objects where each one is either:
a plugin registration function.
an object with the following:
register - the plugin registration function.
options - optional options passed to the registration function when called.
options - optional registration options (different from the options passed to the registration function):
select - a string or array of string labels used to pre-select connections for plugin registration.
routes - modifiers applied to each route added by the plugin:
prefix - string added as prefix to any route path (must begin with '/'). If a plugin registers a child plugin the prefix is passed on to the child or is added in front of the child-specific prefix.
vhost - virtual host string (or array of strings) applied to every route. The outer-most vhost overrides the any nested configuration.
callback - the callback function with signature function(err) where:
err - an error returned from the registration function. Note that exceptions thrown by the registration function are not handled by the framework.
server.register({
register: require('plugin_name'),
options: {
message: 'hello'
}
}, function (err) {
if (err) {
console.log('Failed loading plugin');
}
});*/
/**
* server.register(plugins, [options], callback)
* Registers a plugin where:
* plugins - an object or array of objects where each one is either:
* a plugin registration function.
* an object with the following:
* register - the plugin registration function.
* options - optional options passed to the registration function when called.
* options - optional registration options (different from the options passed to the registration function):
* select - a string or array of string labels used to pre-select connections for plugin registration.
* routes - modifiers applied to each route added by the plugin:
* prefix - string added as prefix to any route path (must begin with '/'). If a plugin registers a child plugin the prefix is passed on to the child or is added in front of the child-specific prefix.
* vhost - virtual host string (or array of strings) applied to every route. The outer-most vhost overrides the any nested configuration.
* callback - the callback function with signature function(err) where:
* err - an error returned from the registration function. Note that exceptions thrown by the registration function are not handled by the framework.
*
* If no callback is provided, a Promise object is returned.
*/
register(plugins: any | any[], options: {
select: string | string[];
routes: {
prefix: string; vhost?: string | string[]
};
}
, callback: (err: any) => void): void;
select: string | string[];
routes: {
prefix: string; vhost?: string | string[]
};
}, callback: (err: any) => void): void;
register(plugins: any | any[], options: {
select: string | string[];
routes: {
prefix: string; vhost?: string | string[]
};
}): IPromise<any>;
register(plugins: any | any[], callback: (err: any) => void): void;
register(plugins: any | any[]): IPromise<any>;
/**server.render(template, context, [options], callback)
Utilizes the server views manager to render a template where:
+28
View File
@@ -0,0 +1,28 @@
/// <reference path="image-size.d.ts" />
import * as url from "url";
import * as http from "http";
import * as sizeOf from "image-size";
// Synchronous
const dimensions = sizeOf("images/funny-cats.png");
console.log(dimensions.width, dimensions.height);
// Asynchronous
sizeOf("images/funny-cats.png", (err, dimensions) => {
console.log(dimensions.width, dimensions.height);
});
// From URL
const imgUrl = "http://my-amazing-website.com/image.jpeg";
const options = url.parse(imgUrl);
http.get(options, (response) => {
const chunks: Buffer[] = [];
response.on("data", (chunk: Buffer) => {
chunks.push(chunk);
}).on("end", () => {
const buffer = Buffer.concat(chunks);
console.log(sizeOf(buffer));
});
});
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for image-size
// Project: https://github.com/image-size/image-size
// Definitions by: Elisée MAURER <https://github.com/elisee/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "image-size" {
interface ImageInfo {
width: number;
height: number;
type: string;
}
function sizeOf(path: string): ImageInfo;
function sizeOf(path: string, callback: (err: Error, dimensions: ImageInfo) => void): void;
function sizeOf(buffer: Buffer): ImageInfo;
namespace sizeOf {}
export = sizeOf;
}
+11 -11
View File
@@ -226,17 +226,17 @@ declare module jake{
*/
reenable(): void;
addListener(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): NodeJS.EventEmitter;
once(event: string, listener: Function): NodeJS.EventEmitter;
removeListener(event: string, listener: Function): NodeJS.EventEmitter;
removeAllListeners(event?: string): NodeJS.EventEmitter;
setMaxListeners(n: number): NodeJS.EventEmitter;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
value: any;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
value: any;
}
export class DirectoryTask{
+1 -1
View File
@@ -54,7 +54,7 @@ declare module jest {
toContain(expected: string): boolean;
toBeCloseTo(expected: number, delta: number): boolean;
toBeGreaterThan(expected: number): boolean;
toBeLessThen(expected: number): boolean;
toBeLessThan(expected: number): boolean;
toBeCalled(): boolean;
toBeCalledWith(...args: any[]): boolean;
lastCalledWith(...args: any[]): boolean;
+19
View File
@@ -0,0 +1,19 @@
/// <reference path="js-clipper.d.ts" />
class jsClipperTest{
public intPointTest(){
let v1: ClipperLib.IntPoint = new ClipperLib.IntPoint(10, 10);
console.log("def: v1 - " + v1.X.toString() + v1.Y.toString());
let v2: ClipperLib.IntPoint = new ClipperLib.IntPoint(20, 20);
console.log("def: v2 - " + v2.X.toString() + v1.Y.toString());
let v3: ClipperLib.IntPoint = new ClipperLib.IntPoint(30, 30);
console.log("def: v3 -" + v3.X.toString() + v1.Y.toString());
console.log("perp: v3 - " + v3.X.toString() + v3.Y.toString());
}
}
var tt = new jsClipperTest;
tt.intPointTest();
+302
View File
@@ -0,0 +1,302 @@
// Type definitions for js-clipper
// Project: https://github.com/mathisonian/JsClipper
// Definitions by: Hou Chunlei <https://github.com/omni360>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
declare module ClipperLib {
export var biginteger_used: boolean;
export function Math_Abs_Int64(a: number): number;
export function Math_Abs_Int32(a: number): number;
export function Math_Abs_Double(a: number): number;
export function Math_Max_Int32_Int32(a: number, b: number): number;
export function Cast_Int32(a: number): number;
export function Cast_Int64(a: number): number;
export function Clear(a: ArrayLike<any>): void;
export var MaxSteps: number;
export var PI: number;
export var PI2: number;
export class IntPoint {
X: number;
Y: number;
constructor();
constructor(PointXY: IntPoint);
constructor(x: number, y: number);
}
export class IntRect {
left: number;
top: number;
right: number;
bottom: number;
constructor();
constructor(left: number, top: number, right: number, bottom: number);
}
export class Polygon {
constructor();
constructor(poly: ArrayLike<IntPoint>);
}
export class Polygons {
constructor();
constructor(polys: ArrayLike<ArrayLike<IntPoint>>);
}
export class ExPolygon {
outer: ArrayLike<IntPoint>;
holes: ArrayLike<ArrayLike<IntPoint>>;
}
export enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor }
export enum PolyType { ptSubject, ptClip }
export enum PolyFillType { pftEvenOdd, pftNonZero, pftPositive, pftNegative }
export enum JoinType { jtSquare, jtRound, jtMiter }
export enum EdgeSide { esLeft, esRight }
export enum Protects { ipNone, ipLeft, ipRight, ipBoth }
export enum Direction { dRightToLeft, dLeftToRight }
export class TEdge {
xbot: number;
ybot: number;
xcurr: number;
ycurr: number;
xtop: number;
ytop: number;
dx: number;
deltaX: number;
deltaY: number;
tmpX: number;
polyType: PolyType;
side: EdgeSide;
windDelta: number;
windCnt: number;
windCnt2: number;
outIdx: number;
next: TEdge;
prev: TEdge;
nextInLML: TEdge;
nextInAEL: TEdge;
prevInAEL: TEdge;
nextInSEL: TEdge;
prevInSEL: TEdge;
}
export class IntersectNode {
edge1: TEdge;
edge2: TEdge;
pt: TEdge;
next: TEdge;
}
export class LocalMinima {
Y: number;
leftBound: TEdge;
rightBound: TEdge;
next: TEdge;
}
export class Scanbeam {
Y: number;
next: TEdge;
}
export class OutRec {
idx: number;
isHole: boolean;
FirstLeft: TEdge;
AppendLink: OutRec;
pts: OutPt;
bottomPt: OutPt;
}
export class OutPt {
idx: number;
pt: OutPt;
next: OutPt;
prev: OutPt;
}
export class JoinRec {
pt1a: IntPoint;
pt1b: IntPoint;
poly1Idx: number;
pt2a: IntPoint;
pt2b: IntPoint;
poly2Idx: number;
}
export class HorzJoinRec {
edge: TEdge;
savedIdx: number;
}
export class ClipperBase {
m_MinimaList: LocalMinima;
m_CurrentLM: LocalMinima;
m_edges: ArrayLike<ArrayLike<TEdge>>;
m_UseFullRange: boolean;
horizontal: number;
loRange: number;
hiRange: number;
PointsEqual(pt1: IntPoint, pt2: IntPoint): boolean;
PointIsVertex(pt: IntPoint, pp: JoinRec): boolean;
PointInPolygon(pt: IntPoint, pp: JoinRec, UseFulllongRange: boolean): boolean;
SlopesEqual(e1: TEdge, e2: TEdge, UseFullRange: boolean): boolean;
SlopesEqual(pt1: IntPoint, pt2: IntPoint, pt3: IntPoint, UseFullRange: boolean): boolean;
SlopesEqual(pt1: IntPoint, pt2: IntPoint, pt3: IntPoint, pt4: IntPoint, UseFullRange: boolean): boolean;
clear(): void;
DisposeLocalMinimaList(): void;
AddPolygons(ppg: ArrayLike<ArrayLike<IntPoint>>, polyType: PolyType): boolean | string;
AddPolygon(pg: ArrayLike<IntPoint>, polyType: PolyType, multiple: boolean): boolean | string;
InitEdge(e: TEdge, eNext: TEdge, ePrev: TEdge, pt: IntPoint, polyType: PolyType): void;
SetDx(e: TEdge): void;
AddBoundsToLML(e: TEdge): TEdge;
InsertLocalMinima(newLm: LocalMinima): void;
PopLocalMinima(): void;
SwapX(e: TEdge): void;
Reset(): void;
GetBounds(): IntRect;
}
export class Clipper extends ClipperBase {
m_PolyOuts: TEdge | ArrayLike<TEdge>;
m_ClipType: ClipType;
m_Scanbeam: Scanbeam;
m_ActiveEdges: TEdge;
m_SortedEdges: TEdge;
m_intersectnodes: IntersectNode;
m_ExecuteLocked: boolean;
m_ClipFillType: PolyFillType;
m_SubjFillType: PolyFillType;
m_Joins: ArrayLike<JoinRec>;
m_HorizJoins: ArrayLike<HorzJoinRec>;
m_ReverseOutput: boolean;
m_UsingExPolygons: boolean;
DoublePoint: Function;
PolyOffsetBuilder: Function;
DisposeScanbeamList(): void;
get_ReverseSolution(): boolean;
set_ReverseSolution(value: boolean): boolean;
InsertScanbeam(Y: number): void;
Execute(clipType: ClipType, solution: ArrayLike<IntPoint> | ExPolygon): boolean;
Execute(clipType: ClipType, solution: ArrayLike<IntPoint> | ExPolygon, subjFillType: PolyFillType, clipFillType: PolyFillType): boolean;
PolySort(or1: OutRec, or2: OutRec): number;
FindAppendLinkEnd(outRec: OutRec): OutRec;
FixHoleLinkage(outRec: OutRec): void;
ExecuteInternal(): boolean;
PopScanbeam(): number;
DisposeOutRec(index: number): void;
DisposeOutPts(pp: OutPt): void;
AddJoin(e1: TEdge, e2: TEdge, e1OutIdx: number, e2OutIdx: number): void;
AddHorzJoin(e: TEdge, idx: number): void;
InsertLocalMinimaIntoAEL(botY: number): void;
InsertEdgeIntoAEL(edge: TEdge): void;
E2InsertsBeforeE1(e1: TEdge, e2: TEdge): boolean;
IsEvenOddFillType(edge: TEdge): boolean;
IsEvenOddAltFillType(edge: TEdge): boolean;
IsContributing(edge: TEdge): boolean;
SetWindingCount(edge: TEdge): void;
AddEdgeToSEL(edge: TEdge): void;
CopyAELToSEL(): void;
SwapPositionsInAEL(edge1: TEdge, edge2: TEdge): void;
SwapPositionsInSEL(edge1: TEdge, edge2: TEdge): void;
AddLocalMaxPoly(e1: TEdge, e2: TEdge, pt: OutPt): void;
AddLocalMinPoly(e1: TEdge, e2: TEdge, pt: OutPt): void;
CreateOutRec(): OutRec;
AddOutPt(e: TEdge, pt: IntPoint): void;
SwapPoints(pt1: IntPoint, pt2: IntPoint): void;
GetOverlapSegment(pt1a: IntPoint, pt1b: IntPoint, pt2a: IntPoint, pt2b: IntPoint, pt1: IntPoint, pt2: IntPoint): boolean;
FindSegment(pp: IntPoint, pt1: IntPoint, pt2: IntPoint): boolean;
Pt3IsBetweenPt1AndPt2(pt1: boolean, pt2: boolean, pt3: boolean): OutPt;
InsertPolyPtBetween(p1: OutPt, p2: OutPt, pt: OutPt): OutPt;
SetHoleState(e: TEdge, outRec: OutRec): void;
GetDx(pt1: IntPoint, pt2: IntPoint): number;
FirstIsBottomPt(btmPt1: OutPt, btmPt2: OutPt): boolean;
GetBottomPt(pp: OutPt): OutPt;
GetLowermostRec(outRec1: OutRec, outRec2: OutRec): OutRec;
Param1RightOfParam2(outRec1: OutRec, outRec2: OutRec): boolean;
AppendPolygon(e1: TEdge, e2: TEdge): void;
ReversePolyPtLinks(pp: OutPt): void;
SwapSides(edge1: TEdge, edge2: TEdge): void;
SwapPolyIndexes(edge1: TEdge, edge2: TEdge): void;
DoEdge1(edge1: TEdge, edge2: TEdge, pt: OutPt): void;
DoEdge2(edge1: TEdge, edge2: TEdge, pt: OutPt): void;
DoBothEdges(edge1: TEdge, edge2: TEdge, pt: OutPt): void;
IntersectEdges(e1: TEdge, e2: TEdge, pt: OutPt, protects: Protects): void;
DeleteFromAEL(e: TEdge): void;
DeleteFromSEL(e: TEdge): void;
UpdateEdgeIntoAEL(e: TEdge): void;
ProcessHorizontals(): void;
ProcessHorizontal(horzEdge: TEdge): void;
IsTopHorz(horzEdge: TEdge, XPos: IntPoint): boolean;
GetNextInAEL(e: TEdge, Direction: TEdge): TEdge;
IsMinima(e: TEdge): boolean;
IsMaxima(e: TEdge, Y: number): boolean;
IsIntermediate(e: TEdge, Y: number): boolean;
GetMaximaPair(e: TEdge): TEdge;
ProcessIntersections(botY: number, topY: number): boolean;
BuildIntersectList(botY: number, topY: number): void;
FixupIntersections(): boolean;
ProcessIntersectList(): void;
Round(a: number): number;
TopX(edge: TEdge, currentY: number): number;
AddIntersectNode(e1: TEdge, e2: TEdge, pt: IntPoint): void;
ProcessParam1BeforeParam2(node1: IntersectNode, node2: IntersectNode): boolean;
SwapIntersectNodes(int1: IntersectNode, int2: IntersectNode): void;
IntersectPoint(edge1: TEdge, edge2: TEdge, ip: IntPoint): boolean;
DisposeIntersectNodes(): void;
ProcessEdgesAtTopOfScanbeam(topY: number): void;
DoMaxima(e: TEdge, topY: number): void;
ReversePolygons(polys: Polygons): void;
Orientation(poly: Polygon): boolean;
PointCount(pts: ArrayLike<OutPt>): number;
BuildResult(polyg: Polygon): void;
BuildResultEx(polyg: ExPolygon): void;
FixupOutPolygon(outRec: OutPt): void;
JoinPoints(j: JoinRec, p1: IntPoint, p2: IntPoint): boolean;
FixupJoinRecs(j: JoinRec, pt: JoinRec, startIdx: number): void;
JoinCommonEdges(): void;
FullRangeNeeded(pts: ArrayLike<IntPoint>): boolean;
Area(poly: Polygon): number;
Area(outRec: OutRec, UseFull64BitRange: boolean): number;
BuildArc(pt: IntPoint, a1: IntPoint, a2: IntPoint, r: number): Polygon;
GetUnitNormal(pt1: IntPoint, pt2: IntPoint): DoublePoint;
OffsetPolygons(poly: Polygon, delta: number, jointype: JoinType, MiterLimit: number, AutoFix: boolean): ArrayLike<ArrayLike<IntPoint>>;
SimplifyPolygon(poly: Polygon, fillType: PolyFillType): Polygon;
SimplifyPolygons(polys: Polygons, fillType: PolyFillType): Polygons;
}
export class DoublePoint {
X: number;
Y: number;
constructor(x: number, y: number);
}
export class PolyOffsetBuilder {
pts: Polygons;
currentPoly: Polygon;
normals: ArrayLike<IntPoint>;
delta: number;
m_R: number;
m_i: number;
m_j: number;
m_k: number;
botPt: PolyOffsetBuilder;
constructor(pts: Polygons, solution: { value: Polygons }, delta: number, jointype: JoinType, MiterLimit: number, AutoFix: boolean);
UpdateBotPt(pt: IntPoint): boolean;
AddPoint(pt: IntPoint): void;
DoSquare(mul: number): void;
DoMiter(): void;
DoRound(): void;
}
export function Error(message: string): void;
export function Clone(polygon: ArrayLike<IntPoint> | ArrayLike<ArrayLike<IntPoint>>): ArrayLike<IntPoint> | ArrayLike<ArrayLike<IntPoint>>;
export function Clean(polygon: ArrayLike<IntPoint> | ArrayLike<ArrayLike<IntPoint>>, delta: number): ArrayLike<IntPoint> | ArrayLike<ArrayLike<IntPoint>>;
export function Lighten(polygon: ArrayLike<IntPoint> | ArrayLike<ArrayLike<IntPoint>>, tolerance: number): ArrayLike<IntPoint> | ArrayLike<ArrayLike<IntPoint>>;
}
+5
View File
@@ -24,6 +24,11 @@ token = jwt.sign({ foo: 'bar' }, 'shhhhh');
cert = fs.readFileSync('private.key'); // get private key
token = jwt.sign({ foo: 'bar' }, cert, { algorithm: 'RS256'});
// sign asynchronously
jwt.sign({ foo: 'bar' }, cert, { algorithm: 'RS256' }, function(token: string) {
console.log(token);
});
/**
* jwt.verify
* https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback
+2 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for jsonwebtoken 0.4.0
// Project: https://github.com/auth0/node-jsonwebtoken
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>
// Definitions by: Maxime LUCE <https://github.com/SomaticIT>, Daniel Heim <https://github.com/danielheim>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
@@ -53,7 +53,7 @@ declare module "jsonwebtoken" {
}
export interface SignCallback {
(err: Error, encoded: string): void;
(encoded: string): void;
}
/**
+238
View File
@@ -0,0 +1,238 @@
/// <reference path="jspdf.d.ts" />
// From: https://mrrio.github.io/jsPDF/examples/basic.html
function test_simple_two_page_document() {
var doc = new jsPDF();
doc.text(20, 20, 'Hello world!');
doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
doc.addPage();
doc.text(20, 20, 'Do you like that?');
doc.save('Test.pdf');
}
function test_landscape() {
var doc = new jsPDF('landscape');
doc.text(20, 20, 'Hello landscape world!');
doc.save('Test.pdf');
}
function test_metadata() {
var doc = new jsPDF();
doc.text(20, 20, 'This PDF has a title, subject, author, keywords and a creator.');
doc.setProperties({
title: 'Title',
subject: 'This is the subject',
author: 'James Hall',
keywords: 'generated, javascript, web 2.0, ajax',
creator: 'MEEE'
});
doc.save('Test.pdf');
}
function test_user_input() {
var doc = new jsPDF();
doc.text(20, 20, 'This PDF has a title, subject, author, keywords and a creator.');
doc.setProperties({
title: 'Title',
subject: 'This is the subject',
author: 'James Hall',
keywords: 'generated, javascript, web 2.0, ajax',
creator: 'MEEE'
});
doc.save('Test.pdf');
}
function test_font_sizes() {
var doc = new jsPDF();
doc.setFontSize(22);
doc.text(20, 20, 'This is a title');
doc.setFontSize(16);
doc.text(20, 30, 'This is some normal sized text underneath.');
doc.save('Test.pdf');
}
function test_font_types() {
var doc = new jsPDF();
doc.text(20, 20, 'This is the default font.');
doc.setFont("courier");
doc.text(20, 30, 'This is courier normal.');
doc.setFont("times");
doc.setFontType("italic");
doc.text(20, 40, 'This is times italic.');
doc.setFont("helvetica");
doc.setFontType("bold");
doc.text(20, 50, 'This is helvetica bold.');
doc.setFont("courier");
doc.setFontType("bolditalic");
doc.text(20, 60, 'This is courier bolditalic.');
doc.save('Test.pdf');
}
function test_text_colors() {
var doc = new jsPDF();
doc.setTextColor(100);
doc.text(20, 20, 'This is gray.');
doc.setTextColor(150);
doc.text(20, 30, 'This is light gray.');
doc.setTextColor(255, 0, 0);
doc.text(20, 40, 'This is red.');
doc.setTextColor(0, 255, 0);
doc.text(20, 50, 'This is green.');
doc.setTextColor(0, 0, 255);
doc.text(20, 60, 'This is blue.');
doc.save('Test.pdf');
}
function test_font_metrics_based_line_sizing_split() {
var pdf = new jsPDF('p', 'in', 'letter');
var sizes:number[] = [12, 16, 20];
var fonts = [['Times', 'Roman'], ['Helvetica', ''], ['Times', 'Italic']];
var font:string[];
var size:number;
var lines:any[];
var verticalOffset = 0.5; // inches on a 8.5 x 11 inch sheet.
var loremipsum = 'Lorem ipsum dolor sit amet, ...';
for (var i in fonts) {
if (fonts.hasOwnProperty(i)) {
font = fonts[i];
size = sizes[i];
lines = pdf.setFont(font[0], font[1])
.setFontSize(size)
.splitTextToSize(loremipsum, 7.5);
pdf.text(0.5, verticalOffset + size / 72, lines);
verticalOffset += (lines.length + 0.5) * size / 72
}
}
pdf.save('Test.pdf');
}
function test_from_html() {
var pdf = new jsPDF('p', 'pt', 'letter')
, source = document.getElementById('#fromHTMLtestdiv')
, specialElementHandlers = {
'#bypassme': function (element:HTMLElement, renderer:any) {
return true
}
};
var margins = {
top: 80,
bottom: 60,
left: 40,
width: 522
};
pdf.fromHTML(
source // HTML string or DOM elem ref.
, margins.left // x coord
, margins.top // y coord
, {
'width': margins.width // max width of content on PDF
, 'elementHandlers': specialElementHandlers
},
function (dispose:any) {
pdf.save('Test.pdf');
},
margins
)
}
function test_rect_squares() {
var doc = new jsPDF();
doc.rect(20, 20, 10, 10); // empty square
doc.rect(40, 20, 10, 10, 'F'); // filled square
doc.setDrawColor(255, 0, 0);
doc.rect(60, 20, 10, 10); // empty red square
doc.setDrawColor(255, 0, 0);
doc.rect(80, 20, 10, 10, 'FD'); // filled square with red borders
doc.setDrawColor(0);
doc.setFillColor(255, 0, 0);
doc.rect(100, 20, 10, 10, 'F'); // filled red square
doc.setDrawColor(0);
doc.setFillColor(255, 0, 0);
doc.rect(120, 20, 10, 10, 'FD'); // filled red square with black borders
doc.setDrawColor(0);
doc.setFillColor(255, 255, 255);
doc.roundedRect(140, 20, 10, 10, 3, 3, 'FD'); // Black sqaure with rounded corners
doc.save('Test.pdf');
}
function test_lines() {
var doc = new jsPDF();
doc.line(20, 20, 60, 20); // horizontal line
doc.setLineWidth(0.5);
doc.line(20, 25, 60, 25);
doc.setLineWidth(1);
doc.line(20, 30, 60, 30);
doc.setLineWidth(1.5);
doc.line(20, 35, 60, 35);
doc.setDrawColor(255, 0, 0); // draw red lines
doc.setLineWidth(0.1);
doc.line(100, 20, 100, 60); // vertical line
doc.setLineWidth(0.5);
doc.line(105, 20, 105, 60);
doc.setLineWidth(1);
doc.line(110, 20, 110, 60);
doc.setLineWidth(1.5);
doc.line(115, 20, 115, 60);
doc.save('Test.pdf');
}
function test_circles_ellipses() {
var doc = new jsPDF();
doc.ellipse(40, 20, 10, 5);
doc.setFillColor(0, 0, 255);
doc.ellipse(80, 20, 10, 5, 'F');
doc.setLineWidth(1);
doc.setDrawColor(0);
doc.setFillColor(255, 0, 0);
doc.circle(120, 20, 5, 'FD');
doc.save('Test.pdf');
}
function test_triangles() {
var doc = new jsPDF();
doc.triangle(60, 100, 60, 120, 80, 110, 'FD');
doc.setLineWidth(1);
doc.setDrawColor(255, 0, 0);
doc.setFillColor(0, 0, 255);
doc.triangle(100, 100, 110, 100, 120, 130, 'FD');
doc.save('My file.pdf');
}
function test_images() {
var getImageFromUrl = function (url:string, callback:Function) {
var img = new Image();
img.onerror = function () {
alert('Cannot load image: "' + url + '"');
};
img.onload = function () {
callback(img);
};
img.src = url;
};
var createPDF = function (imgData:string) {
var doc = new jsPDF();
doc.addImage(imgData, 'JPEG', 10, 10, 50, 50, 'monkey'); // Cache the image using the alias 'monkey'
doc.addImage('monkey', 70, 10, 100, 120); // use the cached 'monkey' image, JPEG is optional regardless
doc.addImage({
imageData: imgData,
angle: -20,
x: 10,
y: 78,
w: 45,
h: 58
});
doc.output('datauri');
};
getImageFromUrl('thinking-monkey.jpg', createPDF);
}
function test_add_html() {
var pdf = new jsPDF('p', 'pt', 'a4');
pdf.addHTML(document.body, function () {
var string = pdf.output('datauristring');
document.getElementsByClassName('preview-pane')[0].setAttribute('src', string);
});
}
+203
View File
@@ -0,0 +1,203 @@
// Type definitions for jsPDF v1.1.135
// Project: https://github.com/MrRio/jsPDF
// Definitions by: Amber Schühmacher <https://github.com/amberjs>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare class jsPDF {
constructor(orientation?:any,
unit?:string,
format?:string,
compressPdf?:number);
CapJoinStyles:any;
version:string;
internal: {
'pdfEscape'(text:string, flags:any): any;
'getStyle'(style:string) : any;
'getFont'(): any;
'getFontSize'():number;
'getLineHeight'():number;
'write'(string1:string):any;
'getCoordinateString'(value:number):number;
'getVerticalCoordinateString'(value:number):number;
'collections':any;
'newObject'():number;
'newAdditionalObject'():any;
'newObjectDeferred'():number;
'newObjectDeferredBegin'(oid:number):void;
'putStream'(str:string):void;
'events':any;
'scaleFactor':number;
'pageSize': {
width:number;
height:number;
};
'output'(type:any, options:any):any;
'getNumberOfPages'():number;
'pages':number[];
'out'(string:string):void;
'f2'(number:number):number;
'getPageInfo'(pageNumberOneBased:number):any;
'getCurrentPageInfo'():any;
};
addPage():jsPDF;
setPage(n:number):jsPDF;
insertPage(beforePage:number):jsPDF;
movePage(targetPage:number, beforePage:number):jsPDF;
deletePage(n:number):jsPDF;
setDisplayMode(zoom?:string, layout?:string, pmode?:string):jsPDF;
text(text:any, x:any, y:any, flags?:any, angle?:any, align?:any):jsPDF;
lstext(text:string, x:number, y:number, spacing:number):jsPDF;
line(x1:number, y1:number, x2:number, y2:number):any;
clip():void;
lines(lines:any, x:any, y:any, scale?:any, style?:string, closed?:boolean):jsPDF;
rect(x:number, y:number, w:number, h:number, style?:string):jsPDF;
triangle(x1:number, y1:number, x2:number, y2:number, x3:number, y3:number, style:string):jsPDF;
roundedRect(x:number, y:number, w:number, h:number, rx:number, ry:number, style:string):jsPDF;
ellipse(x:number, y:number, rx:number, ry:number, style?:string):jsPDF;
circle(x:number, y:number, r:number, style:string):jsPDF;
setProperties(properties:any):jsPDF;
setFontSize(size:number):jsPDF;
setFont(fontName?:string, fontStyle?:string):jsPDF;
setFontStyle(style:string):jsPDF;
setFontType(style:string):jsPDF;
getFontList():any;
addFont(postScriptName:string, fontName:string, fontStyle:string):string;
setLineWidth(width:number):jsPDF;
setDrawColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
setFillColor(ch1:number|string, ch2?:number, ch3?:number, ch4?:number):jsPDF;
setTextColor(r?:number, g?:number, b?:number):jsPDF;
setLineCap(style:string|number):jsPDF;
setLineJoin(style:string|number):jsPDF;
output(type?:string, options?:any):any;
save(filename:string):jsPDF;
/**
* jsPDF plugins below:
*
* - AddHTML
* - AddImage
* - Annotations
* - AutoPrint
* - Canvas
* - Cell
* - Context2D
* - FromHTML
* - JavaScript
* - PNG
* - split_text_to_size
* - SVG
* - total_pages
*/
// jsPDF plugin: addHTML
addHTML(element:any, x:number, y:number, options:any, callback:Function):jsPDF;
addHTML(element:any, callback:Function):jsPDF;
// jsPDF plugin: addImage
color_spaces:any;
decode:any;
image_compression:any;
sHashCode(str:string):any;
isString(object:any):boolean;
extractInfoFromBase64DataURI(dataURI:string):any[];
supportsArrayBuffer():boolean;
isArrayBuffer(object:any):boolean;
isArrayBufferView(object:any):boolean;
binaryStringToUint8Array(binary_string:string):Uint8Array;
arrayBufferToBinaryString(buffer:any):string;
arrayBufferToBase64(arrayBuffer:ArrayBuffer):string;
createImageInfo(data:any, wd:any, ht:any, cs:any, bpc:any, imageIndex:number, alias:any, f?:any, dp?:any, trns?:any, pal?:any, smask?:any):any;
addImage(imageData?:any, format?:any, x?:number, y?:number, w?:number, h?:number, alias?:any, compression?:any, rotation?:any):jsPDF;
processJPEG(data:any, index:number, alias:any, compression?:any, dataAsBinaryString?:string):any;
processJPG():any;
// jsPDF plugin: Annotations
annotationPlugin:any;
createAnnotation(options:any):void;
link(x:number, y:number, w:number, h:number, options:any):void;
textWithLink(text:string, x:number, y:number, options:any):number;
getTextWidth(text:string):number;
getLineHeight():number;
// jsPDF plugin: AutoPrint
autoPrint():jsPDF;
// jsPDF plugin: Canvas
canvas: {
getContext():any;
style:any;
};
// jsPDF plugin: Cell
setHeaderFunction(func:Function):void;
getTextDimensions(txt:string):any;
cellAddPage():void;
cellInitialize():void;
cell(x:number, y:number, w:number, h:number, txt:string, ln:number, align:string):jsPDF;
arrayMax(array:any[], comparisonFn?:Function):number;
table(x:number, y:number, data:any, headers:string[], config:any):jsPDF;
calculateLineHeight(headerNames:string[], columnWidths:number[], model:any[]):number;
setTableHeaderRow(config:any[]):void;
printHeaderRow(lineNumber:number, new_page?:boolean):void;
// jsPDF plugin: Context2D
context2d: {
pageWrapXEnabled: boolean;
pageWrapYEnabled: boolean;
pageWrapX: number;
pageWrapY: number;
f2(number:number):number;
fillRect(x:number, y:number, w:number, h:number):void;
strokeRect(x:number, y:number, w:number, h:number):void;
clearRect(x:number, y:number, w:number, h:number):void;
save():void;
restore():void;
beginPath():void;
closePath():void;
setFillStyle(style:string):void;
setStrokeStyle(style:string):void;
fillText(text:string|string[], x:number, y:number, maxWidth:number):void;
strokeText(text:string|string[], x:number, y:number, maxWidth:number):void;
setFont(font:string):void;
setTextBaseline(baseline:string):void;
getTextBaseline():string;
setLineWidth(width:number):void;
setLineCap(style:string):void;
setLineJoin(style:string):void;
moveTo(x:number, y:number):void;
lastBreak: number;
pageBreaks: any[];
lineTo(x:number, y:number):void;
bezierCurveTo(x1:number, y1:number, x2:number, y2:number, x:number, y:number):void;
quadraticCurveTo(x1:number, y1:number, x:number, y:number):void;
arc(x:number, y:number, radius:number, startAngle:number, endAngle:number, anticlockwise:any):void;
drawImage(img:string, x:number, y:number, w:number, h:number, x2?:number, y2?:number, w2?:number, h2?:number):void;
stroke():void;
fill():void;
translate(x:number, y:number):void;
measureText(text:string):number;
};
// jsPDF plugin: fromHTML
fromHTML(HTML:string | HTMLElement, x:number, y:number, settings?:any, callback?:Function, margins?:any):jsPDF;
// jsPDF plugin: JavaScript
addJS(txt:string):jsPDF;
// jsPDF plugin: PNG
processPNG(imageData:any, imageIndex:number, alias:string, compression:any, dataAsBinaryString:string):any;
// jsPDF plugin: split_text_to_size
getCharWidthsArray(text:string, options?:any):any[];
getStringUnitWidth(text:string, options?:any):number;
splitTextToSize(text:string, maxlen:number, options?:any):any;
// jsPDF plugin: SVG
addSVG(svgtext:string, x:number, y:number, w?:number, h?:number):jsPDF;
// jsPDF plugin: total_pages
putTotalPages(pageExpression:string):jsPDF;
}
+146
View File
@@ -6371,6 +6371,26 @@ module TestIsBoolean {
}
}
// _.isBuffer
module TestIsBuffer {
{
let result: boolean;
result = _.isBuffer(any);
result = _(1).isBuffer();
result = _<any>([]).isBuffer();
result = _({}).isBuffer();
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(1).chain().isBuffer();
result = _<any>([]).chain().isBuffer();
result = _({}).chain().isBuffer();
}
}
// _.isDate
module TestIsBoolean {
{
@@ -6620,6 +6640,37 @@ module TestIsLength {
}
}
// _.isMap
module TestIsMap {
{
let value: number|Map<string, number>;
if (_.isMap<string, number>(value)) {
let result: Map<string, number> = value;
}
else {
let result: number = value;
}
}
{
let result: boolean;
result = _.isMap(any);
result = _(1).isMap();
result = _<any>([]).isMap();
result = _({}).isMap();
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(1).chain().isMap();
result = _<any>([]).chain().isMap();
result = _({}).chain().isMap();
}
}
// _.isMatch
module TestIsMatch {
let testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean;
@@ -8823,6 +8874,101 @@ module TestInvert {
}
}
// _.invertBy
namespace TestInvertBy {
let array: ({a: number;})[];
let list: _.List<{a: number;}>;
let dictionary: _.Dictionary<{a: number;}>;
let numericDictionary: _.NumericDictionary<{a: number;}>;
let stringIterator: (value: string) => any;
let arrayIterator: (value: {a: number;}) => any;
let listIterator: (value: {a: number;}) => any;
let dictionaryIterator: (value: {a: number;}) => any;
let numericDictionaryIterator: (value: {a: number;}) => any;
{
let result: _.Dictionary<string[]>;
result = _.invertBy('foo');
result = _.invertBy('foo', stringIterator);
result = _.invertBy(array);
result = _.invertBy<{a: number;}>(array, 'a');
result = _.invertBy<{a: number;}>(array, arrayIterator);
result = _.invertBy<{a: number;}>(array, {a: 1});
result = _.invertBy(list);
result = _.invertBy<{a: number;}>(list, 'a');
result = _.invertBy<{a: number;}>(list, listIterator);
result = _.invertBy<{a: number;}>(list, {a: 1});
result = _.invertBy(dictionary);
result = _.invertBy<{a: number;}>(dictionary, 'a');
result = _.invertBy<{a: number;}>(dictionary, dictionaryIterator);
result = _.invertBy<{a: number;}>(dictionary, {a: 1});
result = _.invertBy(numericDictionary);
result = _.invertBy<{a: number;}>(numericDictionary, 'a');
result = _.invertBy<{a: number;}>(numericDictionary, numericDictionaryIterator);
result = _.invertBy<{a: number;}>(numericDictionary, {a: 1});
}
{
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<string[]>>;
result = _('foo').invertBy();
result = _('foo').invertBy(stringIterator);
result = _(array).invertBy();
result = _(array).invertBy('a');
result = _(array).invertBy(arrayIterator);
result = _(array).invertBy({a: 1});
result = _(list).invertBy();
result = _(list).invertBy('a');
result = _(list).invertBy(listIterator);
result = _(list).invertBy<{a: number;}>({a: 1});
result = _(dictionary).invertBy();
result = _(dictionary).invertBy('a');
result = _(dictionary).invertBy(dictionaryIterator);
result = _(dictionary).invertBy<{a: number;}>({a: 1});
result = _(numericDictionary).invertBy();
result = _(numericDictionary).invertBy('a');
result = _(numericDictionary).invertBy(numericDictionaryIterator);
result = _(numericDictionary).invertBy<{a: number;}>({a: 1});
}
{
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<string[]>>;
result = _('foo').chain().invertBy();
result = _('foo').chain().invertBy(stringIterator);
result = _(array).chain().invertBy();
result = _(array).chain().invertBy('a');
result = _(array).chain().invertBy(arrayIterator);
result = _(array).chain().invertBy({a: 1});
result = _(list).chain().invertBy();
result = _(list).chain().invertBy('a');
result = _(list).chain().invertBy(listIterator);
result = _(list).chain().invertBy<{a: number;}>({a: 1});
result = _(dictionary).chain().invertBy();
result = _(dictionary).chain().invertBy('a');
result = _(dictionary).chain().invertBy(dictionaryIterator);
result = _(dictionary).chain().invertBy<{a: number;}>({a: 1});
result = _(numericDictionary).chain().invertBy();
result = _(numericDictionary).chain().invertBy('a');
result = _(numericDictionary).chain().invertBy(numericDictionaryIterator);
result = _(numericDictionary).chain().invertBy<{a: number;}>({a: 1});
}
}
// _.keys
module TestKeys {
let object: _.Dictionary<any>;
+177
View File
@@ -11159,6 +11159,31 @@ declare module _ {
isBoolean(): LoDashExplicitWrapper<boolean>;
}
//_.isBuffer
interface LoDashStatic {
/**
* Checks if value is a buffer.
*
* @param value The value to check.
* @return Returns true if value is a buffer, else false.
*/
isBuffer(value?: any): boolean;
}
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.isBuffer
*/
isBuffer(): boolean;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.isBuffer
*/
isBuffer(): LoDashExplicitWrapper<boolean>;
}
//_.isDate
interface LoDashStatic {
/**
@@ -11516,6 +11541,31 @@ declare module _ {
isLength(): LoDashExplicitWrapper<boolean>;
}
//_.isMap
interface LoDashStatic {
/**
* Checks if value is classified as a Map object.
*
* @param value The value to check.
* @returns Returns true if value is correctly classified, else false.
*/
isMap<K, V>(value?: any): value is Map<K, V>;
}
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.isMap
*/
isMap(): boolean;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.isMap
*/
isMap(): LoDashExplicitWrapper<boolean>;
}
//_.isMatch
interface isMatchCustomizer {
(value: any, other: any, indexOrKey?: number|string): boolean;
@@ -14951,6 +15001,133 @@ declare module _ {
invert<TResult extends {}>(multiValue?: boolean): LoDashExplicitObjectWrapper<TResult>;
}
//_.inverBy
interface InvertByIterator<T> {
(value: T): any;
}
interface LoDashStatic {
/**
* This method is like _.invert except that the inverted object is generated from the results of running each
* element of object through iteratee. The corresponding inverted value of each inverted key is an array of
* keys responsible for generating the inverted value. The iteratee is invoked with one argument: (value).
*
* @param object The object to invert.
* @param interatee The iteratee invoked per element.
* @return Returns the new inverted object.
*/
invertBy(
object: Object,
interatee?: InvertByIterator<any>|string
): Dictionary<string[]>;
/**
* @see _.invertBy
*/
invertBy<T>(
object: _.Dictionary<T>|_.NumericDictionary<T>,
interatee?: InvertByIterator<T>|string
): Dictionary<string[]>;
/**
* @see _.invertBy
*/
invertBy<W>(
object: Object,
interatee?: W
): Dictionary<string[]>;
/**
* @see _.invertBy
*/
invertBy<T, W>(
object: _.Dictionary<T>,
interatee?: W
): Dictionary<string[]>;
}
interface LoDashImplicitWrapper<T> {
/**
* @see _.invertBy
*/
invertBy(
interatee?: InvertByIterator<any>
): LoDashImplicitObjectWrapper<Dictionary<string[]>>;
}
interface LoDashImplicitArrayWrapper<T> {
/**
* @see _.invertBy
*/
invertBy(
interatee?: InvertByIterator<T>|string
): LoDashImplicitObjectWrapper<Dictionary<string[]>>;
/**
* @see _.invertBy
*/
invertBy<W>(
interatee?: W
): LoDashImplicitObjectWrapper<Dictionary<string[]>>;
}
interface LoDashImplicitObjectWrapper<T> {
/**
* @see _.invertBy
*/
invertBy(
interatee?: InvertByIterator<any>|string
): LoDashImplicitObjectWrapper<Dictionary<string[]>>;
/**
* @see _.invertBy
*/
invertBy<W>(
interatee?: W
): LoDashImplicitObjectWrapper<Dictionary<string[]>>;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.invertBy
*/
invertBy(
interatee?: InvertByIterator<any>
): LoDashExplicitObjectWrapper<Dictionary<string[]>>;
}
interface LoDashExplicitArrayWrapper<T> {
/**
* @see _.invertBy
*/
invertBy(
interatee?: InvertByIterator<T>|string
): LoDashExplicitObjectWrapper<Dictionary<string[]>>;
/**
* @see _.invertBy
*/
invertBy<W>(
interatee?: W
): LoDashExplicitObjectWrapper<Dictionary<string[]>>;
}
interface LoDashExplicitObjectWrapper<T> {
/**
* @see _.invertBy
*/
invertBy(
interatee?: InvertByIterator<any>|string
): LoDashExplicitObjectWrapper<Dictionary<string[]>>;
/**
* @see _.invertBy
*/
invertBy<W>(
interatee?: W
): LoDashExplicitObjectWrapper<Dictionary<string[]>>;
}
//_.keys
interface LoDashStatic {
/**
+10 -11
View File
@@ -58,9 +58,9 @@ declare module 'mailparser' {
class MailParser implements WritableStream {
constructor(options? : Options);
on(event : string, callback : (any : any) => void) : void;
constructor(options?: Options);
on(event: string, callback: (any: any) => void): this;
// from WritableStream
writable: boolean;
write(buffer: Buffer, cb?: Function): boolean;
@@ -70,19 +70,18 @@ declare module 'mailparser' {
end(buffer: Buffer, cb?: Function): void;
end(str: string, cb?: Function): void;
end(str: string, encoding?: string, cb?: Function): void;
// from EventEmitter
static listenerCount(emitter: EventEmitter, event: string): number;
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
setMaxListeners(n: number): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
}
}
+2
View File
@@ -394,6 +394,8 @@ declare module Accounts {
function onCreateUser(func: Function): void;
function validateLoginAttempt(func: Function): { stop: () => void };
function validateNewUser(func: Function): boolean;
function loginServicesConfigured(): boolean;
function onPageLoadLogin(func: Function): void;
}
declare module App {
+5
View File
@@ -79,3 +79,8 @@ moment.tz.names();
moment.tz.setDefault('America/Los_Angeles');
moment.tz.guess();
moment.tz('America/Los_Angeles').zoneAbbr();
moment.tz('America/Los_Angeles').zoneName();
+2
View File
@@ -9,6 +9,8 @@ declare module moment {
interface Moment {
tz(): string;
tz(timezone: string): Moment;
zoneAbbr() :Moment;
zoneName() :Moment;
}
interface MomentStatic {
+18 -18
View File
@@ -37,11 +37,11 @@ declare module "noble" {
writeHandle(handle: NodeBuffer, data: NodeBuffer, withoutResponse: boolean, callback: (error: string) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
on(event: "connect", listener: (error: string) => void): events.EventEmitter;
on(event: "disconnect", listener: (error: string) => void): events.EventEmitter;
on(event: "rssiUpdate", listener: (rssi: number) => void): events.EventEmitter;
on(event: "servicesDiscover", listener: (services: Service[]) => void): events.EventEmitter;
on(event: string, listener: Function): this;
on(event: "connect", listener: (error: string) => void): this;
on(event: "disconnect", listener: (error: string) => void): this;
on(event: "rssiUpdate", listener: (rssi: number) => void): this;
on(event: "servicesDiscover", listener: (services: Service[]) => void): this;
}
export interface Advertisement {
@@ -63,9 +63,9 @@ declare module "noble" {
discoverCharacteristics(characteristicUUIDs: string[], callback?: (error: string, characteristics: Characteristic[]) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
on(event: "includedServicesDiscover", listener: (includedServiceUuids: string[]) => void): events.EventEmitter;
on(event: "characteristicsDiscover", listener: (characteristics: Characteristic[]) => void): events.EventEmitter;
on(event: string, listener: Function): this;
on(event: "includedServicesDiscover", listener: (includedServiceUuids: string[]) => void): this;
on(event: "characteristicsDiscover", listener: (characteristics: Characteristic[]) => void): this;
}
export class Characteristic extends events.EventEmitter {
@@ -82,13 +82,13 @@ declare module "noble" {
discoverDescriptors(callback?: (error: string, descriptors: Descriptor[]) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
on(event: string, option: boolean, listener: Function): events.EventEmitter;
on(event: "read", listener: (data: NodeBuffer, isNotification: boolean) => void): events.EventEmitter;
on(event: "write", withoutResponse: boolean, listener: (error: string) => void): events.EventEmitter;
on(event: "broadcast", listener: (state: string) => void): events.EventEmitter;
on(event: "notify", listener: (state: string) => void): events.EventEmitter;
on(event: "descriptorsDiscover", listener: (descriptors: Descriptor[]) => void): events.EventEmitter;
on(event: string, listener: Function): this;
on(event: string, option: boolean, listener: Function): this;
on(event: "read", listener: (data: NodeBuffer, isNotification: boolean) => void): this;
on(event: "write", withoutResponse: boolean, listener: (error: string) => void): this;
on(event: "broadcast", listener: (state: string) => void): this;
on(event: "notify", listener: (state: string) => void): this;
on(event: "descriptorsDiscover", listener: (descriptors: Descriptor[]) => void): this;
}
export class Descriptor extends events.EventEmitter {
@@ -100,9 +100,9 @@ declare module "noble" {
writeValue(data: NodeBuffer, callback?: (error: string) => void): void;
toString(): string;
on(event: string, listener: Function): events.EventEmitter;
on(event: "valueRead", listener: (error: string, data: NodeBuffer) => void): events.EventEmitter;
on(event: "valueWrite", listener: (error: string) => void): events.EventEmitter;
on(event: string, listener: Function): this;
on(event: "valueRead", listener: (error: string, data: NodeBuffer) => void): this;
on(event: "valueWrite", listener: (error: string) => void): this;
}
}
-6
View File
@@ -36,12 +36,6 @@ declare namespace __NodeUUID {
v1(options?: UUIDOptions): string;
v1(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v2(options?: UUIDOptions): string;
v2(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v3(options?: UUIDOptions): string;
v3(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v4(options?: UUIDOptions): string;
v4(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
-4
View File
@@ -3,8 +3,6 @@
import nodeUuid = require('node-uuid');
var uid1: string = nodeUuid.v1();
var uid2: string = nodeUuid.v2();
var uid3: string = nodeUuid.v3();
var uid4: string = nodeUuid.v4();
var options: __NodeUUID.UUIDOptions = {
@@ -24,6 +22,4 @@ nodeUuid.parse(uid4, buf, offset);
nodeUuid.unparse(buf, offset);
var uid21: number[] = nodeUuid.v1(options, padding, offset);
var uid22: number[] = nodeUuid.v2(options, padding, offset);
var uid23: number[] = nodeUuid.v3(options, padding, offset);
var uid24: number[] = nodeUuid.v4(options, padding, offset);
-4
View File
@@ -1,8 +1,6 @@
/// <reference path="node-uuid-global.d.ts" />
var uid1: string = uuid.v1();
var uid2: string = uuid.v2();
var uid3: string = uuid.v3();
var uid4: string = uuid.v4();
var options: __NodeUUID.UUIDOptions = {
@@ -22,6 +20,4 @@ uuid.parse(uid4, buf, offset);
uuid.unparse(buf, offset);
var uid21: number[] = uuid.v1(options, padding, offset);
var uid22: number[] = uuid.v2(options, padding, offset);
var uid23: number[] = uuid.v3(options, padding, offset);
var uid24: number[] = uuid.v4(options, padding, offset);
-6
View File
@@ -3,8 +3,6 @@
import nodeUuid = require('node-uuid');
var uid1: string = nodeUuid.v1();
var uid2: string = nodeUuid.v2();
var uid3: string = nodeUuid.v3();
var uid4: string = nodeUuid.v4();
var options: __NodeUUID.UUIDOptions = {
@@ -24,13 +22,9 @@ nodeUuid.parse(uid4, buf, offset);
nodeUuid.unparse(buf, offset);
var uid21: number[] = nodeUuid.v1(options, padding, offset);
var uid22: number[] = nodeUuid.v2(options, padding, offset);
var uid23: number[] = nodeUuid.v3(options, padding, offset);
var uid24: number[] = nodeUuid.v4(options, padding, offset);
var buffer: Buffer;
var uid31: Buffer = nodeUuid.v1(options, buffer, offset);
var uid32: Buffer = nodeUuid.v2(options, buffer, offset);
var uid33: Buffer = nodeUuid.v3(options, buffer, offset);
var uid34: Buffer = nodeUuid.v4(options, buffer, offset);
-8
View File
@@ -23,14 +23,6 @@ declare module __NodeUUID {
v1(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v1(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer;
v2(options?: UUIDOptions): string;
v2(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v2(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer;
v3(options?: UUIDOptions): string;
v3(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v3(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer;
v4(options?: UUIDOptions): string;
v4(options?: UUIDOptions, buffer?: number[], offset?: number): number[];
v4(options?: UUIDOptions, buffer?: Buffer, offset?: number): Buffer;
+11 -17
View File
@@ -87,11 +87,11 @@ declare module NodeJS {
}
export interface EventEmitter {
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -208,7 +208,7 @@ interface NodeBuffer {
length: number;
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
slice(start?: number, end?: number): Buffer;
readUInt8(offset: number, noAsset?: boolean): number;
readUInt8(offset: number, noAssert?: boolean): number;
readUInt16LE(offset: number, noAssert?: boolean): number;
readUInt16BE(offset: number, noAssert?: boolean): number;
readUInt32LE(offset: number, noAssert?: boolean): number;
@@ -259,11 +259,11 @@ declare module "events" {
export class EventEmitter implements NodeJS.EventEmitter {
static listenerCount(emitter: EventEmitter, event: string): number;
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1389,12 +1389,6 @@ declare module "domain" {
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
addListener(event: string, listener: Function): Domain;
on(event: string, listener: Function): Domain;
once(event: string, listener: Function): Domain;
removeListener(event: string, listener: Function): Domain;
removeAllListeners(event?: string): Domain;
}
export function create(): Domain;
+11 -17
View File
@@ -87,11 +87,11 @@ declare module NodeJS {
}
export interface EventEmitter {
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -208,7 +208,7 @@ interface NodeBuffer {
length: number;
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
slice(start?: number, end?: number): Buffer;
readUInt8(offset: number, noAsset?: boolean): number;
readUInt8(offset: number, noAssert?: boolean): number;
readUInt16LE(offset: number, noAssert?: boolean): number;
readUInt16BE(offset: number, noAssert?: boolean): number;
readUInt32LE(offset: number, noAssert?: boolean): number;
@@ -259,11 +259,11 @@ declare module "events" {
export class EventEmitter implements NodeJS.EventEmitter {
static listenerCount(emitter: EventEmitter, event: string): number;
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1312,12 +1312,6 @@ declare module "domain" {
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
addListener(event: string, listener: Function): Domain;
on(event: string, listener: Function): Domain;
once(event: string, listener: Function): Domain;
removeListener(event: string, listener: Function): Domain;
removeAllListeners(event?: string): Domain;
}
export function create(): Domain;
+11 -17
View File
@@ -168,11 +168,11 @@ declare module NodeJS {
}
export interface EventEmitter {
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -364,7 +364,7 @@ interface NodeBuffer {
readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
readUInt8(offset: number, noAsset?: boolean): number;
readUInt8(offset: number, noAssert?: boolean): number;
readUInt16LE(offset: number, noAssert?: boolean): number;
readUInt16BE(offset: number, noAssert?: boolean): number;
readUInt32LE(offset: number, noAssert?: boolean): number;
@@ -415,11 +415,11 @@ declare module "events" {
export class EventEmitter implements NodeJS.EventEmitter {
static listenerCount(emitter: EventEmitter, event: string): number;
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): void;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -1844,12 +1844,6 @@ declare module "domain" {
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
addListener(event: string, listener: Function): Domain;
on(event: string, listener: Function): Domain;
once(event: string, listener: Function): Domain;
removeListener(event: string, listener: Function): Domain;
removeAllListeners(event?: string): Domain;
}
export function create(): Domain;
+1 -1
View File
@@ -170,7 +170,7 @@ interface Buffer {
length: number;
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
slice(start?: number, end?: number): Buffer;
readUInt8(offset: number, noAsset?: boolean): number;
readUInt8(offset: number, noAssert?: boolean): number;
readUInt16LE(offset: number, noAssert?: boolean): number;
readUInt16BE(offset: number, noAssert?: boolean): number;
readUInt32LE(offset: number, noAssert?: boolean): number;
+44 -21
View File
@@ -174,12 +174,12 @@ declare module NodeJS {
}
export interface EventEmitter {
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
setMaxListeners(n: number): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -211,6 +211,23 @@ declare module NodeJS {
export interface ReadWriteStream extends ReadableStream, WritableStream {}
export interface Events extends EventEmitter { }
export interface Domain extends Events {
run(fn: Function): void;
add(emitter: Events): void;
remove(emitter: Events): void;
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
}
export interface Process extends EventEmitter {
stdout: WritableStream;
stderr: WritableStream;
@@ -275,9 +292,12 @@ declare module NodeJS {
umask(mask?: number): number;
uptime(): number;
hrtime(time?:number[]): number[];
domain: Domain;
// Worker
send?(message: any, sendHandle?: any): void;
disconnect(): void;
connected: boolean;
}
export interface Global {
@@ -373,7 +393,7 @@ interface NodeBuffer {
readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
readUInt8(offset: number, noAsset?: boolean): number;
readUInt8(offset: number, noAssert?: boolean): number;
readUInt16LE(offset: number, noAssert?: boolean): number;
readUInt16BE(offset: number, noAssert?: boolean): number;
readUInt32LE(offset: number, noAssert?: boolean): number;
@@ -440,12 +460,12 @@ declare module "events" {
static listenerCount(emitter: EventEmitter, event: string): number; // deprecated
static defaultMaxListeners: number;
addListener(event: string, listener: Function): EventEmitter;
on(event: string, listener: Function): EventEmitter;
once(event: string, listener: Function): EventEmitter;
removeListener(event: string, listener: Function): EventEmitter;
removeAllListeners(event?: string): EventEmitter;
setMaxListeners(n: number): EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
@@ -626,6 +646,12 @@ declare module "cluster" {
silent?: boolean;
}
export interface Address {
address: string;
port: number;
addressType: string;
}
export class Worker extends events.EventEmitter {
id: string;
process: child.ChildProcess;
@@ -1720,15 +1746,18 @@ declare module "crypto" {
final(): Buffer;
final(output_encoding: string): string;
setAutoPadding(auto_padding: boolean): void;
getAuthTag(): Buffer;
}
export function createDecipher(algorithm: string, password: any): Decipher;
export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
export interface Decipher {
update(data: Buffer): Buffer;
update(data: string, input_encoding?: string, output_encoding?: string): string;
update(data: string|Buffer, input_encoding?: string, output_encoding?: string): string;
update(data: string|Buffer, input_encoding?: string, output_encoding?: string): Buffer;
final(): Buffer;
final(output_encoding: string): string;
setAutoPadding(auto_padding: boolean): void;
setAuthTag(tag: Buffer): void;
}
export function createSign(algorithm: string): Signer;
export interface Signer extends NodeJS.WritableStream {
@@ -1951,19 +1980,13 @@ declare module "tty" {
declare module "domain" {
import * as events from "events";
export class Domain extends events.EventEmitter {
export class Domain extends events.EventEmitter implements NodeJS.Domain {
run(fn: Function): void;
add(emitter: events.EventEmitter): void;
remove(emitter: events.EventEmitter): void;
bind(cb: (err: Error, data: any) => any): any;
intercept(cb: (data: any) => any): any;
dispose(): void;
addListener(event: string, listener: Function): Domain;
on(event: string, listener: Function): Domain;
once(event: string, listener: Function): Domain;
removeListener(event: string, listener: Function): Domain;
removeAllListeners(event?: string): Domain;
}
export function create(): Domain;
+211 -163
View File
@@ -141,7 +141,7 @@ declare module olx {
/** Use the ol.Map#pixelRatio value when requesting the image from the remote server. Default is true.*/
hidpi?: boolean;
logo?: string | olx.LogoOptions;
/** Tile grid. Base this on the resolutions, tilesize and extent supported by the server. If this is not defined, a default grid will be used: if there is a projection extent, the grid will be based on that; if not, a grid based on a global extent with origin at 0,0 will be used. */
@@ -172,15 +172,15 @@ declare module olx {
* Object literal with config options for the map logo.
*/
interface LogoOptions {
/**
* Link url for the logo. Will be followed when the logo is clicked.
*/
href: string;
/**
* Link url for the logo. Will be followed when the logo is clicked.
*/
href: string;
/**
* Image src for the logo
*/
src: string;
/**
* Image src for the logo
*/
src: string;
}
@@ -529,15 +529,15 @@ declare module olx {
pinchZoom?: boolean;
zoomDelta?: number;
zoomDuration?: number;
}
interface ModifyOptions {
}
interface ModifyOptions {
deleteCondition?: ol.events.ConditionType;
pixelTolerance?: number;
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
features: ol.Collection<ol.Feature>;
wrapX?: boolean;
}
interface DrawOptions {
interface DrawOptions {
clickTolerance?: number;
features?: ol.Collection<ol.Feature>;
source?: ol.source.Vector;
@@ -545,15 +545,15 @@ declare module olx {
type: ol.geom.GeometryType;
maxPoints?: number;
minPoints?: number;
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
geometryFunction?: ol.interaction.DrawGeometryFunctionType;
wrapX?: boolean;
}
interface SelectOptions{
interface SelectOptions {
addCondition?: ol.events.ConditionType;
condition?: ol.events.ConditionType;
layers?: Array<ol.layer.Layer>;
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
style?: ol.style.Style | Array<ol.style.Style> | ol.style.StyleFunction;
removeCondition?: ol.events.ConditionType;
toggleCondition?: ol.events.ConditionType;
multi?: boolean;
@@ -580,7 +580,7 @@ declare module olx {
* The bounding extent for layer rendering. The layer will not be rendered outside of this extent.
*/
extent?: ol.Extent;
zIndex?: number;
/**
* The minimum resolution (inclusive) at which this layer will be visible.
@@ -748,7 +748,7 @@ declare module olx {
*/
wrapX?: boolean;
}
interface WMTSOptions{
interface WMTSOptions {
attributions?: Array<ol.Attribution>;
crossOrigin?: string;
logo?: string | olx.LogoOptions;
@@ -788,18 +788,18 @@ declare module olx {
}
interface TextOptions {
font?: string;
offsetX?: number;
offsetY?: number;
scale?: number;
rotation?: number;
text?: string;
textAlign?: string;
textBaseline?: string;
fill?: ol.style.Fill;
stroke?: ol.style.Stroke;
font?: string;
offsetX?: number;
offsetY?: number;
scale?: number;
rotation?: number;
text?: string;
textAlign?: string;
textBaseline?: string;
fill?: ol.style.Fill;
stroke?: ol.style.Stroke;
}
interface StrokeOptions {
interface StrokeOptions {
color?: ol.Color | string;
lineCap?: string;
lineJoin?: string;
@@ -985,6 +985,12 @@ declare module olx {
}
module format {
interface WKTOptions {
/**
* Whether to split GeometryCollections into multiple features on reading. Default is false.
*/
splitCollection?: boolean;
}
interface GeoJSONOptions {
@@ -1037,9 +1043,9 @@ declare module olx {
*/
declare module ol {
interface TileLoadFunctionType{ (image: ol.Image, url: string): void }
interface TileLoadFunctionType { (image: ol.Image, url: string): void }
interface ImageLoadFunctionType{ (image: ol.Image, url: string): void }
interface ImageLoadFunctionType { (image: ol.Image, url: string): void }
/**
* An attribution for a layer source.
@@ -1282,7 +1288,7 @@ declare module ol {
* Set the feature id. The feature id is considered stable and may be used when requesting features or comparing identifiers returned from a remote source. The feature id can be used with the ol.source.Vector#getFeatureById method.
* @param id The feature id.
*/
setId(id: string|number): void;
setId(id: string | number): void;
/**
* Set the style for the feature. This can be a single style object, an array of styles, or a function that takes a resolution and returns an array of styles. If it is null the feature has no style (a null style).
@@ -2197,19 +2203,12 @@ declare module ol {
constrainResolution(resolution: number, delta?: number, direction?: number): number;
/**
* Fit the map view to the passed extent and size. The size is pixel dimensions of the box to fit the extent into. In most cases you will want to use the map size, that is map.getSize().
* @param extent Extent.
* @param size Box pixel size.
*/
fitExtent(extent: ol.Extent, size: ol.Size): void;
/**
* Fit the given geometry into the view based on the given map size and border.
* @param geometry Geometry.
* @param size Box pixel size.
* @param options Options
*/
fitGeometry(geometry: ol.geom.SimpleGeometry, size: ol.Size, options?: olx.view.FitGeometryOptions): void;
* Fit the map view to the passed extent and size. The size is pixel dimensions of the box to fit the extent into. In most cases you will want to use the map size, that is map.getSize().
* @param extent Extent.
* @param size Box pixel size.
* @param options Options
*/
fit(geometry: ol.geom.SimpleGeometry | ol.Extent, size: ol.Size, opt_options?: olx.view.FitGeometryOptions): void;
/**
* Get the view center.
@@ -2803,6 +2802,55 @@ declare module ol {
}
class WKT {
constructor(opt_options?: olx.format.WKTOptions);
/**
* Read a feature from a WKT source.
* @param source Source
* @param options Read options
* @returns Feature
*/
readFeature(source: Document | Node | JSON | string, opt_options?: olx.format.ReadOptions): ol.Feature;
/**
* Read all features from a WKT source.
* @param source Source
* @param options Read options
* @returns Features
*/
readFeatures(source: Document | Node | JSON | string, options?: olx.format.ReadOptions): Array<ol.Feature>;
/**
* Read a geometry from a GeoJSON source.
* @param source Source
* @param options Read options
* @returns Geometry
*/
readGeometry(source: Document | Node | JSON | string, options?: olx.format.ReadOptions): ol.geom.Geometry;
/**
* Encode a feature as a WKT string.
* @param feature Feature
* @param options Write options
* @returns GeoJSON
*/
writeFeature(feature: ol.Feature, options?: olx.format.WriteOptions): string;
/**
* Encode an array of features as a WKT string.
* @param features Features
* @param options Write options
* @returns GeoJSON
*/
writeFeatures(features: Array<ol.Feature>, options?: olx.format.WriteOptions): string;
/**
* Write a single geometry as a WKT string.
* @param geometry Geometry
* @param options Write options
* @returns GeoJSON
*/
writeGeometry(geometry: ol.geom.Geometry, options?: olx.format.WriteOptions): string;
}
class WMSCapabilities {
@@ -3057,7 +3105,7 @@ declare module ol {
* @param coordinates Coordinates.
* @param layout Layout.
*/
setCoordinates(coordinates: Array<ol.Coordinate>, layout?: ol.geom.GeometryLayout) : void;
setCoordinates(coordinates: Array<ol.Coordinate>, layout?: ol.geom.GeometryLayout): void;
}
/**
@@ -3549,8 +3597,8 @@ declare module ol {
}
function defaults(opts: olx.interaction.DefaultsOptions): ol.Collection<ol.interaction.Interaction>;
interface DrawGeometryFunctionType { (coordinates: ol.Coordinate, geom?: ol.geom.Geometry): ol.geom.Geometry;}
interface SelectFilterFunction { (feature: ol.Feature | ol.render.Feature, layer: ol.layer.Layer):boolean;}
interface DrawGeometryFunctionType { (coordinates: ol.Coordinate, geom?: ol.geom.Geometry): ol.geom.Geometry; }
interface SelectFilterFunction { (feature: ol.Feature | ol.render.Feature, layer: ol.layer.Layer): boolean; }
}
module layer {
@@ -4014,7 +4062,7 @@ declare module ol {
class VectorContext {
}
class Feature{
class Feature {
get(key: string): any;
getExtent(): ol.Extent;
getGeometry(): ol.geom.Geometry;
@@ -4099,39 +4147,39 @@ declare module ol {
}
class Vector {
constructor(opts: olx.source.VectorOptions)
/**
* Add a single feature to the source. If you want to add a batch of features at once,
* call source.addFeatures() instead.
*/
addFeature(feature: ol.Feature):void;
constructor(opts?: olx.source.VectorOptions)
/**
* Add a single feature to the source. If you want to add a batch of features at once,
* call source.addFeatures() instead.
*/
addFeature(feature: ol.Feature): void;
/**
* Add a batch of features to the source.
*/
addFeatures(features: ol.Feature[]):void;
/**
* Add a batch of features to the source.
*/
addFeatures(features: ol.Feature[]): void;
/**
* Remove all features from the source.
* @param Skip dispatching of removefeature events.
*/
clear(fast?: boolean):void;
/**
* Get the extent of the features currently in the source.
*/
getExtent(): ol.Extent;
clear(fast?: boolean): void;
/**
* Get the extent of the features currently in the source.
*/
getExtent(): ol.Extent;
/**
* Get all features in the provided extent. Note that this returns all features whose bounding boxes
* intersect the given extent (so it may include features whose geometries do not intersect the extent).
* This method is not available when the source is configured with useSpatialIndex set to false.
*/
getFeaturesInExtent(extent: ol.Extent): ol.Feature[];
/**
* Get all features in the provided extent. Note that this returns all features whose bounding boxes
* intersect the given extent (so it may include features whose geometries do not intersect the extent).
* This method is not available when the source is configured with useSpatialIndex set to false.
*/
getFeaturesInExtent(extent: ol.Extent): ol.Feature[];
/**
* Get all features on the source
*/
getFeatures(): ol.Feature[];
/**
* Get all features on the source
*/
getFeatures(): ol.Feature[];
}
class VectorEvent {
@@ -4162,7 +4210,7 @@ declare module ol {
class AtlasManager {
}
class Circle extends Image{
class Circle extends Image {
constructor(opt_options?: olx.style.CircleOptions);
}
@@ -4171,16 +4219,16 @@ declare module ol {
*/
class Fill {
constructor(opt_options?: olx.style.FillOptions);
constructor(opt_options?: olx.style.FillOptions);
getColor(): ol.Color | string;
getColor(): ol.Color | string;
/**
* Set the color.
*/
setColor(color: ol.Color | string): void;
/**
* Set the color.
*/
setColor(color: ol.Color | string): void;
getChecksum(): string;
getChecksum(): string;
}
class Icon extends Image {
@@ -4193,14 +4241,14 @@ declare module ol {
getRotation(): number;
getScale(): number;
getSnapToPiexl(): boolean;
setOpacity(opacity: number):void;
setRotation(rotation: number):void;
setScale(scale: number):void;
setOpacity(opacity: number): void;
setRotation(rotation: number): void;
setScale(scale: number): void;
}
interface GeometryFunction {
(feature: Feature): ol.geom.Geometry
(feature: Feature): ol.geom.Geometry
}
class RegularShape {
@@ -4208,18 +4256,18 @@ declare module ol {
class Stroke {
constructor(opts?: olx.style.StrokeOptions);
getColor(): ol.Color|string;
getColor(): ol.Color | string;
getLineCap(): string;
getLineDash(): number[];
getLineJoin(): string;
getMitterLimit(): number;
getWidth(): number;
setColor(color: ol.Color|string):void;
setLineCap(lineCap: string):void;
setLineDash(lineDash: number[]):void;
setLineJoin(lineJoin: string):void;
setMiterLimit(miterLimit: number):void;
setWidth(width: number):void;
setColor(color: ol.Color | string): void;
setLineCap(lineCap: string): void;
setLineDash(lineDash: number[]): void;
setLineJoin(lineJoin: string): void;
setMiterLimit(miterLimit: number): void;
setWidth(width: number): void;
}
/**
@@ -4228,92 +4276,92 @@ declare module ol {
* feature, layer or FeatureOverlay that uses the style is re-rendered.
*/
class Style {
constructor(opts: olx.style.StyleOptions);
getFill(): ol.style.Fill;
/***
* Get the geometry to be rendered.
* @return Feature property or geometry or function that returns the geometry that will
* be rendered with this style.
*/
getGeometry(): string | ol.geom.Geometry | ol.style.GeometryFunction;
getGeometryFunction(): ol.style.GeometryFunction;
getImage(): ol.style.Image;
getStroke(): ol.style.Stroke;
getText(): ol.style.Text;
getZIndex(): number;
setGeometry(geometry: string | ol.geom.Geometry | ol.style.GeometryFunction):void;
setZIndex( zIndex: number):void;
constructor(opts: olx.style.StyleOptions);
getFill(): ol.style.Fill;
/***
* Get the geometry to be rendered.
* @return Feature property or geometry or function that returns the geometry that will
* be rendered with this style.
*/
getGeometry(): string | ol.geom.Geometry | ol.style.GeometryFunction;
getGeometryFunction(): ol.style.GeometryFunction;
getImage(): ol.style.Image;
getStroke(): ol.style.Stroke;
getText(): ol.style.Text;
getZIndex(): number;
setGeometry(geometry: string | ol.geom.Geometry | ol.style.GeometryFunction): void;
setZIndex(zIndex: number): void;
}
/**
* Set text style for vector features.
*/
class Text {
constructor(opt?: olx.style.TextOptions);
constructor(opt?: olx.style.TextOptions);
getFont(): string;
getOffsetX(): number;
getOffsetY(): number;
getFill(): Fill;
getRotation(): number;
getScale(): number;
getStroke(): Stroke;
getText(): string;
getTextAlign(): string;
getTextBaseline(): string;
getFont(): string;
getOffsetX(): number;
getOffsetY(): number;
getFill(): Fill;
getRotation(): number;
getScale(): number;
getStroke(): Stroke;
getText(): string;
getTextAlign(): string;
getTextBaseline(): string;
/**
* Set the font.
*/
setFont(font: string): void;
/**
* Set the font.
*/
setFont(font: string): void;
/**
* Set the x offset.
*/
setOffsetX(offsetX: number): void;
/**
* Set the x offset.
*/
setOffsetX(offsetX: number): void;
/**
* Set the y offset.
*/
setOffsetY(offsetY: number): void;
/**
* Set the y offset.
*/
setOffsetY(offsetY: number): void;
/**
* Set the fill.
*/
setFill(fill: Fill): void;
/**
* Set the fill.
*/
setFill(fill: Fill): void;
/**
* Set the rotation.
*/
setRotation(rotation: number): void;
/**
* Set the rotation.
*/
setRotation(rotation: number): void;
/**
* Set the scale.
*/
setScale(scale: number): void;
/**
* Set the scale.
*/
setScale(scale: number): void;
/**
* Set the stroke.
*
*/
setStroke(stroke: Stroke): void;
/**
* Set the stroke.
*
*/
setStroke(stroke: Stroke): void;
/**
* Set the text.
*/
setText(text: string): void;
/**
* Set the text.
*/
setText(text: string): void;
/**
* Set the text alignment.
*/
setTextAlign(textAlign: string): void;
/**
* Set the text alignment.
*/
setTextAlign(textAlign: string): void;
/**
* Set the text baseline.
*/
setTextBaseline(textBaseline: string): void;
/**
* Set the text baseline.
*/
setTextBaseline(textBaseline: string): void;
}
/**
+8 -8
View File
@@ -108,7 +108,7 @@ declare module 'parse5' {
* The resulting document node.
*/
document: ASTNode;
on(event: string, listener: Function): ParserStream;
on(event: string, listener: Function): this;
/**
* Raised then parser encounters a <script> element. If this event has listeners, parsing will be suspended
* once it is emitted. So, if <script> has the src attribute,
@@ -117,44 +117,44 @@ declare module 'parse5' {
* The script element that caused the event, a function for writing additional html at the current parsing position. Suitable for implementing the DOM document.write and document.writeln methods.
* And finally a resume function as a callback to signal the continuation of the parsing
*/
on(event: 'script', listener: (scriptElement: ASTNode, documentWrite: (html: string) => void, resume: Function) => void): ParserStream;
on(event: 'script', listener: (scriptElement: ASTNode, documentWrite: (html: string) => void, resume: Function) => void): this;
}
export class SAXParser extends stream.Transform {
constructor(options?: SAXParserOptions);
on(event: string, listener: Function): events.EventEmitter;
on(event: string, listener: Function): this;
/**
* Raised when the parser encounters a start tag.
* Listener function has 4 parameters:
* Tag name, List of attributes in the { key: String, value: String } form, selfClosing boolean
* and start tag source code location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'startTag', listener: (name: string, attrs: Attribute[], selfClosing: boolean, location?: StartTagLocationInfo) => void): SAXParser;
on(event: 'startTag', listener: (name: string, attrs: Attribute[], selfClosing: boolean, location?: StartTagLocationInfo) => void): this;
/**
* Raised when parser encounters an end tag.
* Listener function has 2 parameters:
* Tag name and location End tag source code location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'endTag', listener: (name: string, location?: LocationInfo) => void): SAXParser;
on(event: 'endTag', listener: (name: string, location?: LocationInfo) => void): this;
/**
* Raised then parser encounters a comment.
* Listener function has 2 parameters:
* The comment text and the source code location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'comment', listener: (text: string, location?: LocationInfo) => void): SAXParser;
on(event: 'comment', listener: (text: string, location?: LocationInfo) => void): this;
/**
* Raised then parser encounters text content.
* Listener function has 2 parameters:
* The text content and location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'text', listener: (text: string, location?: LocationInfo) => void): SAXParser;
on(event: 'text', listener: (text: string, location?: LocationInfo) => void): this;
/**
* Raised then parser encounters a document type declaration.
* Listener function has 4 parameters:
* The document type name, document type public identifier, document type system identifier and
* location info. Available if location info is enabled in SAXParserOptions.
*/
on(event: 'doctype', listener: (name: string, publicId: string, systemId: string, location?: LocationInfo) => void): SAXParser;
on(event: 'doctype', listener: (name: string, publicId: string, systemId: string, location?: LocationInfo) => void): this;
/**
* Stops parsing. Useful if you want the parser to stop consuming CPU time once you've obtained the desired info from the input stream.
* Doesn't prevent piping, so that data will flow through the parser as usual.
Vendored
+12 -12
View File
@@ -67,22 +67,22 @@ declare module "pg" {
pauseDrain(): void;
resumeDrain(): void;
public on(event: "drain", listener: () => void): Client;
public on(event: "error", listener: (err: Error) => void): Client;
public on(event: "notification", listener: (message: any) => void): Client;
public on(event: "notice", listener: (message: any) => void): Client;
public on(event: string, listener: Function): Client;
public on(event: "drain", listener: () => void): this;
public on(event: "error", listener: (err: Error) => void): this;
public on(event: "notification", listener: (message: any) => void): this;
public on(event: "notice", listener: (message: any) => void): this;
public on(event: string, listener: Function): this;
}
export class Query extends events.EventEmitter {
public on(event: "row", listener: (row: any, result?: ResultBuilder) => void): Query;
public on(event: "error", listener: (err: Error) => void): Query;
public on(event: "end", listener: (result: ResultBuilder) => void): Query;
public on(event: string, listener: Function): Query;
public on(event: "row", listener: (row: any, result?: ResultBuilder) => void): this;
public on(event: "error", listener: (err: Error) => void): this;
public on(event: "end", listener: (result: ResultBuilder) => void): this;
public on(event: string, listener: Function): this;
}
export class Events extends events.EventEmitter {
public on(event: "error", listener: (err: Error, client: Client) => void): Events;
public on(event: string, listener: Function): Events;
public on(event: "error", listener: (err: Error, client: Client) => void): this;
public on(event: string, listener: Function): this;
}
}
}
-5
View File
@@ -49,10 +49,5 @@ declare module 'png-async' {
write(data: any, cb?: any): boolean;
end(data?: any): void;
bitblt(dst: Image, sx: number, sy: number, w: number, h: number, dx: number, dy: number): Image;
on(event: string, listener: Function): Image;
once(event: string, listener: Function): Image;
removeListener(event: string, listener: Function): Image;
removeAllListeners(event: string): Image;
}
}
+6 -6
View File
@@ -22,7 +22,7 @@ declare module "pngjs2" {
colorType?: number;
inputHasAlpha?: boolean;
}
interface PNGMetadata {
width: number;
height: number;
@@ -40,10 +40,10 @@ declare module "pngjs2" {
data: Buffer;
gamma: number;
on(event: string, callback: Function): PNG;
on(event: "metadata", callback: (metadata: PNGMetadata) => void): PNG;
on(event: "parsed", callback: (data: Buffer) => void): PNG;
on(event: "error", callback: (err: Error) => void): PNG;
on(event: string, callback: Function): this;
on(event: "metadata", callback: (metadata: PNGMetadata) => void): this;
on(event: "parsed", callback: (data: Buffer) => void): this;
on(event: "error", callback: (err: Error) => void): this;
parse(data: string|Buffer, callback?: (err: Error, data: Buffer) => void): PNG;
pack(): PNG;
@@ -55,7 +55,7 @@ declare module "pngjs2" {
bitblt(dst: PNG, srcX: number, srcY: number,
width: number, height: number, deltaX: number, deltaY: number): PNG;
}
export namespace PNG {
namespace sync {
function read(buffer: string|Buffer, options?: PNGOptions): PNG;
@@ -0,0 +1,18 @@
/// <reference path="promisify-supertest.d.ts" />
/// <reference path="../express/express.d.ts" />
import * as request from 'promisify-supertest';
import * as express from 'express';
let app = express();
request(app)
.get('/')
.expect(200)
.end()
.then(function(res) {
// blah blah blah
})
.catch(function(err) {
throw err;
});
+45
View File
@@ -0,0 +1,45 @@
// Type definitions for promisify-supertest v1.0.0
// Project: https://www.npmjs.com/package/promisify-supertest
// Definitions by: Leo Liang <https://github.com/aleung/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../superagent/superagent.d.ts' />
/// <reference path="../express/express.d.ts" />
declare module 'promisify-supertest' {
// Mostly copy-pasted from supertest.d.ts
import * as superagent from 'superagent';
import * as express from 'express';
type CallbackHandler = (err: any, res: supertest.Response) => void;
function supertest(app: express.Express): supertest.SuperTest;
module supertest {
function agent(app?: any): supertest.SuperTest;
interface SuperTest extends superagent.SuperAgent<Test> {
}
interface Test extends superagent.Request<Test> {
url: string;
serverAddress(app: any, path: string): string;
expect(status: number, callback?: CallbackHandler): Test;
expect(status: number, body: string, callback?: CallbackHandler): Test;
expect(body: string, callback?: CallbackHandler): Test;
expect(body: RegExp, callback?: CallbackHandler): Test;
expect(body: Object, callback?: CallbackHandler): Test;
expect(field: string, val: string, callback?: CallbackHandler): Test;
expect(field: string, val: RegExp, callback?: CallbackHandler): Test;
expect(checker: (res: Response) => any): Test;
end(callback: CallbackHandler): Test;
end(): Promise<Response>;
}
interface Response extends superagent.Response {
}
}
export = supertest;
}
+7 -7
View File
@@ -78,14 +78,14 @@ declare module 'pty.js' {
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
// NodeJS EventEmitter interface
addListener(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): NodeJS.EventEmitter;
once(event: string, listener: Function): NodeJS.EventEmitter;
removeListener(event: string, listener: Function): NodeJS.EventEmitter;
removeAllListeners(event?: string): NodeJS.EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
// NOTE: this method is not actually defined in pty.js
setMaxListeners(n: number): NodeJS.EventEmitter;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
+7 -3
View File
@@ -38,14 +38,14 @@ declare module __ReactDnd {
export function DragSource<P>(
type: Identifier | ((props: P) => Identifier),
spec: DragSourceSpec<P>,
collect: (connect: DragSourceConnector, monitor: DragSourceMonitor) => Object,
collect: DragSourceCollector,
options?: DndOptions<P>
): (componentClass: React.ComponentClass<P>) => DndComponentClass<P>;
export function DropTarget<P>(
types: Identifier | Identifier[] | ((props: P) => Identifier | Identifier[]),
spec: DropTargetSpec<P>,
collect: (connect: DropTargetConnector, monitor: DropTargetMonitor) => Object,
collect: DropTargetCollector,
options?: DndOptions<P>
): (componentClass: React.ComponentClass<P>) => DndComponentClass<P>;
@@ -54,10 +54,14 @@ declare module __ReactDnd {
): (componentClass: React.ComponentClass<P>) => ContextComponentClass<P>;
export function DragLayer<P>(
collect: (monitor: DragLayerMonitor) => Object,
collect: DragLayerCollector,
options?: DndOptions<P>
): (componentClass: React.ComponentClass<P>) => DndComponentClass<P>;
type DragSourceCollector = (connect: DragSourceConnector, monitor: DragSourceMonitor) => Object;
type DropTargetCollector = (connect: DropTargetConnector, monitor: DropTargetMonitor) => Object;
type DragLayerCollector = (monitor: DragLayerMonitor) => Object;
// Shared
// ----------------------------------------------------------------------
+25
View File
@@ -0,0 +1,25 @@
// react-holder test
///<reference path="react-holder.d.ts"/>
///<reference path="../react/react.d.ts"/>
import * as React from "react";
import Holder from "react-holder";
export class ReactHolderTest extends React.Component<any, any> {
public render() {
return (
<div>
<Holder
// width and height can be a number or a string
width="100%"
height="200px"
// default: false
updateOnResize={true}
className={'my-custom-class'}
/>
</div>
);
}
}
+34
View File
@@ -0,0 +1,34 @@
// Type definitions for react-holder 1.0.0
// Project: https://github.com/Moeriki/react-holder
// Definitions by: Isman Usoh <https://github.com/isman-usoh>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="../react/react.d.ts"/>
declare module "react-holder" {
import React = __React;
interface ReactHolderProp extends React.HTMLProps<ReactHolder> {
width: string | number;
height: string | number;
updateOnResize: boolean;
// config args
theme?: string;
random?: boolean;
bg?: string
fg?: string;
text?: string;
size?: number;
font?: string;
align?: string;
outline?: boolean;
lineWrap?: number;
}
class ReactHolder extends React.Component<ReactHolderProp, any> {
}
export default ReactHolder;
}
@@ -0,0 +1,5 @@
/// <reference path="react-tap-event-plugin.d.ts"/>
import * as injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for react-tap-event-plugin
// Project: https://github.com/zilverline/react-tap-event-plugin
// Definitions by: Michael Ledin <https://github.com/mxl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'react-tap-event-plugin'{
var exports:()=>any;
export = exports;
}
+3
View File
@@ -1843,6 +1843,9 @@ declare namespace __React {
results?: number;
security?: string;
unselectable?: boolean;
// Allows aria- and data- Attributes
[key: string]: any;
}
interface SVGAttributes extends HTMLAttributes {
+7 -7
View File
@@ -62,7 +62,7 @@ declare module 'request' {
interface DefaultUriUrlRequestApi<TRequest extends Request,
TOptions extends CoreOptions,
TUriUrlOptions> extends RequestAPI<TRequest, TOptions, TUriUrlOptions> {
defaults(options: TOptions): DefaultUriUrlRequestApi<TRequest, TOptions, OptionalUriUrl>;
(): TRequest;
get(): TRequest;
@@ -182,12 +182,12 @@ declare module 'request' {
oauth(oauth: OAuthOptions): Request;
jar(jar: CookieJar): Request;
on(event: string, listener: Function): Request;
on(event: 'request', listener: (req: http.ClientRequest) => void): Request;
on(event: 'response', listener: (resp: http.IncomingMessage) => void): Request;
on(event: 'data', listener: (data: Buffer | string) => void): Request;
on(event: 'error', listener: (e: Error) => void): Request;
on(event: 'complete', listener: (resp: http.IncomingMessage, body?: string | Buffer) => void): Request;
on(event: string, listener: Function): this;
on(event: 'request', listener: (req: http.ClientRequest) => void): this;
on(event: 'response', listener: (resp: http.IncomingMessage) => void): this;
on(event: 'data', listener: (data: Buffer | string) => void): this;
on(event: 'error', listener: (e: Error) => void): this;
on(event: 'complete', listener: (resp: http.IncomingMessage, body?: string | Buffer) => void): this;
write(buffer: Buffer, cb?: Function): boolean;
write(str: string, cb?: Function): boolean;
+23
View File
@@ -0,0 +1,23 @@
/// <reference path="sat.d.ts" />
class SatTest{
public vectorTest(){
let v1: SAT.Vector = new SAT.Vector(10, 10);
console.log("def: v1 - " + v1.x.toString() + v1.y.toString());
let v2: SAT.Vector = new SAT.Vector(20,20);
console.log("def: v2 - " + v2.x.toString() + v1.y.toString());
let v3: SAT.Vector = new SAT.Vector(30,30);
console.log("def: v3 -" + v3.x.toString() + v1.y.toString());
v2.copy(v1);
console.log("copy: v2 - " + v2.x.toString() + v2.y.toString());
v3 = v1.clone();
console.log("clone: v3 - " + v3.x.toString() + v3.y.toString());
v3.perp();
console.log("perp: v3 - " + v3.x.toString() + v3.y.toString());
}
}
let test = new SatTest;
test.vectorTest();
+142
View File
@@ -0,0 +1,142 @@
// Type definitions for sat.js
// Project: https://github.com/jriecken/sat-js
// Definitions by: Hou Chunlei <https://github.com/omni360>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module SAT {
/**
* This is a simple 2D vector/point class,Vector has two parameters {x},{y}.
*/
export class Vector {
/**
* @class Vector has two properties
* @param {number} x The x-coordinate of the Vector.
* @param {number} y The y-coordinate of the Vector.
*/
constructor(x: number, y: number);
x: number;
y: number;
copy(other: Vector): Vector;
clone(): Vector;
perp(): Vector;
rotate(angle: number): Vector;
reverse(): Vector;
normalize(): Vector;
add(other: Vector): Vector;
sub(other: Vector): Vector;
scale(x: number, y: number): Vector;
project(other: Vector): Vector;
projectN(other: Vector): Vector;
reflect(axis: Vector): Vector;
reflectN(axis: Vector): Vector;
dot(other: Vector): number;
len2(): number;
len(): number;
}
/**
* This is simple circle with a center {pos} position and radius {r}.
*/
export class Circle {
constructor(pos: Vector, r: number);
pos: Vector;
r: number;
}
export class Polygon {
constructor(pos: Vector, points: Vector[]);
pos: Vector;
points: Vector[];
angle: number;
offset: Vector;
calcPoints: Vector[];
edges: Vector[];
normals: Vector[];
setPoints(points: Vector[]): Polygon;
setAngle(angle: number): Polygon;
setOffset(offset: Vector): Polygon;
recalc(): Polygon;
rotate(angle: number): Polygon;
translate(x: number, y: number): Polygon;
getAABB(): Polygon;
}
export class Box {
constructor(pos: Vector, width: number, height: number);
pos: Vector;
w: number;
h: number;
toPolygon(): Polygon;
}
export class Response {
constructor();
a: any;
b: any;
overlap: number;
overlapN: Vector;
overlapV: Vector;
aInB: boolean;
bInA: boolean;
clear(): Response;
}
/**
* @function {pointInCircle} checks whether a given point {p} is inside the specified circle {c}.
* @param {Vector} p given a point to checks.
* @param {Circle} c check with a specified circle
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function pointInCircle(p: Vector, c: Circle): boolean;
/**
* @function {pointInPolygon} checks whether a given point [p] is inside a specified convex polygon.
* @param {Vector} p given a point to check.
* @param {Polygon} poly check with a spcified convex polygon.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function pointInPolygon(p: Vector, poly: Polygon): boolean;
/**
* @function {testCicleCircle} tests a collision between two {Circle}s, {a} and {b}.
* if a {response} is to be calculated in the event of a collision, pass in a cleared {Response} object.
* @param {Circle} a specified circle a to tests.
* @param {Circle} b spacified circle b to tests.
* @param {Response} response specified the result of a collision between two circle.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function testCircleCircle(a: Circle, b: Circle, response?: Response): boolean;
/**
* @function {testPolygonCicle} tests a collision between a {Polygon} and a {Circle}. if a response is to
* be calculated in the event of a collision, pass in a cleared {Response} object.
* @param {Polygon} polygon specified a Polygon to tests a collision.
* @param {Circle} circle specified a Circle to tests a collision.
* @param {Response} response specified the result of a collision between a {Polygon} and a {Circle}.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function testPolygonCircle(polygon: Polygon, circle: Circle, response?: Response): boolean;
/**
* @function {testCirclePolygon} tests a collision between a {Circle} and a {Polygon}. if a response is to
* be calculated in the event of a collision, pass in a cleared {Response} object.
* @param {Circle} circle specified a {Circle} to tests a collision.
* @param {Polygon} polygon specified a {Polygon} to tests a collision.
* @param {Response} response specified the result of a collision between a {Circle} and a {Polygon}.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function testCirclePolygon(circle: Circle, polygon: Polygon, response?: Response): boolean;
/**
* @function {testPolygonPolygon} tests whether two polygons {a} and {b} collide.
* if a response is to be calculated in the event of a collision, pass in a cleared {Response} object.
* @param {Polygon} a specified a {Polygon} {a} to test a collision.
* @param {Polygon} b specified a {Polygon} {b} to test a collision.
* @param {Response} response specified the result of a collision between two {Polygon}s.
* @return {boolean} return {true} if there is a collision. {false} otherwise.
*/
export function testPolygonPolygon(a: Polygon, b: Polygon, response?: Response): boolean;
}
+84 -38
View File
@@ -1,43 +1,89 @@
/// <reference path="../node/node.d.ts" />
/// <reference path="./sax.d.ts" />
import sax = require("sax");
var opts: sax.SAXOptions = {
lowercase: true,
normalize: true,
xmlns: true,
position: true
};
var parser = sax.parser(/*strict=*/true, opts);
parser.onerror = function(e: Error) {
};
parser.ontext = function(text: string) {
};
parser.onopentag = function(tag: sax.Tag) {
};
parser.onattribute = function(attr: { name: string; value: string; }) {
};
parser.onend = function() {
};
parser.write("<xml>Hello, <who name=\"world\">world</who>!</xml>").close();
var saxStream = sax.createStream(/*strict=*/true, opts);
saxStream.on("error", function(e: Error) {
this._parser.error = null;
this._parser.resume();
});
import fs = require("fs");
fs.createReadStream("file.xml")
.pipe(saxStream)
.pipe(fs.createWriteStream("file-copy.xml"));
(function xmlnsTests() {
let opts: sax.SAXOptions = {
lowercase: true,
normalize: true,
xmlns: true,
position: true
};
let parser = sax.parser(/*strict=*/true, opts);
parser.onerror = function(e: Error) {
};
parser.ontext = function(text: string) {
};
parser.onopentag = function(tag: sax.QualifiedTag) {
let prefix: string = tag.prefix;
let local: string = tag.local;
let uri: string = tag.uri;
let name: string = tag.name;
let isSelfClosing: boolean = tag.isSelfClosing;
let attr: sax.QualifiedAttribute = tag.attributes["name"];
if (attr) {
let attrPrefix: string = attr.prefix;
let attrLocal: string = attr.local;
let attrUri: string = attr.uri;
let attrName: string = attr.name;
let attrValue: string = attr.value;
}
};
parser.onattribute = function(attr: { name: string; value: string; }) {
};
parser.onend = function() {
};
parser.write("<xml>Hello, <who name=\"world\">world</who>!</xml>").close();
let saxStream = sax.createStream(/*strict=*/true, opts);
saxStream.on("error", function(e: Error) {
this._parser.error = null;
this._parser.resume();
});
fs.createReadStream("file.xml")
.pipe(saxStream)
.pipe(fs.createWriteStream("file-copy.xml"));
})();
(function noXmlnsTests() {
let opts: sax.SAXOptions = {
lowercase: true,
normalize: true,
xmlns: false,
position: true
};
let parser = sax.parser(/*strict=*/true, opts);
parser.onerror = function(e: Error) {
};
parser.ontext = function(text: string) {
};
parser.onopentag = function(tag: sax.Tag) {
let name: string = tag.name;
let isSelfClosing: boolean = tag.isSelfClosing;
let attrValue: string = tag.attributes["name"];
};
parser.onattribute = function(attr: { name: string; value: string; }) {
};
parser.onend = function() {
};
parser.write("<xml>Hello, <who name=\"world\">world</who>!</xml>").close();
})();
+23 -9
View File
@@ -16,15 +16,30 @@ declare module "sax" {
position?: boolean;
}
export interface Tag {
export interface QualifiedName {
name: string;
attributes: { [key: string]: string };
prefix: string;
local: string;
uri: string;
}
// Available if opt.xmlns
ns?: { [key: string]: string };
prefix?: string;
local?: string;
uri?: string;
export interface QualifiedAttribute extends QualifiedName {
value: string;
}
interface BaseTag {
name: string;
isSelfClosing: boolean;
}
// Interface used when the xmlns option is set
export interface QualifiedTag extends QualifiedName, BaseTag {
ns: { [key: string]: string };
attributes: { [key: string]: QualifiedAttribute };
}
export interface Tag extends BaseTag {
attributes: { [key: string]: string };
}
export function parser(strict: boolean, opt: SAXOptions): SAXParser;
@@ -54,7 +69,7 @@ declare module "sax" {
ontext(t: string): void;
ondoctype(doctype: string): void;
onprocessinginstruction(node: { name: string; body: string }): void;
onopentag(tag: Tag): void;
onopentag(tag: Tag | QualifiedTag): void;
onclosetag(tagName: string): void;
onattribute(attr: { name: string; value: string }): void;
oncomment(comment: string): void;
@@ -75,4 +90,3 @@ declare module "sax" {
private _parser: SAXParser;
}
}
+10
View File
@@ -1567,3 +1567,13 @@ s.transaction( function() {
s.transaction( { isolationLevel : 'SERIALIZABLE' }, function( t ) { return Promise.resolve(); } );
s.transaction( { isolationLevel : s.Transaction.ISOLATION_LEVELS.SERIALIZABLE }, (t) => Promise.resolve() );
s.transaction( { isolationLevel : s.Transaction.ISOLATION_LEVELS.READ_COMMITTED }, (t) => Promise.resolve() );
// transaction types
new Sequelize( '', { transactionType: 'DEFERRED' } );
new Sequelize( '', { transactionType: Sequelize.Transaction.TYPES.DEFERRED} );
new Sequelize( '', { transactionType: Sequelize.Transaction.TYPES.IMMEDIATE} );
new Sequelize( '', { transactionType: Sequelize.Transaction.TYPES.EXCLUSIVE} );
s.transaction( { type : 'DEFERRED' }, (t) => Promise.resolve() );
s.transaction( { type : s.Transaction.TYPES.DEFERRED }, (t) => Promise.resolve() );
s.transaction( { type : s.Transaction.TYPES.IMMEDIATE }, (t) => Promise.resolve() );
s.transaction( { type : s.Transaction.TYPES.EXCLUSIVE }, (t) => Promise.resolve() );
+59
View File
@@ -5176,6 +5176,14 @@ declare module "sequelize" {
*/
isolationLevel? : string;
/**
* Set the default transaction type. See `Sequelize.Transaction.TYPES` for possible
* options.
*
* Defaults to 'DEFERRED'
*/
transactionType? : string;
}
/**
@@ -5786,6 +5794,41 @@ declare module "sequelize" {
*/
ISOLATION_LEVELS : TransactionIsolationLevels;
/**
* Transaction type can be set per-transaction by passing `options.type` to
* `sequelize.transaction`. Default to `DEFERRED` but you can override the default isolation level
* by passing `options.transactionType` in `new Sequelize`.
*
* The transaction types to use when starting a transaction:
*
* ```js
* {
* DEFERRED: "DEFERRED",
* IMMEDIATE: "IMMEDIATE",
* EXCLUSIVE: "EXCLUSIVE"
* }
* ```
*
* Pass in the transaction type the first argument:
*
* ```js
* return sequelize.transaction({
* type: Sequelize.Transaction.EXCLUSIVE
* }, function (t) {
*
* // your transactions
*
* }).then(function(result) {
* // transaction has been committed. Do something after the commit if required.
* }).catch(function(err) {
* // do something with the err.
* });
* ```
*
* @see Sequelize.Transaction.TYPES
*/
TYPES : TransactionTypes;
/**
* Possible options for row locking. Used in conjuction with `find` calls:
*
@@ -5837,6 +5880,17 @@ declare module "sequelize" {
SERIALIZABLE: string; // 'SERIALIZABLE'
}
/**
* Transaction type can be set per-transaction by passing `options.type` to `sequelize.transaction`.
* Default to `DEFERRED` but you can override the default isolation level by passing
* `options.transactionType` in `new Sequelize`.
*/
interface TransactionTypes {
DEFERRED: string; // 'DEFERRED'
IMMEDIATE: string; // 'IMMEDIATE'
EXCLUSIVE: string; // 'EXCLUSIVE'
}
/**
* Possible options for row locking. Used in conjuction with `find` calls:
*/
@@ -5861,6 +5915,11 @@ declare module "sequelize" {
*/
isolationLevel?: string;
/**
* See `Sequelize.Transaction.TYPES` for possible options
*/
type?: string;
/**
* A function that gets executed while running the query to log the sql.
*/
+61
View File
@@ -0,0 +1,61 @@
/// <reference path="slate-irc.d.ts" />
import * as net from "net";
import * as SlateIRC from "slate-irc";
let socket: net.Socket;
const client = SlateIRC(socket);
client.on("welcome", (name) => {
console.log(client.me);
});
client.on("motd", (event) => {
console.log(event.motd);
});
client.on("join", (event) => {
console.log(`${event.nick} has joined ${event.channel}`);
});
client.on("part", (event) => {
console.log(`${event.nick} has parted ${event.channels.join(", ")}`);
});
client.on("nick", (event) => {
console.log(`${event.nick} is now known as ${event.new}`);
});
client.on("quit", (event) => {
console.log(`${event.nick} has quit (${event.message}).`);
});
client.on("data", (event) => {
console.log(`Got ${event.command} command: ${event.string}`);
});
client.on("message", (event) => {
console.log(`[${event.to}] ${event.from}: ${event.message}`);
});
client.on("notice", (event) => {
console.log(`[${event.to}] ${event.from}: ${event.message}`);
});
client.on("disconnect", () => {
console.log("Disconnected.");
});
client.pass("pass");
client.nick("tobi");
client.user("tobi", "Tobi Ferret");
client.join("#channel");
client.join("#channel", "password");
client.names("#channel", (err, names) => {
console.log(names);
});
client.part("#channel");
client.part("#channel", "Leaving...");
+98
View File
@@ -0,0 +1,98 @@
// Type definitions for slate-irc
// Project: https://github.com/slate/slate-irc
// Definitions by: Elisée MAURER <https://github.com/elisee/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "slate-irc" {
import * as net from "net";
function IRC(socket: net.Socket): IRC.Client;
namespace IRC {
interface DataEvent {
prefix: string;
command: string;
params: string;
trailing: string;
string: string;
}
interface MOTDEvent {
motd: string[];
}
interface MessageEvent {
from: string;
hostmask: any;
to: string;
message: string;
}
interface JoinEvent {
nick: string;
hostmask: string;
channel: string;
}
interface PartEvent {
nick: string;
hostmask: string;
channels: string[];
}
interface NickEvent {
nick: string;
hostmask: string;
new: string;
}
interface QuitEvent {
nick: string;
hostmask: string;
message: string;
}
class Client {
me: string;
write(str: string): void;
pass(pass: string): void;
nick(nick: string): void;
user(username: string, realname: string): void;
invite(name: string, channel: string): void;
send(target: string, msg: string): void;
action(target: string, msg: string): void;
notice(target: string, msg: string): void;
ctcp(target: string, msg: string): void;
join(channel: string, key?: string): void;
part(channel: string, msg?: string): void;
names(channel: string, callback: (error: Error, names: { name: string; mode: string; }[]) => void): void;
away(message: string): void;
topic(channel: string, topic: string): void;
kick(channels: string|string[], nicks: string|string[], msg: string): void;
oper(name: string, password: string): void;
mode(target: string, flags: string, params: string): void;
quit(msg: string): void;
whois(target: string, mask: string, callback: Function): void;
on(event: string, callback: Function): void;
on(event: "data", callback: (event: DataEvent) => void): void;
on(event: "welcome", callback: (name: string) => void): void;
on(event: "message", callback: (event: MessageEvent) => void): void;
on(event: "notice", callback: (event: MessageEvent) => void): void;
on(event: "motd", callback: (event: MOTDEvent) => void): void;
on(event: "join", callback: (event: JoinEvent) => void): void;
on(event: "part", callback: (event: PartEvent) => void): void;
on(event: "nick", callback: (event: NickEvent) => void): void;
on(event: "quit", callback: (event: QuitEvent) => void): void;
}
}
export = IRC;
}
+5 -5
View File
@@ -435,13 +435,13 @@ declare module SocketIO {
* @param listener A listener that should take one parameter of type Socket
* @return This Namespace
*/
on( event: 'connection', listener: ( socket: Socket ) => void ): Namespace;
on( event: 'connection', listener: ( socket: Socket ) => void ): this;
/**
* @see on( 'connection', listener )
*/
on( event: 'connect', listener: ( socket: Socket ) => void ): Namespace;
on( event: 'connect', listener: ( socket: Socket ) => void ): this;
/**
* Base 'on' method to add a listener for an event
* @param event The event that we want to add a listener for
@@ -449,7 +449,7 @@ declare module SocketIO {
* for the callback depend on the event
* @ This Namespace
*/
on( event: string, listener: Function ): Namespace;
on( event: string, listener: Function ): this;
/**
* Gets a list of clients.
+5 -5
View File
@@ -24,8 +24,8 @@ declare module "sockjs" {
export interface Server extends NodeJS.EventEmitter {
installHandlers(server: http.Server, options?: ServerOptions): any;
on(event: 'connection', listener: (conn: Connection) => any): Server;
on(event: string, listener: Function): Server;
on(event: 'connection', listener: (conn: Connection) => any): this;
on(event: string, listener: Function): this;
}
export interface Connection extends NodeJS.ReadWriteStream {
@@ -50,8 +50,8 @@ declare module "sockjs" {
close(code?: string, reason?: string): boolean;
destroy(): void;
on(event: 'data', listener: (message: string) => any): Connection;
on(event: 'close', listener: () => void): Connection;
on(event: string, listener: Function): Connection;
on(event: 'data', listener: (message: string) => any): this;
on(event: 'close', listener: () => void): this;
on(event: string, listener: Function): this;
}
}
+7 -7
View File
@@ -68,13 +68,13 @@ declare module "sqlite3" {
public serialize(callback?: () => void): void;
public parallelize(callback?: () => void): void;
public on(event: "trace", listener: (sql: string) => void): Database;
public on(event: "profile", listener: (sql: string, time: number) => void): Database;
public on(event: "error", listener: (err: Error) => void): Database;
public on(event: "open", listener: () => void): Database;
public on(event: "close", listener: () => void): Database;
public on(event: string, listener: Function): Database;
public on(event: "trace", listener: (sql: string) => void): this;
public on(event: "profile", listener: (sql: string, time: number) => void): this;
public on(event: "error", listener: (err: Error) => void): this;
public on(event: "open", listener: () => void): this;
public on(event: "close", listener: () => void): this;
public on(event: string, listener: Function): this;
}
function verbose(): void;
-7
View File
@@ -233,13 +233,6 @@ declare module "ssh2" {
exit(name: string, coreDumped: boolean, msg: string): boolean;
exit(status: number): boolean;
stderr?: ServerStderr;
// EventEmitter overrides
addListener(event: string, listener: Function): Channel;
on(event: string, listener: Function): Channel;
once(event: string, listener: Function): Channel;
removeListener(event: string, listener: Function): Channel;
removeAllListeners(event?: string): Channel;
}
interface ServerStderr extends NodeJS.WritableStream {
+6 -6
View File
@@ -47,12 +47,12 @@ declare module Steam {
setPersonaName(name: string): void;
// Event emitter
addListener(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): NodeJS.EventEmitter;
once(event: string, listener: Function): NodeJS.EventEmitter;
removeListener(event: string, listener: Function): NodeJS.EventEmitter;
removeAllListeners(event?: string): NodeJS.EventEmitter;
setMaxListeners(n: number): NodeJS.EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
+6 -6
View File
@@ -698,12 +698,12 @@ declare module Stylus {
import(file: string): Renderer;
//#region EventEmitter Members
addListener(event: string, listener: Function): Renderer;
on(event: string, listener: Function): Renderer;
once(event: string, listener: Function): Renderer;
removeListener(event: string, listener: Function): Renderer;
removeAllListeners(event?: string): Renderer;
setMaxListeners(n: number): Renderer;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
+26
View File
@@ -386,6 +386,32 @@ _.isNull(undefined);
_.isUndefined((<any>window).missingVariable);
//////////////////////////////////// User Defined Guard tests
function useElement(arg: Element) {};
function useArguments(arg: IArguments) {};
function useFunction(arg: Function) {};
function useError(arg: Error) {};
function useString(arg: String) {};
function useNumber(arg: Number) {};
function useBoolean(arg: Boolean) {};
function useDate(arg: Date) {};
function useRegExp(arg: RegExp) {};
function useArray<T>(arg: T[]) {};
var guardedType: {};
if(_.isElement(guardedType)) useElement(guardedType);
if(_.isArray(guardedType)) useArray(guardedType);
if(_.isArray<String>(guardedType)) useArray(guardedType);
if(_.isArguments(guardedType)) useArguments(guardedType);
if(_.isFunction(guardedType)) useFunction(guardedType);
if(_.isError(guardedType)) useError(guardedType);
if(_.isString(guardedType)) useString(guardedType);
if(_.isNumber(guardedType)) useNumber(guardedType);
if(_.isBoolean(guardedType)) useBoolean(guardedType);
if(_.isDate(guardedType)) useDate(guardedType);
if(_.isRegExp(guardedType)) useRegExp(guardedType);
///////////////////////////////////////////////////////////////////////////////////////
var UncleMoe = { name: 'moe' };
+19 -12
View File
@@ -1,6 +1,6 @@
// Type definitions for Underscore 1.7.0
// Project: http://underscorejs.org/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Josh Baldwin <https://github.com/jbaldwin/>
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Josh Baldwin <https://github.com/jbaldwin/>, Christopher Currens <https://github.com/ccurrens/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module _ {
@@ -3738,14 +3738,21 @@ interface UnderscoreStatic {
* @param object Check if this object is a DOM element.
* @return True if `object` is a DOM element, otherwise false.
**/
isElement(object: any): boolean;
isElement(object: any): object is Element;
/**
* Returns true if object is an Array.
* @param object Check if this object is an Array.
* @return True if `object` is an Array, otherwise false.
**/
isArray(object: any): boolean;
isArray(object: any): object is [];
/**
* Returns true if object is an Array.
* @param object Check if this object is an Array.
* @return True if `object` is an Array, otherwise false.
**/
isArray<T>(object: any): object is T[];
/**
* Returns true if value is an Object. Note that JavaScript arrays and functions are objects,
@@ -3760,35 +3767,35 @@ interface UnderscoreStatic {
* @param object Check if this object is an Arguments object.
* @return True if `object` is an Arguments object, otherwise false.
**/
isArguments(object: any): boolean;
isArguments(object: any): object is IArguments;
/**
* Returns true if object is a Function.
* @param object Check if this object is a Function.
* @return True if `object` is a Function, otherwise false.
**/
isFunction(object: any): boolean;
isFunction(object: any): object is Function;
/**
/**
* Returns true if object inherits from an Error.
* @param object Check if this object is an Error.
* @return True if `object` is a Error, otherwise false.
**/
isError(object:any): boolean;
isError(object:any): object is Error;
/**
* Returns true if object is a String.
* @param object Check if this object is a String.
* @return True if `object` is a String, otherwise false.
**/
isString(object: any): boolean;
isString(object: any): object is string;
/**
* Returns true if object is a Number (including NaN).
* @param object Check if this object is a Number.
* @return True if `object` is a Number, otherwise false.
**/
isNumber(object: any): boolean;
isNumber(object: any): object is number;
/**
* Returns true if object is a finite Number.
@@ -3802,21 +3809,21 @@ interface UnderscoreStatic {
* @param object Check if this object is a bool.
* @return True if `object` is a bool, otherwise false.
**/
isBoolean(object: any): boolean;
isBoolean(object: any): object is boolean;
/**
* Returns true if object is a Date.
* @param object Check if this object is a Date.
* @return True if `object` is a Date, otherwise false.
**/
isDate(object: any): boolean;
isDate(object: any): object is Date;
/**
* Returns true if object is a RegExp.
* @param object Check if this object is a RegExp.
* @return True if `object` is a RegExp, otherwise false.
**/
isRegExp(object: any): boolean;
isRegExp(object: any): object is RegExp;
/**
* Returns true if object is NaN.
+2 -2
View File
@@ -196,7 +196,7 @@ interface MediaDevices {
interface MediaDeviceInfo {
label: string;
id: string;
deviceId: string;
kind: string;
facing: string;
groupId: string;
}
+42 -42
View File
@@ -151,14 +151,14 @@ declare module "websocket" {
shutDown(): void;
// Events
on(event: string, listener: () => void): server;
on(event: 'request', cb: (request: request) => void): server;
on(event: 'connect', cb: (connection: connection) => void): server;
on(event: 'close', cb: (connection: connection, reason: number, desc: string) => void): server;
addListener(event: string, listener: () => void): server;
addListener(event: 'request', cb: (request: request) => void): server;
addListener(event: 'connect', cb: (connection: connection) => void): server;
addListener(event: 'close', cb: (connection: connection, reason: number, desc: string) => void): server;
on(event: string, listener: () => void): this;
on(event: 'request', cb: (request: request) => void): this;
on(event: 'connect', cb: (connection: connection) => void): this;
on(event: 'close', cb: (connection: connection, reason: number, desc: string) => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'request', cb: (request: request) => void): this;
addListener(event: 'connect', cb: (connection: connection) => void): this;
addListener(event: 'close', cb: (connection: connection, reason: number, desc: string) => void): this;
}
export interface ICookie {
@@ -240,12 +240,12 @@ declare module "websocket" {
reject(httpStatus?: number, reason?: string): void;
// Events
on(event: string, listener: () => void): request;
on(event: 'requestAccepted', cb: (connection: connection) => void): request;
on(event: 'requestRejected', cb: () => void): request;
addListener(event: string, listener: () => void): request;
addListener(event: 'requestAccepted', cb: (connection: connection) => void): request;
addListener(event: 'requestRejected', cb: () => void): request;
on(event: string, listener: () => void): this;
on(event: 'requestAccepted', cb: (connection: connection) => void): this;
on(event: 'requestRejected', cb: () => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'requestAccepted', cb: (connection: connection) => void): this;
addListener(event: 'requestRejected', cb: () => void): this;
}
export interface IMessage {
@@ -288,12 +288,12 @@ declare module "websocket" {
take(encoding?: string): any;
// Events
on(event: string, listener: () => void): IBufferList;
on(event: 'advance', cb: (n: number) => void): IBufferList;
on(event: 'write', cb: (buf: Buffer) => void): IBufferList;
addListener(event: string, listener: () => void): IBufferList;
addListener(event: 'advance', cb: (n: number) => void): IBufferList;
addListener(event: 'write', cb: (buf: Buffer) => void): IBufferList;
on(event: string, listener: () => void): this;
on(event: 'advance', cb: (n: number) => void): this;
on(event: 'write', cb: (buf: Buffer) => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'advance', cb: (n: number) => void): this;
addListener(event: 'write', cb: (buf: Buffer) => void): this;
}
class connection extends events.EventEmitter {
@@ -430,16 +430,16 @@ declare module "websocket" {
sendFrame(frame: frame, cb?: (msg: string) => void): void;
// Events
on(event: string, listener: () => void): connection;
on(event: 'message', cb: (data: IMessage) => void): connection;
on(event: 'frame', cb: (frame: frame) => void): connection;
on(event: 'close', cb: (code: number, desc: string) => void): connection;
on(event: 'error', cb: (err: Error) => void): connection;
addListener(event: string, listener: () => void): connection;
addListener(event: 'message', cb: (data: IMessage) => void): connection;
addListener(event: 'frame', cb: (frame: frame) => void): connection;
addListener(event: 'close', cb: (code: number, desc: string) => void): connection;
addListener(event: 'error', cb: (err: Error) => void): connection;
on(event: string, listener: () => void): this;
on(event: 'message', cb: (data: IMessage) => void): this;
on(event: 'frame', cb: (frame: frame) => void): this;
on(event: 'close', cb: (code: number, desc: string) => void): this;
on(event: 'error', cb: (err: Error) => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'message', cb: (data: IMessage) => void): this;
addListener(event: 'frame', cb: (frame: frame) => void): this;
addListener(event: 'close', cb: (code: number, desc: string) => void): this;
addListener(event: 'error', cb: (err: Error) => void): this;
}
class frame {
@@ -559,12 +559,12 @@ declare module "websocket" {
connect(requestUrl: string, protocols?: string, origin?: string, headers?: any[]): void;
// Events
on(event: string, listener: () => void): client;
on(event: 'connect', cb: (connection: connection) => void): client;
on(event: 'connectFailed', cb: (err: Error) => void): client;
addListener(event: string, listener: () => void): client;
addListener(event: 'connect', cb: (connection: connection) => void): client;
addListener(event: 'connectFailed', cb: (err: Error) => void): client;
on(event: string, listener: () => void): this;
on(event: 'connect', cb: (connection: connection) => void): this;
on(event: 'connectFailed', cb: (err: Error) => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'connect', cb: (connection: connection) => void): this;
addListener(event: 'connectFailed', cb: (err: Error) => void): this;
}
class routerRequest extends events.EventEmitter {
@@ -616,12 +616,12 @@ declare module "websocket" {
reject(httpStatus?: number, reason?: string): void;
// Events
on(event: string, listener: () => void): request;
on(event: 'requestAccepted', cb: (connection: connection) => void): request;
on(event: 'requestRejected', cb: () => void): request;
addListener(event: string, listener: () => void): request;
addListener(event: 'requestAccepted', cb: (connection: connection) => void): request;
addListener(event: 'requestRejected', cb: () => void): request;
on(event: string, listener: () => void): this;
on(event: 'requestAccepted', cb: (connection: connection) => void): this;
on(event: 'requestRejected', cb: () => void): this;
addListener(event: string, listener: () => void): this;
addListener(event: 'requestAccepted', cb: (connection: connection) => void): this;
addListener(event: 'requestRejected', cb: () => void): this;
}
interface IRouterConfig {
+16 -16
View File
@@ -28,8 +28,8 @@ declare module WebTorrent {
}
export interface Client extends NodeJS.EventEmitter, ClientConstructor {
on(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): this;
/**
* Start downloading a new torrent. Aliased as client.download.
@@ -50,16 +50,16 @@ declare module WebTorrent {
add(magnetUriOrPathOrInfoHash:string, opts?:TorrentOptions, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(torrentFileOrInfoHash:Buffer, opts?:TorrentOptions, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(parsedTorrent:ParseTorrent.ParsedTorrent, opts?:TorrentOptions, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(magnetUriOrPathOrInfoHash:string, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(torrentFileOrInfoHash:Buffer, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
add(parsedTorrent:ParseTorrent.ParsedTorrent, onTorrentCallback?:(torrent:Torrent)=>void):Torrent;
/**
* Emitted when a torrent is ready to be used (i.e. metadata is available and store is ready). See the torrent section for more info on what methods a torrent has.
*/
on(event:'torrent', callback:(torrent:Torrent)=>void): NodeJS.EventEmitter;
on(event:'torrent', callback:(torrent:Torrent)=>void): this;
/**
* Start seeding a new torrent.
@@ -117,8 +117,8 @@ declare module WebTorrent {
}
export interface Torrent extends NodeJS.EventEmitter {
on(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): this;
/**
* Get the info hash of the torrent.
*/
@@ -228,22 +228,22 @@ declare module WebTorrent {
/**
* Emitted when all the torrent's files have been downloaded.
*/
on(event: 'done', callback:()=>void): NodeJS.EventEmitter;
on(event: 'done', callback:()=>void): this;
/**
* Emitted every time a new chunk of data arrives, it's useful for reporting the current torrent status.
*/
on(event: 'download', callback:(chunkSize:number)=>void): NodeJS.EventEmitter;
on(event: 'download', callback:(chunkSize:number)=>void): this;
/**
* Emitted whenever a new peer is connected for this torrent. wire is an instance of bittorrent-protocol, which is a node.js-style duplex stream to the remote peer. This event can be used to specify custom BitTorrent protocol extensions.
*/
on(event: 'wire', callback:(wire:any)=>void): NodeJS.EventEmitter;
on(event: 'wire', callback:(wire:any)=>void): this;
}
export interface InTorrentFile extends NodeJS.EventEmitter {
on(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): this;
/**
* File name, as specified by the torrent. Example: 'some-filename.txt'
*/
@@ -330,7 +330,7 @@ declare module WebTorrent {
/**
* Emitted when the file have been downloaded.
*/
on(event: 'done', callback:()=>void): NodeJS.EventEmitter;
on(event: 'done', callback:()=>void): this;
}
}
+38
View File
@@ -2509,6 +2509,8 @@ declare namespace Windows {
name: string;
/** Gets the identifier of a registered background task. */
taskId: string;
/** Gets the trigger associated with the background task. */
trigger: Windows.ApplicationModel.Background.IBackgroundTrigger;
}
/** Represents a method that handles completion events for a background task. */
type BackgroundTaskCompletedEventHandler = (ev: Windows.ApplicationModel.Background.BackgroundTaskCompletedEventArgs & WinRTEvent<Windows.ApplicationModel.Background.BackgroundTaskRegistration>) => void;
@@ -2533,6 +2535,12 @@ declare namespace Windows {
task: Windows.ApplicationModel.Background.BackgroundTaskRegistration;
/** Gets additional information associated with a background task instance. */
triggerDetails: any;
/**
* Retrieves the number of times the background task has been suspended for using too many resources.
* @param counter Indicates the type of resource to include in the throttle count: network, CPU, or both.
* @return This method returns the number of times the background task has been suspended for exceeding its quota of the indicated resource type.
*/
getThrottleCount(counter: Windows.ApplicationModel.Background.BackgroundTaskThrottleCounter): number;
}
}
/** Controls multiple aspects of how an application on the phone behaves, including lock-screen interaction, the phone call history, and various telephony options and information. */
@@ -53466,6 +53474,17 @@ declare namespace Windows {
name: string;
/** Gets the full file-system path of the item, if the item has a path. */
path: string;
/**
* Gets the parent folder of the current storage item.
* @return When this method completes, it returns the parent folder as a StorageFolder .
*/
getParentAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<Windows.Storage.StorageFolder>;
/**
* Indicates whether the current item is the same as the specified item.
* @param item The IStorageItem object that represents a storage item to compare against.
* @return Returns true if the current storage item is the same as the specified storage item; otherwise false.
*/
isEqual(item: Windows.Storage.IStorageItem): boolean;
}
/** Represents a file. Provides information about the file and its contents, and ways to manipulate them. */
interface IStorageFile extends Windows.Storage.IStorageItem, Windows.Storage.Streams.IRandomAccessStreamReference, Windows.Storage.Streams.IInputStreamReference {
@@ -53529,11 +53548,24 @@ declare namespace Windows {
* @return When this method completes, it returns the random-access stream (type IRandomAccessStream ).
*/
openAsync(accessMode: Windows.Storage.FileAccessMode): Windows.Foundation.IPromiseWithIAsyncOperation<Windows.Storage.Streams.IRandomAccessStream>;
/**
* Opens a random-access stream over the file.
* @param accessMode One of the enumeration values that specifies the type of access to allow.
* @param options A bitwise combination of the enumeration values that specify options for opening the stream.
* @return When this method completes, it returns an IRandomAccessStream that contains the requested random-access stream.
*/
openAsync(accessMode: Windows.Storage.FileAccessMode, options: Windows.Storage.StorageOpenOptions): Windows.Foundation.IPromiseWithIAsyncOperation<Windows.Storage.Streams.IRandomAccessStream>;
/**
* Opens a transacted, random-access stream for writing to the file.
* @return When this method completes, it returns a StorageStreamTransaction that contains the random-access stream and methods that can be used to complete transactions.
*/
openTransactedWriteAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<Windows.Storage.StorageStreamTransaction>;
/**
* Opens a random-access stream to the file that can be used for transacted-write operations with the specified options.
* @param options A bitwise combination of the enumeration values that specify options for opening the stream.
* @return When this method completes, it returns a StorageStreamTransaction that contains the random-access stream and methods that can be used to complete transactions.
*/
openTransactedWriteAsync(options: Windows.Storage.StorageOpenOptions): Windows.Foundation.IPromiseWithIAsyncOperation<Windows.Storage.StorageStreamTransaction>;
/** Gets the MIME type of the contents of the file. */
contentType: string;
/** Gets the type (file name extension) of the file. */
@@ -53600,6 +53632,12 @@ declare namespace Windows {
* @return When this method completes successfully, it returns a list of the files and folders (type IVectorView ). The files and folders in the list are represented by objects of type IStorageItem .
*/
getItemsAsync(): Windows.Foundation.IPromiseWithIAsyncOperation<Windows.Foundation.Collections.IVectorView<any /* unmapped */>>;
/**
* Try to get a single file or sub-folder from the current folder by using the name of the item.
* @param name The name (or path relative to the current folder) of the file or sub-folder to try to retrieve.
* @return When this method completes successfully, it returns the file or folder (type IStorageItem ).
*/
tryGetItemAsync(name: string): Windows.Foundation.IPromiseWithIAsyncOperation<Windows.Storage.IStorageItem>;
}
/** Represents a method that handles the request to set the version of the application data in the application data store. */
type ApplicationDataSetVersionHandler = (setVersionRequest: Windows.Storage.SetVersionRequest) => void;
Vendored
+22 -22
View File
@@ -69,21 +69,21 @@ declare module "ws" {
addEventListener(method: string, listener?: () => void): void;
// Events
on(event: 'error', cb: (err: Error) => void): WebSocket;
on(event: 'close', cb: (code: number, message: string) => void): WebSocket;
on(event: 'message', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
on(event: 'ping', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
on(event: 'pong', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
on(event: 'open', cb: () => void): WebSocket;
on(event: string, listener: () => void): WebSocket;
on(event: 'error', cb: (err: Error) => void): this;
on(event: 'close', cb: (code: number, message: string) => void): this;
on(event: 'message', cb: (data: any, flags: {binary: boolean}) => void): this;
on(event: 'ping', cb: (data: any, flags: {binary: boolean}) => void): this;
on(event: 'pong', cb: (data: any, flags: {binary: boolean}) => void): this;
on(event: 'open', cb: () => void): this;
on(event: string, listener: () => void): this;
addListener(event: 'error', cb: (err: Error) => void): WebSocket;
addListener(event: 'close', cb: (code: number, message: string) => void): WebSocket;
addListener(event: 'message', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
addListener(event: 'ping', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
addListener(event: 'pong', cb: (data: any, flags: {binary: boolean}) => void): WebSocket;
addListener(event: 'open', cb: () => void): WebSocket;
addListener(event: string, listener: () => void): WebSocket;
addListener(event: 'error', cb: (err: Error) => void): this;
addListener(event: 'close', cb: (code: number, message: string) => void): this;
addListener(event: 'message', cb: (data: any, flags: {binary: boolean}) => void): this;
addListener(event: 'ping', cb: (data: any, flags: {binary: boolean}) => void): this;
addListener(event: 'pong', cb: (data: any, flags: {binary: boolean}) => void): this;
addListener(event: 'open', cb: () => void): this;
addListener(event: string, listener: () => void): this;
}
module WebSocket {
@@ -115,15 +115,15 @@ declare module "ws" {
upgradeHead: Buffer, callback: (client: WebSocket) => void): void;
// Events
on(event: 'error', cb: (err: Error) => void): Server;
on(event: 'headers', cb: (headers: string[]) => void): Server;
on(event: 'connection', cb: (client: WebSocket) => void): Server;
on(event: string, listener: () => void): Server;
on(event: 'error', cb: (err: Error) => void): this;
on(event: 'headers', cb: (headers: string[]) => void): this;
on(event: 'connection', cb: (client: WebSocket) => void): this;
on(event: string, listener: () => void): this;
addListener(event: 'error', cb: (err: Error) => void): Server;
addListener(event: 'headers', cb: (headers: string[]) => void): Server;
addListener(event: 'connection', cb: (client: WebSocket) => void): Server;
addListener(event: string, listener: () => void): Server;
addListener(event: 'error', cb: (err: Error) => void): this;
addListener(event: 'headers', cb: (headers: string[]) => void): this;
addListener(event: 'connection', cb: (client: WebSocket) => void): this;
addListener(event: string, listener: () => void): this;
}
export function createServer(options?: IServerOptions,
+6 -6
View File
@@ -46,12 +46,12 @@ declare module yo {
runHooks(callback?: Function): void;
sourceRoot(rootPath?: string): string;
templatePath(...path: string[]): string;
addListener(event: string, listener: Function): NodeJS.EventEmitter;
on(event: string, listener: Function): NodeJS.EventEmitter;
once(event: string, listener: Function): NodeJS.EventEmitter;
removeListener(event: string, listener: Function): NodeJS.EventEmitter;
removeAllListeners(event?: string): NodeJS.EventEmitter;
setMaxListeners(n: number): NodeJS.EventEmitter;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;