Merge branch 'master' into body-parser

This commit is contained in:
Tomek Łaziuk
2017-03-07 08:25:44 +01:00
committed by GitHub
1159 changed files with 45214 additions and 45162 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
import packer = require("3d-bin-packing");
import samchon = require("samchon-framework");
import samchon = require("samchon");
function main(): void
{
+140 -258
View File
@@ -1,20 +1,22 @@
// Type definitions for 3d-bin-packing
// Type definitions for 3d-bin-packing v1.1.2
// Project: https://github.com/betterwaysystems/packer
// Definitions by: Jeongho Nam <http://samchon.org>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="typescript-stl" />
/// <reference types="samchon-framework" />
/// <reference types="react" />
/// <reference types="react-data-grid" />
/// <reference types="three" />
/// <reference types="samchon" />
declare module "3d-bin-packing"
{
export = bws.packer;
export = bws.packer;
}
/// <reference types="samchon" />
/// <reference types="tstl" />
declare namespace bws.packer {
export import library = samchon.library;
export import protocol = samchon.protocol;
function _Test(): void;
}
declare var ReactDataGrid: typeof AdazzleReactDataGrid.ReactDataGrid;
declare namespace boxologic {
/**
* <p> An abstract instance of boxologic. </p>
@@ -62,122 +64,6 @@ declare namespace boxologic {
constructor(width: number, height: number, length: number);
}
}
declare namespace bws.packer {
/**
* @brief Packer, a solver of 3d bin packing with multiple wrappers.
*
* @details
* <p> Packer is a facade class supporting packing operations in user side. You can solve a packing problem
* by constructing Packer class with {@link WrapperArray wrappers} and {@link InstanceArray instances} to
* pack and executing {@link optimize Packer.optimize()} method. </p>
*
* <p> In background side, deducting packing solution, those algorithms are used. </p>
* <ul>
* <li> <a href="http://betterwaysystems.github.io/packer/reference/AirForceBinPacking.pdf" target="_blank">
* Airforce Bin Packing; 3D pallet packing problem: A human intelligence-based heuristic approach </a>
* </li>
* <li> Genetic Algorithm </li>
* <li> Greedy and Back-tracking algorithm </li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class Packer extends samchon.protocol.Entity {
/**
* Candidate wrappers who can contain instances.
*/
protected wrapperArray: WrapperArray;
/**
* Instances trying to pack into the wrapper.
*/
protected instanceArray: InstanceArray;
/**
* Default Constructor.
*/
constructor();
/**
* Construct from members.
*
* @param wrapperArray Candidate wrappers who can contain instances.
* @param instanceArray Instances to be packed into some wrappers.
*/
constructor(wrapperArray: WrapperArray, instanceArray: InstanceArray);
/**
* @inheritdoc
*/
construct(xml: samchon.library.XML): void;
/**
* Get wrapperArray.
*/
getWrapperArray(): WrapperArray;
/**
* Get instanceArray.
*/
getInstanceArray(): InstanceArray;
/**
* <p> Deduct
*
*/
optimize(): WrapperArray;
/**
* @brief Initialize sequence list (gene_array).
*
* @details
* <p> Deducts initial sequence list by such assumption: </p>
*
* <ul>
* <li> Cost of larger wrapper is less than smaller one, within framework of price per volume unit. </li>
* <ul>
* <li> Wrapper Larger: (price: $1,000, volume: 100cm^3 -> price per volume unit: $10 / cm^3) </li>
* <li> Wrapper Smaller: (price: $700, volume: 50cm^3 -> price per volume unit: $14 / cm^3) </li>
* <li> Larger's <u>cost</u> is less than Smaller, within framework of price per volume unit </li>
* </ul>
* </ul>
*
* <p> Method {@link initGenes initGenes()} constructs {@link WrapperGroup WrapperGroups} corresponding
* with the {@link wrapperArray} and allocates {@link instanceArray instances} to a {@link WrapperGroup},
* has the smallest <u>cost</u> between containbles. </p>
*
* <p> After executing packing solution by {@link WrapperGroup.optimize WrapperGroup.optimize()}, trying to
* {@link repack re-pack} each {@link WrapperGroup} to another type of {@link Wrapper}, deducts the best
* solution between them. It's the initial sequence list of genetic algorithm. </p>
*
* @return Initial sequence list.
*/
protected initGenes(): GAWrapperArray;
/**
* Try to repack each wrappers to another type.
*
* @param $wrappers Wrappers to repack.
* @return Re-packed wrappers.
*/
protected repack($wrappers: WrapperArray): WrapperArray;
/**
* @inheritdoc
*/
TAG(): string;
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
}
}
declare namespace flex {
class TabNavigator extends React.Component<TabNavigatorProps, TabNavigatorProps> {
render(): JSX.Element;
private handle_change(index, event);
}
class NavigatorContent extends React.Component<NavigatorContentProps, NavigatorContentProps> {
render(): JSX.Element;
}
interface TabNavigatorProps extends React.Props<TabNavigator> {
selectedIndex?: number;
style?: React.CSSProperties;
}
interface NavigatorContentProps extends React.Props<NavigatorContent> {
label: string;
}
}
declare namespace boxologic {
/**
* A box, trying to pack into a {@link Pallet}.
@@ -589,7 +475,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class PackerForm extends samchon.protocol.Entity {
class PackerForm extends protocol.Entity {
/**
* Form of Instances to pack.
*/
@@ -609,12 +495,12 @@ declare namespace bws.packer {
* @param wrapperArray Type of Wrappers to be used.
*/
constructor(instanceFormArray: InstanceFormArray, wrapperArray: WrapperArray);
construct(xml: samchon.library.XML): void;
construct(xml: library.XML): void;
optimize(): WrapperArray;
getInstanceFormArray(): InstanceFormArray;
getWrapperArray(): WrapperArray;
TAG(): string;
toXML(): samchon.library.XML;
toXML(): library.XML;
toPacker(): Packer;
}
/**
@@ -622,12 +508,12 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class InstanceFormArray extends samchon.protocol.EntityArrayCollection<InstanceForm> {
class InstanceFormArray extends protocol.EntityArrayCollection<InstanceForm> {
/**
* Default Constructor.
*/
constructor();
createChild(xml: samchon.library.XML): InstanceForm;
createChild(xml: library.XML): InstanceForm;
TAG(): string;
CHILD_TAG(): string;
/**
@@ -645,7 +531,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class InstanceForm extends samchon.protocol.Entity {
class InstanceForm extends protocol.Entity {
/**
* A duplicated Instance.
*/
@@ -661,7 +547,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
construct(xml: samchon.library.XML): void;
construct(xml: library.XML): void;
private createInstance(xml);
key(): any;
getInstance(): Instance;
@@ -679,7 +565,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
toXML(): library.XML;
/**
* <p> Repeated {@link instance} to {@link InstanceArray}.
*
@@ -694,7 +580,7 @@ declare namespace bws.packer {
}
}
declare namespace bws.packer {
class WrapperArray extends samchon.protocol.EntityArrayCollection<Wrapper> {
class WrapperArray extends protocol.EntityArrayCollection<Wrapper> {
/**
* Default Constructor.
*/
@@ -702,7 +588,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
createChild(xml: samchon.library.XML): Wrapper;
createChild(xml: library.XML): Wrapper;
/**
* Get (calculate) price.
*/
@@ -756,7 +642,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
interface Instance extends samchon.protocol.IEntity {
interface Instance extends protocol.IEntity {
/**
* Get name.
*/
@@ -813,7 +699,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class InstanceArray extends samchon.protocol.EntityArray<Instance> {
class InstanceArray extends protocol.EntityArray<Instance> {
/**
* Default Constructor.
*/
@@ -821,7 +707,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
createChild(xml: samchon.library.XML): Instance;
createChild(xml: library.XML): Instance;
/**
* @inheritdoc
*/
@@ -832,13 +718,113 @@ declare namespace bws.packer {
CHILD_TAG(): string;
}
}
declare namespace bws.packer {
/**
* @brief Packer, a solver of 3d bin packing with multiple wrappers.
*
* @details
* <p> Packer is a facade class supporting packing operations in user side. You can solve a packing problem
* by constructing Packer class with {@link WrapperArray wrappers} and {@link InstanceArray instances} to
* pack and executing {@link optimize Packer.optimize()} method. </p>
*
* <p> In background side, deducting packing solution, those algorithms are used. </p>
* <ul>
* <li> <a href="http://betterwaysystems.github.io/packer/reference/AirForceBinPacking.pdf" target="_blank">
* Airforce Bin Packing; 3D pallet packing problem: A human intelligence-based heuristic approach </a>
* </li>
* <li> Genetic Algorithm </li>
* <li> Greedy and Back-tracking algorithm </li>
* </ul>
*
* @author Jeongho Nam <http://samchon.org>
*/
class Packer extends protocol.Entity {
/**
* Candidate wrappers who can contain instances.
*/
protected wrapperArray: WrapperArray;
/**
* Instances trying to pack into the wrapper.
*/
protected instanceArray: InstanceArray;
/**
* Default Constructor.
*/
constructor();
/**
* Construct from members.
*
* @param wrapperArray Candidate wrappers who can contain instances.
* @param instanceArray Instances to be packed into some wrappers.
*/
constructor(wrapperArray: WrapperArray, instanceArray: InstanceArray);
/**
* @inheritdoc
*/
construct(xml: library.XML): void;
/**
* Get wrapperArray.
*/
getWrapperArray(): WrapperArray;
/**
* Get instanceArray.
*/
getInstanceArray(): InstanceArray;
/**
* <p> Deduct
*
*/
optimize(): WrapperArray;
/**
* @brief Initialize sequence list (gene_array).
*
* @details
* <p> Deducts initial sequence list by such assumption: </p>
*
* <ul>
* <li> Cost of larger wrapper is less than smaller one, within framework of price per volume unit. </li>
* <ul>
* <li> Wrapper Larger: (price: $1,000, volume: 100cm^3 -> price per volume unit: $10 / cm^3) </li>
* <li> Wrapper Smaller: (price: $700, volume: 50cm^3 -> price per volume unit: $14 / cm^3) </li>
* <li> Larger's <u>cost</u> is less than Smaller, within framework of price per volume unit </li>
* </ul>
* </ul>
*
* <p> Method {@link initGenes initGenes()} constructs {@link WrapperGroup WrapperGroups} corresponding
* with the {@link wrapperArray} and allocates {@link instanceArray instances} to a {@link WrapperGroup},
* has the smallest <u>cost</u> between containbles. </p>
*
* <p> After executing packing solution by {@link WrapperGroup.optimize WrapperGroup.optimize()}, trying to
* {@link repack re-pack} each {@link WrapperGroup} to another type of {@link Wrapper}, deducts the best
* solution between them. It's the initial sequence list of genetic algorithm. </p>
*
* @return Initial sequence list.
*/
protected initGenes(): GAWrapperArray;
/**
* Try to repack each wrappers to another type.
*
* @param $wrappers Wrappers to repack.
* @return Re-packed wrappers.
*/
protected repack($wrappers: WrapperArray): WrapperArray;
/**
* @inheritdoc
*/
TAG(): string;
/**
* @inheritdoc
*/
toXML(): library.XML;
}
}
declare namespace bws.packer {
/**
* A product.
*
* @author Jeongho Nam <http://samchon.org>
*/
class Product extends samchon.protocol.Entity implements Instance {
class Product extends protocol.Entity implements Instance {
/**
* <p> Name, key of the Product. </p>
*
@@ -921,7 +907,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
toXML(): library.XML;
}
}
declare namespace bws.packer {
@@ -937,7 +923,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class Wrap extends samchon.protocol.Entity {
class Wrap extends protocol.Entity {
/**
* A wrapper wrapping the {@link instance}.
*/
@@ -962,10 +948,6 @@ declare namespace bws.packer {
* Placement orientation of wrapped {@link instance}.
*/
protected orientation: number;
/**
*
*/
protected color: number;
/**
* Construct from a Wrapper.
*
@@ -996,7 +978,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
construct(xml: samchon.library.XML): void;
construct(xml: library.XML): void;
/**
* Factory method of wrapped Instance.
*
@@ -1058,11 +1040,11 @@ declare namespace bws.packer {
/**
* Get width.
*/
getWidth(): number;
getLayoutWidth(): number;
/**
* Get height.
*/
getHeight(): number;
getLayoutHeight(): number;
/**
* Get length.
*/
@@ -1071,9 +1053,9 @@ declare namespace bws.packer {
* Get volume.
*/
getVolume(): number;
$instanceName: string;
$layoutScale: string;
$position: string;
readonly $instanceName: string;
readonly $layoutScale: string;
readonly $position: string;
/**
* @inheritdoc
*/
@@ -1081,19 +1063,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
/**
* Thickness of boundary lines of a shape represents the {@link instance}.
*/
private static BOUNDARY_THICKNESS;
/**
*
*
* @param geometry
*
* @return A shape and its boundary lines as 3D-objects.
*/
toDisplayObjects(geometry: THREE.Geometry): std.Vector<THREE.Object3D>;
toXML(): library.XML;
}
}
declare namespace bws.packer {
@@ -1102,7 +1072,7 @@ declare namespace bws.packer {
*
* @author Jeongho Nam <http://samchon.org>
*/
class Wrapper extends samchon.protocol.EntityDeque<Wrap> implements Instance {
class Wrapper extends protocol.EntityDeque<Wrap> implements Instance {
/**
* <p> Name, key of the Wrapper. </p>
*
@@ -1151,11 +1121,10 @@ declare namespace bws.packer {
* @param thickness A thickness causes shrinkness on containable volume.
*/
constructor(name: string, price: number, width: number, height: number, length: number, thickness: number);
construct(xml: samchon.library.XML): void;
/**
* @inheritdoc
*/
createChild(xml: samchon.library.XML): Wrap;
createChild(xml: library.XML): Wrap;
/**
* Key of a Wrapper is its name.
*/
@@ -1232,7 +1201,7 @@ declare namespace bws.packer {
* @return utilization ratio.
*/
getUtilization(): number;
equal_to(obj: Wrapper): boolean;
equals(obj: Wrapper): boolean;
/**
* <p> Wrapper is enough greater? </p>
*
@@ -1272,8 +1241,8 @@ declare namespace bws.packer {
$height: string;
$length: string;
$thickness: string;
$scale: string;
$spaceUtilization: string;
readonly $scale: string;
readonly $spaceUtilization: string;
/**
* @inheritdoc
*/
@@ -1289,25 +1258,7 @@ declare namespace bws.packer {
/**
* @inheritdoc
*/
toXML(): samchon.library.XML;
private static scene;
private static renderer;
private static camera;
private static trackball;
private static mouse;
private static BOUNDARY_THICKNESS;
/**
* <p> Convert to a canvas containing 3D elements. </p>
*
* @param endIndex
*
* @return A 3D-canvans printing the Wrapper and its children {@link Wrap wrapped}
* {@link Instance instances} with those boundary lines.
*/
toCanvas(endIndex?: number): HTMLCanvasElement;
private static handleMouseMove(event);
private static animate();
private static render();
toXML(): library.XML;
}
}
declare namespace bws.packer {
@@ -1430,72 +1381,3 @@ declare namespace bws.packer {
TAG(): string;
}
}
declare namespace bws.packer {
abstract class Editor<T extends samchon.protocol.IEntity> extends React.Component<{
dataProvider: samchon.protocol.EntityArrayCollection<T>;
}, {}> {
private columns;
private selected_index;
/**
* Default Constructor.
*/
constructor();
protected abstract createColumns(): AdazzleReactDataGrid.Column[];
private get_row(index);
private insert_instance(event);
private erase_instances(event);
private handle_data_change(event);
private handle_row_change(event);
private handle_select(event);
render(): JSX.Element;
}
}
declare namespace bws.packer {
interface ItemEditorProps extends React.Props<ItemEditor> {
application: PackerApplication;
instances: InstanceFormArray;
wrappers: WrapperArray;
}
class ItemEditor extends React.Component<ItemEditorProps, {}> {
private clear(event);
private open(event);
private save(event);
private pack(event);
render(): JSX.Element;
}
class InstanceEditor extends Editor<InstanceForm> {
protected createColumns(): AdazzleReactDataGrid.Column[];
}
class WrapperEditor extends Editor<Wrapper> {
protected createColumns(): AdazzleReactDataGrid.Column[];
}
}
declare namespace bws.packer {
class PackerApplication extends React.Component<{}, {}> {
private instances;
private wrappers;
private result;
/**
* Default Constructor.
*/
constructor();
pack(): void;
drawWrapper(wrapper: Wrapper, index?: number): void;
render(): JSX.Element;
static main(): void;
}
}
declare namespace bws.packer {
class ResultViewer extends React.Component<WrapperViewerProps, {}> {
drawWrapper(wrapper: Wrapper, index?: number): void;
private clear(event);
private open(event);
private save(event);
refresh(): void;
render(): JSX.Element;
}
interface WrapperViewerProps extends React.Props<ResultViewer> {
application: PackerApplication;
wrappers: WrapperArray;
}
}
+2 -2
View File
@@ -811,8 +811,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](jquery.cookie/jquery.cookie.d.ts) [jQuery Cookie Plugin](https://github.com/carhartl/jquery-cookie) by [Roy Goode](https://github.com/RoyGoode), [Ben Lorantfy](https://github.com/BenLorantfy)
* [:link:](jquery-cropbox/jquery-cropbox.d.ts) [jQuery cropbox](https://github.com/acornejo/jquery-cropbox) by [Per Kastman](https://github.com/PerKastman)
* [:link:](jquery.cycle2/jquery.cycle2.d.ts) [jQuery Cycle2 version (build 20140216)](http://jquery.malsup.com/cycle2) by [Donny Nadolny](https://github.com/dnadolny)
* [:link:](jquery.dataTables/jquery.dataTables.d.ts) [JQuery DataTables](http://www.datatables.net) by [Kiarash Ghiaseddin](https://github.com/Silver-Connection/DefinitelyTyped), [Omid Rad](https://github.com/omidkrad), [Armin Sander](https://github.com/pragmatrix)
* [:link:](datatables-buttons/datatables-buttons.d.ts) [JQuery DataTables Buttons extension](http://datatables.net/extensions/buttons) by [Sam Germano](https://github.com/SammyG4Free)
* [:link:](datatables.net/index.d.ts) [JQuery DataTables](http://www.datatables.net) by [Kiarash Ghiaseddin](https://github.com/Silver-Connection/DefinitelyTyped), [Omid Rad](https://github.com/omidkrad), [Armin Sander](https://github.com/pragmatrix)
* [:link:](datatables.net-buttons/index.d.ts) [JQuery DataTables Buttons extension](http://datatables.net/extensions/buttons) by [Sam Germano](https://github.com/SammyG4Free)
* [:link:](jquery.fileupload/jquery.fileupload.d.ts) [jQuery File Upload Plugin](https://github.com/blueimp/jQuery-File-Upload) by [Rob Alarcon](https://github.com/rob-alarcon)
* [:link:](jquery.joyride/jquery.joyride.d.ts) [jQuery JoyRide Plugin](https://github.com/zurb/joyride) by [Vincent Bortone](https://github.com/vbortone)
* [:link:](jqgrid/jqgrid.d.ts) [jQuery jqgrid Plugin](https://github.com/tonytomov/jqGrid) by [Lokesh Peta](https://github.com/lokeshpeta)
+3 -3
View File
@@ -110,7 +110,9 @@ Your package should have this structure:
| tsconfig.json | This allows you to run `tsc` within the package. |
| tslint.json | Enables linting. |
Generate these by running `npm run new-package -- new-package-name`.
Generate these by running `npm run new-package -- --name my-package-name --template module`.
(Other templates are `module-class`, `module-function`, `module-plugin`, `global`, `global-plugin`, and `global-modifying-module`.
This just wraps [dts-gen](https://github.com/Microsoft/dts-gen), so it supports all options from that.)
You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option.
@@ -167,10 +169,8 @@ If a `tslint.json` turns rules off, this is because that hasn't been fixed yet.
(To indicate that a lint rule truly does not apply, use `// tslint:disable:rule-name` or better, `//tslint:disable-next-line:rule-name`.)
Only `.d.ts` files are linted.
Test the linter by running `npm run lint -- package-name`. Do not use a globally installed tslint.
## FAQ
#### What exactly is the relationship between this repository and the `@types` packages on NPM?
+47 -44
View File
@@ -1,5 +1,7 @@
import * as Ably from 'ably';
declare var console: { log(message: any): void };
const ApiKey = 'appId.keyId:secret';
const client = new Ably.Realtime(ApiKey);
const restClient = new Ably.Rest(ApiKey);
@@ -7,13 +9,13 @@ const restClient = new Ably.Rest(ApiKey);
// Connection
// Successful connection:
client.connection.on('connected', function() {
client.connection.on('connected', () => {
// successful connection
});
// Failed connection:
client.connection.on('failed', function() {
client.connection.on('failed', () => {
// failed connection
});
@@ -21,14 +23,14 @@ client.connection.on('failed', function() {
// Subscribing to a channel
var channel = client.channels.get('test');
channel.subscribe(function(message) {
channel.subscribe(message => {
message.name; // 'greeting'
message.data; // 'Hello World!'
});
// Only certain events:
channel.subscribe('myEvent', function(message) {
channel.subscribe('myEvent', message => {
message.name; // 'myEvent'
message.data; // 'myData'
});
@@ -39,30 +41,30 @@ channel.subscribe('myEvent', function(message) {
channel.publish('greeting', 'Hello World!');
// Optionally, you can use a callback to be notified of success or failure
channel.publish('greeting', 'Hello World!', function(err) {
if(err) {
channel.publish('greeting', 'Hello World!', err => {
if (err) {
console.log('publish failed with error ' + err);
} else {
console.log('publish succeeded');
}
})
});
// Publish several messages at once
channel.publish([{name: 'greeting', data: 'Hello World!'}], function() { });
channel.publish([{name: 'greeting', data: 'Hello World!'}], () => { });
// Querying the History
channel.history(function(err, messagesPage) {
channel.history((err, messagesPage) => {
messagesPage.items; // array of Message
messagesPage.items[0].data; // payload for first message
messagesPage.items.length; // number of messages in the current page of history
messagesPage.hasNext(); // true if there are further pages
messagesPage.isLast(); // true if this page is the last page
messagesPage.next(function(nextPage) { nextPage; }); // retrieves the next page as PaginatedResult
messagesPage.next(nextPage => { nextPage; }); // retrieves the next page as PaginatedResult
});
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
channel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, direction: 'forwards'}, function(err, messagesPage) {
channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards'}, (err, messagesPage) => {
console.log(messagesPage.items.length);
});
@@ -70,7 +72,7 @@ channel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, directio
// Presence on a channel
// Getting presence:
channel.presence.get(function(presenceSet) {
channel.presence.get(presenceSet => {
presenceSet; // array of PresenceMessages
});
@@ -78,46 +80,47 @@ channel.presence.get(function(presenceSet) {
// Entering (and leaving) the presence set:
channel.presence.enter('my status', function(err) {
channel.presence.enter('my status', err => {
// now I am entered
});
channel.presence.update('new status', function(err) {
channel.presence.update('new status', err => {
// my presence data is updated
});
channel.presence.leave(null, function(err) {
channel.presence.leave(null, err => {
// I've left the presence set
});
channel.presence.enterClient('myClientId', 'status', function(err) {
channel.presence.enterClient('myClientId', 'status', err => {
});
// and similiarly, updateClient and leaveClient
// Querying the Presence History
channel.presence.history(function(err, messagesPage) { // PaginatedResult
channel.presence.history((err, messagesPage) => { // PaginatedResult
messagesPage.items; // array of PresenceMessage
messagesPage.items[0].data; // payload for first message
messagesPage.items.length; // number of messages in the current page of history
messagesPage.hasNext(); // true if there are further pages
messagesPage.isLast(); // true if this page is the last page
messagesPage.next(function(nextPage) { }); // retrieves the next page as PaginatedResult
messagesPage.next(nextPage => { }); // retrieves the next page as PaginatedResult
});
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
channel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, direction: 'forwards' }, function(err, messagesPage) {});
channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {});
// Symmetrical end-to-end encrypted payloads on a channel
// When a 128 bit or 256 bit key is provided to the library, the data attributes of all messages are encrypted and decrypted automatically using that key. The secret key is never transmitted to Ably. See https://www.ably.io/documentation/realtime/encryption
// When a 128 bit or 256 bit key is provided to the library, the data attributes of all messages are encrypted and decrypted automatically using that key.
// The secret key is never transmitted to Ably. See https://www.ably.io/documentation/realtime/encryption
// Generate a random 256-bit key for demonstration purposes (in
// practice you need to create one and distribute it to clients yourselves)
Ably.Realtime.Crypto.generateRandomKey(function(err, key) {
var channel = client.channels.get('channelName', { cipher: { key: key } });
Ably.Realtime.Crypto.generateRandomKey((err, key) => {
var channel = client.channels.get('channelName', { cipher: { key } });
channel.subscribe(function(message) {
channel.subscribe(message => {
message.name; // 'name is not encrypted'
message.data; // 'sensitive data is encrypted'
});
@@ -127,7 +130,7 @@ Ably.Realtime.Crypto.generateRandomKey(function(err, key) {
// You can also change the key on an existing channel using setOptions (which takes a callback which is called after the new encryption settings have taken effect):
channel.setOptions({cipher: {key: '<KEY>'}}, function() {
channel.setOptions({cipher: {key: '<KEY>'}}, () => {
// New encryption settings are in effect
});
@@ -141,56 +144,56 @@ var restChannel = restClient.channels.get('test');
restChannel.publish('greeting', 'Hello World!');
// Optionally, you can use a callback to be notified of success or failure
restChannel.publish('greeting', 'Hello World!', function(err) {
if(err) {
restChannel.publish('greeting', 'Hello World!', err => {
if (err) {
console.log('publish failed with error ' + err);
} else {
console.log('publish succeeded');
}
})
});
// Publish several messages at once
restChannel.publish([{name: 'greeting', data: 'Hello World!'}], function() {});
restChannel.publish([{name: 'greeting', data: 'Hello World!'}], () => {});
// Querying the History
restChannel.history(function(err, messagesPage) {
restChannel.history((err, messagesPage) => {
messagesPage; // PaginatedResult
messagesPage.items; // array of Message
messagesPage.items[0].data; // payload for first message
messagesPage.items.length; // number of messages in the current page of history
messagesPage.hasNext(); // true if there are further pages
messagesPage.isLast(); // true if this page is the last page
messagesPage.next(function(nextPage) {}); // retrieves the next page as PaginatedResult
messagesPage.next(nextPage => {}); // retrieves the next page as PaginatedResult
});
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
restChannel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, direction: 'forwards' }, function(err, messagesPage) {});
restChannel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {});
// Presence on a channel
restChannel.presence.get(function(err, presencePage) { // PaginatedResult
restChannel.presence.get((err, presencePage) => { // PaginatedResult
presencePage.items; // array of PresenceMessage
presencePage.items[0].data; // payload for first message
presencePage.items.length; // number of messages in the current page of members
presencePage.hasNext(); // true if there are further pages
presencePage.isLast(); // true if this page is the last page
presencePage.next(function(nextPage) {}); // retrieves the next page as PaginatedResult
presencePage.next(nextPage => {}); // retrieves the next page as PaginatedResult
});
// Querying the Presence History
restChannel.presence.history(function(err, messagesPage) { // PaginatedResult
restChannel.presence.history((err, messagesPage) => { // PaginatedResult
messagesPage.items; // array of PresenceMessage
messagesPage.items[0].data; // payload for first message
messagesPage.items.length; // number of messages in the current page of history
messagesPage.hasNext(); // true if there are further pages
messagesPage.isLast(); // true if this page is the last page
messagesPage.next(function(nextPage) { }); // retrieves the next page as PaginatedResult
messagesPage.next(nextPage => { }); // retrieves the next page as PaginatedResult
});
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
restChannel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, direction: 'forwards' }, function(err, messagesPage) {});
restChannel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {});
// Generate Token and Token Request
@@ -198,7 +201,7 @@ restChannel.history({ start: Date.now()-10000, end: Date.now(), limit: 100, dire
// Requesting a token:
client.auth.requestToken(function(err, tokenDetails) {
client.auth.requestToken((err, tokenDetails) => {
// tokenDetails is instance of TokenDetails
// see https://www.ably.io/documentation/rest/authentication/#token-details for its properties
@@ -209,11 +212,11 @@ client.auth.requestToken(function(err, tokenDetails) {
// requestToken can take two optional params
// tokenParams: https://www.ably.io/documentation/rest/authentication/#token-params
// authOptions: https://www.ably.io/documentation/rest/authentication/#auth-options
client.auth.requestToken({}, {}, function(err, tokenDetails) { });
client.auth.requestToken({}, {}, (err, tokenDetails) => { });
// Creating a token request (for example, on a server in response to a request by a client using the authCallback or authUrl mechanisms):
client.auth.createTokenRequest(function(err, tokenRequest) {
client.auth.createTokenRequest((err, tokenRequest) => {
// now send the tokenRequest back to the client, which will
// use it to request a token and connect to Ably
});
@@ -221,22 +224,22 @@ client.auth.createTokenRequest(function(err, tokenRequest) {
// createTokenRequest can take two optional params
// tokenParams: https://www.ably.io/documentation/rest/authentication/#token-params
// authOptions: https://www.ably.io/documentation/rest/authentication/#auth-options
client.auth.createTokenRequest({}, {}, function(err, tokenRequest) { });
client.auth.createTokenRequest({}, {}, (err, tokenRequest) => { });
// Fetching your application's stats
client.stats({ limit: 50 }, function(err, statsPage) { // statsPage as PaginatedResult
client.stats({ limit: 50 }, (err, statsPage) => { // statsPage as PaginatedResult
statsPage.items; // array of Stats
statsPage.items[0].inbound.rest.messages.count; // total messages published over REST
statsPage.items.length; // number of stats in the current page of history
statsPage.hasNext(); // true if there are further pages
statsPage.hasNext(); // true if there are wrther pages
statsPage.isLast(); // true if this page is the last page
statsPage.next(function(nextPage) {}); // retrieves the next page as PaginatedResult
statsPage.next((nextPage) => {}); // retrieves the next page as PaginatedResult
});
// Fetching the Ably service time
client.time({}, function(err, time) {}); // time is in ms since epoch
client.time({}, (err, time) => {}); // time is in ms since epoch
// Getting decoded Message objects from JSON
var messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
+4 -2
View File
@@ -25,7 +25,8 @@ declare namespace ablyLib {
type CLOSED = "closed";
type FAILED = "failed";
}
type ConnectionState = ConnectionState.INITIALIZED | ConnectionState.CONNECTED | ConnectionState.CONNECTING | ConnectionState.DISCONNECTED | ConnectionState.SUSPENDED | ConnectionState.CLOSED | ConnectionState.CLOSING | ConnectionState.FAILED;
type ConnectionState = ConnectionState.INITIALIZED | ConnectionState.CONNECTED | ConnectionState.CONNECTING | ConnectionState.DISCONNECTED |
ConnectionState.SUSPENDED | ConnectionState.CLOSED | ConnectionState.CLOSING | ConnectionState.FAILED;
namespace ConnectionEvent {
type INITIALIZED = "initialized";
@@ -38,7 +39,8 @@ declare namespace ablyLib {
type FAILED = "failed";
type UPDATE = "update";
}
type ConnectionEvent = ConnectionEvent.INITIALIZED | ConnectionEvent.CONNECTED | ConnectionEvent.CONNECTING | ConnectionEvent.DISCONNECTED | ConnectionEvent.SUSPENDED | ConnectionEvent.CLOSED | ConnectionEvent.CLOSING | ConnectionEvent.FAILED | ConnectionEvent.UPDATE;
type ConnectionEvent = ConnectionEvent.INITIALIZED | ConnectionEvent.CONNECTED | ConnectionEvent.CONNECTING | ConnectionEvent.DISCONNECTED |
ConnectionEvent.SUSPENDED | ConnectionEvent.CLOSED | ConnectionEvent.CLOSING | ConnectionEvent.FAILED | ConnectionEvent.UPDATE;
namespace PresenceAction {
type ABSENT = "absent";
+4 -2
View File
@@ -1,7 +1,9 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
@@ -17,4 +19,4 @@
"index.d.ts",
"ably-tests.ts"
]
}
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "../tslint.json" }
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "../tslint.json" }
+3
View File
@@ -67,3 +67,6 @@ acorn.getLineInfo('string', 56);
acorn.plugins['test'] = function (p: acorn.Parser, config: any) {
}
acorn.tokenizer('console.log("hello world)', {locations: true}).getToken();
acorn.tokenizer('console.log("hello world)', {locations: true})[Symbol.iterator]().next();
+6 -3
View File
@@ -238,9 +238,12 @@ declare namespace acorn {
function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression;
// todo: here the tokenizer function returns a Parser instance, that is targeting the detail of
// Parser prototype. Someone need this please reade README.md first.
// function tokenizer(options: Options, input: string): Parser;
interface ITokenizer {
getToken() : Token,
[Symbol.iterator](): Iterator<Token>
}
function tokenizer(input: string, options: Options): ITokenizer;
let parse_dammit: IParse | undefined;
let LooseParser: ILooseParserClass | undefined;
+3 -3
View File
@@ -1,5 +1,5 @@
amplify.request({
resourceId: "statusExample1"
}).done(function (data, status) {
}).fail(function (data, status) {
}).always(function (data, status) { });
}).done((data, status) => {
}).fail((data, status) => {
}).always((data, status) => { });
+1 -1
View File
@@ -3,4 +3,4 @@
"rules": {
"forbidden-types": false
}
}
}
+30 -30
View File
@@ -7,7 +7,7 @@ import amplify = require("amplify");
// Subscribe and publish with no data
amplify.subscribe("nodataexample", function () {
amplify.subscribe("nodataexample", () => {
alert("nodataexample topic published!");
});
@@ -15,24 +15,24 @@ amplify.subscribe("nodataexample", function () {
amplify.publish("nodataexample");
amplify.subscribe("dataexample", function (data) {
amplify.subscribe("dataexample", data => {
alert(data.foo); // bar
});
amplify.publish("dataexample", { foo: "bar" });
amplify.subscribe("dataexample2", function (param1, param2) {
amplify.subscribe("dataexample2", (param1, param2) => {
alert(param1 + param2); // barbaz
});
//...
// ...
amplify.publish("dataexample2", "bar", "baz");
// Subscribe and publish with context and data
amplify.subscribe("datacontextexample", $("p:first"), function (data) {
amplify.subscribe("datacontextexample", $("p:first"), data => {
this.text(data.exampleText); // first p element would have "foo bar baz" as text
});
@@ -40,11 +40,11 @@ amplify.publish("datacontextexample", { exampleText: "foo bar baz" });
// Subscribe to a topic with high priority
amplify.subscribe("priorityexample", function (data) {
amplify.subscribe("priorityexample", data => {
alert(data.foo);
});
amplify.subscribe("priorityexample", function (data) {
amplify.subscribe("priorityexample", data => {
if (data.foo === "oops") {
return false;
}
@@ -87,7 +87,7 @@ amplify.request.define("ajaxExample1", "ajax", {
});
// later in code
amplify.request("ajaxExample1", function (data) {
amplify.request("ajaxExample1", data => {
data.foo; // bar
});
@@ -101,21 +101,21 @@ amplify.request.define("ajaxExample2", "ajax", {
});
// later in code
amplify.request("ajaxExample2", function (data) {
amplify.request("ajaxExample2", data => {
data.foo; // bar
});
// a second call will result in pulling from the cache
amplify.request("ajaxExample2", function (data) {
amplify.request("ajaxExample2", data => {
data.baz; // qux
})
});
// Set up and use a RESTful request utilizing Ajax
amplify.request.define("ajaxRESTFulExample", "ajax", {
url: "/myRestFulApi/{type}/{id}",
type: "GET"
})
});
// later in code
amplify.request("ajaxRESTFulExample",
@@ -123,7 +123,7 @@ amplify.request("ajaxRESTFulExample",
type: "foo",
id: "bar"
},
function (data) {
data => {
// /myRESTFulApi/foo/bar was the URL used
data.foo; // bar
}
@@ -132,9 +132,9 @@ amplify.request("ajaxRESTFulExample",
// POST data with Ajax
amplify.request.define("ajaxPostExample", "ajax", {
url: "/myRestFulApi",
type: "POST"
})
url: "/myRestFulApi",
type: "POST"
});
// later in code
amplify.request("ajaxPostExample",
@@ -142,7 +142,7 @@ amplify.request("ajaxPostExample",
type: "foo",
id: "bar"
},
function (data) {
data => {
data.foo; // bar
}
);
@@ -165,7 +165,7 @@ amplify.request("twitter-search", { term: "amplifyjs" } );
amplify.request.define("twitter-mentions", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: function (data) {
dataMap: data => {
return {
q: "@" + data.user
};
@@ -176,9 +176,9 @@ amplify.request("twitter-mentions", { user: "amplifyjs" });
// Setting up and using decoders
//Example:
// Example:
var appEnvelopeDecoder: amplify.Decoder = function (data, status, xhr, success, error) {
var appEnvelopeDecoder: amplify.Decoder = (data, status, xhr, success, error) => {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
@@ -188,7 +188,7 @@ var appEnvelopeDecoder: amplify.Decoder = function (data, status, xhr, success,
}
};
//a new decoder can be added to the amplifyDecoders interface
// a new decoder can be added to the amplifyDecoders interface
declare module "amplify" {
interface Decoders {
appEnvelope: amplify.Decoder;
@@ -197,7 +197,7 @@ declare module "amplify" {
amplify.request.decoders.appEnvelope = appEnvelopeDecoder;
//but you can also just add it via an index
// but you can also just add it via an index
amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder;
@@ -209,10 +209,10 @@ amplify.request.define("decoderExample", "ajax", {
amplify.request({
resourceId: "decoderExample",
success: function (data) {
success(data) {
data.foo; // bar
},
error: function (message, level) {
error(message, level) {
alert("always handle errors with alerts.");
}
});
@@ -224,7 +224,7 @@ amplify.request({
amplify.request.define("decoderSingleExample", "ajax", {
url: "/myAjaxUrl",
type: "POST",
decoder: function (data, status, xhr, success, error) {
decoder(data, status, xhr, success, error) {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
@@ -237,10 +237,10 @@ amplify.request.define("decoderSingleExample", "ajax", {
amplify.request({
resourceId: "decoderSingleExample",
success: function (data) {
success: data => {
data.foo; // bar
},
error: function (message, level) {
error: (message, level) => {
alert("always handle errors with alerts.");
}
});
@@ -250,14 +250,14 @@ amplify.request({
// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition.
amplify.request.define("statusExample1", "ajax", {
//...
// ...
});
amplify.request({
resourceId: "statusExample1",
success: function (data, status) {
success: (data, status) => {
},
error: function (data, status) {
error: (data, status) => {
}
});
+3 -1
View File
@@ -162,7 +162,9 @@ declare namespace amplify {
* Publish a message.
* topic: The name of the message to publish.
* Any additional parameters will be passed to the subscriptions.
* amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked.
* amplify.publish returns a boolean indicating whether any subscriptions returned false.
* The return value is true if none of the subscriptions returned false, and false otherwise.
* Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked.
*/
publish(topic: string, ...args: any[]): boolean;
+1 -1
View File
@@ -4,4 +4,4 @@
"forbidden-types": false,
"unified-signatures": false
}
}
}
+4 -4
View File
@@ -31,11 +31,11 @@ var anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
import amqpcb = require('amqplib/callback_api');
amqpcb.connect('amqp://localhost', (err, connection) => {
if(!err) {
if (!err) {
connection.createChannel((err, channel) => {
if (!err) {
channel.assertQueue('myQueue', {}, (err, ok) => {
if(!err) {
if (!err) {
channel.sendToQueue('myQueue', new Buffer(msg));
}
});
@@ -45,11 +45,11 @@ amqpcb.connect('amqp://localhost', (err, connection) => {
});
amqpcb.connect('amqp://localhost', (err, connection) => {
if(!err) {
if (!err) {
connection.createChannel((err, channel) => {
if (!err) {
channel.assertQueue('myQueue', {}, (err, ok) => {
if(!err) {
if (!err) {
channel.consume('myQueue', newMsg => console.log('New Message: ' + newMsg.content.toString()));
}
});
+1 -1
View File
@@ -3,4 +3,4 @@
"rules": {
"no-empty-interface": false
}
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ myApp.run(["gridsterConfig", (gridsterConfig: angular.gridster.GridsterConfig) =
gridsterConfig.floating = true;
gridsterConfig.swapping = true;
gridsterConfig.draggable = { enabled: true};
gridsterConfig.resizable = { enabled: true,
gridsterConfig.resizable = { enabled: true,
handles: ["n", "s", "e", "w", "ne", "se", "sw", "nw"]};
}
]);
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "../tslint.json" }
+10
View File
@@ -0,0 +1,10 @@
import * as angular from 'angular';
angular.module('angular-oauth2-test', ['angular-oauth2'])
.config(['OAuthProvider', function(OAuthProvider:angular.oauth2.OAuthProvider){
OAuthProvider.configure({
baseUrl: 'https://api.website.com',
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET' // optional
});
}]);
+49
View File
@@ -0,0 +1,49 @@
// Type definitions for angular-oauth2 4.1
// Project: https://github.com/oauthjs/angular-oauth2
// Definitions by: Antério Vieira <https://github.com/anteriovieira>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as angular from 'angular';
declare module 'angular' {
export namespace oauth2 {
interface OAuthConfig {
baseUrl: string;
clientId: string;
clientSecret?: string;
grantPath?: string;
revokePath?: string;
}
interface OAuthProvider {
configure(params: OAuthConfig): OAuthConfig;
}
interface Data {
username: string;
password: string;
}
interface OAuth {
isAuthenticated(): boolean;
getAccessToken(data: Data, options?: any): angular.IPromise<string>;
getRefreshToken(data?: Data, options?: any): angular.IPromise<string>;
revokeToken(data?: Data, options?: any): angular.IPromise<string>;
}
interface OAuthTokenConfig {
name: string;
options: any;
}
interface OAuthTokenOptions {
secure: boolean;
}
interface OAuthTokenProvider {
configure(params: OAuthTokenConfig): OAuthTokenConfig;
}
}
}
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"angular-oauth2-tests.ts"
]
}
+2 -2
View File
@@ -51,8 +51,8 @@ declare module 'angular' {
cloakClassName(name: string): ITranslateProvider;
fallbackLanguage(langKey?: string): string;
fallbackLanguage(langKey?: string[]): string;
instant(translationId: string, interpolateParams?: any, interpolationId?: string): string;
instant(translationId: string[], interpolateParams?: any, interpolationId?: string): { [key: string]: string };
instant(translationId: string, interpolateParams?: any, interpolationId?: string, forceLanguage?: string, sanitizeStrategy?: string): string;
instant(translationId: string[], interpolateParams?: any, interpolationId?: string, forceLanguage?: string, sanitizeStrategy?: string): { [key: string]: string };
isPostCompilingEnabled(): boolean;
preferredLanguage(langKey?: string): string;
proposedLanguage(): string;
+5 -5
View File
@@ -143,7 +143,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
private $state: ng.ui.IStateService
) {
$rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event));
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
$rootScope.$on('$stateNotFound', (event: ng.IAngularEvent, unfoundState: ng.ui.IUnfoundState, fromState: ng.ui.IState, fromParams: {}) =>
this.onStateNotFound(event, unfoundState, fromState, fromParams));
}
@@ -157,8 +157,8 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
// Note that we do not concern ourselves with what to do if this request fails,
// because if it fails, the web page will be redirected away to the login screen.
this.$http({ url: "/api/me", method: "GET" }).success((user: any) => {
this.currentUser = user;
this.$http({ url: "/api/me", method: "GET" }).then((response: ng.IHttpPromiseCallbackArg<any>) => {
this.currentUser = response.data;
// sync the ui-state with the location in the browser, which effectively
// restarts the state change that was stopped previously
@@ -166,14 +166,14 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
});
}
}
private onStateNotFound(event: ng.IAngularEvent,
unfoundState: ng.ui.IUnfoundState,
fromState: ng.ui.IState,
fromParams: {}) {
var unfoundTo: string = unfoundState.to;
var unfoundToParams: {} = unfoundState.toParams;
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
var unfoundOptions: ng.ui.IStateOptions = unfoundState.options
}
private stateServiceTest() {
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/mgonto/angular-wizard
// Definitions by: Marko Jurisic <https://github.com/mjurisic>, Ronald Wildenberg <https://github.com/rwwilden>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import * as angular from 'angular';
+90 -121
View File
@@ -19,19 +19,19 @@ class AuthService {
* Required by HTTP interceptor.
* Function is attached to provider to be invisible for regular users of this service.
*/
pushToBuffer = function(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
pushToBuffer = (config: ng.IRequestConfig, deferred: ng.IDeferred<any>) => {
this.buffer.push({
config,
deferred
});
};
}
$get = [
'$rootScope', '$injector', function($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
let $http: ng.IHttpService; //initialized later because of circular dependency problem
'$rootScope', '$injector', ($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) => {
let $http: ng.IHttpService; // initialized later because of circular dependency problem
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
$http = $http || $injector.get<ng.IHttpService>('$http');
$http(config).then(function(response) {
$http(config).then(response => {
deferred.resolve(response);
});
}
@@ -49,7 +49,7 @@ class AuthService {
retryAll();
}
};
} as any
}
];
}
@@ -61,13 +61,13 @@ angular.module('http-auth-interceptor', [])
* $http interceptor.
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
*/
.config(['$httpProvider', 'authServiceProvider', function($httpProvider: ng.IHttpProvider, authServiceProvider: any) {
.config(['$httpProvider', 'authServiceProvider', ($httpProvider: ng.IHttpProvider, authServiceProvider: any) => {
$httpProvider.defaults.headers.common = {Authorization: 'Bearer token'};
$httpProvider.defaults.headers.get['Authorization'] = 'Bearer token';
$httpProvider.defaults.headers.post['Authorization'] = function(config: ng.IRequestConfig): string { return 'Bearer token'; };
$httpProvider.defaults.headers.post['Authorization'] = (config: ng.IRequestConfig) => 'Bearer token';
const interceptor = ['$rootScope', '$q', function($rootScope: ng.IScope, $q: ng.IQService) {
const interceptor = ['$rootScope', '$q', ($rootScope: ng.IScope, $q: ng.IQService) => {
function success(response: ng.IHttpPromiseCallbackArg<any>) {
return response;
}
@@ -83,13 +83,10 @@ angular.module('http-auth-interceptor', [])
return $q.reject(response);
}
return function(promise: ng.IHttpPromise<any>) {
return promise.then(success, error);
};
} as any];
return (promise: ng.IHttpPromise<any>) => promise.then(success, error);
}];
$httpProvider.interceptors.push(interceptor);
} as any]);
}]);
namespace HttpAndRegularPromiseTests {
interface Person {
@@ -108,11 +105,6 @@ namespace HttpAndRegularPromiseTests {
}
function someController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.success((data: ExpectedResponse) => {
$scope.person = data;
});
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
@@ -156,21 +148,6 @@ namespace HttpAndRegularPromiseTests {
$scope.nothing = 'really nothing';
});
}
// Test that we can pass around a type-checked success/error Promise Callback
function anotherController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
function buildFooData(): ng.IRequestShortcutConfig {
return {};
}
function doFoo(callback: ng.IHttpPromiseCallback<ExpectedResponse>) {
$http
.get<ExpectedResponse>('/foo', buildFooData())
.success(callback);
};
doFoo((data: any) => console.log(data));
};
}
// Test for AngularJS Syntax
@@ -181,8 +158,8 @@ namespace My.Namespace {
// IModule Registering Test
let mod = angular.module('tests', []);
mod.controller('name', function($scope: ng.IScope) { });
mod.controller('name', ['$scope', function($scope: ng.IScope) { }]);
mod.controller('name', ($scope: ng.IScope) => { });
mod.controller('name', ['$scope', ($scope: ng.IScope) => { }]);
mod.controller('name', class {
// Uncommenting the next line should lead to a type error because this signature isn't compatible
// with the signature of the `$onChanges` hook:
@@ -190,8 +167,8 @@ mod.controller('name', class {
});
mod.controller({
MyCtrl: class{},
MyCtrl2: function() {}, // tslint:disable-line:object-literal-shorthand
MyCtrl3: ['$fooService', function($fooService: any) { }]
MyCtrl2() {},
MyCtrl3: ['$fooService', ($fooService: any) => { }]
});
mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => {
return (scope, el, attrs) => {
@@ -203,7 +180,7 @@ mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => {
scope.$watch(() => foo, () => el.text(foo));
};
});
mod.directive('myDirectiveB', ['$rootScope', function($rootScope: ng.IRootScopeService) {
mod.directive('myDirectiveB', ['$rootScope', ($rootScope: ng.IRootScopeService) => {
return {
link(scope, el, attrs) {
el.click(e => {
@@ -220,28 +197,28 @@ mod.directive({
template: 'my-bar-dir.tpl.html'
})]
});
mod.factory('name', function($scope: ng.IScope) { });
mod.factory('name', ['$scope', function($scope: ng.IScope) { }]);
mod.factory('name', ($scope: ng.IScope) => {});
mod.factory('name', ['$scope', ($scope: ng.IScope) => {}]);
mod.factory({
name1: function(foo: any) { }, // tslint:disable-line:object-literal-shorthand
name2: ['foo', function(foo: any) { }]
name1(foo: any) {},
name2: ['foo', (foo: any) => {}]
});
mod.filter('name', function($scope: ng.IScope) { });
mod.filter('name', ['$scope', function($scope: ng.IScope) { }]);
mod.filter('name', ($scope: ng.IScope) => {});
mod.filter('name', ['$scope', ($scope: ng.IScope) => {}]);
mod.filter({
name1: function(foo: any) { }, // tslint:disable-line:object-literal-shorthand
name2: ['foo', function(foo: any) { }]
name1(foo: any) {},
name2: ['foo', (foo: any) => {}]
});
mod.provider('name', function($scope: ng.IScope) { return { $get: () => { } }; });
mod.provider('name', ($scope: ng.IScope) => ({ $get: () => { } }));
mod.provider('name', TestProvider);
mod.provider('name', ['$scope', function($scope: ng.IScope) { } as any]);
mod.provider('name', ['$scope', ($scope: ng.IScope) => {}]);
mod.provider(My.Namespace);
mod.service('name', function($scope: ng.IScope) { });
mod.service('name', ['$scope', function($scope: ng.IScope) { } as any]);
mod.service('name', ($scope: ng.IScope) => {});
mod.service('name', ['$scope', ($scope: ng.IScope) => {}]);
mod.service({
MyCtrl: class{},
MyCtrl2: function() {}, // tslint:disable-line:object-literal-shorthand
MyCtrl3: ['$fooService', function($fooService: any) { }]
MyCtrl2: () => {}, // tslint:disable-line:object-literal-shorthand
MyCtrl3: ['$fooService', ($fooService: any) => {}]
});
mod.constant('name', 23);
mod.constant('name', '23');
@@ -249,8 +226,8 @@ mod.constant(My.Namespace);
mod.value('name', 23);
mod.value('name', '23');
mod.value(My.Namespace);
mod.decorator('name', function($scope: ng.IScope) {});
mod.decorator('name', ['$scope', function($scope: ng.IScope) {} as any]);
mod.decorator('name', ($scope: ng.IScope) => {});
mod.decorator('name', ['$scope', ($scope: ng.IScope) => {}]);
class TestProvider implements ng.IServiceProvider {
constructor(private $scope: ng.IScope) {
@@ -262,7 +239,7 @@ class TestProvider implements ng.IServiceProvider {
// QProvider tests
angular.module('qprovider-test', [])
.config(['$qProvider', function($qProvider: ng.IQProvider) {
.config(['$qProvider', ($qProvider: ng.IQProvider) => {
const provider: ng.IQProvider = $qProvider.errorOnUnhandledRejections(false);
const currentValue: boolean = $qProvider.errorOnUnhandledRejections();
}]);
@@ -298,7 +275,7 @@ foo.then((x) => {
}).then((x) => {
// Object is inferred here
x.a = 123;
//Try a promise
// Try a promise
var y: ng.IPromise<number>;
var condition: boolean;
return condition ? y : x.a; // IPromise<T> | T, both are good for the 1st arg of .then()
@@ -441,10 +418,10 @@ httpFoo.then((x) => {
x.toFixed();
});
httpFoo.success((data, status, headers, config) => {
const h = headers('test');
httpFoo.then((response: ng.IHttpPromiseCallbackArg<any>) => {
const h = response.headers('test');
h.charAt(0);
const hs = headers();
const hs = response.headers();
hs['content-type'].charAt(1);
});
@@ -557,7 +534,6 @@ namespace TestPromise {
(reason) => anyOf3(reject, tresult, tresultPromise)
));
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult>>(promise.then((result) => tresultHttpPromise));
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother));
@@ -611,10 +587,10 @@ namespace TestPromise {
function test_angular_forEach() {
const values: { [key: string]: string } = { name: 'misko', gender: 'male' };
const log: string[] = [];
angular.forEach(values, function(value, key) {
angular.forEach(values, (value, key) => {
this.push(key + ': ' + value);
}, log);
//expect(log).toEqual(['name: misko', 'gender: male']);
// expect(log).toEqual(['name: misko', 'gender: male']);
}
// angular.element() tests
@@ -729,19 +705,12 @@ angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpo
const defer = $q.defer();
defer.reject();
defer.resolve();
defer.promise.then(function(d) {
return d;
}).then(function(): any {
return null;
}, function(): any {
return null;
})
.catch((): any => {
return null;
})
.finally((): any => {
return null;
});
defer.promise.then(d => d)
.then(
(): any => null,
(): any => null)
.catch((): any => null)
.finally((): any => null);
let promise = new $q((resolve) => {
resolve();
});
@@ -761,39 +730,39 @@ angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpo
// test from https://docs.angularjs.org/guide/directive
angular.module('docsSimpleDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
.controller('Controller', ['$scope', ($scope: any) => {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.directive('myCustomer', function() {
.directive('myCustomer', () => {
return {
template: 'Name: {{customer.name}} Address: {{customer.address}}'
};
});
angular.module('docsTemplateUrlDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
.controller('Controller', ['$scope', ($scope: any) => {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.directive('myCustomer', function() {
.directive('myCustomer', () => {
return {
templateUrl: 'my-customer.html'
};
});
angular.module('docsRestrictDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
.controller('Controller', ['$scope', ($scope: any) => {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.directive('myCustomer', function() {
.directive('myCustomer', () => {
return {
restrict: 'E',
templateUrl: 'my-customer.html'
@@ -801,19 +770,19 @@ angular.module('docsRestrictDirective', [])
});
angular.module('docsScopeProblemExample', [])
.controller('NaomiController', ['$scope', function($scope: any) {
.controller('NaomiController', ['$scope', ($scope: any) => {
$scope.customer = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
}])
.controller('IgorController', ['$scope', function($scope: any) {
.controller('IgorController', ['$scope', ($scope: any) => {
$scope.customer = {
name: 'Igor',
address: '123 Somewhere'
};
}])
.directive('myCustomer', function() {
.directive('myCustomer', () => {
return {
restrict: 'E',
templateUrl: 'my-customer.html'
@@ -821,11 +790,11 @@ angular.module('docsScopeProblemExample', [])
});
angular.module('docsIsolateScopeDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
.controller('Controller', ['$scope', ($scope: any) => {
$scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' };
$scope.igor = { name: 'Igor', address: '123 Somewhere' };
}])
.directive('myCustomer', function() {
.directive('myCustomer', () => {
return {
restrict: 'E',
scope: {
@@ -836,11 +805,11 @@ angular.module('docsIsolateScopeDirective', [])
});
angular.module('docsIsolationExample', [])
.controller('Controller', ['$scope', function($scope: any) {
.controller('Controller', ['$scope', ($scope: any) => {
$scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' };
$scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' };
}])
.directive('myCustomer', function() {
.directive('myCustomer', () => {
return {
restrict: 'E',
scope: {
@@ -851,10 +820,10 @@ angular.module('docsIsolationExample', [])
});
angular.module('docsTimeDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
.controller('Controller', ['$scope', ($scope: any) => {
$scope.format = 'M/d/yy h:mm:ss a';
}])
.directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any) {
.directive('myCurrentTime', ['$interval', 'dateFilter', ($interval: any, dateFilter: any) => {
return {
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) {
@@ -865,17 +834,17 @@ angular.module('docsTimeDirective', [])
element.text(dateFilter(new Date(), format));
}
scope.$watch(attrs['myCurrentTime'], function(value: any) {
scope.$watch(attrs['myCurrentTime'], (value: any) => {
format = value;
updateTime();
});
element.on('$destroy', function() {
element.on('$destroy', () => {
$interval.cancel(timeoutId);
});
// start the UI update process; save the timeoutId for canceling
timeoutId = $interval(function() {
timeoutId = $interval(() => {
updateTime(); // update DOM
}, 1000);
}
@@ -883,10 +852,10 @@ angular.module('docsTimeDirective', [])
}]);
angular.module('docsTransclusionDirective', [])
.controller('Controller', ['$scope', function($scope: any) {
.controller('Controller', ['$scope', ($scope: any) => {
$scope.name = 'Tobias';
}])
.directive('myDialog', function() {
.directive('myDialog', () => {
return {
restrict: 'E',
transclude: true,
@@ -895,10 +864,10 @@ angular.module('docsTransclusionDirective', [])
});
angular.module('docsTransclusionExample', [])
.controller('Controller', ['$scope', function($scope: any) {
.controller('Controller', ['$scope', ($scope: any) => {
$scope.name = 'Tobias';
}])
.directive('myDialog', function() {
.directive('myDialog', () => {
return {
restrict: 'E',
transclude: true,
@@ -911,16 +880,16 @@ angular.module('docsTransclusionExample', [])
});
angular.module('docsIsoFnBindExample', [])
.controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) {
.controller('Controller', ['$scope', '$timeout', ($scope: any, $timeout: any) => {
$scope.name = 'Tobias';
$scope.hideDialog = function() {
$scope.hideDialog = () => {
$scope.dialogIsHidden = true;
$timeout(function() {
$timeout(() => {
$scope.dialogIsHidden = false;
}, 2000);
};
}])
.directive('myDialog', function() {
.directive('myDialog', () => {
return {
restrict: 'E',
transclude: true,
@@ -932,8 +901,8 @@ angular.module('docsIsoFnBindExample', [])
});
angular.module('dragModule', [])
.directive('myDraggable', ['$document', function($document: any) {
return function(scope: any, element: any, attr: any) {
.directive('myDraggable', ['$document', ($document: any) => {
return (scope: any, element: any, attr: any) => {
let startX = 0, startY = 0, x = 0, y = 0;
element.css({
@@ -943,7 +912,7 @@ angular.module('dragModule', [])
cursor: 'pointer'
});
element.on('mousedown', function(event: any) {
element.on('mousedown', (event: any) => {
// Prevent default dragging of selected content
event.preventDefault();
startX = event.pageX - x;
@@ -969,7 +938,7 @@ angular.module('dragModule', [])
}]);
angular.module('docsTabsExample', [])
.directive('myTabs', function() {
.directive('myTabs', () => {
return {
restrict: 'E',
transclude: true,
@@ -977,14 +946,14 @@ angular.module('docsTabsExample', [])
controller($scope: ng.IScope) {
const panes: any = $scope['panes'] = [];
$scope['select'] = function(pane: any) {
angular.forEach(panes, function(pane: any) {
$scope['select'] = (pane: any) => {
angular.forEach(panes, (pane: any) => {
pane.selected = false;
});
pane.selected = true;
};
this.addPane = function(pane: any) {
this.addPane = (pane: any) => {
if (panes.length === 0) {
$scope['select'](pane);
}
@@ -994,7 +963,7 @@ angular.module('docsTabsExample', [])
templateUrl: 'my-tabs.html'
};
})
.directive('myPane', function() {
.directive('myPane', () => {
return {
require: '^myTabs',
restrict: 'E',
@@ -1010,7 +979,7 @@ angular.module('docsTabsExample', [])
});
angular.module('multiSlotTranscludeExample', [])
.directive('dropDownMenu', function() {
.directive('dropDownMenu', () => {
return {
transclude: {
button: 'button',
@@ -1068,15 +1037,15 @@ interface ICopyExampleScope {
}
angular.module('copyExample', [])
.controller('ExampleController', ['$scope', function($scope: ICopyExampleScope) {
.controller('ExampleController', ['$scope', ($scope: ICopyExampleScope) => {
$scope.master = { };
$scope.update = function(user) {
$scope.update = user => {
// Example with 1 argument
$scope.master = angular.copy(user);
};
$scope.reset = function() {
$scope.reset = () => {
// Example with 2 arguments
angular.copy($scope.master, $scope.user);
};
@@ -1149,7 +1118,7 @@ function NgModelControllerTyping() {
var $q: angular.IQService;
// See https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$validators
ngModel.$validators['validCharacters'] = function(modelValue, viewValue) {
ngModel.$validators['validCharacters'] = (modelValue, viewValue) => {
const value = modelValue || viewValue;
return /[0-9]+/.test(value) &&
/[a-z]+/.test(value) &&
@@ -1157,7 +1126,7 @@ function NgModelControllerTyping() {
/\W+/.test(value);
};
ngModel.$asyncValidators['uniqueUsername'] = function(modelValue, viewValue) {
ngModel.$asyncValidators['uniqueUsername'] = (modelValue, viewValue) => {
const value = modelValue || viewValue;
return $http.get('/api/users/' + value).
then(function resolved() {
@@ -1271,8 +1240,8 @@ function parseWithParams() {
function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjectorService {
if (mode === 'debug') {
return angular.bootstrap(element, ['main', function($provide: ng.auto.IProvideService) {
$provide.decorator('$rootScope', function($delegate: ng.IRootScopeService) {
return angular.bootstrap(element, ['main', ($provide: ng.auto.IProvideService) => {
$provide.decorator('$rootScope', ($delegate: ng.IRootScopeService) => {
$delegate['debug'] = true;
});
}, 'debug-helpers'], {
@@ -1292,12 +1261,12 @@ function testIHttpParamSerializerJQLikeProvider() {
}
function anyOf2<T1, T2>(v1: T1, v2: T2) {
return Math.random() < 1/2 ? v1 : v2;
return Math.random() < 0.5 ? v1 : v2;
}
function anyOf3<T1, T2, T3>(v1: T1, v2: T2, v3: T3) {
const rnd = Math.random();
return rnd < 1/3 ? v1 : rnd < 2/3 ? v2 : v3;
return rnd < 0.33 ? v1 : rnd < 0.66 ? v2 : v3;
}
function toPromise<T>(val: T): ng.IPromise<T> {
+4 -16
View File
@@ -411,8 +411,8 @@ declare namespace angular {
$invalid: boolean;
}
//Allows tuning how model updates are done.
//https://docs.angularjs.org/api/ng/directive/ngModelOptions
// Allows tuning how model updates are done.
// https://docs.angularjs.org/api/ng/directive/ngModelOptions
interface INgModelOptions {
updateOn?: string;
debounce?: any;
@@ -1192,7 +1192,7 @@ declare namespace angular {
*/
size: number;
//...: any additional properties from the options object when creating the cache.
// ...: any additional properties from the options object when creating the cache.
};
/**
@@ -1505,18 +1505,6 @@ declare namespace angular {
}
interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> {
/**
* The $http legacy promise methods success and error have been deprecated. Use the standard then method instead.
* If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error.
* @deprecated
*/
success?(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
/**
* The $http legacy promise methods success and error have been deprecated. Use the standard then method instead.
* If $httpProvider.useLegacyPromiseExtensions is set to false then these methods will throw $http/legacy error.
* @deprecated
*/
error?(callback: IHttpPromiseCallback<any>): IHttpPromise<T>;
}
// See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
@@ -2047,7 +2035,7 @@ declare namespace angular {
declare global {
interface JQuery {
// TODO: events, how to define?
//$destroy
// $destroy
find(element: any): JQuery;
find(obj: JQuery): JQuery;
+31 -18
View File
@@ -1,20 +1,33 @@
{
"extends": "../tslint.json",
"rules": {
"class-name": true,
"curly": true,
"no-consecutive-blank-lines": true,
"no-shadowed-variable": true,
"quotemark": [true, "single"],
"align": true,
"callable-types": false,
"forbidden-types": false,
"indent": [true, "spaces"],
"interface-name": false,
"linebreak-style": [true, "LF"],
"no-empty-interface": false,
"unified-signatures": false,
"variable-name": [true, "check-format"],
"void-return": false
}
"extends": "../tslint.json",
"rules": {
"class-name": true,
"curly": true,
"max-line-length": false,
"no-consecutive-blank-lines": true,
"no-shadowed-variable": true,
"quotemark": [
true,
"single"
],
"align": true,
"callable-types": false,
"forbidden-types": false,
"indent": [
true,
"spaces"
],
"interface-name": false,
"linebreak-style": [
true,
"LF"
],
"no-empty-interface": false,
"unified-signatures": false,
"variable-name": [
true,
"check-format"
],
"void-return": false
}
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "../tslint.json" }
@@ -1,4 +1,3 @@
// More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md
var config: Microsoft.ApplicationInsights.IConfig = {
@@ -24,7 +23,11 @@ var config: Microsoft.ApplicationInsights.IConfig = {
disableCorrelationHeaders: true,
disableFlushOnBeforeUnload: false,
enableSessionStorageBuffer: false,
cookieDomain: ""
cookieDomain: "",
isCookieUseDisabled: true,
isRetryDisabled: true,
isPerfAnalyzerEnabled: true,
isStorageUseDisabled: true
};
var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
@@ -35,17 +38,17 @@ var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
startTrackPage(name?: string) { return null; },
stopTrackPage(name?: string, url?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
trackPageView(name?: string, url?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, duration?: number) { return null; },
startTrackEvent(name: string) { return null },
stopTrackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null },
trackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null },
trackAjax(id: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number, method?: string) { return null },
trackException(exception: Error, handledAt?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, severityLevel?: AI.SeverityLevel) { return null },
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { [name: string]: string; }) { return null },
trackTrace(message: string, properties?: { [name: string]: string; }) { return null },
flush() { return null },
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string) { return null },
clearAuthenticatedUserContext() { return null },
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error) { return null }
startTrackEvent(name: string) { return null; },
stopTrackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
trackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number) { return null; },
trackException(exception: Error, handledAt?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, severityLevel?: AI.SeverityLevel) { return null; },
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { [name: string]: string; }) { return null; },
trackTrace(message: string, properties?: { [name: string]: string; }) { return null; },
flush() { return null; },
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string) { return null; },
clearAuthenticatedUserContext() { return null; },
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error) { return null; }
};
// trackPageView
@@ -75,6 +78,9 @@ appInsights.trackException(new Error("sample error"), "handledAt", null, null);
appInsights.trackTrace("message");
appInsights.trackTrace("message", null);
// trackDependency
appInsights.trackDependency("id", "POST", "http://example.com/test/abc", "/test/abc", null, true, null);
// flush
appInsights.flush();
+22 -18
View File
@@ -1,4 +1,4 @@
// Type definitions for ApplicationInsights-JS v0.23.2
// Type definitions for ApplicationInsights-JS 1.0
// Project: https://github.com/Microsoft/ApplicationInsights-JS
// Definitions by: Kamil Szostak <https://github.com/kamilszostak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -323,7 +323,7 @@ declare module Microsoft.ApplicationInsights.Telemetry {
/**
* Constructs a new instance of the EventTelemetry object
*/
constructor(name: string, properties?: Object, measurements?: Object);
constructor(name: string, properties?: any, measurements?: any);
}
class Exception implements Microsoft.ApplicationInsights.ISerializable {
@@ -348,7 +348,7 @@ declare module Microsoft.ApplicationInsights.Telemetry {
/**
* Constructs a new isntance of the ExceptionTelemetry object
*/
constructor(exception: Error, handledAt?: string, properties?: Object, measurements?: Object, severityLevel?: AI.SeverityLevel);
constructor(exception: Error, handledAt?: string, properties?: any, measurements?: any, severityLevel?: AI.SeverityLevel);
/**
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
*/
@@ -369,7 +369,7 @@ declare module Microsoft.ApplicationInsights.Telemetry {
/**
* Constructs a new instance of the MetricTelemetry object
*/
constructor(name: string, value: number, count?: number, min?: number, max?: number, properties?: Object);
constructor(name: string, value: number, count?: number, min?: number, max?: number, properties?: any);
}
class PageView extends AI.PageViewData implements Microsoft.ApplicationInsights.ISerializable {
@@ -477,7 +477,7 @@ declare module Microsoft.ApplicationInsights.Telemetry {
/**
* Constructs a new instance of the MetricTelemetry object
*/
constructor(message: string, properties?: Object);
constructor(message: string, properties?: any);
}
}
@@ -567,8 +567,12 @@ declare module Microsoft.ApplicationInsights {
disableCorrelationHeaders?: boolean;
disableFlushOnBeforeUnload?: boolean;
enableSessionStorageBuffer?: boolean;
isCookieUseDisabled?: boolean;
cookieDomain?: string;
isRetryDisabled?: boolean;
isPerfAnalyzerEnabled?: boolean;
url?: string;
isStorageUseDisabled?: boolean;
}
/**
@@ -657,7 +661,7 @@ declare module Microsoft.ApplicationInsights {
interface IAppInsights {
config: IConfig;
context: ITelemetryContext;
queue: (() => void)[];
queue: Array<() => void>;
/**
* Starts timing how long the user views a page or other item. Call this when the page opens.
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
@@ -717,16 +721,16 @@ declare module Microsoft.ApplicationInsights {
[name: string]: number;
}): any;
/**
* Log an AJAX request
* @param id Event id
* @param absoluteUrl Full url
* @param pathName Leave this parameter blank
* @param totalTime Total time it took for AJAX request to complete
* @param success Whether AJAX request succeeded or failed
* @param resultCode Result code returned from AJAX call
* @param method HTTP verb that was used (GET, POST)
*/
trackAjax(id: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number, method?: string): any;
* Log a dependency call
* @param id unique id, this is used by the backend o correlate server requests. Use Util.newId() to generate a unique Id.
* @param method represents request verb (GET, POST, etc.)
* @param absoluteUrl absolute url used to make the dependency request
* @param pathName the path part of the absolute url
* @param totalTime total request time
* @param success indicates if the request was sessessful
* @param resultCode response code returned by the dependency request
*/
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number): any;
/**
* Log an exception you have caught.
* @param exception An Error from a catch clause, or the string error message.
@@ -755,7 +759,7 @@ declare module Microsoft.ApplicationInsights {
/**
* Log a diagnostic message.
* @param message A message string
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
*/
trackTrace(message: string, properties?: {
[name: string]: string;
@@ -776,7 +780,7 @@ declare module Microsoft.ApplicationInsights {
* Clears the authenticated user id and the account id from the user context.
*/
clearAuthenticatedUserContext(): any;
downloadAndSetup?(config: Microsoft.ApplicationInsights.IConfig): void;
downloadAndSetup?(config: Microsoft.ApplicationInsights.IConfig): any;
/**
* The custom error handler for Application Insights
* @param {string} message - The error message
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../tslint.json",
"rules": {
"interface-name": [ false ],
"no-internal-module": false,
"no-single-declare-module": false
}
}
+9 -8
View File
@@ -135,7 +135,8 @@ export type esriGeometryType = "esriGeometryPoint" | "esriGeometryMultipoint" |
export type Color = [number, number, number, number];
export type SimpleMarkerSymbolStyle = "esriSMSCircle" | "esriSMSCross" | "esriSMSDiamond" | "esriSMSSquare" | "esriSMSX" | "esriSMSTriangle";
export type SimpleLineSymbolStyle = "esriSLSDash" | "esriSLSDashDot" | "esriSLSDashDotDot" | "esriSLSDot" | "esriSLSNull" | "esriSLSSolid";
export type SimpleFillSymbolStyle = "esriSFSBackwardDiagonal" | "esriSFSCross" | "esriSFSDiagonalCross" | "esriSFSForwardDiagonal" | "esriSFSHorizontal" | "esriSFSNull" | "esriSFSSolid" | "esriSFSVertical";
export type SimpleFillSymbolStyle =
"esriSFSBackwardDiagonal" | "esriSFSCross" | "esriSFSDiagonalCross" | "esriSFSForwardDiagonal" | "esriSFSHorizontal" | "esriSFSNull" | "esriSFSSolid" | "esriSFSVertical";
export type SymbolType = "esriSLS" | "esriSMS" | "esriSFS" | "esriPMS" | "esriPFS" | "esriTS";
export interface Symbol {
@@ -168,12 +169,12 @@ export interface SimpleFillSymbol extends Symbol {
"type": "esriSFS";
"style"?: SimpleFillSymbolStyle;
"color"?: Color;
"outline"?: SimpleLineSymbol; //if outline has been specified
"outline"?: SimpleLineSymbol; // if outline has been specified
}
export interface PictureSourced {
"url"?: string; //Relative URL for static layers and full URL for dynamic layers. Access relative URL using http://<mapservice-url>/<layerId1>/images/<imageUrl11>
"imageData"?: string; //"<base64EncodedImageData>";
"url"?: string; // Relative URL for static layers and full URL for dynamic layers. Access relative URL using http://<mapservice-url>/<layerId1>/images/<imageUrl11>
"imageData"?: string; // "<base64EncodedImageData>";
"contentType"?: string;
"width"?: number;
"height"?: number;
@@ -189,14 +190,14 @@ export interface PictureMarkerSymbol extends MarkerSymbol, PictureSourced {
export interface PictureFillSymbol extends Symbol, PictureSourced {
"type": "esriPFS";
"outline"?: SimpleLineSymbol; //if outline has been specified
"outline"?: SimpleLineSymbol; // if outline has been specified
"xscale"?: number;
"yscale"?: number;
}
export interface Font {
"family"?: string; //"<fontFamily>";
"size"?: number; //<fontSize>;
"family"?: string; // "<fontFamily>";
"size"?: number; // <fontSize>;
"style"?: "italic" | "normal" | "oblique";
"weight"?: "bold" | "bolder" | "lighter" | "normal";
"decoration"?: "line-through" | "underline" | "none";
@@ -215,5 +216,5 @@ export interface TextSymbol extends MarkerSymbol {
"rightToLeft"?: boolean;
"kerning"?: boolean;
"font"?: Font;
"text"?: string; //only applicable when specified as a client-side graphic.
"text"?: string; // only applicable when specified as a client-side graphic.
}
+1 -3
View File
@@ -1,3 +1 @@
{
"extends": "../tslint.json"
}
{ "extends": "../tslint.json" }
@@ -1,14 +1,14 @@
import utils = require("arcgis-to-geojson-utils");
import arcgisApi = require("arcgis-rest-api");
let arcgisPoint: arcgisApi.Point = {
const arcgisPoint: arcgisApi.Point = {
x: -122.6764,
y: 45.5165,
spatialReference: {
wkid: 4326
}
};
let geojsonPoint: GeoJSON.Point = {
const geojsonPoint: GeoJSON.Point = {
type: "Point",
coordinates: [45.5165, -122.6764]
};
+1 -3
View File
@@ -1,3 +1 @@
{
"extends": "../tslint.json"
}
{ "extends": "../tslint.json" }
+1 -1
View File
@@ -3,6 +3,6 @@ import arrayFindIndex = require("array-find-index");
arrayFindIndex(['rainbow', 'unicorn', 'pony'], x => x === 'unicorn');
const ctx = {foo: 'rainbow'};
arrayFindIndex(['rainbow', 'unicorn', 'pony'], function (x) {
arrayFindIndex(['rainbow', 'unicorn', 'pony'], function(x) {
return x === this.foo;
}, ctx);
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "../tslint.json" }
+1 -1
View File
@@ -1,7 +1,7 @@
import artyomjs = require('artyom.js');
// Get an unique ArtyomJS instance
let artyom = artyomjs.ArtyomBuilder.getInstance();
const artyom = artyomjs.ArtyomBuilder.getInstance();
// Add a command (not smart)
artyom.addCommands({
+7 -7
View File
@@ -403,7 +403,7 @@ declare namespace Artyom {
/**
* Says a random quote and returns it's object.
* @param data
* @param data
*/
sayRandom(data: any): any;
@@ -423,14 +423,14 @@ declare namespace Artyom {
artyomHey(): any;
/**
* This function will return the webkitSpeechRecognition object used by artyom retrieve it only to debug on it or get some
* This function will return the webkitSpeechRecognition object used by artyom retrieve it only to debug on it or get some
* values, do not make changes directly.
*/
getNativeApi(): any;
/**
* This function returns a boolean according to the SpeechRecognition status if artyom is listening, will return true.
* Note: This is not a feature of SpeechRecognition, therefore this value hangs on the fiability of the onStart and onEnd
* Note: This is not a feature of SpeechRecognition, therefore this value hangs on the fiability of the onStart and onEnd
* events of the SpeechRecognition
* @returns {Boolean}
*/
@@ -438,14 +438,14 @@ declare namespace Artyom {
/**
* This function returns a boolean according to the speechSynthesis status if artyom is speaking, will return true.
* Note: This is not a feature of speechSynthesis, therefore this value hangs on the fiability of the onStart and onEnd
* Note: This is not a feature of speechSynthesis, therefore this value hangs on the fiability of the onStart and onEnd
* events of the speechSynthesis.
* @returns {Boolean}
*/
isSpeaking(): boolean;
/**
* The SpeechSynthesisUtterance objects are stored in the artyom_garbage_collector variable to prevent the wrong behaviour
* The SpeechSynthesisUtterance objects are stored in the artyom_garbage_collector variable to prevent the wrong behaviour
* of artyom.say. Use this method to clear all spoken SpeechSynthesisUtterance unused objects.
* @returns {Boolean}
*/
@@ -487,7 +487,7 @@ declare namespace Artyom {
getVersion(): string;
/**
* Add commands like an artisan. If you use artyom for simple
* Add commands like an artisan. If you use artyom for simple
* tasks then probably you don't like to write a lot to achieve it.
* Use the artisan syntax to write less, but with the same accuracy.
* @disclaimer Not a promise-based implementation, just syntax.
@@ -508,6 +508,6 @@ declare namespace Artyom {
}
//tslint:disable-next-line:export-just-namespace
// tslint:disable-next-line:export-just-namespace
export = Artyom;
export as namespace Artyom;
+1 -1
View File
@@ -1,5 +1,5 @@
import * as assert from 'assert-plus';
let arr = ['one', 'two'];
const arr = ['one', 'two'];
assert.array(arr, '');
+42 -192
View File
@@ -7,262 +7,115 @@
import {Stream} from 'stream';
/**
*
*/
export function array(arr: any[], message ?: string): void;
/**
*
*/
export function bool(bool: boolean, message ?: string): void;
/**
*
*/
export function buffer(buffer: Buffer, message ?: string): void;
/**
*
*/
export function func(func: any, message ?: string): void;
/**
*
*/
export function number(number: number, message ?: string): void;
/**
*
*/
export function finite(finite: number, message ?: string): void;
/**
*
*/
export function object(obj: any, message ?: string): void;
/**
*
*/
export function string(str: string, message ?: string): void;
/**
*
*/
export function stream(stream: Stream, message ?: string): void;
/**
*
*/
export function date(date: Date, message ?: string): void;
/**
*
*/
export function regexp(regexp: RegExp, message ?: string): void;
/**
*
*/
export function uuid(uuid: string, message ?: string): void;
/**
*
*/
export function arrayOfArray(arr: any[][], message ?: string): void;
/**
*
*/
export function arrayOfBool(arr: boolean[], message ?: string): void;
/**
*
*/
export function arrayOfBuffer(arr: Buffer[], message ?: string): void;
/**
*
*/
export function arrayOfFunc(arr: any[], message ?: string): void;
/**
*
*/
export function arrayOfNumber(arr: number[], message ?: string): void;
/**
*
*/
export function arrayOfFinite(arr: number[], message ?: string): void;
/**
*
*/
export function arrayOfObject(arr: any[], message ?: string): void;
/**
*
*/
export function arrayOfString(arr: string[], message ?: string): void;
/**
*
*/
export function arrayOfStream(arr: Stream[], message ?: string): void;
/**
*
*/
export function arrayOfDate(arr: Date[], message ?: string): void;
/**
*
*/
export function arrayOfRegexp(arr: RegExp[], message ?: string): void;
/**
*
*/
export function arrayOfUuid(arr: string[], message ?: string): void;
/**
*
*/
export function optionalArray(arr: any[] | undefined, message ?: string): void;
/**
*
*/
export function optionalBool(bool: boolean | undefined, message ?: string): void;
/**
*
*/
export function optionalBuffer(buffer: Buffer | undefined, message ?: string): void;
/**
*
*/
export function optionalFunc(options: any, message ?: string): void;
/**
*
*/
export function optionalNumber(options: number | undefined, message ?: string): void;
/**
*
*/
export function optionalFinite(options: number | undefined, message ?: string): void;
/**
*
*/
export function optionalObject(options: any, message ?: string): void;
/**
*
*/
export function optionalString(options: string | undefined, message ?: string): void;
/**
*
*/
export function optionalStream(options: Stream | undefined, message ?: string): void;
/**
*
*/
export function optionalDate(options: Date | undefined, message ?: string): void;
/**
*
*/
export function optionalRegexp(options: RegExp | undefined, message ?: string): void;
/**
*
*/
export function optionalUuid(options: string | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfArray(arr: any[][] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfBool(arr: boolean[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfBuffer(arr: Buffer[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfFunc(arr: any[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfNumber(arr: number[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfFinite(arr: number[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfObject(arr: any[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfString(arr: string[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfStream(arr: Stream[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfDate(arr: Date[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfRegexp(arr: RegExp[] | undefined, message ?: string): void;
/**
*
*/
export function optionalArrayOfUuid(arr: string[] | undefined, message ?: string): void;
/**
*
*/
export function AssertionError(options: any, message ?: string): void;
/**
* Throws an `AssertionError`. If `message` is falsy, the error message is set
* as the values of `actual` and `expected` separated by the provided `operator`.
* Otherwise, the error message is the value of `message`.
*
*
* ```js
* const assert = require('assert');
*
*
* assert.fail(1, 2, undefined, '>');
* // AssertionError: 1 > 2
*
*
* assert.fail(1, 2, 'whoops', '>');
* // AssertionError: whoops
* ```
@@ -272,14 +125,14 @@ export function fail(actual: any, expected: any, message: any, operator: any): v
/**
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
*
*
* If `value` is not truthy, an `AssertionError` is thrown with a `message` property
* set equal to the value of the `message` parameter.
* If the `message` parameter is `undefined`, a default error message is assigned.
*
*
* ```js
* const assert = require('assert');
*
*
* assert.ok(true);
* // OK
* assert.ok(1);
@@ -297,21 +150,21 @@ export function ok(options: any, message ?: string): void;
/**
* Tests shallow, coercive equality between the actual and expected parameters
* using the equal comparison operator ( `==` ).
*
*
* ```js
* const assert = require('assert');
*
*
* assert.equal(1, 1);
* // OK, 1 == 1
* assert.equal(1, '1');
* // OK, 1 == '1'
*
*
* assert.equal(1, 2);
* // AssertionError: 1 == 2
* assert.equal({a: {b: 1}}, {a: {b: 1}});
* //AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
* ```
*
*
* If the values are not equal, an `AssertionError` is thrown with
* a `message` property set equal to the value of the `message` parameter.
* If the `message` parameter is undefined, a default error message is assigned.
@@ -320,20 +173,20 @@ export function equal(actual: any, expected: any, message ?: string): void;
/**
* Tests shallow, coercive inequality with the not equal comparison operator ( `!=` ).
*
*
* ```js
* const assert = require('assert');
*
*
* assert.notEqual(1, 2);
* // OK
*
*
* assert.notEqual(1, 1);
* // AssertionError: 1 != 1
*
*
* assert.notEqual(1, '1');
* // AssertionError: 1 != '1'
* ```
*
*
* If the values are equal, an `AssertionError` is thrown with
* a `message` property set equal to the value of the `message` parameter.
* If the `message` parameter is undefined, a default error message is assigned.
@@ -343,20 +196,20 @@ export function notEqual(actual: any, expected: any, message ?: string): void;
/**
* Tests for deep equality between the `actual` and `expected` parameters.
* Primitive values are compared with the equal comparison operator ( `==` ).
*
*
* Only enumerable "own" properties are considered.
* The `deepEqual()` implementation does not test object prototypes, attached symbols,
* or non-enumerable properties. This can lead to some potentially surprising results.
* For example, the following example does not throw an `AssertionError` because
* the properties on the Error object are non-enumerable:
*
*
* ```js
* // WARNING: This does not throw an AssertionError!
* assert.deepEqual(Error('a'), Error('b'));
* ```
*
*
* "Deep" equality means that the enumerable "own" properties of child objects are evaluated also.
*
*
* If the values are not equal, an `AssertionError` is thrown with a `message` property
* set equal to the value of the `message` parameter. If the `message` parameter is undefined,
* a default error message is assigned.
@@ -365,28 +218,28 @@ export function deepEqual<T>(actual: T, expected: T, message ?: string): void;
/**
* Tests for any deep inequality. Opposite of `assert.deepEqual()`.
*
*
* ```js
* const assert = require('assert');
*
*
* const obj1 = { a : { b : 1 } };
* const obj2 = { a : { b : 2 } };
* const obj3 = { a : { b : 1 } };
* const obj4 = Object.create(obj1);
*
*
* assert.notDeepEqual(obj1, obj1);
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
*
*
* assert.notDeepEqual(obj1, obj2);
* // OK, obj1 and obj2 are not deeply equal
*
*
* assert.notDeepEqual(obj1, obj3);
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
*
*
* assert.notDeepEqual(obj1, obj4);
* // OK, obj1 and obj2 are not deeply equal
* ```
*
*
* If the values are deeply equal, an `AssertionError` is thrown with
* a `message` property set equal to the value of the `message` parameter.
* If the `message` parameter is undefined, a default error message is assigned.
@@ -395,20 +248,20 @@ export function notDeepEqual(actual: any, expected: any, message ?: string): voi
/**
* Tests strict equality as determined by the strict equality operator ( `===` ).
*
*
* ```js
* const assert = require('assert');
*
*
* assert.strictEqual(1, 2);
* // AssertionError: 1 === 2
*
*
* assert.strictEqual(1, 1);
* // OK
*
*
* assert.strictEqual(1, '1');
* // AssertionError: 1 === '1'
* ```
*
*
* If the values are not strictly equal, an `AssertionError` is thrown with
* a `message` property set equal to the value of the `message` parameter.
* If the `message` parameter is undefined, a default error message is assigned.
@@ -417,40 +270,37 @@ export function strictEqual<T>(actual: T, expected: T, message ?: string): void;
/**
* Tests strict inequality as determined by the strict not equal operator ( `!==` ).
*
*
* ```js
* const assert = require('assert');
*
*
* assert.notStrictEqual(1, 2);
* // OK
*
*
* assert.notStrictEqual(1, 1);
* // AssertionError: 1 !== 1
*
*
* assert.notStrictEqual(1, '1');
* // OK
* ```
*
*
* If the values are strictly equal, an `AssertionError` is thrown with a `message` property
* set equal to the value of the `message` parameter. If the `message` parameter is undefined,
* a default error message is assigned.
*/
export function notStrictEqual(actual: any, expected: any, message ?: string): void;
/**
*
*/
export function throws(block: any, error ?: any, message ?: string): void;
/**
* Asserts that the function `block` does not throw an error. See `assert.throws()` for more details.
*
*
* When `assert.doesNotThrow()` is called, it will immediately call the `block` function.
*
*
* If an error is thrown and it is the same type as that specified by the `error` parameter,
* then an `AssertionError` is thrown. If the error is of a different type,
* or if the `error` parameter is undefined, the error is propagated back to the caller.
*
*
* The following, for instance, will throw the TypeError because there is no matching error type in the assertion:
* ```js
* assert.doesNotThrow(
@@ -460,7 +310,7 @@ export function throws(block: any, error ?: any, message ?: string): void;
* SyntaxError
* );
* ```
*
*
* However, the following will result in an `AssertionError` with the message 'Got unwanted exception (TypeError)..':
* ```js
* assert.doesNotThrow(
@@ -470,7 +320,7 @@ export function throws(block: any, error ?: any, message ?: string): void;
* TypeError
* );
* ```
*
*
* If an `AssertionError` is thrown and a value is provided for the `message` parameter,
* the value of `message` will be appended to the `AssertionError` message:
* ```js
@@ -490,7 +340,7 @@ export function doesNotThrow(block: any, error ?: any, message ?: string): void;
* Throws `value` if `value` is truthy. This is useful when testing the `error` argument in callbacks.
* ```js
* const assert = require('assert');
*
*
* assert.ifError(0);
* // OK
* assert.ifError(1);
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference types="auth0-js" />
import 'auth0-js';
let webAuth = new auth0.WebAuth({
domain: 'mine.auth0.com',
+3 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for Auth0.js v8.1.3
// Type definitions for Auth0.js 8.1
// Project: https://github.com/auth0/auth0.js
// Definitions by: Adrian Chia <https://github.com/adrianchia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -409,7 +409,7 @@ declare namespace auth0 {
interface Auth0Error {
error: any;
errorDescription: string
errorDescription: string;
}
interface Auth0DecodedHash {
@@ -442,7 +442,7 @@ declare namespace auth0 {
connection: string;
send: string;
phoneNumber?: string;
email?: string,
email?: string;
authParams?: any;
}
+1 -1
View File
@@ -20,4 +20,4 @@
"index.d.ts",
"auth0-js-tests.ts"
]
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
/// <reference types="auth0-js/v7" />
import 'auth0-js';
var auth0 = new Auth0({
domain: 'mine.auth0.com',
clientID: 'dsa7d77dsa7d7',
+7 -7
View File
@@ -1,4 +1,4 @@
// Type definitions for Auth0.js v7.x
// Type definitions for Auth0.js 7.0
// Project: https://github.com/auth0/auth0.js
// Definitions by: Robert McLaws <https://github.com/advancedrei>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -13,20 +13,20 @@ interface Window {
interface Auth0Static {
new(options: Auth0ClientOptions): Auth0Static;
changePassword(options: any, callback?: Function): void;
changePassword(options: any, callback?: (error?: Auth0Error, valid?: any) => void): void;
decodeJwt(jwt: string): any;
login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void;
loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void;
logout(query: string): void;
getConnections(callback?: Function): void;
getConnections(callback?: (error?: Auth0Error, valid?: any) => void): void;
refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
getDelegationToken(options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void;
getProfile(id_token: string, callback?: Function): Auth0UserProfile;
getSSOData(withActiveDirectories: any, callback?: Function): void;
getProfile(id_token: string, callback?: (error?: Auth0Error, valid?: any) => void): Auth0UserProfile;
getSSOData(withActiveDirectories: any, callback?: (error?: Auth0Error, valid?: any) => void): void;
parseHash(hash: string): Auth0DecodedHash;
signup(options: Auth0SignupOptions, callback: Function): void;
signup(options: Auth0SignupOptions, callback: (error?: Auth0Error, valid?: any) => void): void;
validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void;
}
@@ -132,5 +132,5 @@ interface Auth0DelegationToken {
declare const Auth0: Auth0Static;
declare module "auth0-js" {
export = Auth0
export = Auth0;
}
+4 -5
View File
@@ -12,12 +12,11 @@
"typeRoots": [
"../../"
],
"paths": {
"auth0-js": [
"auth0-js/v7"
]
},
"types": [],
"paths": {
"auth0-js": ["auth0-js/v7"],
"auth0-js/*": ["auth0-js/v7/*"]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
+2 -2
View File
@@ -1,5 +1,5 @@
/// <reference types="auth0-js/v7" />
/// <reference path="index.d.ts" />
import 'auth0-js/v7';
import Auth0Lock from 'auth0-lock';
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
const DOMAIN = "YOUR_DOMAIN_AT.auth0.com";
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"@types/auth0-js": "latest"
}
}
+1 -1
View File
@@ -20,4 +20,4 @@
"index.d.ts",
"auth0-lock-tests.ts"
]
}
}
+1 -2
View File
@@ -1,5 +1,4 @@
/// <reference types="auth0-js/v7" />
import 'auth0-js/v7';
var widget: Auth0WidgetStatic = new Auth0Widget({
domain: 'mine.auth0.com',
-1
View File
@@ -5,7 +5,6 @@
/// <reference types="auth0-js/v7" />
interface Auth0WidgetStatic {
new(params: Auth0Constructor): Auth0WidgetStatic;
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"@types/auth0-js": "latest"
}
}
+1 -1
View File
@@ -19,4 +19,4 @@
"index.d.ts",
"auth0.widget-tests.ts"
]
}
}
+341 -22
View File
@@ -1,6 +1,6 @@
// Type definitions for auth0 v2.3.1
// Type definitions for auth0 2.4
// Project: https://github.com/auth0/node-auth0
// Definitions by: Seth Westphal <https://github.com/westy92>
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Promise from 'bluebird';
@@ -10,8 +10,8 @@ export interface ManagementClientOptions {
domain?: string;
}
export type UserMetadata = {};
export type AppMetadata = {};
export interface UserMetadata { }
export interface AppMetadata { }
export interface UserData {
connection: string;
@@ -71,34 +71,353 @@ export interface UpdateUserParameters {
id: string;
}
export class ManagementClient {
constructor(options: ManagementClientOptions);
getUsers(params?: GetUsersData): Promise<User[]>;
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
createUser(data: UserData): Promise<User>;
createUser(data: UserData, cb: (err: Error, data: User) => void): void;
updateUser(params: UpdateUserParameters, data: User): Promise<User>;
updateUser(params: UpdateUserParameters, data: User, cb: (err: Error, data: User) => void): void;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata): Promise<User>;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata, cb: (err: Error, data: User) => void): void
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise<User>;
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void
}
export interface AuthenticationClientOptions {
clientId?: string;
domain: string;
}
export interface RequestChangePasswordEmailData {
interface Environment {
name: string;
version: string;
}
export interface ClientInfo {
name: string;
version: string;
dependencies: any[];
environment: Environment[];
}
export interface RequestEmailOptions {
email: string;
authParams: {};
}
export interface RequestSMSOptions {
phone_number: string;
}
export interface VerifyOptions {
username: string;
password: string;
}
export interface DelegationTokenOptions {
id_token: string;
api_type: string;
scope: string;
target: string;
grant_type: string;
}
export interface ResetPasswordOptions {
connection: string;
email: string;
password: string;
}
export interface ResetPasswordEmailOptions {
email: string;
connection: string;
}
export interface ObjectWithId {
id: string;
}
export interface Data {
name?: string;
[propName: string]: any;
}
export interface ClientParams {
client_id: string;
}
export interface DeleteMultifactorParams {
id: string;
provider: string;
}
export interface LinkAccountsParams {
id: string;
provider: string;
user_id: string;
}
export interface LinkAccountsData {
user_id: string;
connection_id: string;
}
export interface Token {
aud: string;
jti: string;
}
export interface StatsParams {
from: string;
to: string;
}
export interface ImportUsersOptions {
connection_id: string;
users: string;
}
export interface UserIdParams {
user_id: string;
}
export interface PasswordChangeTicketParams {
result_url: string;
user_id: string;
email: string;
new_password: string;
}
export interface EmailVerificationTicketOptions {
user_id: string;
result_url: string;
}
export class AuthenticationClient {
constructor(options: AuthenticationClientOptions);
getClientInfo(): ClientInfo;
requestMagicLink(data: RequestEmailOptions): Promise<any>;
requestMagicLink(data: RequestEmailOptions, cb: (err: Error, message: string) => void): void;
requestEmailCode(data: RequestEmailOptions): Promise<any>;
requestEmailCode(data: RequestEmailOptions, cb: (err: Error, message: string) => void): void;
requestSMSCode(data: RequestSMSOptions): Promise<any>;
requestSMSCode(data: RequestSMSOptions, cb: (err: Error, message: string) => void): void;
verifyEmailCode(data: VerifyOptions): Promise<any>;
verifyEmailCode(data: VerifyOptions, cb: (err: Error, message: string) => void): void;
verifySMSCode(data: VerifyOptions): Promise<any>;
verifySMSCode(data: VerifyOptions, cb: (err: Error, message: string) => void): void;
getDelegationToken(data: DelegationTokenOptions): Promise<any>;
getDelegationToken(data: DelegationTokenOptions, cb: (err: Error, message: string) => void): void;
changePassword(data: ResetPasswordOptions): Promise<any>;
changePassword(data: ResetPasswordOptions, cb: (err: Error, message: string) => void): void;
requestChangePasswordEmail(data: ResetPasswordEmailOptions): Promise<any>;
requestChangePasswordEmail(data: ResetPasswordEmailOptions, cb: (err: Error, message: string) => void): void;
getProfile(accessToken: string): Promise<any>;
getProfile(accessToken: string, cb: (err: Error, message: string) => void): void;
getCredentialsGrant(scope: string): Promise<any>;
getCredentialsGrant(scope: string, cb: (err: Error, message: string) => void): void;
}
export class ManagementClient {
constructor(options: ManagementClientOptions);
getClientInfo(): ClientInfo;
// Connections
getConnections(): Promise<User>;
getConnections(cb: (err: Error, data: any) => void): void;
createConnection(data: ObjectWithId): Promise<User>;
createConnection(data: ObjectWithId, cb: (err: Error, data: any) => void): void;
getConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
getConnection(params: ObjectWithId): Promise<User>;
deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
deleteConnection(params: ObjectWithId): Promise<User>;
deleteConnection(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
deleteConnection(params: ObjectWithId): Promise<User>;
updateConnection(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
updateConnection(params: ObjectWithId, data: Data): Promise<User>;
// Clients
getClients(): Promise<User>;
getClients(cb: (err: Error, data: any) => void): void;
getClient(params: ClientParams): Promise<User>;
getClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
createClient(data: Data): Promise<User>;
createClient(data: Data, cb: (err: Error, data: any) => void): void;
updateClient(params: ClientParams, data: Data): Promise<User>;
updateClient(params: ClientParams, data: Data, cb: (err: Error, data: any) => void): void;
deleteClient(params: ClientParams): Promise<User>;
deleteClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
// Client Grants
getClientGrants(): Promise<User>;
getClientGrants(cb: (err: Error, data: any) => void): void;
createClientGrant(data: Data): Promise<User>;
createClientGrant(data: Data, cb: (err: Error, data: any) => void): void;
updateClientGrant(params: ObjectWithId, data: Data): Promise<User>;
updateClientGrant(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
deleteClientGrant(params: ObjectWithId): Promise<User>;
deleteClientGrant(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
// Device Keys
getDeviceCredentials(): Promise<User>;
getDeviceCredentials(cb: (err: Error, data: any) => void): void;
createDevicePublicKey(data: Data): Promise<User>;
createDevicePublicKey(data: Data, cb: (err: Error, data: any) => void): void;
deleteDeviceCredential(params: ClientParams): Promise<User>;
deleteDeviceCredential(params: ClientParams, cb: (err: Error, data: any) => void): void;
// Rules
getRules(): Promise<User>;
getRules(cb: (err: Error, data: any) => void): void;
getRule(params: ClientParams): Promise<User>;
getRule(params: ClientParams, cb: (err: Error, data: any) => void): void;
createRules(data: Data): Promise<User>;
createRules(data: Data, cb: (err: Error, data: any) => void): void;
updateRule(params: ObjectWithId, data: Data): Promise<User>;
updateRule(params: ObjectWithId, data: Data, cb: (err: Error, data: any) => void): void;
deleteRule(params: ObjectWithId): Promise<User>;
deleteRule(params: ObjectWithId, cb: (err: Error, data: any) => void): void;
// Users
getUsers(params?: GetUsersData): Promise<User[]>;
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
getUser(params?: ObjectWithId): Promise<User[]>;
getUser(params?: ObjectWithId, cb?: (err: Error, users: User[]) => void): void;
createUser(data: UserData): Promise<User>;
createUser(data: UserData, cb: (err: Error, data: User) => void): void;
updateUser(params: UpdateUserParameters, data: User): Promise<User>;
updateUser(params: UpdateUserParameters, data: User, cb: (err: Error, data: User) => void): void;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata): Promise<User>;
updateUserMetadata(params: UpdateUserParameters, data: UserMetadata, cb: (err: Error, data: User) => void): void;
deleteAllUsers(): Promise<User>;
deleteAllUsers(cb: (err: Error, data: any) => void): void;
deleteUser(params?: ObjectWithId): Promise<any>;
deleteUser(params?: ObjectWithId, cb?: (err: Error, users: User[]) => void): void;
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata): Promise<User>;
updateAppMetadata(params: UpdateUserParameters, data: AppMetadata, cb: (err: Error, data: User) => void): void;
deleteUserMultifactor(params: DeleteMultifactorParams): Promise<any>;
deleteUserMultifactor(params: DeleteMultifactorParams, cb: (err: Error, data: any) => void): void;
unlinkUsers(params: LinkAccountsParams): Promise<any>;
unlinkUsers(params: LinkAccountsParams, cb: (err: Error, data: any) => void): void;
linkUsers(params: ObjectWithId, data: LinkAccountsData): Promise<any>;
linkUsers(params: ObjectWithId, data: LinkAccountsData, cb: (err: Error, data: any) => void): void;
// Tokens
getBlacklistedTokens(): Promise<any>;
getBlacklistedTokens(cb?: (err: Error, data: any) => void): void;
blacklistToken(token: Token): Promise<any>;
blacklistToken(token: Token, cb: (err: Error, data: any) => void): void;
// Providers
getEmailProvider(): Promise<any>;
getEmailProvider(cb?: (err: Error, data: any) => void): void;
configureEmailProvider(data: Data): Promise<any>;
configureEmailProvider(data: Data, cb: (err: Error, data: any) => void): void;
deleteEmailProvider(): Promise<any>;
deleteEmailProvider(cb?: (err: Error, data: any) => void): void;
updateEmailProvider(data: Data): Promise<any>;
updateEmailProvider(data: Data, cb?: (err: Error, data: any) => void): void;
// Statistics
getActiveUsersCount(): Promise<any>;
getActiveUsersCount(cb?: (err: Error, data: any) => void): void;
getDailyStats(data: StatsParams): Promise<any>;
getDailyStats(data: StatsParams, cb: (err: Error, data: any) => void): void;
// Tenant
getTenantSettings(): Promise<any>;
getTenantSettings(cb?: (err: Error, data: any) => void): void;
updateTenantSettings(data: Data): Promise<any>;
updateTenantSettings(data: Data, cb?: (err: Error, data: any) => void): void;
// Jobs
getJob(params: ObjectWithId): Promise<any>;
getJob(params: ObjectWithId, cb?: (err: Error, data: any) => void): void;
importUsers(data: ImportUsersOptions): Promise<any>;
importUsers(data: ImportUsersOptions, cb?: (err: Error, data: any) => void): void;
sendEmailVerification(data: UserIdParams): Promise<any>;
sendEmailVerification(data: UserIdParams, cb?: (err: Error, data: any) => void): void;
// Tickets
createPasswordChangeTicket(params: PasswordChangeTicketParams): Promise<any>;
createPasswordChangeTicket(params: PasswordChangeTicketParams, cb?: (err: Error, data: any) => void): void;
createEmailVerificationTicket(data: EmailVerificationTicketOptions): Promise<any>;
createEmailVerificationTicket(data: EmailVerificationTicketOptions, cb?: (err: Error, data: any) => void): void;
// Logs
getLog(params: ObjectWithId): Promise<any>;
getLog(params: ObjectWithId, cb?: (err: Error, data: any) => void): void;
getLogs(): Promise<any>;
getLogs(cb?: (err: Error, data: any) => void): void;
// Resource Server
createResourceServer(data: Data): Promise<any>;
createResourceServer(data: Data, cb?: (err: Error, data: any) => void): void;
getResourceServers(): Promise<any>;
getResourceServers(cb?: (err: Error, data: any) => void): void;
getResourceServer(data: ObjectWithId): Promise<any>;
getResourceServer(data: ObjectWithId, cb?: (err: Error, data: any) => void): void;
deleteResourceServer(params: ObjectWithId): Promise<any>;
deleteResourceServer(params: ObjectWithId, cb?: (err: Error, data: any) => void): void;
updateResourceServer(params: ObjectWithId, data: Data): Promise<any>;
updateResourceServer(params: ObjectWithId, data: Data, cb?: (err: Error, data: any) => void): void;
requestChangePasswordEmail(data: RequestChangePasswordEmailData): Promise<string>;
requestChangePasswordEmail(data: RequestChangePasswordEmailData, cb: (err: Error, message: string) => void): void;
}
+52
View File
@@ -0,0 +1,52 @@
import b_ = require("b_");
const blockClass: string = b_("block");
const blockWithModsClass: string = b_("block", {stringMod: "string", boolMod: true, numberMod: 5});
const elemClass: string = b_("block", "elem");
const elemWithModsClass: string = b_("block", "elem", {stringMod: "string", boolMod: true, numberMod: 5});
const withBlock = b_.with("block");
const withBlockClass: string = withBlock();
const withBlockWithModsClass: string = withBlock({stringMod: "string", boolMod: true, numberMod: 5});
const withBlockElemClass: string = withBlock("elem");
const withBlockElemWithModsClass: string = withBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
const lockBlock = b_.lock("block");
const lockBlockClass: string = lockBlock();
const lockBlockWithModsClass: string = lockBlock({stringMod: "string", boolMod: true, numberMod: 5});
const lockBlockElemClass: string = lockBlock("elem");
const lockBlockElemWithModsClass: string = lockBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
const withElem = b_.with("block", "elem");
const withElemClass: string = withElem();
const withElemWithModsClass: string = withElem({stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedB_ = b_.B({
tailSpace: " ",
elementSeparator: "-",
modSeparator: "_",
modValueSeparator: "-",
classSeparator: " ",
isFullModifier: true
});
const parameterizedBlockClass: string = parameterizedB_("block");
const parameterizedBlockWithModsClass: string = parameterizedB_("block", {stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedElemClass: string = parameterizedB_("block", "elem");
const parameterizedElemWithModsClass: string = parameterizedB_("block", "elem", {stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedWithBlock = parameterizedB_.with("block");
const parameterizedWithBlockClass: string = parameterizedWithBlock();
const parameterizedWithBlockWithModsClass: string = parameterizedWithBlock({stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedWithBlockElemClass: string = parameterizedWithBlock("elem");
const parameterizedWithBlockElemWithModsClass: string = parameterizedWithBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedLockBlock = parameterizedB_.lock("block");
const parameterizedLockBlockClass: string = parameterizedLockBlock();
const parameterizedLockBlockWithModsClass: string = parameterizedLockBlock({stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedLockBlockElemClass: string = parameterizedLockBlock("elem");
const parameterizedLockBlockElemWithModsClass: string = parameterizedLockBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
const parameterizedWithElem = parameterizedB_.with("block", "elem");
const parameterizedWithElemClass: string = parameterizedWithElem();
const parameterizedWithElemWithModsClass: string = parameterizedWithElem({stringMod: "string", boolMod: true, numberMod: 5});
+40
View File
@@ -0,0 +1,40 @@
// Type definitions for b_ 1.3
// Project: https://github.com/azproduction/b_
// Definitions by: Vasya Aksyonov <https://github.com/outring>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Options {
tailSpace?: string;
elementSeparator?: string;
modSeparator?: string;
modValueSeparator?: string;
classSeparator?: string;
isFullModifier?: boolean;
}
interface Mods {
[name: string]: any;
}
interface Formatter {
(block: string, mods?: Mods): string;
(block: string, elem: string, mods?: Mods): string;
with(block: string): BlockFormatter;
with(block: string, elem: string): ElemFormatter;
lock(block: string): BlockFormatter;
lock(block: string, elem: string): ElemFormatter;
B(options: Options): Formatter;
}
interface BlockFormatter {
(mods?: Mods): string;
(elem: string, mods?: Mods): string;
}
type ElemFormatter = (mods?: Mods) => string;
declare const formatter: Formatter;
export = formatter;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"b_-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+1 -3
View File
@@ -1,3 +1 @@
{
"extends": "../tslint.json"
}
{ "extends": "../tslint.json" }
+9 -9
View File
@@ -23,9 +23,9 @@ declare class Request {
method: string;
path: string;
params?: Params | FormData;
}): Promise<ResponseInterface>;
checkStatus(response: ResponseInterface): Promise<ResponseInterface>;
parseJSON<T>(response: ResponseInterface): Promise<T>;
}): Promise<Response>;
checkStatus(response: Response): Promise<Response>;
parseJSON<T>(response: Response): Promise<T>;
private toFormData(params);
private toQueryString(params);
webAppBaseURL: string;
@@ -49,7 +49,7 @@ export class Backlog extends Request {
putSpaceNotification(params: Option.Space.PutSpaceNotificationParams): Promise<any>;
getSpaceDiskUsage(): Promise<any>;
getSpaceIcon(): Promise<Entity.File.FileData>;
postSpaceAttachment(form: FormData): Promise<ResponseInterface>;
postSpaceAttachment(form: FormData): Promise<Response>;
getUsers(): Promise<any>;
getUser(userId: number): Promise<any>;
postUser(params: Option.User.PostUserParams): Promise<any>;
@@ -656,7 +656,7 @@ export namespace Error {
private _status;
private _body;
private _response;
constructor(name: BacklogErrorNameType, response: ResponseInterface, body?: {
constructor(name: BacklogErrorNameType, response: Response, body?: {
errors: BacklogErrorMessage[];
});
name: BacklogErrorNameType;
@@ -665,20 +665,20 @@ export namespace Error {
body: {
errors: BacklogErrorMessage[];
};
response: ResponseInterface;
response: Response;
}
export class BacklogApiError extends BacklogError {
constructor(response: ResponseInterface, body?: {
constructor(response: Response, body?: {
errors: BacklogErrorMessage[];
});
}
export class BacklogAuthError extends BacklogError {
constructor(response: ResponseInterface, body?: {
constructor(response: Response, body?: {
errors: BacklogErrorMessage[];
});
}
export class UnexpectedError extends BacklogError {
constructor(response: ResponseInterface);
constructor(response: Response);
}
export interface BacklogErrorMessage {
message: string;
+3 -3
View File
@@ -1,13 +1,13 @@
import * as base64 from 'base-64';
import * as utf8 from 'utf8';
let text = 'foo © bar 𝌆 baz';
let bytes = utf8.encode(text);
let encoded = base64.encode(bytes);
// → 'Zm9vIMKpIGJhciDwnYyGIGJheg=='
// → 'Zm9vIMKpIGJhciDwnYyGIGJheg=='
encoded = 'Zm9vIMKpIGJhciDwnYyGIGJheg==';
bytes = base64.decode(encoded);
text = utf8.decode(bytes);
let version = base64.version;
const version = base64.version;
+8 -8
View File
@@ -6,19 +6,19 @@
export const version: string;
/**
* This function takes a byte string (the input parameter) and encodes it according to base64.
* The input data must be in the form of a string containing only characters
* in the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
* The base64.encode() function is designed to be fully compatible
* This function takes a byte string (the input parameter) and encodes it according to base64.
* The input data must be in the form of a string containing only characters
* in the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
* The base64.encode() function is designed to be fully compatible
* with btoa() as described in the HTML Standard.
* see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-btoa
*/
export function encode(input: string): string;
/**
* This function takes a base64-encoded string (the input parameter) and decodes it.
* The return value is in the form of a string containing only characters in
* the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
* The base64.decode() function is designed to be fully compatible
* This function takes a base64-encoded string (the input parameter) and decodes it.
* The return value is in the form of a string containing only characters in
* the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
* The base64.decode() function is designed to be fully compatible
* with atob() as described in the HTML Standard.
* see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-atob
*/
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "../tslint.json" }
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "../tslint.json" }
+4 -2
View File
@@ -3,9 +3,11 @@
// Definitions by: Clément Bourgeois <https://github.com/moonpyk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Express from 'express';
/// <reference types="node" />
declare function auth(req: Express.Request): auth.BasicAuthResult;
import * as http from 'http';
declare function auth(req: http.IncomingMessage): auth.BasicAuthResult;
declare namespace auth {
interface BasicAuthResult {
+2 -2
View File
@@ -10,7 +10,7 @@ function test() {
var utils = bezier.getUtils();
var line: BezierJs.Line = { p1: { x: 0, y: 0 }, p2: { x: 1, y: 1 } };
var abc: BezierJs.ABC = { A: null, B: null, C: null };
var arc: BezierJs.Arc = { e: 0, s: 0, x: 0, y: 0, r: 1 };
var arc: BezierJs.Arc = { e: 0, s: 0, x: 0, y: 0, r: 1, interval:{ start: 0, end: 1 } };
var bbox: BezierJs.BBox = bezier.bbox();
var closest: BezierJs.Closest = { mdist: 1, mpos: 0 };
var inflection: BezierJs.Inflection = { values: null, x: [0], y: [0], z: [0] };
@@ -95,4 +95,4 @@ function test() {
utils.round(.999, .001);
utils.shapeintersections(shape, bbox, shape, bbox);
}
}
+1
View File
@@ -51,6 +51,7 @@ declare namespace BezierJs {
e: number;
r: number;
s: number;
interval: { start: number; end: number; };
}
interface Shape {
startcap: BezierCap;
+5 -5
View File
@@ -1,9 +1,9 @@
import BigInteger = require('bigi')
import BigInteger = require('bigi');
var b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012")
var b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811")
var b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012");
var b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
var b3 = b1.multiply(b2)
var b3 = b1.multiply(b2);
console.log(b3.toHex())
console.log(b3.toHex());
// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132
+39 -38
View File
@@ -1,63 +1,64 @@
/// <reference types="node" />
import bigi = require('bigi')
import bigi = require('bigi');
import bitcoin = require('bitcoinjs-lib');
declare var it: any;
declare var describe: any;
declare var assert: any;
describe('bitcoinjs-lib (basic)', function () {
it('can generate a random bitcoin address', function () {
describe('bitcoinjs-lib (basic)', () => {
it('can generate a random bitcoin address', () => {
// for testing only
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
// generate random keyPair
var keyPair = bitcoin.ECPair.makeRandom({ rng: rng })
var address = keyPair.getAddress()
var keyPair = bitcoin.ECPair.makeRandom({ rng });
var address = keyPair.getAddress();
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64')
})
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64');
});
it('can generate an address from a SHA256 hash', function () {
var hash = bitcoin.crypto.sha256('correct horse battery staple')
var d = bigi.fromBuffer(hash)
it('can generate an address from a SHA256 hash', () => {
var hash = bitcoin.crypto.sha256('correct horse battery staple');
var d = bigi.fromBuffer(hash);
var keyPair = new bitcoin.ECPair(d)
var address = keyPair.getAddress()
var keyPair = new bitcoin.ECPair(d);
var address = keyPair.getAddress();
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8')
})
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8');
});
it('can generate a random keypair for alternative networks', function () {
it('can generate a random keypair for alternative networks', () => {
// for testing only
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
var litecoin = bitcoin.networks.litecoin
var litecoin = bitcoin.networks.litecoin;
var keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng: rng })
var wif = keyPair.toWIF()
var address = keyPair.getAddress()
var keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
var wif = keyPair.toWIF();
var address = keyPair.getAddress();
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn')
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS')
})
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn');
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS');
});
it('can import an address via WIF', function () {
var keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct')
var address = keyPair.getAddress()
it('can import an address via WIF', () => {
var keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
var address = keyPair.getAddress();
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31')
})
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31');
});
it('can create a Transaction', function () {
var keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy')
var tx = new bitcoin.TransactionBuilder()
it('can create a Transaction', () => {
var keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
var tx = new bitcoin.TransactionBuilder();
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0)
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000)
tx.sign(0, keyPair)
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000);
tx.sign(0, keyPair);
assert.strictEqual(tx.build().toHex(), '0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000006b483045022100aefbcf847900b01dd3e3debe054d3b6d03d715d50aea8525f5ea3396f168a1fb022013d181d05b15b90111808b22ef4f9ebe701caf2ab48db269691fdf4e9048f4f60121029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000')
})
})
// tslint:disable-next-line:max-line-length
assert.strictEqual(tx.build().toHex(), '0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000006b483045022100aefbcf847900b01dd3e3debe054d3b6d03d715d50aea8525f5ea3396f168a1fb022013d181d05b15b90111808b22ef4f9ebe701caf2ab48db269691fdf4e9048f4f60121029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000');
});
});
@@ -1,20 +1,20 @@
import * as Protocol from 'bittorrent-protocol';
import * as net from 'net';
net.createServer(function(socket) {
net.createServer(socket => {
var wire = new Protocol();
// pipe to and from the protocol
socket.pipe(wire).pipe(socket);
wire.on('handshake', function(infoHash, peerId) {
wire.on('handshake', (infoHash, peerId) => {
// receive a handshake (infoHash and peerId are hex strings)
// lets emit a handshake of our own as well
wire.handshake('my info hash (hex)', 'my peer id (hex)');
});
wire.on('unchoke', function() {
wire.on('unchoke', () => {
console.log('peer is no longer choking us: ' + wire.peerChoking);
});
}).listen(6881);
+21 -19
View File
@@ -1,20 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bittorrent-protocol-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bittorrent-protocol-tests.ts"
]
}
+4 -1
View File
@@ -1,3 +1,6 @@
{
"extends": "../tslint.json"
"extends": "../tslint.json",
"rules": {
"no-misused-new": false
}
}
+4 -4
View File
@@ -1,13 +1,13 @@
var someInput = { a: 1, b: 2, c: 3 }
var someInput = { a: 1, b: 2, c: 3 };
import blacklist = require('blacklist')
import blacklist = require('blacklist');
blacklist(someInput, 'b', 'c')
blacklist(someInput, 'b', 'c');
// => { a: 1 }
blacklist(someInput, {
a: true, // a will not be in the result
b: false, // b will be in the result
c: 1 > 2 // false, therefore c will be in the result
})
});
// => { b: 2, c: 3 }
+8 -7
View File
@@ -1,9 +1,10 @@
{
"extends": "../tslint.json",
"rules": {
"no-empty-interface": false,
"array-type": false,
"unified-signatures": false,
"forbidden-types": false
}
"extends": "../tslint.json",
"rules": {
"max-line-length": false,
"no-empty-interface": false,
"array-type": false,
"unified-signatures": false,
"forbidden-types": false
}
}
+3 -2
View File
@@ -10,7 +10,7 @@ import { Request, RequestHandler, Response } from 'express';
// for docs go to https://github.com/expressjs/body-parser/tree/1.16.0#body-parser
// @deprecated
declare function bodyParser(options?: bodyParser.OptionsJson | bodyParser.OptionsText | bodyParser.OptionsUrlencoded): RequestHandler;
declare function bodyParser(options?: bodyParser.OptionsJson & bodyParser.OptionsText & bodyParser.OptionsUrlencoded): RequestHandler;
declare namespace bodyParser {
@@ -42,6 +42,7 @@ declare namespace bodyParser {
export function text(options?: OptionsText): RequestHandler;
export function urlencoded(options?: OptionsUrlencoded): RequestHandler;
}
export = bodyParser;
export = bodyParser;
+2 -2
View File
@@ -4,5 +4,5 @@ var log = bunyan.createLogger({
name: 'play',
serializers: bunyan.stdSerializers
});
log.debug({foo: 'bar'}, 'hi at debug')
log.trace('hi at trace')
log.debug({foo: 'bar'}, 'hi at debug');
log.trace('hi at trace');
+3 -3
View File
@@ -1,13 +1,13 @@
import BufferStream = require('bufferstream')
import BufferStream = require('bufferstream');
var stream = new BufferStream({encoding:'utf8', size:'flexible'});
var stream = new BufferStream({encoding: 'utf8', size: 'flexible'});
stream.enable();
stream.disable();
stream.split('//', ':');
stream.on('split', (chunk: any, token: any) => {
console.log("got '%s' by '%s'", chunk.toString(), token.toString())
console.log("got '%s' by '%s'", chunk.toString(), token.toString());
});
stream.write("buffer:stream//23");
console.log(stream.toString());
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "../tslint.json" }
+5 -5
View File
@@ -1,10 +1,10 @@
import camelcaseKeys = require('camelcase-keys');
camelcaseKeys({'foo-bar': true});
//=> {fooBar: true}
// => {fooBar: true}
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
//=> {fooBar: true, nested: {unicornRainbow: true}}
camelcaseKeys({'foo-bar': true, 'nested': {unicorn_rainbow: true}}, {deep: true});
// => {fooBar: true, nested: {unicornRainbow: true}}
camelcaseKeys({_: [], 'foo-bar': true});
//=> {_: [], fooBar: true}
camelcaseKeys({'_': [], 'foo-bar': true});
// => {_: [], fooBar: true}
+3
View File
@@ -40,5 +40,8 @@ expect(wrapper).to.have.data("test", "Test");
expect(wrapper).to.have.style("background", "green");
expect(wrapper).to.have.state("test", "test");
expect(wrapper).to.have.prop("test", 5);
expect(wrapper).to.have.props(["test1", "test2"]);
expect(wrapper).to.have.props({ test: 5 });
expect(wrapper).to.contain(<Test/>);
expect(wrapper).to.containMatchingElement(<Test/>);
expect(wrapper).to.match(<Test/>);
+19 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for chai-enzyme 0.5.0
// Type definitions for chai-enzyme 0.6.1
// Project: https://github.com/producthunt/chai-enzyme
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -39,6 +39,12 @@ declare namespace Chai {
*/
className(name: string): Assertion;
/**
* Assert that the wrapper contains a certain element:
* @param selector
*/
containMatchingElement(selector: EnzymeSelector): Assertion;
/**
* Assert that the wrapper contains a descendant matching the given selector:
* @param selector
@@ -140,6 +146,18 @@ declare namespace Chai {
* @param val
*/
prop(key: string, val?: any): Assertion;
/**
* Assert that the wrapper has given props [with values]:
* @param keys
*/
props(keys: string[]): Assertion;
/**
* Assert that the wrapper has given props [with values]:
* @param props
*/
props(props: EnzymeSelector): Assertion;
}
}
+2 -4
View File
@@ -1,5 +1,3 @@
/// <reference path="index.d.ts" />
import { expect } from 'chai';
import { assert } from 'chai';
@@ -44,14 +42,14 @@ const fruitSchema = {
}
};
//bdd style
// bdd style
expect(goodApple).to.be.jsonSchema(fruitSchema);
expect(badApple).to.not.be.jsonSchema(fruitSchema);
goodApple.should.be.jsonSchema(fruitSchema);
badApple.should.not.be.jsonSchema(fruitSchema);
//tdd style
// tdd style
assert.jsonSchema(goodApple, fruitSchema);
assert.notJsonSchema(badApple, fruitSchema);
+4 -4
View File
@@ -1,6 +1,6 @@
{
"extends": "../tslint.json",
"rules": {
"no-single-declare-module": false
}
"extends": "../tslint.json",
"rules": {
"no-single-declare-module": false
}
}
+9 -9
View File
@@ -8,7 +8,7 @@ var expect = chai.expect;
var assert = chai.assert;
function test_containSubset() {
var obj: Object = {
var obj = {
a: 'b',
c: 'd',
e: {
@@ -34,7 +34,7 @@ function test_containSubset() {
}
function test_notContainSubset() {
var obj: Object = {
var obj = {
a: 'b',
c: 'd',
e: {
@@ -50,16 +50,16 @@ function test_notContainSubset() {
}
function test_arrayContainSubset() {
var list: Array<Object> = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
var list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
expect(list).to.containSubset([{a:'a', b: 'b'}]);
list.should.containSubset([{a:'a', b: 'b'}]);
assert.containSubset(list, [{a:'a', b: 'b'}]);
expect(list).to.containSubset([{a: 'a', b: 'b'}]);
list.should.containSubset([{a: 'a', b: 'b'}]);
assert.containSubset(list, [{a: 'a', b: 'b'}]);
}
function test_arrayNotContainSubset() {
var list: Array<Object> = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
var list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
expect(list).not.to.containSubset([{a:'a', b: 'bd'}]);
list.should.not.containSubset([{a:'a', b: 'bd'}]);
expect(list).not.to.containSubset([{a: 'a', b: 'bd'}]);
list.should.not.containSubset([{a: 'a', b: 'bd'}]);
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "../tslint.json" }
+2 -2
View File
@@ -2,10 +2,10 @@ import * as chai from 'chai';
import chaiXml = require('chai-xml');
chai.use(chaiXml);
let expect = chai.expect;
const expect = chai.expect;
function test_chaiXml() {
let testXml = '<a:test attribute1="1" xmlns:a="test"><a:h1><a:h2>test</a:h2></a:h1></a:test>';
const testXml = '<a:test attribute1="1" xmlns:a="test"><a:h1><a:h2>test</a:h2></a:h1></a:test>';
expect('nope').xml.not.to.be.valid();
expect(testXml).xml.to.be.valid();
expect(testXml).xml.to.equal('<a:test attribute1="1" xmlns:a="test">\n<a:h1><a:h2>test</a:h2></a:h1></a:test>\n');
+1
View File
@@ -358,6 +358,7 @@ declare namespace Chai {
sameMembers(set1: any[], set2: any[], msg?: string): void;
sameDeepMembers(set1: any[], set2: any[], msg?: string): void;
includeMembers(superset: any[], subset: any[], msg?: string): void;
includeDeepMembers(superset: any[], subset: any[], msg?: string): void;
ifError(val: any, msg?: string): void;
+1 -1
View File
@@ -7,7 +7,7 @@ var colors: getCharm.CharmColor[] = [ 'red', 'cyan', 'yellow', 'green', 'blue' ]
var text = 'Always after me lucky charms.';
var offset = 0;
var iv = setInterval(function () {
var iv = setInterval(() => {
var y = 0, dy = 1;
for (var i = 0; i < 40; i++) {
var color = colors[(i + offset) % colors.length];
+1
View File
@@ -103,6 +103,7 @@ declare namespace Chart {
animation?: ChartAnimationOptions;
elements?: ChartElementsOptions;
scales?: ChartScales;
cutoutPercentage?: number;
}
export interface ChartFontOptions {
+2 -2
View File
@@ -1831,7 +1831,7 @@ declare namespace chrome.devtools.panels {
* If you specify the callback parameter, it should be a function that looks like this:
* function() {...};
*/
setObject(jsonObject: string, rootTitle?: string, callback?: () => void): void;
setObject(jsonObject: Object, rootTitle?: string, callback?: () => void): void;
/**
* Sets a JSON-compliant object to be displayed in the sidebar pane.
* @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client).
@@ -1839,7 +1839,7 @@ declare namespace chrome.devtools.panels {
* If you specify the callback parameter, it should be a function that looks like this:
* function() {...};
*/
setObject(jsonObject: string, callback?: () => void): void;
setObject(jsonObject: Object, callback?: () => void): void;
/**
* Sets an HTML page to be displayed in the sidebar pane.
* @param path Relative path of an extension page to display within the sidebar.
+4 -4
View File
@@ -1,11 +1,11 @@
// Chunker
let chunker = new Chunker(1337, Uint8Array.of(1,2,3), 2);
for (let chunk of chunker) {
let chunker = new Chunker(1337, Uint8Array.of(1, 2, 3), 2);
for (const chunk of chunker) {
// Do smoething with chunk
}
while (chunker.hasNext) {
let chunk = chunker.next().value;
const chunk = chunker.next().value;
}
// Unchunker
@@ -14,6 +14,6 @@ let unchunker = new Unchunker();
unchunker.onMessage = (message: Uint8Array, context: any[]) => {
// Do something with the received message
};
let chunk = Uint8Array.of(1,2).buffer;
let chunk = Uint8Array.of(1, 2).buffer;
unchunker.add(chunk);
unchunker.gc(1024);
+5 -5
View File
@@ -1,4 +1,4 @@
// Type definitions for chunked-dc v0.1.2
// Type definitions for chunked-dc 0.1
// Project: https://github.com/saltyrtc/chunked-dc-js
// Definitions by: Danilo Bargen <https://github.com/dbrgn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -21,7 +21,7 @@ declare namespace chunkedDc {
}
interface ChunkerStatic {
new(id: number, message: Uint8Array, chunkSize: number): Chunker
new(id: number, message: Uint8Array, chunkSize: number): Chunker;
}
/** unchunker.ts **/
@@ -35,14 +35,14 @@ declare namespace chunkedDc {
}
interface UnchunkerStatic {
new(): Unchunker
new(): Unchunker;
}
/** main.ts **/
interface Standalone {
Chunker: ChunkerStatic,
Unchunker: UnchunkerStatic,
Chunker: ChunkerStatic;
Unchunker: UnchunkerStatic;
}
}
+1
View File
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
],
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+2 -2
View File
@@ -17,12 +17,12 @@ var cb5 = new Clipboard('.btn', {
cb1.destroy();
cb2.on('success', function(e) {
cb2.on('success', e => {
console.info('Action:', e.action);
console.info('Text:', e.text);
console.info('Trigger:', e.trigger);
e.clearSelection();
});
cb2.on('error', function(e) { });
cb2.on('error', e => { });
+23 -17
View File
@@ -1,6 +1,6 @@
import * as Clndr from 'clndr';
let options: Clndr.ClndrOptions = {
const options: Clndr.ClndrOptions = {
template: '',
startWithMonth: "YYYY-MM-DD",
weekOffset: 0,
@@ -25,21 +25,21 @@ let options: Clndr.ClndrOptions = {
adjacentMonth: "adjacent-month",
},
clickEvents: {
click: function (target) { },
today: function (month) { },
nextMonth: function (month) { },
previousMonth: function (month) { },
onMonthChange: function (month) { },
nextYear: function (month) { },
previousYear: function (month) { },
onYearChange: function (month) { },
nextInterval: function (start, end) { },
previousInterval: function (start, end) { },
onIntervalChange: function (start, end) { }
click(target) { },
today(month) { },
nextMonth(month) { },
previousMonth(month) { },
onMonthChange(month) { },
nextYear(month) { },
previousYear(month) { },
onYearChange(month) { },
nextInterval(start, end) { },
previousInterval(start, end) { },
onIntervalChange(start, end) { }
},
useTouchEvents: false,
ready: function () { },
doneRendering: function () { },
ready() { },
doneRendering() { },
events: [],
dateParameter: 'date',
multiDayEvents: {
@@ -59,7 +59,7 @@ let options: Clndr.ClndrOptions = {
interval: 1
},
extras: { },
render: function (data) {
render(data) {
return '<div class="html data as a string"></div>';
},
constraints: {
@@ -69,7 +69,13 @@ let options: Clndr.ClndrOptions = {
moment: null
};
let myCalendar = $('.parent-element').clndr(options);
const myCalendar = $('.parent-element').clndr(options);
myCalendar.options.constraints = {
startDate: '2017-12-22',
endDate: '2018-01-09'
};
myCalendar.render();
myCalendar
.forward()
@@ -82,5 +88,5 @@ myCalendar
.today()
.setEvents([])
.addEvents([])
.removeEvents(event => { return event.id === 'idToRemove'; })
.removeEvents(event => event.id === 'idToRemove')
.destroy();

Some files were not shown because too many files have changed in this diff Show More