Merge branch 'master' into master

This commit is contained in:
Manuel J. López Ambrosio
2017-03-22 13:20:47 +01:00
committed by GitHub
429 changed files with 31691 additions and 21024 deletions
-20
View File
@@ -1,22 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
-1
View File
@@ -1 +0,0 @@
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) at [definitelytyped.org](http://definitelytyped.org/guides/contributing.html) for information on how to contribute to DefinitelyTyped.
-1893
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -444,7 +444,7 @@ declare namespace ablyLib {
}
}
export declare class Rest {
export class Rest {
constructor(options: ablyLib.ClientOptions | string);
static Crypto: ablyLib.Crypto;
static Message: ablyLib.MessageStatic;
@@ -456,7 +456,7 @@ export declare class Rest {
time: (paramsOrCallback?: ablyLib.timeCallback | any, callback?: ablyLib.timeCallback) => void;
}
export declare class Realtime {
export class Realtime {
constructor(options: ablyLib.ClientOptions | string);
static Crypto: ablyLib.Crypto;
static Message: ablyLib.MessageStatic;
+2 -2
View File
@@ -4,11 +4,11 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace accepts {
export interface Headers {
interface Headers {
[key: string]: string | string[];
}
export interface Accepts {
interface Accepts {
/**
* Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned.
*/
-1
View File
@@ -257,4 +257,3 @@ amplify.request({
error: (data, status) => {
}
});
-5
View File
@@ -34,7 +34,6 @@ declare namespace amplify {
}
interface Request {
/***
* Request a resource.
* resourceId: Identifier string for the resource.
@@ -118,7 +117,6 @@ declare namespace amplify {
}
interface Store extends StorageTypeStore {
/***
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
@@ -143,12 +141,9 @@ declare namespace amplify {
* An in-memory store is provided as a fallback if none of the other storage types are available.
*/
memory: StorageTypeStore;
}
interface Static {
subscribe: Subscribe;
/***
+4 -5
View File
@@ -3,13 +3,12 @@
// Definitions by: Donald Nairn <https://github.com/deenairn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
declare namespace angular {
import * as angular from 'angular';
declare module 'angular' {
/**
* A core Angular factory proving FileSaver functionality.
*/
interface FileSaver {
export interface FileSaver {
/**
* Immediately starts saving a file
* @param data: a Blob instance;
@@ -18,4 +17,4 @@ declare namespace angular {
*/
saveAs(blob: Blob, fileName: string, disableBOM?: boolean): void;
}
}
}
+1 -7
View File
@@ -8,11 +8,8 @@ import * as angular from "angular";
export default "gridster";
declare module "angular" {
export namespace gridster {
namespace gridster {
interface GridsterConfig {
// number of columns in the grid
columns?: number;
// whether to push other items out of the way
@@ -83,7 +80,6 @@ declare module "angular" {
// options to pass to resizable handler
resizable?: {
// whether the items are resizable
enabled?: boolean;
@@ -103,7 +99,6 @@ declare module "angular" {
// options to pass to draggable handler
draggable?: {
// whether the items are resizable
enabled?: boolean;
@@ -128,7 +123,6 @@ declare module "angular" {
}
interface StandardGridsterItem {
// width of the item expressed in terms of number of columns it will occupy
sizeX: number;
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"localforage": "^1.5.0"
}
}
+2 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for Angular Material (angular.material module) 1.1
// Project: https://github.com/angular/material
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>, Geert Jansen <https://github.com/geertjansen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as angular from 'angular';
@@ -18,6 +18,7 @@ declare module 'angular' {
controller?: string | Function;
locals?: { [index: string]: any };
clickOutsideToClose?: boolean;
bindToController?: boolean; // default: false
disableBackdrop?: boolean;
escapeToClose?: boolean;
resolve?: { [index: string]: () => angular.IPromise<any> };
+2 -4
View File
@@ -6,8 +6,8 @@
import * as angular from 'angular';
declare module 'angular' {
export namespace oauth2 {
interface OAuthConfig {
namespace oauth2 {
interface OAuthConfig {
baseUrl: string;
clientId: string;
clientSecret?: string;
@@ -43,7 +43,5 @@ declare module 'angular' {
interface OAuthTokenProvider {
configure(params: OAuthTokenConfig): OAuthTokenConfig;
}
}
}
+13 -7
View File
@@ -15,6 +15,7 @@ export type IDropdownConfig = angular.ui.bootstrap.IDropdownConfig;
export type IModalProvider = angular.ui.bootstrap.IModalProvider;
export type IModalService = angular.ui.bootstrap.IModalService;
export type IModalServiceInstance = angular.ui.bootstrap.IModalServiceInstance;
export type IModalInstanceService = angular.ui.bootstrap.IModalInstanceService;
export type IModalScope = angular.ui.bootstrap.IModalScope;
export type IModalSettings = angular.ui.bootstrap.IModalSettings;
export type IModalStackService = angular.ui.bootstrap.IModalStackService;
@@ -320,12 +321,12 @@ declare module 'angular' {
interface IModalService {
/**
* @param {IModalSettings} options
* @returns {IModalServiceInstance}
* @returns {IModalInstanceService}
*/
open(options: IModalSettings): IModalServiceInstance;
open(options: IModalSettings): IModalInstanceService;
}
interface IModalServiceInstance {
interface IModalInstanceService {
/**
* A method that can be used to close a modal, passing a result. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
*/
@@ -357,6 +358,11 @@ declare module 'angular' {
closed: angular.IPromise<any>;
}
/**
* @deprecated use IModalInstanceService instead.
*/
interface IModalServiceInstance extends IModalInstanceService { }
interface IModalScope extends angular.IScope {
/**
* Dismiss the dialog without assigning a value to the promise output. If `preventDefault` is called on the `modal.closing` event then the modal will remain open.
@@ -512,17 +518,17 @@ declare module 'angular' {
/**
* Opens a new modal instance.
*/
open(modalInstance: IModalServiceInstance, modal: any): void;
open(modalInstance: IModalInstanceService, modal: any): void;
/**
* Closes a modal instance with an optional result.
*/
close(modalInstance: IModalServiceInstance, result?: any): void;
close(modalInstance: IModalInstanceService, result?: any): void;
/**
* Dismisses a modal instance with an optional reason.
*/
dismiss(modalInstance: IModalServiceInstance, reason?: any): void;
dismiss(modalInstance: IModalInstanceService, reason?: any): void;
/**
* Dismiss all open modal instances with an optional reason that will be passed to each instance.
@@ -536,7 +542,7 @@ declare module 'angular' {
}
interface IModalStackedMapKeyValuePair {
key: IModalServiceInstance;
key: IModalInstanceService;
value: any;
}
+1 -6
View File
@@ -26,7 +26,6 @@ import ng = angular;
// ng module (angular.js)
///////////////////////////////////////////////////////////////////////////////
declare namespace angular {
type Injectable<T extends Function> = T | Array<string | T>;
// not directly implemented, but ensures that constructed class implements $get
@@ -344,7 +343,6 @@ declare namespace angular {
* see https://docs.angularjs.org/api/ng/type/form.FormController
*/
interface IFormController {
/**
* Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272
*/
@@ -532,7 +530,6 @@ declare namespace angular {
* see https://docs.angularjs.org/api/ng/directive/ngRepeat
*/
interface IRepeatScope extends IScope {
/**
* iterator offset of the repeated element (0..length-1).
*/
@@ -562,7 +559,6 @@ declare namespace angular {
* true if the iterator position $index is odd (otherwise false).
*/
$odd: boolean;
}
interface IAngularEvent {
@@ -1944,8 +1940,7 @@ declare namespace angular {
///////////////////////////////////////////////////////////////////////////
// AUTO module (angular.js)
///////////////////////////////////////////////////////////////////////////
export namespace auto {
namespace auto {
///////////////////////////////////////////////////////////////////////
// InjectorService
// see http://docs.angularjs.org/api/AUTO.$injector
@@ -31,7 +31,7 @@ var config: Microsoft.ApplicationInsights.IConfig = {
};
var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
config: config,
config,
context: null,
queue: null,
@@ -128,7 +128,8 @@ context.track(eventEnvelope);
// track exception
var exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(
Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
var exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
context.track(exceptionEnvelope);
@@ -146,13 +147,15 @@ context.track(pageViewEnvelope);
// track page view performance
var pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(
Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
var pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
context.track(pageViewPerfEnvelope);
// track remote dependency
var remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(
Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
var remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
context.track(pageViewPerfEnvelope);
+1 -2
View File
@@ -306,7 +306,6 @@ declare module Microsoft.Telemetry {
}
declare module Microsoft.ApplicationInsights.Telemetry {
class Event implements Microsoft.ApplicationInsights.ISerializable {
static envelopeType: string;
static dataType: string;
@@ -794,7 +793,7 @@ declare module Microsoft.ApplicationInsights {
}
declare module 'applicationinsights-js' {
export let AppInsights: Microsoft.ApplicationInsights.IAppInsights;
const AppInsights: Microsoft.ApplicationInsights.IAppInsights;
}
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
+2 -4
View File
@@ -164,7 +164,6 @@ interface SpeechSynthesisVoice {
}
declare namespace Artyom {
interface ArtyomDevice {
isChrome(): boolean;
isMobile(): boolean;
@@ -235,7 +234,7 @@ declare namespace Artyom {
onend(): void;
}
export interface ArtyomJS {
interface ArtyomJS {
/**
* Contains some basic information that artyom needs to know as the type of device and browser
* @see http://ourcodeworld.com/projects/projects-documentation/6/read-doc/artyom-device/artyom-js
@@ -499,13 +498,12 @@ declare namespace Artyom {
/**
* ArtyomBuilder bla, bla...
*/
export class ArtyomBuilder {
class ArtyomBuilder {
/**
* Method to bla, bla, bla...
*/
static getInstance(): ArtyomJS
}
}
// tslint:disable-next-line:export-just-namespace
+21 -22
View File
@@ -6,17 +6,16 @@
interface Dictionary<T> { [key: string]: T; }
interface ErrorCallback<T> { (err?: T): void; }
interface AsyncWaterfallCallback<E> { (err: E, ...args: any[]): void; }
interface AsyncBooleanResultCallback<E> { (err: E, truthValue: boolean): void; }
interface AsyncResultCallback<T, E> { (err: E, result: T): void; }
interface AsyncResultArrayCallback<T, E> { (err: E, results: T[]): void; }
interface AsyncResultObjectCallback<T, E> { (err: E, results: Dictionary<T>): void; }
interface AsyncBooleanResultCallback<E> { (err?: E, truthValue?: boolean): void; }
interface AsyncResultCallback<T, E> { (err?: E, result?: T): void; }
interface AsyncResultArrayCallback<T, E> { (err?: E, results?: (T | undefined)[]): void; }
interface AsyncResultObjectCallback<T, E> { (err: E | undefined, results: Dictionary<T | undefined>): void; }
interface AsyncFunction<T, E> { (callback: (err?: E, result?: T) => void): void; }
interface AsyncIterator<T, E> { (item: T, callback: ErrorCallback<E>): void; }
interface AsyncForEachOfIterator<T, E> { (item: T, key: number|string, callback: ErrorCallback<E>): void; }
interface AsyncResultIterator<T, R, E> { (item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncMemoIterator<T, R, E> { (memo: R, item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncMemoIterator<T, R, E> { (memo: R | undefined, item: T, callback: AsyncResultCallback<R, E>): void; }
interface AsyncBooleanIterator<T, E> { (item: T, callback: AsyncBooleanResultCallback<E>): void; }
interface AsyncWorker<T, E> { (task: T, callback: ErrorCallback<E>): void; }
@@ -76,7 +75,7 @@ interface AsyncPriorityQueue<T> {
interface AsyncCargo {
length(): number;
payload: number;
payload?: number;
push(task: any, callback? : Function): void;
push(task: any[], callback? : Function): void;
saturated(): void;
@@ -175,7 +174,7 @@ interface Async {
during<E>(test: (testCallback : AsyncBooleanResultCallback<E>) => void, fn: AsyncVoidFunction<E>, callback: ErrorCallback<E>): void;
doDuring<E>(fn: AsyncVoidFunction<E>, test: (testCallback: AsyncBooleanResultCallback<E>) => void, callback: ErrorCallback<E>): void;
forever<E>(next: (next : ErrorCallback<E>) => void, errBack: ErrorCallback<E>) : void;
waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T,E>): void;
waterfall<T, E>(tasks: Function[], callback?: AsyncResultCallback<T, E | Error>): void;
compose(...fns: Function[]): Function;
seq(...fns: Function[]): Function;
applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
@@ -186,29 +185,30 @@ interface Async {
cargo<E>(worker : (tasks: any[], callback : ErrorCallback<E>) => void, payload? : number) : AsyncCargo;
auto<E>(tasks: any, concurrency?: number, callback?: AsyncResultCallback<any, E>): void;
autoInject<E>(tasks: any, callback?: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E>): void;
retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E>): void;
retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E>;
apply<E>(fn: Function, ...arguments: any[]): AsyncFunction<any,E>;
retry<T, E>(opts: number, task: (callback : AsyncResultCallback<T, E>, results: any) => void, callback: AsyncResultCallback<any, E | Error>): void;
retry<T, E>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T, E>, results : any) => void, callback: AsyncResultCallback<any, E | Error>): void;
retryable<T, E>(opts: number | {times: number, interval: number}, task: AsyncFunction<T, E>): AsyncFunction<T, E | Error>;
apply<E>(fn: Function, ...arguments: any[]): AsyncFunction<any,E | Error>;
nextTick(callback: Function, ...args: any[]): void;
setImmediate: typeof async.nextTick;
reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
reflect<T, E>(fn: AsyncFunction<T, E>) : (callback: (err: null, result: {error?: E, value?: T}) => void) => void;
reflectAll<T, E>(tasks: AsyncFunction<T, E>[]): ((callback: (err: null, result: {error?: E, value?: T}) => void) => void)[];
timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E>;
timeout<T, R, E>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E>;
timeout<T, E>(fn: AsyncFunction<T, E>, milliseconds: number, info?: any): AsyncFunction<T, E | Error>;
timeout<T, R, E>(fn: AsyncResultIterator<T, R, E>, milliseconds: number, info?: any): AsyncResultIterator<T, R, E | Error>;
times<T, E> (n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesSeries<T, E>(n: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
timesLimit<T, E>(n: number, limit: number, iterator: AsyncResultIterator<number, T, E>, callback: AsyncResultArrayCallback<T, E>): void;
transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void): void;
transform<T, R, E>(arr: T[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
transform<T, R, E>(arr: T[], acc: R[], iteratee: (acc: R[], item: T, key: number, callback: (error?: E) => void) => void, callback?: AsyncResultArrayCallback<T, E>): void;
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E>) : void;
transform<T, R, E>(arr: {[key: string] : T}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
transform<T, R, E>(arr: {[key: string] : T}, acc: {[key: string] : R}, iteratee: (acc: {[key: string] : R}, item: T, key: string, callback: (error?: E) => void) => void, callback?: AsyncResultObjectCallback<T, E>): void;
race<T, E>(tasks: (AsyncFunction<T, E>)[], callback: AsyncResultCallback<T, E | Error>) : void;
// Utils
memoize(fn: Function, hasher?: Function): Function;
@@ -226,4 +226,3 @@ declare var async: Async;
declare module "async" {
export = async;
}
+42 -12
View File
@@ -1,44 +1,74 @@
interface StringCallback { (err: Error, result: string): void; }
interface StringCallback { (err?: Error, result?: string): void; }
interface AsyncStringGetter { (callback: StringCallback): void; }
var taskArray: AsyncStringGetter[] = [
function (callback) {
setTimeout(function () {
callback(null, 'one');
callback(undefined, 'one');
}, 200);
},
function (callback) {
setTimeout(function () {
callback(null, 'two');
callback(undefined, 'two');
}, 100);
},
];
async.series(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
async.parallel(taskArray, function (err, results) { console.log(results[0].match(/o/)) });
async.parallelLimit(taskArray, 3, function (err, results) { console.log(results[0].match(/o/)) });
async.series(taskArray, function (err, results) {
if (results) {
let first = results[0];
if (first) {
console.log(first.match(/o/))
}
}
});
async.parallel(taskArray, function (err, results) {
if (results) {
let first = results[0];
if (first) {
console.log(first.match(/o/))
}
}
});
async.parallelLimit(taskArray, 3, function (err, results) {
if (results) {
let first = results[0];
if (first) {
console.log(first.match(/o/))
}
}
});
interface Lookup<T> { [key: string]: T; }
interface NumberCallback { (err: Error, result: number): void; }
interface NumberCallback { (err?: Error, result?: number): void; }
interface AsyncNumberGetter { (callback: NumberCallback): void; }
var taskDict: Lookup<AsyncNumberGetter> = {
one: function(callback){
setTimeout(function(){
callback(null, 1);
callback(undefined, 1);
}, 200);
},
two: function(callback){
setTimeout(function(){
callback(null, 2);
callback(undefined, 2);
}, 100);
}
}
async.series(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
async.parallel(taskDict, function(err, results) { console.log(results['one'].toFixed(1)) });
async.parallelLimit(taskDict, 3, function(err, results) { console.log(results['one'].toFixed(1)) });
async.series(taskDict, function(err, results) {
let one = results['one'];
console.log(one && one.toFixed(1))
});
async.parallel(taskDict, function(err, results) {
let one = results['one'];
console.log(one && one.toFixed(1))
});
async.parallelLimit(taskDict, 3, function(err, results) {
let one = results['one'];
console.log(one && one.toFixed(1))
});
+8 -8
View File
@@ -350,9 +350,9 @@ q2.unshift(['task3', 'task4', 'task5'], function (error) {
});
var aq = async.queue<number, number, Error>(function (level: number, callback: (error : Error, newLevel: number) => void) {
var aq = async.queue<number, number, Error>(function (level: number, callback: (error?: Error, newLevel?: number) => void) {
console.log('hello ' + level);
callback(null, level+1);
callback(undefined, level+1);
});
aq.push(1, function (err : Error, newLevel : number) {
@@ -807,9 +807,9 @@ async.some<number, Error>({
// timeout
function myFunction1(foo : any, callback: (err : Error, result : any) => void ) : void {
function myFunction1(foo : any, callback: (err?: Error, result?: any) => void ) : void {
console.log(`async.timeout 1 ${foo}`);
return callback(null, foo);
return callback(undefined, foo);
}
var wrapped1 = async.timeout(myFunction1, 1000);
wrapped1({ bar: 'bar' }, function(err : Error, data : any) {
@@ -817,9 +817,9 @@ wrapped1({ bar: 'bar' }, function(err : Error, data : any) {
});
function myFunction2(callback: (err : Error, result : any) => void ) : void {
function myFunction2(callback: (err?: Error, result?: any) => void ) : void {
console.log(`async.timeout 2`);
return callback(null, { bar: 'bar' });
return callback(undefined, { bar: 'bar' });
}
var wrapped2 = async.timeout(myFunction2, 1000);
@@ -827,9 +827,9 @@ wrapped2( function(err : Error, data : any) {
console.log(`async.timeout 2 end ${data}`);
});
function myFunction3(callback: (err : Error, result : any) => void ) : void {
function myFunction3(callback: (err?: Error, result?: any) => void ) : void {
console.log(`async.timeout 3`);
return callback(null, { bar: 'bar' });
return callback(undefined, { bar: 'bar' });
}
var wrapped3 = async.timeout(myFunction3, 1000, { bar: 'bar' });
+2 -2
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -20,4 +20,4 @@
"test/index.ts",
"test/explicit.ts"
]
}
}
+1 -1
View File
@@ -3,7 +3,6 @@
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="q" />
/// <reference types="jquery" />
/// <reference types="space-pen" />
/// <reference types="emissary" />
@@ -1519,6 +1518,7 @@ declare var atom:AtomCore.IAtom;
declare module "atom" {
import spacePen = require("space-pen");
import Q = require("q");
var $:typeof spacePen.$;
var $$:typeof spacePen.$$;
+3
View File
@@ -12,6 +12,9 @@
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
@@ -1,6 +1,4 @@
export class ViewModel {
constructor(private knockoutBindable: KnockoutBindable) {
}
+1 -2
View File
@@ -3,8 +3,7 @@
// Definitions by: Christian Kotzbauer <https://github.com/code-chris>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare interface KnockoutBindable {
interface KnockoutBindable {
/**
* Applys all values from a data object (usually the activation data) to the corresponding instance fields
* in the current view model if they are marked as @bindable. By default all matching values from the data object
+1 -1
View File
@@ -34,7 +34,7 @@ function test_client() {
session.publish('com.myapp.hello', ['Hello, world!']);
// 3) register a procedure for remoting
session.register('com.myapp.add2', myInstance.add2);
session.register('com.myapp.add2', myInstance.add2, { invoke: 'roundrobin' });
// 4) call a remote procedure
session.call<number>('com.myapp.add2', [2, 3]).then(
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for AutobahnJS v0.9.6
// Type definitions for AutobahnJS v0.9.7
// Project: http://autobahn.ws/js/
// Definitions by: Elad Zelingher <https://github.com/darkl/>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -177,6 +177,7 @@ declare namespace autobahn {
interface IRegisterOptions {
disclose_caller?: boolean;
invoke?: 'single' | 'roundrobin' | 'random' | 'first' | 'last';
}
export class Connection {
+3 -4
View File
@@ -6,8 +6,7 @@
import { Plugin, Transformer as PostcssTransformer } from 'postcss';
declare namespace autoprefixer {
export interface Options {
interface Options {
browsers?: string[];
env?: string;
cascade?: boolean;
@@ -19,11 +18,11 @@ declare namespace autoprefixer {
stats?: any;
}
export interface Transformer extends PostcssTransformer {
interface Transformer extends PostcssTransformer {
info(): string;
}
export interface Autoprefixer extends Plugin<Options> {
interface Autoprefixer extends Plugin<Options> {
(opts?: Options): Transformer;
}
}
+2 -2
View File
@@ -54,7 +54,7 @@ new Awesomplete('input[data-multiple]', {
var ajax = new XMLHttpRequest();
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
ajax.onload = () => {
var list = JSON.parse(ajax.responseText).map((i: any) => { return i.name; });
new Awesomplete(document.querySelector("#ajax-example input"), { list: list });
var list = JSON.parse(ajax.responseText).map((i: any) => i.name);
new Awesomplete(document.querySelector("#ajax-example input"), { list });
};
ajax.send();
+1 -1
View File
@@ -41,7 +41,7 @@ declare namespace Awesomplete {
type Suggestion = string | {label: string | any, value: string | any} | [string, string];
interface Options {
list?: string | string[] | Element | { label: string, value: any }[] | [string, string][];
list?: string | string[] | Element | Array<{ label: string, value: any }> | Array<[string, string]>;
minChars?: number;
maxItems?: number;
autoFirst?: boolean;
+43 -4
View File
@@ -12,11 +12,50 @@ var context: AWSLambda.Context;
var identity: AWSLambda.CognitoIdentity;
var proxyResult: AWSLambda.ProxyResult;
var snsEvt: AWSLambda.SNSEvent;
var snsEvtRecs: Array<AWSLambda.SNSEventRecord>;
var snsEvtRecs: AWSLambda.SNSEventRecord[];
var snsEvtRec: AWSLambda.SNSEventRecord;
var snsMsg: AWSLambda.SNSMessage;
var snsMsgAttr: AWSLambda.SNSMessageAttribute;
var snsMsgAttrs: AWSLambda.SNSMessageAttributes;
var S3CreateEvent: AWSLambda.S3CreateEvent = {
Records: [{
eventVersion: 'string',
eventSource: 'string',
awsRegion: 'string',
eventTime: 'string',
eventName: 'string',
userIdentity: {
principalId: 'string'
},
requestParameters: {
sourceIPAddress: 'string'
},
responseElements: {
'x-amz-request-id': 'string',
'x-amz-id-2': 'string'
},
s3: {
s3SchemaVersion: 'string',
configurationId: 'string',
bucket: {
name: 'string',
ownerIdentity: {
principalId: 'string'
},
arn: 'string'
},
object: {
key: 'string',
size: 1,
eTag: 'string',
versionId: 'string',
sequencer: 'string'
}
}
}
]
};
/* API Gateway Event */
str = apiGwEvt.body;
@@ -78,7 +117,7 @@ num = proxyResult.statusCode;
proxyResult.headers["example"] = str;
proxyResult.headers["example"] = b;
proxyResult.headers["example"] = num;
str = proxyResult.body
str = proxyResult.body;
/* Context */
b = context.callbackWaitsForEmptyEventLoop;
@@ -142,5 +181,5 @@ context.fail(error);
context.fail(str);
/* Handler */
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => {};
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => {};
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { };
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { };
+44 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for AWS Lambda
// Project: http://docs.aws.amazon.com/lambda
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>, Simon Ramsay <https://github.com/nexus-uw>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// API Gateway "event"
@@ -74,6 +74,49 @@ interface SNSEvent {
Records: Array<SNSEventRecord>;
}
/**
* S3Create event
* https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html
*/
interface S3CreateEvent {
Records: [{
eventVersion: string;
eventSource: string;
awsRegion: string
eventTime: string;
eventName: string;
userIdentity: {
principalId: string;
},
requestParameters: {
sourceIPAddress: string;
},
responseElements: {
'x-amz-request-id': string;
'x-amz-id-2': string;
},
s3: {
s3SchemaVersion: string;
configurationId: string;
bucket: {
name: string;
ownerIdentity: {
principalId: string;
},
arn: string;
},
object: {
key: string;
size: number;
eTag: string;
versionId: string;
sequencer: string;
}
}
}
];
}
// Context
// http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
interface Context {
+7
View File
@@ -0,0 +1,7 @@
import * as axel from 'axel';
axel.clear();
axel.bg(0,255,0);
axel.line(1,1,10,10);
axel.cursor.restore();
+37
View File
@@ -0,0 +1,37 @@
// Type definitions for Axel module
// Project: https://github.com/F1LT3R/axel
// Definitions by: Ruslan Molodyko <https://github.com/ruslan-molodyko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Axel {
brush: string;
rows: number;
cols: number;
cursor: cursorInterface;
lerp(p1: number, p2: number, m: number): number;
circ(x: number, y: number, m: number): number;
goto(x: number, y: number): void;
scrub(x1: number, y1: number, w: number, h: number): void;
box(x1: number, y1: number, w: number, h: number): void;
point(x: number, y: number, char: string): void;
dist(x1: number, y1: number, x2: number, y2: number): number;
line(x1: number, y1: number, x2: number, y2: number): void;
text(x: number, y: number, text: string): void;
fg(r: number, g: number, b: number): void;
bg(r: number, g: number, b: number): void;
draw(cb: Function): void;
clear(): void;
}
declare interface cursorInterface {
on(): void;
off(): void;
reset(): void;
restore(): void;
}
declare module 'axel' {
const instance: Axel;
export = instance;
}
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"axel-tests.ts",
"index.d.ts"
]
}
@@ -66,11 +66,11 @@ namespace MarionetteTests {
let regions: {[key: string]: Marionette.Region} = this.layoutView.getRegions();
let prefix: string = this.layoutView.childViewEventPrefix;
let region: Marionette.Region = this.layoutView.removeRegion('main');
let layout: Marionette.LayoutView<Backbone.Model> = this.layoutView.destroy();
let layout: Marionette.View<Backbone.Model> = this.layoutView.destroy();
}
}
class AppLayoutView extends Marionette.LayoutView<Backbone.Model> {
class AppLayoutView extends Marionette.View<Backbone.Model> {
constructor() {
super({ el: 'body' });
}
@@ -111,7 +111,7 @@ namespace MarionetteTests {
}
class MyView extends Marionette.ItemView<MyModel> {
class MyView extends Marionette.View<MyModel> {
behaviors: any;
constructor(model: MyModel) {
@@ -189,7 +189,7 @@ namespace MarionetteTests {
constructor() {
super();
this.childView = MyView;
this.childEvents = {
this.childViewEvents = {
render: function () {
console.log("a childView has been rendered");
}
+105 -231
View File
@@ -4,6 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Backbone from 'backbone';
import * as Radio from 'backbone.radio';
export as namespace Marionette;
export = Marionette;
@@ -22,8 +23,6 @@ declare module 'backbone' {
findByIndex(index: number): TView;
findByCid(cid: string): TView;
remove(view: TView): void;
call(method: any): void;
apply(method: any, args?: any[]): void;
//mixins from Collection (copied from Backbone's Collection declaration)
@@ -180,6 +179,27 @@ declare namespace Marionette {
* backbone conventions and utilities like initialize and Backbone.Events.
*/
class Object extends Backbone.Events {
/**
* Defines the Radio channel that will be used for the requests and/or events
*/
channelName: string;
/**
* Returns a Radio.Channel instance using 'channelName'
*/
getChannel(): Backbone.Radio.Channel;
/**
* Defines an events hash with the events to be listened and its respective handlers
*/
radioEvents: any;
/**
* Defines an events hash with the requests to be replied and its respective handlers
*/
radioRequests: any;
/**
* Initialize is called immediately after the Object has been instantiated,
* and is invoked with the same arguments that the constructor received.
@@ -750,7 +770,7 @@ declare namespace Marionette {
/**
* View implements a destroy method, which is called by the region managers automatically. As part of the implementation.
*/
destroy(...args: any[]): void;
destroy(...args: any[]): View<TModel>;
/**
* In several cases you need to access ui elements inside the view to
@@ -772,12 +792,37 @@ declare namespace Marionette {
triggerMethod(name: string, ...args: any[]): any;
/**
* Called on the view instance when the view has been rendered and
* displayed. This event can be used to react to when a view has been
* shown via a region. A common use case for the onShow method is to
* use it to add children views.
* Item views will serialize a model or collection, by default, by calling
* .toJSON on either the model or collection. If both a model and
* collection are attached to an item view, the model will be used as the
* data source. The results of the data serialization will be passed to
* the template that is rendered.
*
* If you need custom serialization for your data, you can provide a serializeData
* method on your view. It must return a valid JSON object, as if you had
* called .toJSON on a model or collection.
*/
onShow(): void;
serializeData(): any;
/**
* Renders the view. It is unwise to override the render method of any
* Marionette view. Instead, you should use the onBeforeRender and
* onRender callbacks to layer in additional functionality to the
* rendering of your view.
*/
render(): any;
/**
* Triggered before an ItemView is rendered.
*/
onBeforeRender(): void;
/**
* Triggered after the view has been rendered. You can implement this in
* your view to provide custom code for dealing with the view's el after
* it has been rendered.
*/
onRender(): void;
/**
* Triggered just after the view has been destroyed.
@@ -814,49 +859,65 @@ declare namespace Marionette {
isDestroyed: boolean;
supportsRenderLifecycle: boolean;
supportsDestroyLifecycle: boolean;
}
/**
* An ItemView is a view that represents a single item. That item may be
* a Backbone.Model or may be a Backbone.Collection. Whichever it is though,
* it will be treated as a single item.
*/
class ItemView<TModel extends Backbone.Model> extends View<TModel> {
constructor(options?: Backbone.ViewOptions<TModel>);
/**
* Item views will serialize a model or collection, by default, by calling
* .toJSON on either the model or collection. If both a model and
* collection are attached to an item view, the model will be used as the
* data source. The results of the data serialization will be passed to
* the template that is rendered.
*
* If you need custom serialization for your data, you can provide a serializeData
* method on your view. It must return a valid JSON object, as if you had
* called .toJSON on a model or collection.
* If you have the need to replace the Region with a region class of your
* own implementation, you can specify an alternate class to use with this
* property.
*/
serializeData(): any;
regionClass: any;
/**
* Renders the view. It is unwise to override the render method of any
* Marionette view. Instead, you should use the onBeforeRender and
* onRender callbacks to layer in additional functionality to the
* rendering of your view.
*/
render(): ItemView<TModel>;
* Regions hash or a method returning the regions hash that maps
* regions/selectors to methods on your View.
**/
regions(): any;
/** Adds a region to the layout view. */
addRegion(name: string, definition: any): Region;
/**
* Triggered before an ItemView is rendered.
* Add multiple regions as a {name: definition, name2: def2} object literal.
*/
onBeforeRender(): void;
addRegions(regions: any): any;
/** Returns a region from the layout view */
getRegion(name: string): Region;
/**
* Triggered after the view has been rendered. You can implement this in
* your view to provide custom code for dealing with the view's el after
* it has been rendered.
* Removes the region with the specified name.
* @param name the name of the region to remove.
*/
onRender(): void;
removeRegion(name: string): Region;
/** Enable easy overriding of the default `RegionManager`
* for customized region interactions and business specific
* view logic for better control over single regions.
*/
getRegionManager(): RegionManager;
/**
* Show a view into the region specified by `regionName`.
*/
showChildView(regionName: string, view: any, options?: RegionShowOptions): void;
/**
* Get the current view that is shown in the region specified by
* `regionName`.
*/
getChildView(regionName: string): Backbone.View<TModel>;
/**
* Returns all regions from the layout view. The results contains an
* Object hash that has `string`s as keys and `Region`s as values.
*/
getRegions(): {[key: string]: Region};
/**
* You can customize the event prefix for events that are forwarded through
* the layout view with this property.
*/
childViewEventPrefix: string;
}
@@ -928,12 +989,12 @@ declare namespace Marionette {
childViewEventPrefix: string;
/**
* You can specify a childEvents hash or method which allows you to
* capture all bubbling childEvents without having to manually set bindings.
* You can specify a childViewEvents hash or method which allows you to
* capture all bubbling childViewEvents without having to manually set bindings.
* The keys of the hash can either be a function or a string that is the
* name of a method on the collection view.
*/
childEvents: any;
childViewEvents: any;
/**
* When a collection has no children, and you need to render a view other than
@@ -1034,37 +1095,9 @@ declare namespace Marionette {
*/
attachHtml(collectionView: CollectionView<TModel, TView>, childView: TView, index: number): void;
/**
* The value returned by this method is the ChildView class that will be
* instantiated when a Model needs to be initially rendered. This method
* also gives you the ability to customize per Model ChildViews.
*/
getChildView<M extends Backbone.Model>(item: M): new (...args:any[]) => TView;
/**
* If you need the emptyView's class chosen dynamically, specify
* getEmptyView.
*/
getEmptyView(): any;
/** Serialize a collection by serializing each of its models. */
serializeCollection(): any;
/**
* Attaches the content of a given view.
* This method can be overridden to optimize rendering,
* or to render in a non standard way.
*
* For example, using `innerHTML` instead of `$el.html`
*
* @example
* attachElContent: function(html) {
* this.el.innerHTML = html;
* return this;
* }
*/
attachElContent(html: string): ItemView<TModel>;
/**
* Reorder DOM after sorting. When your element's rendering
* do not use their index, you can pass reorderOnSort: true
@@ -1132,165 +1165,6 @@ declare namespace Marionette {
onRemoveChild(childView: TView): void;
}
/**
* A CompositeView extends from CollectionView to be used as a composite view
* for scenarios where it should represent both a branch and leaf in a tree
* structure, or for scenarios where a collection needs to be rendered within
* a wrapper template.
*/
class CompositeView<TModel extends Backbone.Model, TView extends View<Backbone.Model>> extends CollectionView<TModel, TView> {
constructor(options?: CollectionViewOptions<TModel>);
/**
* Each childView will be rendered using the childView's template. The
* CompositeView's template is rendered and the childView's templates are
* added to this.
*/
childView: new (...args:any[]) => TView;
/**
* By default the composite view uses the same attachHtml method that the
* collection view provides. This means the view will call jQuery's
* .append to move the HTML contents from the child view instance in to
* the collection view's el.
* This is typically not very useful as a composite view will usually render
* a container DOM element in which the child views should be placed.
* This can be either a string or a function returning a string.
*/
childViewContainer: any;
/**
* Renders the view.
*/
render(): CompositeView<TModel, TView>;
/**
* Invoked before the model has been rendered
*/
onBeforeRenderTemplate(): void;
/**
* Invoked after the model has been rendered.
*/
onRenderTemplate(): void;
/**
* Invoked before the collection of models is rendered
*/
onBeforeRenderCollection(): void;
/**
* Invoked after the collection of models has been rendered
*/
onRenderCollection(): void;
}
interface LayoutViewOptions<TModel extends Backbone.Model> extends Backbone.ViewOptions<TModel> {
/**
* The LayoutView takes an additional parameter where you can pass the regions as option on creation.
*/
regions?:any;
/**
* This option removes the layoutView from the DOM before destroying the
* children preventing repaints as each option is removed. However, it
* makes it difficult to do close animations for a child view (false by
* default)
*/
destroyImmediate?: boolean;
}
/**
* A LayoutView is a hybrid of an ItemView and a collection of Region objects.
* They are ideal for rendering application layouts with multiple sub-regions
* managed by specified region managers.
* A layoutView can also act as a composite-view to aggregate multiple views
* and sub-application areas of the screen allowing applications to attach
* multiple region managers to dynamically rendered HTML.
* You can create complex views by nesting layoutView managers within Regions.
*/
class LayoutView<TModel extends Backbone.Model> extends ItemView<TModel> {
/**
* If you have the need to replace the Region with a region class of your
* own implementation, you can specify an alternate class to use with this
* property.
*/
regionClass: any;
/**
* Constructor.
* A hash that can contain a regions hash that allows you to specify regions per
* LayoutView instance.
*/
constructor(options?: LayoutViewOptions<TModel>);
/**
* Handle destroying regions, and then destroy the view itself.
*/
destroy(): LayoutView<TModel>;
/**
* Regions hash or a method returning the regions hash that maps
* regions/selectors to methods on your View.
**/
regions(): any;
/** Adds a region to the layout view. */
addRegion(name: string, definition: any): Region;
/**
* Add multiple regions as a {name: definition, name2: def2} object literal.
*/
addRegions(regions: any): any;
/** Returns a region from the layout view */
getRegion(name: string): Region;
/**
* Renders the view. It will use the existing region objects the first
* time it is called. Subsequent calls will destroy the views that the
* regions are showing and then reset the `el` for the regions to the
* newly rendered DOM elements.
*/
render(): LayoutView<TModel>;
/**
* Removes the region with the specified name.
* @param name the name of the region to remove.
*/
removeRegion(name: string): Region;
/** Enable easy overriding of the default `RegionManager`
* for customized region interactions and business specific
* view logic for better control over single regions.
*/
getRegionManager(): RegionManager;
/**
* Show a view into the region specified by `regionName`.
*/
showChildView(regionName: string, view: any, options?: RegionShowOptions): void;
/**
* Get the current view that is shown in the region specified by
* `regionName`.
*/
getChildView(regionName: string): Backbone.View<TModel>;
/**
* Returns all regions from the layout view. The results contains an
* Object hash that has `string`s as keys and `Region`s as values.
*/
getRegions(): {[key: string]: Region};
/**
* You can customize the event prefix for events that are forwarded through
* the layout view with this property.
*/
childViewEventPrefix: string;
}
interface AppRouterOptions extends Backbone.RouterOptions {
/**
* The appRoutes.
@@ -1437,7 +1311,7 @@ declare namespace Marionette {
options: any;
/**
/**
* Behaviors can have their own ui hash, which will be mixed into the ui
* hash of its associated View instance. ui elements defined on either the
* Behavior or the View will be made available within events and triggers.
+303 -305
View File
@@ -1,87 +1,87 @@
var x: BigNumber.BigNumber = new BigNumber(9)
var y = new BigNumber(x)
var x: BigNumber.BigNumber = new BigNumber(9);
var y = new BigNumber(x);
BigNumber(435.345)
BigNumber(435.345);
new BigNumber('5032485723458348569331745.33434346346912144534543')
new BigNumber('4.321e+4')
new BigNumber('-735.0918e-430')
new BigNumber(Infinity)
new BigNumber(NaN)
new BigNumber('.5')
new BigNumber('+2')
new BigNumber(-10110100.1, 2)
new BigNumber(-0b10110100)
new BigNumber('123412421.234324', 5)
new BigNumber('ff.8', 16)
new BigNumber('0xff.8')
new BigNumber('5032485723458348569331745.33434346346912144534543');
new BigNumber('4.321e+4');
new BigNumber('-735.0918e-430');
new BigNumber(Infinity);
new BigNumber(NaN);
new BigNumber('.5');
new BigNumber('+2');
new BigNumber(-10110100.1, 2);
new BigNumber(-0b10110100);
new BigNumber('123412421.234324', 5);
new BigNumber('ff.8', 16);
new BigNumber('0xff.8');
new BigNumber(9, 2)
new BigNumber(9, 2);
new BigNumber(96517860459076817.4395)
new BigNumber(96517860459076817.4395);
new BigNumber('blurgh')
new BigNumber('blurgh');
BigNumber.config({ DECIMAL_PLACES: 5 })
new BigNumber(1.23456789)
new BigNumber(1.23456789, 10)
BigNumber.config({ DECIMAL_PLACES: 5 });
new BigNumber(1.23456789);
new BigNumber(1.23456789, 10);
BigNumber.config({ DECIMAL_PLACES: 5 })
var BN = BigNumber.another({ DECIMAL_PLACES: 9 })
BigNumber.config({ DECIMAL_PLACES: 5 });
var BN = BigNumber.another({ DECIMAL_PLACES: 9 });
x = new BigNumber(1)
y = new BN(1)
x = new BigNumber(1);
y = new BN(1);
x.div(3)
y.div(3)
x.div(3);
y.div(3);
BN = BigNumber.another()
BN.config({ DECIMAL_PLACES: 9 })
BN = BigNumber.another();
BN.config({ DECIMAL_PLACES: 9 });
BigNumber.config({ DECIMAL_PLACES: 5 })
BigNumber.set({ DECIMAL_PLACES: 5 })
BigNumber.config(5)
BigNumber.config({ DECIMAL_PLACES: 5 });
BigNumber.set({ DECIMAL_PLACES: 5 });
BigNumber.config(5);
BigNumber.config({ ROUNDING_MODE: 0 })
BigNumber.config(undefined, BigNumber.ROUND_UP)
BigNumber.config({ ROUNDING_MODE: 0 });
BigNumber.config(undefined, BigNumber.ROUND_UP);
BigNumber.config({ EXPONENTIAL_AT: 2 })
new BigNumber(12.3)
new BigNumber(123)
new BigNumber(0.123)
new BigNumber(0.0123)
BigNumber.config({ EXPONENTIAL_AT: 2 });
new BigNumber(12.3);
new BigNumber(123);
new BigNumber(0.123);
new BigNumber(0.0123);
BigNumber.config({ EXPONENTIAL_AT: [-7, 20] })
new BigNumber(123456789)
new BigNumber(0.000000123)
BigNumber.config({ EXPONENTIAL_AT: [-7, 20] });
new BigNumber(123456789);
new BigNumber(0.000000123);
BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
BigNumber.config({ EXPONENTIAL_AT: 1e+9 });
BigNumber.config({ EXPONENTIAL_AT: 0 })
BigNumber.config({ EXPONENTIAL_AT: 0 });
BigNumber.config({ RANGE: 500 })
BigNumber.config().RANGE
new BigNumber('9.999e499')
new BigNumber('1e500')
new BigNumber('1e-499')
new BigNumber('1e-500')
BigNumber.config({ RANGE: 500 });
BigNumber.config().RANGE;
new BigNumber('9.999e499');
new BigNumber('1e500');
new BigNumber('1e-499');
new BigNumber('1e-500');
BigNumber.config({ RANGE: [-3, 4] })
new BigNumber(99999)
new BigNumber(100000)
new BigNumber(0.001)
new BigNumber(0.0001)
BigNumber.config({ RANGE: [-3, 4] });
new BigNumber(99999);
new BigNumber(100000);
new BigNumber(0.001);
new BigNumber(0.0001);
BigNumber.config({ ERRORS: false })
BigNumber.config({ ERRORS: false });
BigNumber.config({ CRYPTO: true })
BigNumber.config().CRYPTO
BigNumber.random()
BigNumber.config({ CRYPTO: true });
BigNumber.config().CRYPTO;
BigNumber.random();
BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
BigNumber.config({ MODULO_MODE: 9 })
BigNumber.config({ MODULO_MODE: BigNumber.EUCLID });
BigNumber.config({ MODULO_MODE: 9 });
BigNumber.config({ POW_PRECISION: 100 })
BigNumber.config({ POW_PRECISION: 100 });
BigNumber.config({
FORMAT: {
@@ -110,197 +110,195 @@ BigNumber.config({
}
});
BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80)
BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80);
var obj = BigNumber.config();
obj.ERRORS
obj.RANGE
obj.ERRORS;
obj.RANGE;
x = new BigNumber('3257869345.0378653')
BigNumber.max(4e9, x, '123456789.9')
x = new BigNumber('3257869345.0378653');
BigNumber.max(4e9, x, '123456789.9');
var arr = [12, '13', new BigNumber(14)]
BigNumber.max(arr)
var arr = [12, '13', new BigNumber(14)];
BigNumber.max(arr);
x = new BigNumber('3257869345.0378653')
BigNumber.min(4e9, x, '123456789.9')
x = new BigNumber('3257869345.0378653');
BigNumber.min(4e9, x, '123456789.9');
arr = [2, new BigNumber(-14), '-15.9999', -12]
BigNumber.min(arr)
arr = [2, new BigNumber(-14), '-15.9999', -12];
BigNumber.min(arr);
BigNumber.config({ DECIMAL_PLACES: 10 })
BigNumber.random()
BigNumber.random(20)
BigNumber.config({ DECIMAL_PLACES: 10 });
BigNumber.random();
BigNumber.random(20);
BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL })
BigNumber.config({ ROUNDING_MODE: 2 })
BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL });
BigNumber.config({ ROUNDING_MODE: 2 });
x = new BigNumber(-0.8)
y = x.absoluteValue()
var z = y.abs()
x = new BigNumber(-0.8);
y = x.absoluteValue();
var z = y.abs();
x = new BigNumber(1.3)
x.ceil()
y = new BigNumber(-1.8)
y.ceil()
x = new BigNumber(1.3);
x.ceil();
y = new BigNumber(-1.8);
y.ceil();
x = new BigNumber(Infinity)
y = new BigNumber(5)
x.comparedTo(y)
x.comparedTo(x.minus(1))
y.cmp(NaN)
y.cmp('110', 2)
x = new BigNumber(Infinity);
y = new BigNumber(5);
x.comparedTo(y);
x.comparedTo(x.minus(1));
y.cmp(NaN);
y.cmp('110', 2);
x = new BigNumber(123.45)
x.decimalPlaces()
y = new BigNumber('9.9e-101')
y.dp()
x = new BigNumber(123.45);
x.decimalPlaces();
y = new BigNumber('9.9e-101');
y.dp();
x = new BigNumber(355)
y = new BigNumber(113)
x.dividedBy(y)
x.div(5)
x.div(47, 16)
x = new BigNumber(355);
y = new BigNumber(113);
x.dividedBy(y);
x.div(5);
x.div(47, 16);
x = new BigNumber(5)
y = new BigNumber(3)
x.dividedToIntegerBy(y)
x.divToInt(0.7)
x.divToInt('0.f', 16)
x = new BigNumber(5);
y = new BigNumber(3);
x.dividedToIntegerBy(y);
x.divToInt(0.7);
x.divToInt('0.f', 16);
0 === 1e-324
x = new BigNumber(0)
x.equals('1e-324')
BigNumber(-0).eq(x)
BigNumber(255).eq('ff', 16)
0 === 1e-324;
x = new BigNumber(0);
x.equals('1e-324');
BigNumber(-0).eq(x);
BigNumber(255).eq('ff', 16);
y = new BigNumber(NaN)
y.equals(NaN)
y = new BigNumber(NaN);
y.equals(NaN);
x = new BigNumber(1.8)
x.floor()
y = new BigNumber(-1.3)
y.floor()
x = new BigNumber(1.8);
x.floor();
y = new BigNumber(-1.3);
y.floor();
0.1 > (0.3 - 0.2)
x = new BigNumber(0.1)
x.greaterThan(BigNumber(0.3).minus(0.2))
BigNumber(0).gt(x)
BigNumber(11, 3).gt(11.1, 2)
0.1 > (0.3 - 0.2);
x = new BigNumber(0.1);
x.greaterThan(BigNumber(0.3).minus(0.2));
BigNumber(0).gt(x);
BigNumber(11, 3).gt(11.1, 2);
x = new BigNumber(0.3).minus(0.2)
x.greaterThanOrEqualTo(0.1)
BigNumber(1).gte(x)
BigNumber(10, 18).gte('i', 36)
x = new BigNumber(0.3).minus(0.2);
x.greaterThanOrEqualTo(0.1);
BigNumber(1).gte(x);
BigNumber(10, 18).gte('i', 36);
x = new BigNumber(1)
x.isFinite()
y = new BigNumber(Infinity)
y.isFinite()
x = new BigNumber(1);
x.isFinite();
y = new BigNumber(Infinity);
y.isFinite();
x = new BigNumber(1)
x.isInteger()
y = new BigNumber(123.456)
y.isInt()
x = new BigNumber(1);
x.isInteger();
y = new BigNumber(123.456);
y.isInt();
x = new BigNumber(NaN)
x.isNaN()
y = new BigNumber('Infinity')
y.isNaN()
x = new BigNumber(NaN);
x.isNaN();
y = new BigNumber('Infinity');
y.isNaN();
x = new BigNumber(-0)
x.isNegative()
y = new BigNumber(2)
y.isNeg()
x = new BigNumber(-0);
x.isNegative();
y = new BigNumber(2);
y.isNeg();
x = new BigNumber(-0)
x.isZero() && x.isNeg()
y = new BigNumber(Infinity)
y.isZero()
x = new BigNumber(-0);
x.isZero() && x.isNeg();
y = new BigNumber(Infinity);
y.isZero();
x = new BigNumber(0.3).minus(0.2)
x.lessThan(0.1)
BigNumber(0).lt(x)
BigNumber(11.1, 2).lt(11, 3)
x = new BigNumber(0.3).minus(0.2);
x.lessThan(0.1);
BigNumber(0).lt(x);
BigNumber(11.1, 2).lt(11, 3);
x = new BigNumber(0.1)
x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2))
BigNumber(-1).lte(x)
BigNumber(10, 18).lte('i', 36)
x = new BigNumber(0.1);
x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2));
BigNumber(-1).lte(x);
BigNumber(10, 18).lte('i', 36);
x = new BigNumber(0.3)
x.minus(0.1)
x.sub(0.6, 20)
x = new BigNumber(0.3);
x.minus(0.1);
x.sub(0.6, 20);
x = new BigNumber(1)
x.modulo(0.9)
y = new BigNumber(33)
y.mod('a', 33)
x = new BigNumber(1);
x.modulo(0.9);
y = new BigNumber(33);
y.mod('a', 33);
x = new BigNumber(1.8)
x.negated()
y = new BigNumber(-1.3)
y.neg()
x = new BigNumber(1.8);
x.negated();
y = new BigNumber(-1.3);
y.neg();
x = new BigNumber(0.1)
y = x.plus(0.2)
BigNumber(0.7).plus(x).add(y)
x.plus('0.1', 8)
x = new BigNumber(0.1);
y = x.plus(0.2);
BigNumber(0.7).plus(x).add(y);
x.plus('0.1', 8);
x = new BigNumber(1.234)
x.precision()
y = new BigNumber(987000)
y.sd()
y.sd(true)
x = new BigNumber(1.234);
x.precision();
y = new BigNumber(987000);
y.sd();
y.sd(true);
y = new BigNumber(x)
y.round()
y.round(1)
y.round(2)
y.round(10)
y.round(0, 1)
y.round(0, 6)
y.round(1, 1)
y.round(1, BigNumber.ROUND_HALF_EVEN)
y
y = new BigNumber(x);
y.round();
y.round(1);
y.round(2);
y.round(10);
y.round(0, 1);
y.round(0, 6);
y.round(1, 1);
y.round(1, BigNumber.ROUND_HALF_EVEN);
x = new BigNumber(1.23)
x.shift(3)
x.shift(-3)
x = new BigNumber(1.23);
x.shift(3);
x.shift(-3);
x = new BigNumber(16)
x.squareRoot()
y = new BigNumber(3)
y.sqrt()
x = new BigNumber(16);
x.squareRoot();
y = new BigNumber(3);
y.sqrt();
x = new BigNumber(0.6)
y = x.times(3)
BigNumber('7e+500').times(y)
x.times('-a', 16)
x = new BigNumber(0.6);
y = x.times(3);
BigNumber('7e+500').times(y);
x.times('-a', 16);
BigNumber.config({ DECIMAL_PLACES: 5, ROUNDING_MODE: 4 })
x = new BigNumber(9876.54321)
BigNumber.config({ DECIMAL_PLACES: 5, ROUNDING_MODE: 4 });
x = new BigNumber(9876.54321);
x.toDigits()
x.toDigits(6)
x.toDigits(6, BigNumber.ROUND_UP)
x.toDigits(2)
x.toDigits(2, 1)
x
x.toDigits();
x.toDigits(6);
x.toDigits(6, BigNumber.ROUND_UP);
x.toDigits(2);
x.toDigits(2, 1);
y = new BigNumber(45.6)
y.toExponential()
y.toExponential(0)
y.toExponential(1)
y.toExponential(1, 1)
y.toExponential(3)
y = new BigNumber(45.6);
y.toExponential();
y.toExponential(0);
y.toExponential(1);
y.toExponential(1, 1);
y.toExponential(3);
y = new BigNumber(3.456)
y.toFixed()
y.toFixed(0)
y.toFixed(2)
y.toFixed(2, 1)
y.toFixed(5)
y = new BigNumber(3.456);
y.toFixed();
y.toFixed(0);
y.toFixed(2);
y.toFixed(2, 1);
y.toFixed(5);
var format = {
decimalSeparator: '.',
@@ -309,16 +307,16 @@ var format = {
secondaryGroupSize: 0,
fractionGroupSeparator: ' ',
fractionGroupSize: 0
}
BigNumber.config({ FORMAT: format })
};
BigNumber.config({ FORMAT: format });
x = new BigNumber('123456789.123456789')
x.toFormat()
x.toFormat(1)
x = new BigNumber('123456789.123456789');
x.toFormat();
x.toFormat(1);
format.groupSeparator = ' '
format.fractionGroupSize = 5
x.toFormat()
format.groupSeparator = ' ';
format.fractionGroupSize = 5;
x.toFormat();
BigNumber.config({
FORMAT: {
@@ -327,119 +325,119 @@ BigNumber.config({
groupSize: 3,
secondaryGroupSize: 2
}
})
});
x.toFormat(6)
x.toFormat(6);
x = new BigNumber(1.75)
x.toFraction()
x = new BigNumber(1.75);
x.toFraction();
var pi = new BigNumber('3.14159265358')
pi.toFraction()
pi.toFraction(100000)
pi.toFraction(10000)
pi.toFraction(100)
pi.toFraction(10)
pi.toFraction(1)
var pi = new BigNumber('3.14159265358');
pi.toFraction();
pi.toFraction(100000);
pi.toFraction(10000);
pi.toFraction(100);
pi.toFraction(10);
pi.toFraction(1);
x = new BigNumber('177.7e+457')
y = new BigNumber(235.4325)
z = new BigNumber('0.0098074')
x = new BigNumber('177.7e+457');
y = new BigNumber(235.4325);
z = new BigNumber('0.0098074');
var str = JSON.stringify([x, y, z])
var str = JSON.stringify([x, y, z]);
JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val))
JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val));
x = new BigNumber(456.789)
x.toNumber()
{ +x }
x = new BigNumber(456.789);
x.toNumber();
{ +x; }
y = new BigNumber('45987349857634085409857349856430985')
y.toNumber()
y = new BigNumber('45987349857634085409857349856430985');
y.toNumber();
z = new BigNumber(-0)
1 / +z
1 / z.toNumber()
z = new BigNumber(-0);
1 / +z;
1 / z.toNumber();
x = new BigNumber(0.7)
x.toPower(2)
BigNumber(3).pow(-2)
x = new BigNumber(0.7);
x.toPower(2);
BigNumber(3).pow(-2);
y = new BigNumber(45.6)
x.toPrecision()
y.toPrecision()
x.toPrecision(1)
y.toPrecision(1)
y.toPrecision(2, 0)
y.toPrecision(2, 1)
x.toPrecision(5)
y.toPrecision(5)
y = new BigNumber(45.6);
x.toPrecision();
y.toPrecision();
x.toPrecision(1);
y.toPrecision(1);
y.toPrecision(2, 0);
y.toPrecision(2, 1);
x.toPrecision(5);
y.toPrecision(5);
x = new BigNumber(750000)
x.toString()
BigNumber.config({ EXPONENTIAL_AT: 5 })
x.toString()
x = new BigNumber(750000);
x.toString();
BigNumber.config({ EXPONENTIAL_AT: 5 });
x.toString();
y = new BigNumber(362.875)
y.toString(2)
y.toString(9)
y.toString(32)
y = new BigNumber(362.875);
y.toString(2);
y.toString(9);
y.toString(32);
BigNumber.config({ DECIMAL_PLACES: 4 });
z = new BigNumber('1.23456789')
z.toString()
z.toString(10)
z = new BigNumber('1.23456789');
z.toString();
z.toString(10);
x = new BigNumber(123.456)
x.truncated()
y = new BigNumber(-12.3)
y.trunc()
x = new BigNumber(123.456);
x.truncated();
y = new BigNumber(-12.3);
y.trunc();
x = new BigNumber('-0')
x.toString()
x.valueOf()
y = new BigNumber('1.777e+457')
y.valueOf()
x = new BigNumber('-0');
x.toString();
x.valueOf();
y = new BigNumber('1.777e+457');
y.valueOf();
x = new BigNumber(0.123)
x.toExponential()
x.c
x.e
x.s
x = new BigNumber(0.123);
x.toExponential();
x.c;
x.e;
x.s;
z = new BigNumber('-123.4567000e+2')
z.toExponential()
z.c
z.e
z.s
z = new BigNumber('-123.4567000e+2');
z.toExponential();
z.c;
z.e;
z.s;
x = new BigNumber(3)
x instanceof BigNumber
x.isBigNumber
x = new BigNumber(3);
x instanceof BigNumber;
x.isBigNumber;
BN = BigNumber.another();
y = new BN(3)
y instanceof BigNumber
y.isBigNumber
y = new BN(3);
y instanceof BigNumber;
y.isBigNumber;
y = new BigNumber(-0)
y.c
y.e
y.s
y = new BigNumber(-0);
y.c;
y.e;
y.s;
try {
// ...
} catch (e) {
if (e instanceof Error && e.name == 'BigNumber Error') {
if (e instanceof Error && e.name === 'BigNumber Error') {
// ...
}
}
x = new BigNumber("1.0")
y = new BigNumber("1.1000")
z = x.add(y)
x = new BigNumber("1.0");
y = new BigNumber("1.1000");
z = x.add(y);
x = new BigNumber("1.20")
y = new BigNumber("3.45000")
z = x.mul(y)
x = new BigNumber("1.20");
y = new BigNumber("3.45000");
z = x.mul(y);
+79 -84
View File
@@ -10,9 +10,7 @@ export as namespace BigNumber;
export = BigNumber;
declare namespace BigNumber {
interface FormatConfig {
/**
* The decimal separator.
*/
@@ -45,9 +43,8 @@ declare namespace BigNumber {
}
interface BigNumberConfig {
/**
* The maximum number of decimal places of the results of operations involving division,
* The maximum number of decimal places of the results of operations involving division,
* i.e. division, square root and base conversion operations, and power operations with negative exponents.
*/
DECIMAL_PLACES: number;
@@ -59,56 +56,56 @@ declare namespace BigNumber {
/**
* The exponent value(s) at which `toString` returns exponential notation.
*
*
* If a single number is assigned, the value is the exponent magnitude.
*
* If an array of two numbers is assigned then the first number is the negative exponent value at and beneath which exponential notation is used,
*
* If an array of two numbers is assigned then the first number is the negative exponent value at and beneath which exponential notation is used,
* and the second number is the positive exponent value at and above which the same.
*/
EXPONENTIAL_AT: number | number[];
/**
* The exponent value(s) beyond which overflow to `Infinity` and underflow to zero occurs.
*
* If a single number is assigned, it is the maximum exponent magnitude:
* values wth a positive exponent of greater magnitude become `Infinity`
*
* If a single number is assigned, it is the maximum exponent magnitude:
* values wth a positive exponent of greater magnitude become `Infinity`
* and those with a negative exponent of greater magnitude become zero.
*
*
* If an array of two numbers is assigned then the first number is the negative exponent limit and the second number is the positive exponent limit.
*/
RANGE: number | number[];
/**
* The value that determines whether BigNumber Errors are thrown.
*
*
* If `ERRORS` is false, no errors will be thrown.
*/
ERRORS: boolean | 0 | 1;
/**
* The value that determines whether cryptographically-secure pseudo-random number generation is used.
*
* If `CRYPTO` is set to `true` then the `random` method will generate random digits using `crypto.getRandomValues` in browsers that support it,
*
* If `CRYPTO` is set to `true` then the `random` method will generate random digits using `crypto.getRandomValues` in browsers that support it,
* or `crypto.randomBytes` if using a version of Node.js that supports it.
*
*
* If neither function is supported by the host environment then attempting to set `CRYPTO` to `true` will fail, and if `ERRORS` is `true` an exception will be thrown.
*
*
* If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is assumed to generate at least `30` bits of randomness).
*/
CRYPTO: boolean | 0 | 1;
/**
* The modulo mode used when calculating the modulus: `a mod n`.
*
*
* The quotient, `q = a / n`, is calculated according to the `ROUNDING_MODE` that corresponds to the chosen `MODULO_MODE`.
*
*
* The remainder, `r`, is calculated as: `r = a - n * q`.
*/
MODULO_MODE: ModuloMode;
/**
* The maximum number of significant digits of the result of the power operation (unless a modulus is specified).
*
*
* If set to `0`, the number of signifcant digits will not be limited.
*/
POW_PRECISION: number;
@@ -116,15 +113,14 @@ declare namespace BigNumber {
/**
* The `FORMAT` object configures the format of the string returned by the toFormat method.
*/
FORMAT: Partial<FormatConfig>
FORMAT: Partial<FormatConfig>;
}
type NumberLike = number | string | BigNumber;
type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
type ModuloMode = RoundingMode | 9
type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
type ModuloMode = RoundingMode | 9;
interface BigNumberStatic {
/**
* Returns a new instance of a BigNumber object.
*/
@@ -142,7 +138,7 @@ declare namespace BigNumber {
/**
* Configures the settings for this particular BigNumber constructor.
*
*
*/
config(obj?: Partial<BigNumberConfig>): BigNumberConfig;
@@ -201,17 +197,17 @@ declare namespace BigNumber {
/**
* Returns a new BigNumber with a pseudo-random value equal to or greater than `0` and less than `1`.
*
*
* The return value will have `dp` decimal places (or less if trailing zeros are produced).
* If `dp` is omitted then the number of decimal places will default to the current `DECIMAL_PLACES` setting.
*
* Depending on the value of this BigNumber constructor's `CRYPTO` setting and the support for the `crypto` object in the host environment,
* the random digits of the return value are generated by either
* `Math.random` (fastest),
* `crypto.getRandomValues` (Web Cryptography API in recent browsers)
*
* Depending on the value of this BigNumber constructor's `CRYPTO` setting and the support for the `crypto` object in the host environment,
* the random digits of the return value are generated by either
* `Math.random` (fastest),
* `crypto.getRandomValues` (Web Cryptography API in recent browsers)
* or `crypto.randomBytes` (Node.js).
*
* If `CRYPTO` is `true`, i.e. one of the `crypto` methods is to be used,
*
* If `CRYPTO` is `true`, i.e. one of the `crypto` methods is to be used,
* the value of a returned BigNumber should be cryptographically-secure and statistically indistinguishable from a random value.
*/
random(dp?: number): BigNumber;
@@ -267,15 +263,14 @@ declare namespace BigNumber {
ROUND_HALF_FLOOR: 8;
/**
* The remainder is always positive.
*
* The remainder is always positive.
*
* Euclidian division: `q = sign(n) * floor(a / abs(n))`
*/
EUCLID: 9;
}
interface BigNumber {
/**
* Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this BigNumber.
*/
@@ -293,26 +288,26 @@ declare namespace BigNumber {
/**
* Returns
*
*
* `1` if the value of this BigNumber is greater than the value of `n`
*
*
* `-1` if the value of this BigNumber is less than the value of `n`
*
*
* `0` if this BigNumber and `n` have the same value
*
*
* `null` if the value of either this BigNumber or `n` is `NaN`
*/
comparedTo(n: NumberLike, base?: number): 1 | -1 | 0 | null;
/**
* Returns
*
*
* `1` if the value of this BigNumber is greater than the value of `n`
*
*
* `-1` if the value of this BigNumber is less than the value of `n`
*
*
* `0` if this BigNumber and `n` have the same value
*
*
* `null` if the value of either this BigNumber or `n` is `NaN`
*/
cmp(n: NumberLike, base?: number): 1 | -1 | 0 | null;
@@ -348,15 +343,15 @@ declare namespace BigNumber {
divToInt(n: NumberLike, base?: number): BigNumber;
/**
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
*
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
*
* As with JavaScript, `NaN` does not equal `NaN`.
*/
equals(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
*
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
*
* As with JavaScript, `NaN` does not equal `NaN`.
*/
eq(n: NumberLike, base?: number): boolean;
@@ -388,7 +383,7 @@ declare namespace BigNumber {
/**
* Returns `true` if the value of this BigNumber is a finite number, otherwise returns `false`.
*
*
* The only possible non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`.
*/
isFinite(): boolean;
@@ -434,12 +429,12 @@ declare namespace BigNumber {
lt(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
*/
lessThanOrEqualTo(n: NumberLike, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
*/
lte(n: NumberLike, base?: number): boolean;
@@ -455,18 +450,18 @@ declare namespace BigNumber {
/**
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer remainder of dividing this BigNumber by `n`.
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
* If it is `1` (default value), the result will have the same sign as this BigNumber,
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
* If it is `1` (default value), the result will have the same sign as this BigNumber,
* and it will match that of Javascript's `%` operator (within the limits of double precision) and BigDecimal's `remainder` method.
*/
modulo(n: NumberLike, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer remainder of dividing this BigNumber by `n`.
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
* If it is `1` (default value), the result will have the same sign as this BigNumber,
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
* If it is `1` (default value), the result will have the same sign as this BigNumber,
* and it will match that of Javascript's `%` operator (within the limits of double precision) and BigDecimal's `remainder` method.
*/
mod(n: NumberLike, base?: number): BigNumber;
@@ -493,44 +488,44 @@ declare namespace BigNumber {
/**
* Returns the number of significant digits of the value of this BigNumber.
*
*
* If `z` is `true` or `1` then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not.
*/
precision(z?: boolean | 0 | 1): number;
/**
* Returns the number of significant digits of the value of this BigNumber.
*
*
* If `z` is `true` or `1` then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not.
*/
sd(z?: boolean | 0 | 1): number;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode `rm` to a maximum of `dp` decimal places.
*
*
* If `dp` is omitted, or is `null` or `undefined`, the return value is `n` rounded to a whole number.
*
*
* If `rm` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
round(dp?: number, rm?: RoundingMode): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber shifted `n` places.
*
*
* The shift is of the decimal point, i.e. of powers of ten, and is to the left if `n` is negative or to the right if `n` is positive.
*/
shift(n: number): BigNumber;
/**
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*
*
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding.
*/
squareRoot(): BigNumber;
/**
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*
*
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding.
*/
sqrt(): BigNumber;
@@ -547,36 +542,36 @@ declare namespace BigNumber {
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to `sd` significant digits using rounding mode `rm`.
*
*
* If `sd` is omitted or is `null` or `undefined`, the return value will not be rounded.
*
*
* If `rm` is omitted or is `null` or `undefined`, ROUNDING_MODE will be used.
*/
toDigits(sd?: number, rm?: RoundingMode): BigNumber;
/**
* Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode `rm` to `dp` decimal places,
* Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode `rm` to `dp` decimal places,
* i.e with one digit before the decimal point and `dp` digits after it.
*
*
* If the value of this BigNumber in exponential notation has fewer than `dp` fraction digits, the return value will be appended with zeros accordingly.
*
*
* If `dp` is omitted, or is `null` or `undefined`, the number of digits after the decimal point defaults to the minimum number of digits necessary to represent the value exactly.
*
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
toExponential(dp?: number, rm?: RoundingMode): string;
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to `dp` decimal places using rounding mode `rm`.
*
*
* If the value of this BigNumber in normal notation has fewer than `dp` fraction digits, the return value will be appended with zeros accordingly.
*
*
* Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or equal to `10e21`, this method will always return normal notation.
*
* If `dp` is omitted or is `null` or `undefined`, the return value will be unrounded and in normal notation.
*
* If `dp` is omitted or is `null` or `undefined`, the return value will be unrounded and in normal notation.
* This is also unlike `Number.prototype.toFixed`, which returns the value to zero decimal places.
* It is useful when fixed-point notation is required and the current `EXPONENTIAL_AT` setting causes `toString` to return exponential notation.
*
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
toFixed(dp?: number, rm?: RoundingMode): string;
@@ -584,17 +579,17 @@ declare namespace BigNumber {
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to `dp` decimal places using rounding mode `rm`,
* and formatted according to the properties of the `FORMAT` object.
*
*
* If `dp` is omitted or is `null` or `undefined`, then the return value is not rounded to a fixed number of decimal places.
*
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
toFormat(dp?: number, rm?: RoundingMode): string;
/**
* Returns a string array representing the value of this BigNumber as a simple fraction with an integer numerator and an integer denominator.
* Returns a string array representing the value of this BigNumber as a simple fraction with an integer numerator and an integer denominator.
* The denominator will be a positive non-zero value less than or equal to `max`.
*
*
* If a maximum denominator, `max`, is not specified, or is `null` or `undefined`, the denominator will be the lowest value necessary to represent the number exactly.
*/
toFraction(max?: NumberLike): [string, string];
@@ -606,32 +601,32 @@ declare namespace BigNumber {
/**
* Returns the value of this BigNumber as a JavaScript number primitive.
*
*
* Type coercion with, for example, the unary plus operator will also work, except that a BigNumber with the value minus zero will be converted to positive zero.
*/
toNumber(): number;
/**
* Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo a modulus `m`.
*
*
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*/
toPower(n: number, m?: NumberLike): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo a modulus `m`.
*
*
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
*/
pow(n: number, m?: NumberLike): BigNumber;
/**
* Returns a string representing the value of this BigNumber rounded to `sd` significant digits using rounding mode `rm`.
*
*
* If `sd` is less than the number of digits necessary to represent the integer part of the value in normal (fixed-point) notation, then exponential notation is used.
*
*
* If `sd` is omitted, or is `null` or `undefined`, then the return value is the same as `n.toString()`.
*
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*/
toPrecision(sd?: number, rm?: RoundingMode): string;
+1 -1
View File
@@ -16,7 +16,7 @@ declare namespace BittorrentProtocol {
}
export interface Extension {
//tslint:disable-next-line:no-misused-new - could use class instead of interface but class is not extendible
// tslint:disable-next-line:no-misused-new - could use class instead of interface but class is not extendible
constructor(wire: Wire): this;
onHandshake?: () => void;
onExtendedHandshake?: () => void;
+2
View File
@@ -80,6 +80,8 @@ declare global {
// then: typeof Bluebird.prototype.then;
thenReturn: typeof Bluebird.prototype.thenReturn;
thenThrow: typeof Bluebird.prototype.thenThrow;
catchReturn: typeof Bluebird.prototype.catchReturn;
catchThrow: typeof Bluebird.prototype.catchThrow;
throw: typeof Bluebird.prototype.throw;
timeout: typeof Bluebird.prototype.timeout;
toJSON: typeof Bluebird.prototype.toJSON;
+9
View File
@@ -506,6 +506,15 @@ fooProm = fooProm.thenThrow(err);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
barProm = fooProm.catchReturn(bar);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// fooProm
fooProm = fooProm.catchThrow(err);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
str = fooProm.toString();
obj = fooProm.toJSON();
+31
View File
@@ -248,6 +248,37 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
throw(reason: Error): Bluebird<R>;
thenThrow(reason: Error): Bluebird<R>;
/**
* Convenience method for:
*
* <code>
* .catch(function() {
* return value;
* });
* </code>
*
* in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.catchReturn()`
*/
catchReturn<U>(value: U): Bluebird<U>;
catchReturn<U>(predicate: (error: any) => boolean, value: U): Bluebird<U | R>;
catchReturn<E extends Error, U>(ErrorClass: new (...args: any[]) => E, value: U): Bluebird<U | R>;
catchReturn<U>(predicate: Object, value: U): Bluebird<U | R>;
/**
* Convenience method for:
*
* <code>
* .catch(function() {
* throw reason;
* });
* </code>
* Same limitations apply as with `.catchReturn()`.
*/
catchThrow(reason: Error): Bluebird<R>;
catchThrow(predicate: (error: any) => boolean, reason: Error): Bluebird<R>;
catchThrow<E extends Error, U>(ErrorClass: new (...args: any[]) => E, reason: Error): Bluebird<R>;
catchThrow(predicate: Object, reason: Error): Bluebird<R>;
/**
* Convert to String.
*/
+8 -10
View File
@@ -13,36 +13,34 @@ import { Request, RequestHandler, Response } from 'express';
declare function bodyParser(options?: bodyParser.OptionsJson & bodyParser.OptionsText & bodyParser.OptionsUrlencoded): RequestHandler;
declare namespace bodyParser {
export interface Options {
interface Options {
inflate?: boolean;
limit?: number | string;
type?: string | ((req: Request) => any);
verify?: (req: Request, res: Response, buf: Buffer, encoding: string) => void;
}
export interface OptionsJson extends Options {
interface OptionsJson extends Options {
reviever?: (key: string, value: any) => any;
strict?: boolean;
}
export interface OptionsText extends Options {
interface OptionsText extends Options {
defaultCharset?: string;
}
export interface OptionsUrlencoded extends Options {
interface OptionsUrlencoded extends Options {
extended?: boolean;
parameterLimit?: number;
}
export function json(options?: OptionsJson): RequestHandler;
function json(options?: OptionsJson): RequestHandler;
export function raw(options?: Options): RequestHandler;
function raw(options?: Options): RequestHandler;
export function text(options?: OptionsText): RequestHandler;
export function urlencoded(options?: OptionsUrlencoded): RequestHandler;
function text(options?: OptionsText): RequestHandler;
function urlencoded(options?: OptionsUrlencoded): RequestHandler;
}
export = bodyParser;
+1 -1
View File
@@ -17,7 +17,7 @@ interface Bookshelf extends Bookshelf.Events<any> {
Collection: typeof Bookshelf.Collection;
plugin(name: string | string[] | Function, options?: any): Bookshelf;
transaction<T>(callback: (transaction: knex.Transaction) => T): BlueBird<T>;
transaction<T>(callback: (transaction: knex.Transaction) => BlueBird<T>): BlueBird<T>;
}
declare function Bookshelf(knex: knex): Bookshelf;
+23 -1
View File
@@ -38,7 +38,29 @@ bootbox.prompt({
console.log(result);
}
});
bootbox.prompt({
title: "This is a prompt with a set of checkbox inputs!",
inputType: 'checkbox',
inputOptions: [
{
text: 'Choice One',
value: '1',
group: 'Group 1'
},
{
text: 'Choice Two',
value: '2',
group: 'Group 1'
},
{
text: 'Choice Three',
value: '3'
}
],
callback: function (result) {
console.log(result);
}
});
bootbox.dialog({
title: "Wassup?",
+2 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for Bootbox 4.4.0
// Project: https://github.com/makeusabrew/bootbox
// Definitions by: Vincent Bortone <https://github.com/vbortone/>, Kon Pik <https://github.com/konpikwastaken/>, Anup Kattel <https://github.com/kanup/>, Dominik Schroeter <https://github.com/icereed/>, Troy McKinnon <https://github.com/trodi/>
// Definitions by: Vincent Bortone <https://github.com/vbortone/>, Kon Pik <https://github.com/konpikwastaken/>, Anup Kattel <https://github.com/kanup/>, Dominik Schroeter <https://github.com/icereed/>, Troy McKinnon <https://github.com/trodi/>, Stanny Nuytkens <https://github.com/stannynuytkens>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery" />
@@ -44,6 +44,7 @@ interface BootboxPromptOptions extends BootboxBaseOptions {
inputType?: "text" | "textarea" | "email" | "select" | "checkbox" | "date" | "time" | "number" | "password";
callback: (result: string) => any;
buttons?: BootboxConfirmPromptButtonMap;
inputOptions?: { text: string, value: string, group?: string }[];
}
/** Bootbox options available when setting defaults for modals */
+60 -44
View File
@@ -1,4 +1,4 @@
// Type definitions for Breeze 1.5.x
// Type definitions for Breeze 1.6.3
// Project: http://www.breezejs.com/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, IdeaBlade <https://github.com/IdeaBlade/Breeze/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -12,7 +12,10 @@
// Updated Jan 20 2015 for Breeze 1.5.2 and merging changes from DefinitelyTyped
// Updated Feb 28 2015 add any/all clause on Predicate
// Updated Jun 27 2016 - Marcel Good (www.ideablade.com)
// Updated Jul 28 2016 - Serkan "coni2k" Holat
// Updated Jun 29 2016 - Marcel Good (www.ideablade.com)
// Updated Jul 15 2016 - Added methods to JsonResultsAdapter - Steve Schmitt
// Updated Sep 23 2016 - Added core methods
// Updated March 5 2017 - Eliminate promises.IPromise<T> and replace with Promise<T>
declare namespace breeze.core {
@@ -89,6 +92,19 @@ declare namespace breeze.core {
export function stringStartsWith(str: string, prefix: string): boolean;
export function stringEndsWith(str: string, suffix: string): boolean;
export function formatString(format: string, ...args: any[]): string;
/** Change text to title case with spaces, e.g. 'myPropertyName12' to 'My Property Name 12' */
export function titleCase(str: string): string;
/** Return the ES5 property descriptor for the property, which may be on a prototype of the object */
export function getPropertyDescriptor(obj: any, propertyName: string): PropertyDescriptor
/** safely perform toJSON logic on objects with cycles. Replacer function can map or exclude properties. */
export function toJSONSafe(obj: any, replacer: (prop: string, val: any) => any): any
/** Default value replacer for toJSONSafe. Replaces entityAspect and other internal properties with undefined. */
export function toJSONSafeReplacer(prop: string, val: any): any
}
declare namespace breeze {
@@ -214,19 +230,23 @@ declare namespace breeze {
export class DataServiceAdapter {
checkForRecomposition(interfaceInitializedArgs: { interfaceName: string; isDefault: boolean }): void;
initialize(): void;
fetchMetadata(metadataStore: MetadataStore, dataService: DataService): breeze.promises.IPromise<any>;
executeQuery(mappingContext: { getUrl: () => string; query: EntityQuery; dataService: DataService }): breeze.promises.IPromise<any>;
saveChanges(saveContext: { resourceName: string; dataService: DataService }, saveBundle: Object): breeze.promises.IPromise<SaveResult>;
fetchMetadata(metadataStore: MetadataStore, dataService: DataService): Promise<any>;
executeQuery(mappingContext: { getUrl: () => string; query: EntityQuery; dataService: DataService }): Promise<any>;
saveChanges(saveContext: { resourceName: string; dataService: DataService }, saveBundle: Object): Promise<SaveResult>;
JsonResultsAdapter: JsonResultsAdapter;
}
export class JsonResultsAdapter {
name: string;
extractResults: (data: {}) => {};
extractSaveResults: (data: {}) => any[];
extractKeyMappings: (data: {}) => KeyMapping[];
visitNode: (node: {}, queryContext: QueryContext, nodeContext: NodeContext) => { entityType?: EntityType; nodeId?: any; nodeRefId?: any; ignore?: boolean; };
constructor(config: {
name: string;
extractResults?: (data: {}) => {};
extractSaveResults?: (data: {}) => any[];
extractKeyMappings?: (data: {}) => KeyMapping[];
visitNode: (node: {}, queryContext: QueryContext, nodeContext: NodeContext) => { entityType?: EntityType; nodeId?: any; nodeRefId?: any; ignore?: boolean; };
});
}
@@ -241,6 +261,7 @@ declare namespace breeze {
export interface NodeContext {
nodeType: string;
propertyName: string;
}
export class DataTypeSymbol extends breeze.core.EnumSymbol {
@@ -333,8 +354,8 @@ declare namespace breeze {
isNavigationPropertyLoaded(navigationProperty: string): boolean;
isNavigationPropertyLoaded(navigationProperty: NavigationProperty): boolean;
loadNavigationProperty(navigationProperty: string, callback?: Function, errorCallback?: Function): breeze.promises.IPromise<QueryResult>;
loadNavigationProperty(navigationProperty: NavigationProperty, callback?: Function, errorCallback?: Function): breeze.promises.IPromise<QueryResult>;
loadNavigationProperty(navigationProperty: string, callback?: Function, errorCallback?: Function): Promise<QueryResult>;
loadNavigationProperty(navigationProperty: NavigationProperty, callback?: Function, errorCallback?: Function): Promise<QueryResult>;
rejectChanges(): void;
@@ -423,16 +444,16 @@ declare namespace breeze {
createEntity(typeName: string, config?: {}, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity;
createEntity(entityType: EntityType, config?: {}, entityState?: EntityStateSymbol, mergeStrategy?: MergeStrategySymbol): Entity;
detachEntity(entity: Entity): boolean;
executeQuery(query: string, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): breeze.promises.IPromise<QueryResult>;
executeQuery(query: EntityQuery, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): breeze.promises.IPromise<QueryResult>;
executeQuery(query: string, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise<QueryResult>;
executeQuery(query: EntityQuery, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise<QueryResult>;
executeQueryLocally(query: EntityQuery): Entity[];
exportEntities(entities?: Entity[], includeMetadata?: boolean): string;
exportEntities(entities?: Entity[], options?: ExportEntitiesOptions): any; // string | Object
fetchEntityByKey(typeName: string, keyValue: any, checkLocalCacheFirst?: boolean): breeze.promises.IPromise<EntityByKeyResult>;
fetchEntityByKey(typeName: string, keyValues: any[], checkLocalCacheFirst?: boolean): breeze.promises.IPromise<EntityByKeyResult>;
fetchEntityByKey(entityKey: EntityKey): breeze.promises.IPromise<EntityByKeyResult>;
fetchMetadata(callback?: (schema: any) => void, errorCallback?: breeze.core.ErrorCallback): breeze.promises.IPromise<any>;
fetchEntityByKey(typeName: string, keyValue: any, checkLocalCacheFirst?: boolean): Promise<EntityByKeyResult>;
fetchEntityByKey(typeName: string, keyValues: any[], checkLocalCacheFirst?: boolean): Promise<EntityByKeyResult>;
fetchEntityByKey(entityKey: EntityKey): Promise<EntityByKeyResult>;
fetchMetadata(callback?: (schema: any) => void, errorCallback?: breeze.core.ErrorCallback): Promise<any>;
generateTempKeyValue(entity: Entity): any;
getChanges(): Entity[];
getChanges(entityTypeName: string): Entity[];
@@ -466,7 +487,7 @@ declare namespace breeze {
importEntities(exportedData: Object, config?: { mergeStrategy?: MergeStrategySymbol; metadataVersionFn?: (any: any) => void }): { entities: Entity[]; tempKeyMapping: { [key: string]: EntityKey } };
rejectChanges(): Entity[];
saveChanges(entities?: Entity[], saveOptions?: SaveOptions, callback?: SaveChangesSuccessCallback, errorCallback?: SaveChangesErrorCallback): breeze.promises.IPromise<SaveResult>;
saveChanges(entities?: Entity[], saveOptions?: SaveOptions, callback?: SaveChangesSuccessCallback, errorCallback?: SaveChangesErrorCallback): Promise<SaveResult>;
setProperties(config: EntityManagerProperties): void;
}
@@ -554,7 +575,7 @@ declare namespace breeze {
/** Create query from an expression tree */
constructor(tree: Object);
execute(callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): breeze.promises.IPromise<QueryResult>;
execute(callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise<QueryResult>;
executeLocally(): Entity[];
expand(propertyPaths: string[]): EntityQuery;
expand(propertyPaths: string): EntityQuery;
@@ -591,6 +612,8 @@ declare namespace breeze {
where(property: string, filterop: FilterQueryOpSymbol, property2: string, filterop2: FilterQueryOpSymbol, value: any): EntityQuery; // for any/all clauses
where(property: string, filterop: string, property2: string, filterop2: string, value: any): EntityQuery; // for any/all clauses
where(predicate: FilterQueryOpSymbol): EntityQuery;
where(anArray: IRecursiveArray<string | number | FilterQueryOpSymbol | Predicate>): EntityQuery;
withParameters(params: Object): EntityQuery;
toJSON(): string;
@@ -721,13 +744,14 @@ declare namespace breeze {
addDataService(dataService: DataService, shouldOverwrite?: boolean): void;
addEntityType(structuralType: IStructuralType): void;
exportMetadata(): string;
fetchMetadata(dataService: string, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): breeze.promises.IPromise<any>;
fetchMetadata(dataService: DataService, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): breeze.promises.IPromise<any>;
fetchMetadata(dataService: string, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): Promise<any>;
fetchMetadata(dataService: DataService, callback?: (data: any) => void, errorCallback?: breeze.core.ErrorCallback): Promise<any>;
getDataService(serviceName: string): DataService;
getEntityType(entityTypeName: string, okIfNotFound?: boolean): IStructuralType;
getEntityTypes(): IStructuralType[];
hasMetadataFor(serviceName: string): boolean;
static importMetadata(exportedString: string): MetadataStore;
static normalizeTypeName(typeName: string): string;
importMetadata(exportedString: string, allowMerge?: boolean): MetadataStore;
isEmpty(): boolean;
registerEntityTypeCtor(entityTypeName: string, entityCtor: Function, initializationFn?: (entity: Entity) => void, noTrackingFn?: (node: Object, entityType: EntityType) => Object): void;
@@ -796,7 +820,7 @@ declare namespace breeze {
export interface IRecursiveArray<T> {
[i: number]: T | IRecursiveArray<T>;
}
export class Predicate {
constructor();
constructor(property: string, operator: string, value: any);
@@ -904,10 +928,16 @@ declare namespace breeze {
export interface SaveResult {
entities: Entity[];
keyMappings: any;
keyMappings: KeyMapping[];
XHR: XMLHttpRequest;
}
export interface KeyMapping {
entityTypeName: string;
tempValue: any;
realValue: any;
}
export class ValidationError {
key: string;
context: any;
@@ -993,7 +1023,7 @@ declare namespace breeze {
/** Creates a regular expression validator with a fixed expression. */
static makeRegExpValidator(validatorName: string, expression: RegExp, defaultMessage: string, context?: any): Validator;
/** Run this validator against the specified value.
/** Run this validator against the specified value.
@param value {Object} Value to validate
@param additionalContext {Object} Any additional contextual information that the Validator can make use of.
@return {ValidationError|null} A ValidationError if validation fails, null otherwise */
@@ -1044,20 +1074,16 @@ declare namespace breeze.config {
@return {an instance of the specified adapter}
**/
export function getAdapterInstance(interfaceName: string, adapterName?: string): Object;
export interface Adapter {
getRoutePrefix: Function
}
/**
Initializes a single adapter implementation. Initialization means either newing a instance of the
Initializes a single adapter implementation. Initialization means either newing a instance of the
specified interface and then calling "initialize" on it or simply calling "initialize" on the instance
if it already exists.
@param interfaceName {String} The name of the interface to which the adapter to initialize belongs.
@param adapterName {String} - The name of a previously registered adapter to initialize.
@param isDefault=true {Boolean} - Whether to make this the default "adapter" for this interface.
@param isDefault=true {Boolean} - Whether to make this the default "adapter" for this interface.
@return {an instance of the specified adapter}
**/
export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): Adapter;
export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault?: boolean): Object;
export interface AdapterInstancesConfig {
/** the name of a previously registered "ajax" adapter */
@@ -1080,15 +1106,15 @@ declare namespace breeze.config {
export var objectRegistry: Object;
/**
Method use to register implementations of standard breeze interfaces. Calls to this method are usually
made as the last step within an adapter implementation.
made as the last step within an adapter implementation.
@param interfaceName {String} - one of the following interface names "ajax", "dataService" or "modelLibrary"
@param adapterCtor {Function} - an ctor function that returns an instance of the specified interface.
@param adapterCtor {Function} - an ctor function that returns an instance of the specified interface.
**/
export function registerAdapter(interfaceName: string, adapterCtor: Function): void;
export function registerFunction(fn: Function, fnName: string): void;
export function registerType(ctor: Function, typeName: string): void;
//static setProperties(config: Object): void; //deprecated
/**
/**
Set the promise implementation, if Q.js is not found.
@param q - implementation of promise. @see http://wiki.commonjs.org/wiki/Promises/A
*/
@@ -1101,27 +1127,17 @@ declare namespace breeze.config {
/** Promises interface used by Breeze. Usually implemented by Q (https://github.com/kriskowal/q) or angular.$q using breeze.config.setQ(impl) */
declare namespace breeze.promises {
export interface IPromise<T> {
then<U>(onFulfill: (value: T) => U, onReject?: (reason: any) => U): IPromise<U>;
then<U>(onFulfill: (value: T) => IPromise<U>, onReject?: (reason: any) => U): IPromise<U>;
then<U>(onFulfill: (value: T) => U, onReject?: (reason: any) => IPromise<U>): IPromise<U>;
then<U>(onFulfill: (value: T) => IPromise<U>, onReject?: (reason: any) => IPromise<U>): IPromise<U>;
catch<U>(onRejected: (reason: any) => U): IPromise<U>;
catch<U>(onRejected: (reason: any) => IPromise<U>): IPromise<U>;
finally(finallyCallback: () => any): IPromise<T>;
}
export interface IDeferred<T> {
promise: IPromise<T>;
promise: Promise<T>;
resolve(value: T): void;
reject(reason: any): void;
}
export interface IPromiseService {
defer<T>(): IDeferred<T>;
reject(reason?: any): IPromise<any>;
resolve<T>(object: T): IPromise<T>;
resolve<T>(object: IPromise<T>): IPromise<T>;
reject(reason?: any): Promise<any>;
resolve<T>(object: T): Promise<T>;
resolve<T>(object: Promise<T>): Promise<T>;
}
}
-2
View File
@@ -3,8 +3,6 @@
// Definitions by: Roman Samec <https://github.com/rsamec>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="q" />
declare namespace Validation {
interface IErrorCustomMessage {
(config: any, args: any): string;
-1
View File
@@ -4,7 +4,6 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Source: typings/business-rules-engine/Validation.d.ts
/// <reference types="q" />
import * as Q from "q";
-1
View File
@@ -3,7 +3,6 @@
// Definitions by: Roman Samec <https://github.com/rsamec>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="q" />
/// <reference types="node" />
import Validation = require("business-rules-engine");
+3
View File
@@ -11,6 +11,9 @@
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+3 -1
View File
@@ -368,7 +368,9 @@ function line_examples() {
data: {},
line: {
connectNull: true,
step_type: "step-after"
step: {
type: "step-after"
}
}
});
}
+3 -1
View File
@@ -145,7 +145,9 @@ declare namespace c3 {
/**
* Change step type for step chart. 'step', 'step-before' and 'step-after' can be used.
*/
step_type?: string;
step?: {
type: string;
};
};
area?: {
+2 -2
View File
@@ -413,16 +413,16 @@ declare namespace Chart {
}
export interface TimeScale extends ChartScales {
format?: string;
displayFormats?: TimeDisplayFormat;
isoWeekday?: boolean;
max?: string;
min?: string;
parser?: string | ((arg: any) => any);
round?: string;
round?: TimeUnit;
tooltipFormat?: string;
unit?: TimeUnit;
unitStepSize?: number;
minUnit?: TimeUnit;
}
export interface RadialLinearScale {
@@ -0,0 +1,14 @@
import { Configuration } from 'webpack';
import CompressionPlugin = require('compression-webpack-plugin');
const c: Configuration = {
plugins: [
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.js$|\.html$/,
threshold: 10240,
minRatio: 0.8
})
]
};
+40
View File
@@ -0,0 +1,40 @@
// Type definitions for compression-webpack-plugin 0.3
// Project: https://github.com/webpack-contrib/compression-webpack-plugin
// Definitions by: Anton Kandybo <https://github.com/dublicator>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Plugin } from 'webpack';
export = CompressionPlugin;
declare class CompressionPlugin extends Plugin {
constructor(options?: CompressionPlugin.Options);
}
declare namespace CompressionPlugin {
export interface Options {
asset?: string;
algorithm?: string;
test?: RegExp | RegExp[];
regExp?: RegExp | RegExp[];
threshold?: number;
minRatio?: number;
// zopfli options
verbose?: boolean;
verbose_more?: boolean;
numiterations?: number;
blocksplitting?: boolean;
blocksplittinglast?: boolean;
blocksplittingmax?: number;
// zlib options
level?: number;
flush?: number;
chunkSize?: number;
windowBits?: number;
memLevel?: number;
strategy?: number;
dictionary?: any;
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"compression-webpack-plugin-tests.ts"
]
}
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../tslint.json"
}
+4 -7
View File
@@ -3,14 +3,11 @@
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery" />
/// <reference types="q" />
interface Cordova {
getAppVersion: {
getAppName: () => Q.IPromise<string> & JQueryPromise<string>;
getPackageName: () => Q.IPromise<string> & JQueryPromise<string>;
getVersionCode: () => Q.IPromise<string> & JQueryPromise<string>;
getVersionNumber: () => Q.IPromise<string> & JQueryPromise<string>;
getAppName: () => Promise<string>;
getPackageName: () => Promise<string>;
getVersionCode: () => Promise<string>;
getVersionNumber: () => Promise<string>;
};
}
+85 -83
View File
@@ -3,95 +3,97 @@
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="q" />
import * as Q from "q";
interface CordovaPlugins {
locationManager: BeaconPlugin.LocationManager;
}
declare namespace BeaconPlugin {
/**
* Beacon Plugin.
*/
export interface LocationManager {
delegate: Delegate;
BeaconRegion: BeaconRegion;
Region: Region;
onDomDelegateReady(): Q.Promise<void>;
startMonitoringForRegion(region: Region): Q.Promise<void>;
stopMonitoringForRegion(region: Region): Q.Promise<void>;
requestStateForRegion(region: Region): Q.Promise<void>;
startRangingBeaconsInRegion(region: Region): Q.Promise<void>;
stopRangingBeaconsInRegion(region: Region): Q.Promise<void>;
getAuthorizationStatus(): Q.Promise<PluginResult>;
requestWhenInUseAuthorization(): Q.Promise<void>;
requestAlwaysAuthorization(): Q.Promise<void>;
getMonitoredRegions(): Q.Promise<Region[]>;
getRangedRegions(): Q.Promise<Region[]>;
isRangingAvailable(): Q.Promise<boolean>;
isMonitoringAvailableForClass(region: Region): Q.Promise<boolean>;
startAdvertising(region: Region, measuredPower: boolean): Q.Promise<void>;
stopAdvertising(): Q.Promise<void>;
isAdvertisingAvailable(): Q.Promise<boolean>;
isAdvertising(): Q.Promise<boolean>;
disableDebugLogs(): Q.Promise<void>;
enableDebugNotifications(): Q.Promise<void>;
disableDebugNotifications(): Q.Promise<void>;
enableDebugLogs(): Q.Promise<void>;
isBluetoothEnabled(): Q.Promise<boolean>;
enableBluetooth(): Q.Promise<void>;
disableBluetooth(): Q.Promise<void>;
appendToDeviceLog(message: string): Q.Promise<string>;
declare global {
interface CordovaPlugins {
locationManager: BeaconPlugin.LocationManager;
}
export interface PluginResult {
eventType: string;
region: Region;
beacons: Beacon[];
authorizationStatus: string;
state: string;
error: string;
}
namespace BeaconPlugin {
/**
* Beacon Plugin.
*/
export interface LocationManager {
delegate: Delegate;
BeaconRegion: BeaconRegion;
Region: Region;
onDomDelegateReady(): Q.Promise<void>;
startMonitoringForRegion(region: Region): Q.Promise<void>;
stopMonitoringForRegion(region: Region): Q.Promise<void>;
requestStateForRegion(region: Region): Q.Promise<void>;
startRangingBeaconsInRegion(region: Region): Q.Promise<void>;
stopRangingBeaconsInRegion(region: Region): Q.Promise<void>;
getAuthorizationStatus(): Q.Promise<PluginResult>;
requestWhenInUseAuthorization(): Q.Promise<void>;
requestAlwaysAuthorization(): Q.Promise<void>;
getMonitoredRegions(): Q.Promise<Region[]>;
getRangedRegions(): Q.Promise<Region[]>;
isRangingAvailable(): Q.Promise<boolean>;
isMonitoringAvailableForClass(region: Region): Q.Promise<boolean>;
startAdvertising(region: Region, measuredPower: boolean): Q.Promise<void>;
stopAdvertising(): Q.Promise<void>;
isAdvertisingAvailable(): Q.Promise<boolean>;
isAdvertising(): Q.Promise<boolean>;
disableDebugLogs(): Q.Promise<void>;
enableDebugNotifications(): Q.Promise<void>;
disableDebugNotifications(): Q.Promise<void>;
enableDebugLogs(): Q.Promise<void>;
isBluetoothEnabled(): Q.Promise<boolean>;
enableBluetooth(): Q.Promise<void>;
disableBluetooth(): Q.Promise<void>;
appendToDeviceLog(message: string): Q.Promise<string>;
}
export interface Delegate {
didDetermineStateForRegion(pluginResult: PluginResult): void;
didStartMonitoringForRegion(pluginResult: PluginResult): void;
didExitRegion(pluginResult: PluginResult): void;
didEnterRegion(pluginResult: PluginResult): void;
didRangeBeaconsInRegion(pluginResult: PluginResult): void;
peripheralManagerDidStartAdvertising(pluginResult: PluginResult): void;
peripheralManagerDidUpdateState(pluginResult: PluginResult): void;
didChangeAuthorizationStatus(authorizationStatus: string): void;
monitoringDidFailForRegionWithError(pluginResult: PluginResult): void;
}
export interface PluginResult {
eventType: string;
region: Region;
beacons: Beacon[];
authorizationStatus: string;
state: string;
error: string;
}
export interface Region {
identifier: string;
new (identifier: string): Region;
}
export interface Delegate {
didDetermineStateForRegion(pluginResult: PluginResult): void;
didStartMonitoringForRegion(pluginResult: PluginResult): void;
didExitRegion(pluginResult: PluginResult): void;
didEnterRegion(pluginResult: PluginResult): void;
didRangeBeaconsInRegion(pluginResult: PluginResult): void;
peripheralManagerDidStartAdvertising(pluginResult: PluginResult): void;
peripheralManagerDidUpdateState(pluginResult: PluginResult): void;
didChangeAuthorizationStatus(authorizationStatus: string): void;
monitoringDidFailForRegionWithError(pluginResult: PluginResult): void;
}
export interface BeaconRegion extends Region {
uuid: string;
major: string;
minor: string;
notifyEntryStateOnDisplay: boolean;
new (identifier: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion;
}
export interface Region {
identifier: string;
new (identifier: string): Region;
}
export interface CircularRegion extends Region {
latitude: number;
longitude: number;
radius: number;
new (identifier: string, latitude: number, longitude: number, radius: number): CircularRegion;
}
export interface BeaconRegion extends Region {
uuid: string;
major: string;
minor: string;
notifyEntryStateOnDisplay: boolean;
new (identifier: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion;
}
export interface Beacon {
uuid: string;
major: string;
minor: string;
proximity: string;
tx: number;
rssi: number;
accuracy: number;
export interface CircularRegion extends Region {
latitude: number;
longitude: number;
radius: number;
new (identifier: string, latitude: number, longitude: number, radius: number): CircularRegion;
}
export interface Beacon {
uuid: string;
major: string;
minor: string;
proximity: string;
tx: number;
rssi: number;
accuracy: number;
}
}
}
}
+3
View File
@@ -12,6 +12,9 @@
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+5
View File
@@ -0,0 +1,5 @@
import csprng = require("csprng");
let rngStr: string;
rngStr = csprng(32, 16);
+7
View File
@@ -0,0 +1,7 @@
// Type definitions for csprng 0.1
// Project: https://github.com/jcoglan/node-csprng
// Definitions by: Wink Saville <https://github.com/winksaville>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = csprng;
declare function csprng(bits: number, radix: number): string;
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -17,6 +17,6 @@
},
"files": [
"index.d.ts",
"numbro-tests.ts"
"csprng-tests.ts"
]
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}
@@ -62,7 +62,7 @@ hook({ extensions: ['.scss', '.sass'] });
hook({ ignore: (file: string) => false });
hook({ ignore: 'unused' });
hook({ ignore: /\.test\.(css|scss|sass)/$ });
hook({ ignore: /\.test\.(css|scss|sass)$/ });
//
// https://github.com/css-modules/css-modules-require-hook/blob/master/README.md#preprocesscss-function
+11 -1
View File
@@ -19,6 +19,11 @@ function StepSample() {
console.log(scenarioResult.status === "failed");
callback();
});
Before({ timeout: 1000 }, function (scenarioResult: HookScenarioResult, callback: Callback) {
console.log(scenarioResult.status === "failed");
callback();
});
Around(function (scenarioResult: HookScenarioResult, runScenario: (error: string, callback?: Function) => void) {
scenarioResult.status === "failed" && runScenario(null, function () {
@@ -30,6 +35,11 @@ function StepSample() {
console.log("After");
callback();
});
After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback?: Callback) => {
console.log("After");
callback();
});
registerHandler('AfterFeatures', function (event: any, callback: Function) {
callback();
@@ -123,4 +133,4 @@ function registerListener(): cucumber.EventListener {
});
return listener;
}
}
+9 -3
View File
@@ -1,6 +1,6 @@
// Type definitions for cucumber-js v2.0.0
// Project: https://github.com/cucumber/cucumber-js
// Definitions by: Abraão Alves <https://github.com/abraaoalves>, Jan Molak <https://github.com/jan-molak>
// Definitions by: Abraão Alves <https://github.com/abraaoalves>, Jan Molak <https://github.com/jan-molak>, Isaiah Soung <https://github.com/isoung>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = cucumber;
@@ -61,9 +61,15 @@ declare namespace cucumber {
typeName: string;
}
interface HookOptions{
timeout?: number;
}
export interface Hooks {
Before(code: HookCode): void;
After(code: HookCode): void;
Before(options: HookOptions, code: HookCode): void;
After(code: HookCode): void;
After(options: HookOptions, code: HookCode): void;
Around(code: AroundCode): void;
setDefaultTimeout(time: number): void;
setWorldConstructor(world: (() => void) | ({})): void;
@@ -253,4 +259,4 @@ declare namespace cucumber {
export class JsonFormatter extends Formatter {
}
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for detect-browser v1.3.3
// Type definitions for detect-browser v1.6.2
// Project: https://github.com/DamonOehlman/detect-browser
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -6,7 +6,7 @@
/**
* Browser name
*/
export const name: string;
export const name: "edge" | "yandexbrowser" | "chrome" | "crios" | "firefox" | "opera" | "ie" | "bb10" | "android" | "ios" | "safari";
/**
* Browser version
+3
View File
@@ -0,0 +1,3 @@
import resolve = require("dir-resolve");
resolve("module/package");
+7
View File
@@ -0,0 +1,7 @@
// Type definitions for dir-resolve 1.0
// Project: https://github.com/mwinche/dir-resolve
// Definitions by: Andy Hanson <https://github.com/andy-ms>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function resolve(path: string): string;
export = resolve;
+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",
"dir-resolve-tests.ts"
]
}
-1
View File
@@ -3,7 +3,6 @@
// Definitions by: Karl Düüna <https://github.com/DeadAlready/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="q" />
/// <reference types="node" />
import stream = require('stream');
+3
View File
@@ -11,6 +11,9 @@
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+7 -3
View File
@@ -1,6 +1,6 @@
// Type definitions for Electron v1.4.8
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>, aliib <https://github.com/aliib>, Daniel Perez Alvarez <https://github.com/unindented>
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>, aliib <https://github.com/aliib>, Daniel Perez Alvarez <https://github.com/unindented>, Markus Olsson <https://github.com/niik>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -2455,7 +2455,11 @@ declare namespace Electron {
*/
constructor(options: MenuItemOptions);
click: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void;
/**
* A function that is fired when the MenuItem receives a click event
*/
click: (event: Event, browserWindow: BrowserWindow, webContents: WebContents) => void;
/**
* Read-only property.
*/
@@ -2492,7 +2496,7 @@ declare namespace Electron {
/**
* Callback when the menu item is clicked.
*/
click?: (menuItem: MenuItem, browserWindow: BrowserWindow) => void;
click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void;
/**
* Can be normal, separator, submenu, checkbox or radio.
*/
+11 -4
View File
@@ -531,12 +531,19 @@ var winWindows = new BrowserWindow({
// menu-item
// https://github.com/atom/electron/blob/master/docs/api/menu-item.md
var menuItem = new MenuItem({});
var menuItem = new MenuItem({
click: (menuItem: Electron.MenuItem, browserWindow: Electron.BrowserWindow, event: Electron.Event) => {
console.log('click', menuItem, browserWindow, event);
}
});
const fakeEvent: Electron.Event = {
preventDefault: () => { },
sender: winWindows.webContents,
}
menuItem.label = 'Hello World!';
menuItem.click = (menuItem, browserWindow) => {
console.log('click', menuItem, browserWindow);
};
menuItem.click(fakeEvent, winWindows, winWindows.webContents)
// menu
// https://github.com/atom/electron/blob/master/docs/api/menu.md
+14
View File
@@ -37,6 +37,13 @@ namespace ShallowWrapperTest {
elementWrapper: ShallowWrapper<HTMLAttributes<{}>, {}>,
statelessWrapper: ShallowWrapper<StatelessProps, never>;
function test_props_state_inferring() {
let wrapper: ShallowWrapper<MyComponentProps, MyComponentState>;
wrapper = shallow(<MyComponent stringProp="value" />);
wrapper.state().stateProperty;
wrapper.props().stringProp.toUpperCase();
}
function test_shallow_options() {
shallow(<MyComponent stringProp="1"/>, {
context: {
@@ -337,6 +344,13 @@ namespace ReactWrapperTest {
elementWrapper: ReactWrapper<HTMLAttributes<{}>, {}>,
statelessWrapper: ReactWrapper<StatelessProps, never>;
function test_prop_state_inferring() {
let wrapper: ReactWrapper<MyComponentProps, MyComponentState>;
wrapper = mount(<MyComponent stringProp="value" />);
wrapper.state().stateProperty;
wrapper.props().stringProp.toUpperCase();
}
function test_unmount() {
reactWrapper = reactWrapper.unmount();
}
+2
View File
@@ -546,6 +546,7 @@ export interface MountRendererProps {
* @param node
* @param [options]
*/
export function shallow<P>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, any>;
export function shallow<P, S>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, S>;
/**
@@ -553,6 +554,7 @@ export function shallow<P, S>(node: ReactElement<P>, options?: ShallowRendererPr
* @param node
* @param [options]
*/
export function mount<P>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, any>;
export function mount<P, S>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, S>;
/**
+3
View File
@@ -11,6 +11,9 @@
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+2
View File
@@ -161,6 +161,8 @@ interface CookieOptions {
path?: string;
domain?: string;
secure?: boolean | 'auto';
encode?: (val: string) => void;
sameSite?: boolean | string;
}
interface Errback { (err: Error): void; }
+48
View File
@@ -0,0 +1,48 @@
import * as fetchJsonp from 'fetch-jsonp';
/* Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/README.md */
fetchJsonp('/users.jsonp')
.then(function(response) {
return response.json()
}).then(function(json) {
console.log('parsed json', json)
}).catch(function(ex) {
console.log('parsing failed', ex)
})
fetchJsonp('/users.jsonp', {
jsonpCallback: 'custom_callback'
})
.then(function(response) {
return response.json()
}).then(function(json) {
console.log('parsed json', json)
}).catch(function(ex) {
console.log('parsing failed', ex)
})
fetchJsonp('/users.jsonp', {
timeout: 3000,
jsonpCallback: 'custom_callback'
})
.then(function(response) {
return response.json()
}).then(function(json) {
console.log('parsed json', json)
}).catch(function(ex) {
console.log('parsing failed', ex)
})
// Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/examples/index.html
var result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gne?format=json', {
jsonpCallback: 'jsoncallback',
timeout: 3000
})
result.then(function(response) {
return response.json()
}).then(function(json) {
document.body.innerHTML = JSON.stringify(json);
})['catch'](function(ex) {
document.body.innerHTML = 'failed:' + ex;
})
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for fetch-jsonp 1.0
// Project: https://github.com/camsong/fetch-jsonp
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare namespace fetchJsonp {
interface Options {
timeout?: number;
jsonpCallback?: string;
}
}
declare function fetchJsonp(url: RequestInfo, options?: fetchJsonp.Options): Promise<Response>;
export = fetchJsonp;
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"module": "commonjs",
"lib": ["es6", "dom"],
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noImplicitThis": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true
},
"files": [
"index.d.ts",
"fetch-jsonp-tests.ts"
]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "../tslint.json",
"rules": {
"only-arrow-functions-2": false
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/wheresrhys/fetch-mock
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>, Tamir Duberstein <https://github.com/tamird>, Risto Keravuori <https://github.com/merrywhether>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="whatwg-fetch" />
// TypeScript Version: 2.2
type MockRequest = Request | RequestInit;
+7 -7
View File
@@ -19,16 +19,16 @@ var client = new FirebaseClient({
var newUser:User = new User();
newUser.name = {
first: "Fred",
last: "Flinstone"
last: "Flinstone"
};
client.push("users", newUser)
.then(function (result){
console.log(result.name);
var newUser2:User = new User();
newUser2.name = {
first: "Fred",
last: "Rockington"
newUser2.name = {
first: "Fred",
last: "Rockington"
}
return client.update("users/" + result.name, newUser2);
}).then(function (result){
@@ -36,15 +36,15 @@ client.push("users", newUser)
var newUser3:User = new User();
newUser3.name = {
first: "Axe",
last: "Steel"
last: "Steel"
};
return client.set("users/AXESTEEL", newUser3);
}).then(function (result){
console.log(result.name.first);
return client.get();
}).then(function (result){
}).then(function (result){
console.log(result);
return client.get<User>("users/AXESTEEL")
}).then(function (result){
console.log(result.name.first);
console.log(result.name.first);
});
+10 -12
View File
@@ -3,7 +3,7 @@
// Definitions by: Andrew Breen <https://github.com/fpsscarecrow/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="q" />
import * as Q from "q";
interface PushResponse {
/**
@@ -17,7 +17,7 @@ interface FirebaseConfig {
* path for the Firebase instance
*/
url : string;
/**
* Token for authorisation
*/
@@ -29,38 +29,38 @@ interface FirebaseClient {
* Creates a new FirebaseClient given the provided configuration
*/
new (config : FirebaseConfig) : FirebaseClient;
/**
* Retrieves all objects at the base path
*/
get<T>() : Q.Promise<T>;
/**
* Retrieves an object
* @param path Relative path from the base for the resource
*/
get<T>(path : string) : Q.Promise<T>;
/**
* Returns a promise of the HTTP response from setting the value at the given path
* @param path Relative path from the base for the resource
* @param data Data to be set as the value for the given path
*/
set<T>(path : string, data : T) : Q.Promise<T>;
/**
* Update a node at a given path
* @param path Relative path from the base for the resource
* @param value Value of the response
*/
update<T>(path : string, value : T) : Q.Promise<T>;
/**
* Deletes the resource at a given path
* @param path Relative path from the base for the resource
*/
delete(path : string) : Q.Promise<void>;
/**
* @param path Relative path from the base for the resource
* @param value Object to push to the path
@@ -70,7 +70,5 @@ interface FirebaseClient {
declare var FirebaseClient: FirebaseClient;
declare module 'firebase-client' {
export = FirebaseClient;
}
export = FirebaseClient;
export as namespace FirebaseClient;
+3
View File
@@ -12,6 +12,9 @@
"typeRoots": [
"../"
],
"paths": {
"q": [ "q/v0" ]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+42
View File
@@ -0,0 +1,42 @@
import * as Board from 'firmata'
function test_basic_board()
{
let board = new Board('');
}
function test_board_with_callback()
{
let board = new Board('', (error: any) =>
{
board.pinMode(13, board.MODES.OUTPUT);
board.pinMode(12, Board.PIN_MODE.OUTPUT);
});
}
function test_board_with_listener()
{
let board = new Board('');
board.on('ready', () =>
{
board.pinMode(13, board.MODES.OUTPUT);
board.pinMode(12, Board.PIN_MODE.OUTPUT);
});
}
function test_class_extension()
{
class MyBoard extends Board
{
Disconnect()
{
this.transport.close((error: any) => {});
}
}
let myBoard: MyBoard = new MyBoard('', () =>
{
myBoard.Disconnect();
});
}
+303
View File
@@ -0,0 +1,303 @@
// Type definitions for firmata.js 0.15
// Project: https://github.com/firmata/firmata.js
// Definitions by: Troy W. <https://github.com/troywweber7, https://bitbucket.org/troywweber/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as SerialPort from 'serialport'
export = Board;
/**
* Most of these are generated by observing https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js.
*
* This is a starting point that appeared to work fine for months within a project of my company, but I give no
* guarantee that it cannot be improved.
*/
declare class Board extends NodeJS.EventEmitter
{
constructor(serialPort: string, callback?: (error: any) => void)
MODES: Board.PinModes;
STEPPER: Board.StepperConstants;
I2C_MODES: Board.I2cModes;
SERIAL_MODES: Board.SerialModes;
SERIAL_PORT_IDs: Board.SerialPortIds;
SERIAL_PIN_TYPES: Board.SerialPinTypes;
HIGH: Board.PIN_STATE;
LOW: Board.PIN_STATE;
pins: Board.Pins[];
ports: number[];
analogPins: number[];
version: Board.Version;
firmware: Board.Firmware;
settings: Board.Settings;
protected transport: SerialPort;
reportVersion(callback: () => void): void
queryFirmware(callback: () => void): void
analogRead(pin: number, callback: (value: number) => void): void
analogWrite(pin: number, value: number): void
pwmWrite(pin: number, value: number): void
servoConfig(pin: number, min: number, max: number): void
servoWrite(pin: number, value: number): void
pinMode(pin: number, mode: Board.PIN_MODE): void
digitalWrite(pin: number, val: Board.PIN_STATE): void
digitalRead(pin: number, callback: (val: Board.PIN_STATE) => void): void
queryCapabilities(callback: () => void): void
queryAnalogMapping(callback: () => void): void
queryPinState(pin: number, callback: () => void): void
// TODO untested --- TWW
sendString(str: string): void
// TODO untested --- TWW
sendI2CConfig(delay: number): void
// TODO untested --- TWW
i2cConfig(options: number|{ delay: number }): void
// TODO untested --- TWW
sendI2CWriteRequest(slaveAddress: number, bytes: number[]): void
// TODO untested --- TWW
i2cWrite(address: number, register: number, inBytes: number[]): void
i2cWrite(address: number, data: number[]): void
// TODO untested --- TWW
i2cWriteReg(address: number, register: number, byte: number): void
// TODO untested --- TWW
sendI2CReadRequest(address: number, numBytes: number, callback: () => void): void
// TODO untested --- TWW
i2cRead(address: number, register: number, bytesToRead: number, callback: (data: number[]) => void): void
i2cRead(address: number, bytesToRead: number, callback: (data: number[]) => void): void
// TODO untested --- TWW
i2cStop(options: number|{ bus: number, address: number }): void
// TODO untested --- TWW
i2cReadOnce(address: number, register: number, bytesToRead: number, callback: (data: number[]) => void): void
i2cReadOnce(address: number, bytesToRead: number, callback: (data: number[]) => void): void
// TODO untested --- TWW
sendOneWireConfig(pin: number, enableParasiticPower: boolean): void
// TODO untested --- TWW
sendOneWireSearch(pin: number, callback: () => void): void
// TODO untested --- TWW
sendOneWireAlarmsSearch(pin: number, callback: () => void): void
// TODO untested --- TWW
sendOneWireRead(pin: number, device: number, numBytesToRead: number, callback: () => void): void
// TODO untested --- TWW
sendOneWireReset(pin: number): void
// TODO untested --- TWW
sendOneWireWrite(pin: number, device: number, data: number|number[]): void
// TODO untested --- TWW
sendOneWireDelay(pin: number, delay: number): void
// TODO untested --- TWW
sendOneWireWriteAndRead(pin: number, device: number, data: number|number[], numBytesToRead: number,
callback: (error?: Error, data?: number) => void): void
setSamplingInterval(interval: number): void
getSamplingInterval(): number
reportAnalogPin(pin: number, value: Board.REPORTING): void
reportDigitalPin(pin: number, value: Board.REPORTING): void
// TODO untested/incomplete --- TWW
pingRead(opts: any, callback: () => void): void
stepperConfig(deviceNum: number, type: number, stepsPerRev: number, dirOrMotor1Pin: number,
stepOrMotor2Pin: number, motor3Pin?: number, motor4Pin?: number): void
stepperStep(deviceNum: number, direction: Board.STEPPER_DIRECTION, steps: number, speed: number,
accel: number|((bool?: boolean) => void), decel?: number, callback?: (bool?: boolean) => void): void
// TODO untested --- TWW
serialConfig(options: { portId: Board.SERIAL_PORT_ID, baud: number, rxPin?: number, txPin?: number }): void
// TODO untested --- TWW
serialWrite(portId: Board.SERIAL_PORT_ID, inBytes: number[]): void
// TODO untested --- TWW
serialRead(portId: Board.SERIAL_PORT_ID, maxBytesToRead: number, callback: () => void): void
// TODO untested --- TWW
serialStop(portId: Board.SERIAL_PORT_ID): void
// TODO untested --- TWW
serialClose(portId: Board.SERIAL_PORT_ID): void
// TODO untested --- TWW
serialFlush(portId: Board.SERIAL_PORT_ID): void
// TODO untested --- TWW
serialListen(portId: Board.SERIAL_PORT_ID): void
// TODO untested --- TWW
sysexResponse(commandByte: number, handler: (data: number[]) => void): void
// TODO untested --- TWW
sysexCommand(message: number[]): void
reset(): void
static isAcceptablePort(port: Board.Port): boolean
static requestPort(callback: (error: any, port: Board.Port) => any): void
// TODO untested --- TWW
static encode(data: number[]): number[]
// TODO untested --- TWW
static decode(data: number[]): number[]
// TODO untested/incomplete --- TWW
protected _sendOneWireSearch(type: any, event: any, pin: number, callback: () => void): void
// TODO untested/incomplete --- TWW
protected _sendOneWireRequest(pin: number, subcommand: any, device: any, numBytesToRead: any, correlationId: any,
delay: number, dataToWrite: any, event: any, callback: () => void): void
}
declare namespace Board
{
export interface PinModes
{
INPUT: PIN_MODE, OUTPUT: PIN_MODE, ANALOG: PIN_MODE, PWM: PIN_MODE, SERVO: PIN_MODE, SHIFT: PIN_MODE,
I2C: PIN_MODE, ONEWIRE: PIN_MODE, STEPPER: PIN_MODE, SERIAL: PIN_MODE, PULLUP: PIN_MODE, IGNORE: PIN_MODE,
PING_READ: PIN_MODE, UNKOWN: PIN_MODE
}
export interface StepperConstants
{
TYPE: { DRIVER: STEPPER_TYPE, TWO_WIRE: STEPPER_TYPE, FOUR_WIRE: STEPPER_TYPE },
RUNSTATE: {
STOP: STEPPER_RUN_STATE, ACCEL: STEPPER_RUN_STATE, DECEL: STEPPER_RUN_STATE, RUN: STEPPER_RUN_STATE
},
DIRECTION: { CCW: STEPPER_DIRECTION, CW: STEPPER_DIRECTION }
}
// tslint:disable-next-line interface-name
export interface I2cModes
{
WRITE: I2C_MODE, READ: I2C_MODE, CONTINUOUS_READ: I2C_MODE, STOP_READING: I2C_MODE
}
export interface SerialModes
{
CONTINUOUS_READ: SERIAL_MODE, STOP_READING: SERIAL_MODE
}
export interface SerialPortIds
{
HW_SERIAL0: SERIAL_PORT_ID, HW_SERIAL1: SERIAL_PORT_ID, HW_SERIAL2: SERIAL_PORT_ID,
HW_SERIAL3: SERIAL_PORT_ID, SW_SERIAL0: SERIAL_PORT_ID, SW_SERIAL1: SERIAL_PORT_ID,
SW_SERIAL2: SERIAL_PORT_ID, SW_SERIAL3: SERIAL_PORT_ID, DEFAULT: SERIAL_PORT_ID,
}
export interface SerialPinTypes
{
RES_RX0: SERIAL_PIN_TYPE, RES_TX0: SERIAL_PIN_TYPE, RES_RX1: SERIAL_PIN_TYPE, RES_TX1: SERIAL_PIN_TYPE,
RES_RX2: SERIAL_PIN_TYPE, RES_TX2: SERIAL_PIN_TYPE, RES_RX3: SERIAL_PIN_TYPE, RES_TX3: SERIAL_PIN_TYPE,
}
export interface Pins
{
mode: PIN_MODE,
value: PIN_STATE|number,
supportedModes: PIN_MODE[],
analogChannel: number,
report: REPORTING,
state: PIN_STATE|PULLUP_STATE, // TODO not sure if this exists anymore... --- TWW
}
export interface Firmware
{
name: string,
version: Version,
}
export interface Settings
{
reportVersionTimeout: number,
samplingInterval: number,
serialport: {
baudRate: number,
bufferSize: number
}
}
export interface Port
{
comName: string,
}
export interface Version
{
major: number,
minor: number
}
// TODO these enums could actually be non-const in the future (provides some benefits) --- TWW
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L449-L464
export const enum PIN_MODE {
INPUT = 0x00,
OUTPUT = 0x01,
ANALOG = 0x02,
PWM = 0x03,
SERVO = 0x04,
SHIFT = 0x05,
I2C = 0x06,
ONEWIRE = 0x07,
STEPPER = 0x08,
SERIAL = 0x0A,
PULLUP = 0x0B,
IGNORE = 0x7F,
PING_READ = 0x75,
UNKNOWN = 0x10,
}
export const enum PIN_STATE {
LOW = 0,
HIGH = 1
}
export const enum REPORTING {
ON = 1,
OFF = 0,
}
export const enum PULLUP_STATE {
ENABLED = 1,
DISABLED = 0,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L474-L478
export const enum STEPPER_TYPE {
DRIVER = 1,
TWO_WIRE = 2,
FOUR_WIRE = 4,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L479-L484
export const enum STEPPER_RUN_STATE {
STOP = 0,
ACCEL = 1,
DECEL = 2,
RUN = 3,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L485-L488
export const enum STEPPER_DIRECTION {
CCW = 0,
CW = 1,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L466-L471
export const enum I2C_MODE {
WRITE = 0,
READ = 1,
CONTINUOUS_READ = 2,
STOP_READING = 3
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L491-L494
export const enum SERIAL_MODE {
CONTINUOUS_READ = 0x00,
STOP_READING = 0x01,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L497-L512
export const enum SERIAL_PORT_ID {
HW_SERIAL0 = 0x00,
HW_SERIAL1 = 0x01,
HW_SERIAL2 = 0x02,
HW_SERIAL3 = 0x03,
SW_SERIAL0 = 0x08,
SW_SERIAL1 = 0x09,
SW_SERIAL2 = 0x10,
SW_SERIAL3 = 0x11,
DEFAULT = 0x08,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L515-L524
export const enum SERIAL_PIN_TYPE {
RES_RX0 = 0x00,
RES_TX0 = 0x01,
RES_RX1 = 0x02,
RES_TX1 = 0x03,
RES_RX2 = 0x04,
RES_TX2 = 0x05,
RES_RX3 = 0x06,
RES_TX3 = 0x07,
}
}
@@ -17,6 +17,6 @@
},
"files": [
"index.d.ts",
"xmpp-jid-tests.ts"
"firmata-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+152 -152
View File
@@ -1,152 +1,152 @@
/* Example taken from Google Calendar API JavaScript Quickstart https://developers.google.com/google-apps/calendar/quickstart/js */
{
// Your Client ID can be retrieved from your project in the Google
// Developer Console, https://console.developers.google.com
var CLIENT_ID = '<YOUR_CLIENT_ID>';
var SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"];
/**
* Check if current user has authorized this application.
*/
function checkAuth() {
gapi.auth.authorize(
{
'client_id': CLIENT_ID,
'scope': SCOPES.join(' '),
'immediate': true
}, handleAuthResult);
}
/**
* Handle response from authorization server.
*
* @param {Object} authResult Authorization result.
*/
function handleAuthResult(authResult: GoogleApiOAuth2TokenObject) {
var authorizeDiv = document.getElementById('authorize-div')!;
if (authResult && !authResult.error) {
// Hide auth UI, then load client library.
authorizeDiv.style.display = 'none';
loadCalendarApi();
} else {
// Show auth UI, allowing the user to initiate authorization by
// clicking authorize button.
authorizeDiv.style.display = 'inline';
}
}
/**
* Initiate auth flow in response to user clicking authorize button.
*
* @param {Event} event Button click event.
*/
function handleAuthClick(event: MouseEvent) {
gapi.auth.authorize(
{client_id: CLIENT_ID, scope: SCOPES, immediate: false},
handleAuthResult);
return false;
}
/**
* Load Google Calendar client library. List upcoming events
* once client library is loaded.
*/
function loadCalendarApi() {
gapi.client.load('calendar', 'v3', listUpcomingEvents);
}
/**
* Print the summary and start datetime/date of the next ten events in
* the authorized user's calendar. If no events are found an
* appropriate message is printed.
*/
function listUpcomingEvents() {
var request = gapi.client.calendar.events.list({
'calendarId': 'primary',
'timeMin': (new Date()).toISOString(),
'showDeleted': false,
'singleEvents': true,
'maxResults': 10,
'orderBy': 'startTime'
});
request.execute(function(resp) {
var events = resp.items;
appendPre('Upcoming events:');
if (events.length > 0) {
for (let i = 0; i < events.length; i++) {
var event = events[i];
var when = event.start.dateTime;
if (!when) {
when = event.start.date;
}
appendPre(event.summary + ' (' + when + ')')
}
} else {
appendPre('No upcoming events found.');
}
});
}
/**
* Append a pre element to the body containing the given message
* as its text node.
*
* @param {string} message Text to be placed in pre element.
*/
function appendPre(message: string) {
var pre = document.getElementById('output')!;
var textContent = document.createTextNode(message + '\n');
pre.appendChild(textContent);
}
}
/* Example taken from https://developers.google.com/google-apps/calendar/v3/reference/events/insert#examples */
{
// Refer to the JavaScript quickstart on how to setup the environment:
// https://developers.google.com/google-apps/calendar/quickstart/js
// Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
// stored credentials.
const event = {
'summary': 'Google I/O 2015',
'location': '800 Howard St., San Francisco, CA 94103',
'description': 'A chance to hear more about Google\'s developer products.',
'start': {
'dateTime': '2015-05-28T09:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'end': {
'dateTime': '2015-05-28T17:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'recurrence': [
'RRULE:FREQ=DAILY;COUNT=2'
],
'attendees': [
{'email': 'lpage@example.com'},
{'email': 'sbrin@example.com'}
],
'reminders': {
'useDefault': false,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10}
]
}
};
var request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': event
});
request.execute(function(event) {
appendPre('Event created: ' + event.htmlLink);
});
}
/* Example taken from Google Calendar API JavaScript Quickstart https://developers.google.com/google-apps/calendar/quickstart/js */
{
// Your Client ID can be retrieved from your project in the Google
// Developer Console, https://console.developers.google.com
var CLIENT_ID = '<YOUR_CLIENT_ID>';
var SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"];
/**
* Check if current user has authorized this application.
*/
function checkAuth() {
gapi.auth.authorize(
{
'client_id': CLIENT_ID,
'scope': SCOPES.join(' '),
'immediate': true
}, handleAuthResult);
}
/**
* Handle response from authorization server.
*
* @param {Object} authResult Authorization result.
*/
function handleAuthResult(authResult: GoogleApiOAuth2TokenObject) {
var authorizeDiv = document.getElementById('authorize-div')!;
if (authResult && !authResult.error) {
// Hide auth UI, then load client library.
authorizeDiv.style.display = 'none';
loadCalendarApi();
} else {
// Show auth UI, allowing the user to initiate authorization by
// clicking authorize button.
authorizeDiv.style.display = 'inline';
}
}
/**
* Initiate auth flow in response to user clicking authorize button.
*
* @param {Event} event Button click event.
*/
function handleAuthClick(event: MouseEvent) {
gapi.auth.authorize(
{client_id: CLIENT_ID, scope: SCOPES, immediate: false},
handleAuthResult);
return false;
}
/**
* Load Google Calendar client library. List upcoming events
* once client library is loaded.
*/
function loadCalendarApi() {
gapi.client.load('calendar', 'v3', listUpcomingEvents);
}
/**
* Print the summary and start datetime/date of the next ten events in
* the authorized user's calendar. If no events are found an
* appropriate message is printed.
*/
function listUpcomingEvents() {
var request = gapi.client.calendar.events.list({
'calendarId': 'primary',
'timeMin': (new Date()).toISOString(),
'showDeleted': false,
'singleEvents': true,
'maxResults': 10,
'orderBy': 'startTime'
});
request.execute(function(resp) {
var events = resp.items;
appendPre('Upcoming events:');
if (events.length > 0) {
for (let i = 0; i < events.length; i++) {
var event = events[i];
var when = event.start.dateTime;
if (!when) {
when = event.start.date;
}
appendPre(event.summary + ' (' + when + ')')
}
} else {
appendPre('No upcoming events found.');
}
});
}
/**
* Append a pre element to the body containing the given message
* as its text node.
*
* @param {string} message Text to be placed in pre element.
*/
function appendPre(message: string) {
var pre = document.getElementById('output')!;
var textContent = document.createTextNode(message + '\n');
pre.appendChild(textContent);
}
}
/* Example taken from https://developers.google.com/google-apps/calendar/v3/reference/events/insert#examples */
{
// Refer to the JavaScript quickstart on how to setup the environment:
// https://developers.google.com/google-apps/calendar/quickstart/js
// Change the scope to 'https://www.googleapis.com/auth/calendar' and delete any
// stored credentials.
const event = {
'summary': 'Google I/O 2015',
'location': '800 Howard St., San Francisco, CA 94103',
'description': 'A chance to hear more about Google\'s developer products.',
'start': {
'dateTime': '2015-05-28T09:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'end': {
'dateTime': '2015-05-28T17:00:00-07:00',
'timeZone': 'America/Los_Angeles'
},
'recurrence': [
'RRULE:FREQ=DAILY;COUNT=2'
],
'attendees': [
{'email': 'lpage@example.com'},
{'email': 'sbrin@example.com'}
],
'reminders': {
'useDefault': false,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10}
]
}
};
var request = gapi.client.calendar.events.insert({
'calendarId': 'primary',
'resource': event
});
request.execute(function(event) {
appendPre('Event created: ' + event.htmlLink);
});
}
+97 -97
View File
@@ -1,97 +1,97 @@
/// <reference types="gapi.people" />
/// <reference types="gapi.plus" />
/* Examples taken from https://developers.google.com/api-client-library/javascript/start/start-js */
{
function start1() {
// 2. Initialize the JavaScript client library.
gapi.client.init({
'apiKey': 'YOUR_API_KEY',
'discoveryDocs': ['https://people.googleapis.com/$discovery/rest'],
// clientId and scope are optional if auth is not required.
'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
'scope': 'profile',
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.people.people.get({
resourceName: 'people/me'
});
}).then(function(response) {
console.log(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
// 1. Load the JavaScript client library.
gapi.load('client', start1);
}
{
function start2() {
// 2. Initialize the JavaScript client library.
gapi.client.init({
'apiKey': 'YOUR_API_KEY',
// clientId and scope are optional if auth is not required.
'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
'scope': 'profile',
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.request({
'path': 'https://people.googleapis.com/v1/people/me',
})
}).then(function(response) {
console.log(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
// 1. Load the JavaScript client library.
gapi.load('client', start2);
}
/* Examples taken from https://developers.google.com/api-client-library/javascript/features/promises */
gapi.client.request({'path': '/plus/v1/people', 'params': {'query': 'John'}}).then(function(response) {
// Handle response
}, function(reason) {
// Handle error
});
gapi.client.load('plus', 'v1').then(function() {
gapi.client.plus.people.search({'query': ''}).then(response => { });
});
var personFetcher = {
results: [],
// Why this: any? Check https://github.com/Microsoft/TypeScript/issues/10835
fetch: function(this: any, name: string) {
gapi.client.request({path: '/plus/v1/people', params:{query: name}}).then(function(this: any, response) {
this.results.push(response.result);
}, function(reason) {
console.error(name, 'was not fetched:', reason.result.error.message);
}, this);
}
};
personFetcher.fetch('John');
gapi.client.request({
'path': 'plus/v1/people',
'params': {'query': name}
}).execute(function(resp, rawResp) {
processResponse(resp);
});
gapi.client.request({
'path': 'plus/v1/people',
'params': {'query': name}
}).then(function(resp) {
processResponse(resp.result);
});
function processResponse(response: any) {
// Stub
}
/// <reference types="gapi.people" />
/// <reference types="gapi.plus" />
/* Examples taken from https://developers.google.com/api-client-library/javascript/start/start-js */
{
function start1() {
// 2. Initialize the JavaScript client library.
gapi.client.init({
'apiKey': 'YOUR_API_KEY',
'discoveryDocs': ['https://people.googleapis.com/$discovery/rest'],
// clientId and scope are optional if auth is not required.
'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
'scope': 'profile',
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.people.people.get({
resourceName: 'people/me'
});
}).then(function(response) {
console.log(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
// 1. Load the JavaScript client library.
gapi.load('client', start1);
}
{
function start2() {
// 2. Initialize the JavaScript client library.
gapi.client.init({
'apiKey': 'YOUR_API_KEY',
// clientId and scope are optional if auth is not required.
'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
'scope': 'profile',
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.request({
'path': 'https://people.googleapis.com/v1/people/me',
})
}).then(function(response) {
console.log(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
// 1. Load the JavaScript client library.
gapi.load('client', start2);
}
/* Examples taken from https://developers.google.com/api-client-library/javascript/features/promises */
gapi.client.request({'path': '/plus/v1/people', 'params': {'query': 'John'}}).then(function(response) {
// Handle response
}, function(reason) {
// Handle error
});
gapi.client.load('plus', 'v1').then(function() {
gapi.client.plus.people.search({'query': ''}).then(response => { });
});
var personFetcher = {
results: [],
// Why this: any? Check https://github.com/Microsoft/TypeScript/issues/10835
fetch: function(this: any, name: string) {
gapi.client.request({path: '/plus/v1/people', params:{query: name}}).then(function(this: any, response) {
this.results.push(response.result);
}, function(reason) {
console.error(name, 'was not fetched:', reason.result.error.message);
}, this);
}
};
personFetcher.fetch('John');
gapi.client.request({
'path': 'plus/v1/people',
'params': {'query': name}
}).execute(function(resp, rawResp) {
processResponse(resp);
});
gapi.client.request({
'path': 'plus/v1/people',
'params': {'query': name}
}).then(function(resp) {
processResponse(resp.result);
});
function processResponse(response: any) {
// Stub
}
+501 -6
View File
@@ -42,13 +42,508 @@ declare namespace UniversalAnalytics {
enum HitType {
'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'
}
// https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference
interface FieldsObject {
affiliation?: string;
allowAnchor?: boolean;
allowLinker?: boolean;
alwaysSendReferrer?: boolean;
anonymizeIp?: boolean;
appId?: string;
appInstallerId?: string;
appName?: string;
appVersion?: string;
brand?: string;
campaignId?: string;
campaignContent?: string;
campaignKeyword?: string;
campaignMedium?: string;
campaignName?: string;
campaignSource?: string;
category?: string;
clientId?: string;
contentGroup1?: string;
contentGroup2?: string;
contentGroup3?: string;
contentGroup4?: string;
contentGroup5?: string;
contentGroup6?: string;
contentGroup7?: string;
contentGroup8?: string;
contentGroup9?: string;
contentGroup10?: string;
cookieName?: string;
cookieDomain?: string;
cookieExpires?: number;
coupon?: string;
creative?: string;
currencyCode?: string;
dataSource?: string;
dimension1?: string;
dimension2?: string;
dimension3?: string;
dimension4?: string;
dimension5?: string;
dimension6?: string;
dimension7?: string;
dimension8?: string;
dimension9?: string;
dimension10?: string;
dimension11?: string;
dimension12?: string;
dimension13?: string;
dimension14?: string;
dimension15?: string;
dimension16?: string;
dimension17?: string;
dimension18?: string;
dimension19?: string;
dimension20?: string;
dimension21?: string;
dimension22?: string;
dimension23?: string;
dimension24?: string;
dimension25?: string;
dimension26?: string;
dimension27?: string;
dimension28?: string;
dimension29?: string;
dimension30?: string;
dimension31?: string;
dimension32?: string;
dimension33?: string;
dimension34?: string;
dimension35?: string;
dimension36?: string;
dimension37?: string;
dimension38?: string;
dimension39?: string;
dimension40?: string;
dimension41?: string;
dimension42?: string;
dimension43?: string;
dimension44?: string;
dimension45?: string;
dimension46?: string;
dimension47?: string;
dimension48?: string;
dimension49?: string;
dimension50?: string;
dimension51?: string;
dimension52?: string;
dimension53?: string;
dimension54?: string;
dimension55?: string;
dimension56?: string;
dimension57?: string;
dimension58?: string;
dimension59?: string;
dimension60?: string;
dimension61?: string;
dimension62?: string;
dimension63?: string;
dimension64?: string;
dimension65?: string;
dimension66?: string;
dimension67?: string;
dimension68?: string;
dimension69?: string;
dimension70?: string;
dimension71?: string;
dimension72?: string;
dimension73?: string;
dimension74?: string;
dimension75?: string;
dimension76?: string;
dimension77?: string;
dimension78?: string;
dimension79?: string;
dimension80?: string;
dimension81?: string;
dimension82?: string;
dimension83?: string;
dimension84?: string;
dimension85?: string;
dimension86?: string;
dimension87?: string;
dimension88?: string;
dimension89?: string;
dimension90?: string;
dimension91?: string;
dimension92?: string;
dimension93?: string;
dimension94?: string;
dimension95?: string;
dimension96?: string;
dimension97?: string;
dimension98?: string;
dimension99?: string;
dimension100?: string;
dimension101?: string;
dimension102?: string;
dimension103?: string;
dimension104?: string;
dimension105?: string;
dimension106?: string;
dimension107?: string;
dimension108?: string;
dimension109?: string;
dimension110?: string;
dimension111?: string;
dimension112?: string;
dimension113?: string;
dimension114?: string;
dimension115?: string;
dimension116?: string;
dimension117?: string;
dimension118?: string;
dimension119?: string;
dimension120?: string;
dimension121?: string;
dimension122?: string;
dimension123?: string;
dimension124?: string;
dimension125?: string;
dimension126?: string;
dimension127?: string;
dimension128?: string;
dimension129?: string;
dimension130?: string;
dimension131?: string;
dimension132?: string;
dimension133?: string;
dimension134?: string;
dimension135?: string;
dimension136?: string;
dimension137?: string;
dimension138?: string;
dimension139?: string;
dimension140?: string;
dimension141?: string;
dimension142?: string;
dimension143?: string;
dimension144?: string;
dimension145?: string;
dimension146?: string;
dimension147?: string;
dimension148?: string;
dimension149?: string;
dimension150?: string;
dimension151?: string;
dimension152?: string;
dimension153?: string;
dimension154?: string;
dimension155?: string;
dimension156?: string;
dimension157?: string;
dimension158?: string;
dimension159?: string;
dimension160?: string;
dimension161?: string;
dimension162?: string;
dimension163?: string;
dimension164?: string;
dimension165?: string;
dimension166?: string;
dimension167?: string;
dimension168?: string;
dimension169?: string;
dimension170?: string;
dimension171?: string;
dimension172?: string;
dimension173?: string;
dimension174?: string;
dimension175?: string;
dimension176?: string;
dimension177?: string;
dimension178?: string;
dimension179?: string;
dimension180?: string;
dimension181?: string;
dimension182?: string;
dimension183?: string;
dimension184?: string;
dimension185?: string;
dimension186?: string;
dimension187?: string;
dimension188?: string;
dimension189?: string;
dimension190?: string;
dimension191?: string;
dimension192?: string;
dimension193?: string;
dimension194?: string;
dimension195?: string;
dimension196?: string;
dimension197?: string;
dimension198?: string;
dimension199?: string;
dimension200?: string;
encoding?: string;
eventAction?: string;
eventCategory?: string;
eventLabel?: string;
eventValue?: number;
exDescription?: string;
exFatal?: boolean;
expId?: string;
expVar?: string;
flashVersion?: string;
forceSSL?: boolean;
hitCallback?: () => void;
hitType?: string;
hostname?: string;
id?: string;
javaEnabled?: boolean;
language?: string;
legacyCookieDomain?: string;
legacyHistoryImport?: boolean;
linkid?: string;
list?: string;
location?: string;
metric1?: number;
metric2?: string;
metric3?: string;
metric4?: string;
metric5?: string;
metric6?: string;
metric7?: string;
metric8?: string;
metric9?: string;
metric10?: string;
metric11?: string;
metric12?: string;
metric13?: string;
metric14?: string;
metric15?: string;
metric16?: string;
metric17?: string;
metric18?: string;
metric19?: string;
metric20?: string;
metric21?: string;
metric22?: string;
metric23?: string;
metric24?: string;
metric25?: string;
metric26?: string;
metric27?: string;
metric28?: string;
metric29?: string;
metric30?: string;
metric31?: string;
metric32?: string;
metric33?: string;
metric34?: string;
metric35?: string;
metric36?: string;
metric37?: string;
metric38?: string;
metric39?: string;
metric40?: string;
metric41?: string;
metric42?: string;
metric43?: string;
metric44?: string;
metric45?: string;
metric46?: string;
metric47?: string;
metric48?: string;
metric49?: string;
metric50?: string;
metric51?: string;
metric52?: string;
metric53?: string;
metric54?: string;
metric55?: string;
metric56?: string;
metric57?: string;
metric58?: string;
metric59?: string;
metric60?: string;
metric61?: string;
metric62?: string;
metric63?: string;
metric64?: string;
metric65?: string;
metric66?: string;
metric67?: string;
metric68?: string;
metric69?: string;
metric70?: string;
metric71?: string;
metric72?: string;
metric73?: string;
metric74?: string;
metric75?: string;
metric76?: string;
metric77?: string;
metric78?: string;
metric79?: string;
metric80?: string;
metric81?: string;
metric82?: string;
metric83?: string;
metric84?: string;
metric85?: string;
metric86?: string;
metric87?: string;
metric88?: string;
metric89?: string;
metric90?: string;
metric91?: string;
metric92?: string;
metric93?: string;
metric94?: string;
metric95?: string;
metric96?: string;
metric97?: string;
metric98?: string;
metric99?: string;
metric100?: string;
metric101?: string;
metric102?: string;
metric103?: string;
metric104?: string;
metric105?: string;
metric106?: string;
metric107?: string;
metric108?: string;
metric109?: string;
metric110?: string;
metric111?: string;
metric112?: string;
metric113?: string;
metric114?: string;
metric115?: string;
metric116?: string;
metric117?: string;
metric118?: string;
metric119?: string;
metric120?: string;
metric121?: string;
metric122?: string;
metric123?: string;
metric124?: string;
metric125?: string;
metric126?: string;
metric127?: string;
metric128?: string;
metric129?: string;
metric130?: string;
metric131?: string;
metric132?: string;
metric133?: string;
metric134?: string;
metric135?: string;
metric136?: string;
metric137?: string;
metric138?: string;
metric139?: string;
metric140?: string;
metric141?: string;
metric142?: string;
metric143?: string;
metric144?: string;
metric145?: string;
metric146?: string;
metric147?: string;
metric148?: string;
metric149?: string;
metric150?: string;
metric151?: string;
metric152?: string;
metric153?: string;
metric154?: string;
metric155?: string;
metric156?: string;
metric157?: string;
metric158?: string;
metric159?: string;
metric160?: string;
metric161?: string;
metric162?: string;
metric163?: string;
metric164?: string;
metric165?: string;
metric166?: string;
metric167?: string;
metric168?: string;
metric169?: string;
metric170?: string;
metric171?: string;
metric172?: string;
metric173?: string;
metric174?: string;
metric175?: string;
metric176?: string;
metric177?: string;
metric178?: string;
metric179?: string;
metric180?: string;
metric181?: string;
metric182?: string;
metric183?: string;
metric184?: string;
metric185?: string;
metric186?: string;
metric187?: string;
metric188?: string;
metric189?: string;
metric190?: string;
metric191?: string;
metric192?: string;
metric193?: string;
metric194?: string;
metric195?: string;
metric196?: string;
metric197?: string;
metric198?: string;
metric199?: string;
metric200?: string;
name?: string;
nonInteraction?: boolean;
option?: string;
page?: string;
position?: number | string;
price?: string;
quantity?: number;
queueTime?: number;
referrer?: string;
revenue?: string;
sampleRate?: number;
sessionControl?: string;
siteSpeedSampleRate?: number;
screenColors?: string;
screenName?: string;
screenResolution?: string;
shipping?: string;
socialAction?: string;
socialNetwork?: string;
socialTarget?: string;
some?: string;
step?: boolean;
tax?: string;
timingCategory?: string;
timingLabel?: string;
timingValue?: number;
timingVar?: string;
title?: string;
transport?: string;
useBeacon?: boolean;
userId?: string;
variant?: string;
viewportSize?: string;
}
interface ga {
l: number;
q: any[];
(command: 'send', hitType: 'event', eventCategory: string, eventAction: string,
eventLabel?: string, eventValue?: number, fieldsObject?: {}): void;
eventLabel?: string, eventValue?: number, fieldsObject?: FieldsObject): void;
(command: 'send', hitType: 'event', fieldsObject: {
eventCategory: string,
eventAction: string,
@@ -71,19 +566,19 @@ declare namespace UniversalAnalytics {
timingCategory: string, timingVar: string, timingValue: number): void;
(command: 'send', hitType: 'timing',
fieldsObject: {timingCategory: string, timingVar: string, timingValue: number}): void;
(command: 'send', fieldsObject: {}): void;
(command: 'send', fieldsObject: FieldsObject): void;
(command: string, hitType: HitType, ...fields: any[]): void;
(command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: {}): void;
(command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: FieldsObject): void;
(command: 'remove'): void;
(command: string, ...fields: any[]): void;
(readyCallback: (defaultTracker?: UniversalAnalytics.Tracker) => void): void;
create(trackingId: string, cookieDomain: string, name: string, fieldsObject?: {}): UniversalAnalytics.Tracker;
create(trackingId: string, cookieDomain: string, fieldsObject?: {}): UniversalAnalytics.Tracker;
create(trackingId: string, fieldsObject?: {}): UniversalAnalytics.Tracker;
create(trackingId: string, cookieDomain: string, name: string, fieldsObject?: FieldsObject): UniversalAnalytics.Tracker;
create(trackingId: string, cookieDomain: string, fieldsObject?: FieldsObject): UniversalAnalytics.Tracker;
create(trackingId: string, fieldsObject?: FieldsObject): UniversalAnalytics.Tracker;
getAll(): UniversalAnalytics.Tracker[];
getByName(name: string): UniversalAnalytics.Tracker;
+1 -1
View File
@@ -2276,7 +2276,7 @@ declare namespace google.maps {
}
export interface PlaceDetailsRequest {
placeId: string;
placeid: string;
}
export interface PlaceGeometry {
+6 -2
View File
@@ -4,13 +4,17 @@
// Type definitions for Gridstack
// Project: http://troolee.github.io/gridstack.js/
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>, Ricky Blankenaufulland <https://github.com/ZoolWay/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
var options = <IGridstackOptions> {
float: true
};
var gridstack:GridStack = $(document).gridstack(options);
var element: JQuery = $(document).gridstack(options);
var gridstack: GridStack = $(document).data("gridstack");
var gsFromElement: GridStack = element.data("gridstack");
if (gridstack !== gsFromElement) throw Error('These should match!');
gridstack.addWidget("test", 1, 2, 3, 4, true);
gridstack.batchUpdate();
+3 -2
View File
@@ -1,10 +1,11 @@
// Type definitions for Gridstack
// Project: http://troolee.github.io/gridstack.js/
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>, Ricky Blankenaufulland <https://github.com/ZoolWay/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface JQuery {
gridstack (options: IGridstackOptions):GridStack
gridstack (options: IGridstackOptions): JQuery;
data(key: "gridstack"): GridStack;
}
interface GridStack {

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