Merge pull request #2 from DefinitelyTyped/master

Merging from master
This commit is contained in:
Ajay Shrestha
2018-06-20 14:16:47 +05:45
committed by GitHub
622 changed files with 71817 additions and 9588 deletions
+1 -1
View File
@@ -54,7 +54,7 @@ Before you share your improvement with the world, use it yourself.
#### Test editing an existing package
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html).
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`, or copy them from there and follow the steps below.
+1 -1
View File
@@ -101,7 +101,7 @@ declare module 'angular' {
* Note: This property is not currently supported in any browser.
* Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/vibrate
*/
vibrate?: boolean;
vibrate?: any;
/**
* The onclick property of the Notification interface specifies an event listener to receive click events.
+1
View File
@@ -9,6 +9,7 @@
import * as angular from 'angular';
export type gettextCatalog = angular.gettext.gettextCatalog;
declare module 'angular' {
export namespace gettext {
+4
View File
@@ -8,6 +8,10 @@
import * as angular from 'angular';
export type ILocalStorageServiceProvider = angular.local.storage.ILocalStorageServiceProvider;
export type ILocalStorageService = angular.local.storage.ILocalStorageService;
export type ICookie = angular.local.storage.ICookie;
declare module 'angular' {
export namespace local.storage {
interface ILocalStorageServiceProvider extends angular.IServiceProvider {
File diff suppressed because it is too large Load Diff
+419 -215
View File
@@ -1,10 +1,9 @@
// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.5
// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.6
// Project: http://angularjs.org
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Tony Curtis <https://github.com/daltin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.4
/// <reference types="angular" />
/// <reference path="mocks.d.ts" />
import * as angular from 'angular';
@@ -13,7 +12,6 @@ import * as angular from 'angular';
// ngMock module (angular-mocks.js)
///////////////////////////////////////////////////////////////////////////////
declare module 'angular' {
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// We reopen it to add the MockStatic definition
@@ -23,27 +21,27 @@ declare module 'angular' {
}
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject
// Depending on context, it might return a function, however having `void | (() => void)`
// as a return type seems to be not useful. E.g. it requires type assertions in `beforeEach(inject(...))`.
interface IInjectStatic {
(...fns: Function[]): any;
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
strictDi(val?: boolean): void;
(...fns: Array<Injectable<(...args: any[]) => void>>): any; // void | (() => void);
strictDi(val?: boolean): any; // void | (() => void);
}
interface IMockStatic {
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump
dump(obj: any): string;
inject: IInjectStatic
inject: IInjectStatic;
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.module
module: {
(...modules: any[]): any;
sharedInjector(): void;
}
};
// see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate
TzDate(offset: number, timestamp: number): Date;
TzDate(offset: number, timestamp: string): Date;
TzDate(offset: number, timestamp: number | string): Date;
}
///////////////////////////////////////////////////////////////////////////
@@ -62,7 +60,6 @@ declare module 'angular' {
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
flush(delay?: number): void;
flushNext(expectedDelay?: number): void;
verifyNoPendingTasks(): void;
}
@@ -96,9 +93,11 @@ declare module 'angular' {
///////////////////////////////////////////////////////////////////////////
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
<T>(controllerConstructor: Function, locals?: any, bindings?: any): T;
<T>(controllerName: string, locals?: any, bindings?: any): T;
<T>(
controllerConstructor: (new (...args: any[]) => T) | ((...args: any[]) => T) | string,
locals?: any,
bindings?: any
): T;
}
///////////////////////////////////////////////////////////////////////////
@@ -108,268 +107,473 @@ declare module 'angular' {
interface IComponentControllerService {
// TBinding is an interface exposed by a component as per John Papa's style guide
// https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top
<T, TBinding>(componentName: string, locals: { $scope?: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T;
<T, TBinding>(
componentName: string,
locals: { $scope?: IScope; [key: string]: any },
bindings?: TBinding,
ident?: string
): T;
}
///////////////////////////////////////////////////////////////////////////
// HttpBackendService
// see https://docs.angularjs.org/api/ngMock/service/$httpBackend
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
/**
* Flushes pending requests using the trained responses. Requests are flushed in the order they were made, but it is also possible to skip one or more requests (for example to have them flushed later). This is useful for simulating scenarios where responses arrive from the server in any order.
*
* If there are no pending requests to flush when the method is called, an exception is thrown (as this is typically a sign of programming error).
* @param count Number of responses to flush. If undefined/null, all pending requests (starting after `skip`) will be flushed.
* @param skip Number of pending requests to skip. For example, a value of 5 would skip the first 5 pending requests and start flushing from the 6th onwards. _(default: 0)_
*/
* Flushes pending requests using the trained responses. Requests are flushed in the order they
* were made, but it is also possible to skip one or more requests (for example to have them
* flushed later). This is useful for simulating scenarios where responses arrive from the server
* in any order.
*
* If there are no pending requests to flush when the method is called, an exception is thrown (as
* this is typically a sign of programming error).
*
* @param count Number of responses to flush. If undefined/null, all pending requests (starting
* after `skip`) will be flushed.
* @param skip Number of pending requests to skip. For example, a value of 5 would skip the first 5 pending requests and start flushing from the 6th onwards. _(default: 0)_
*/
flush(count?: number, skip?: number): void;
/**
* Resets all request expectations, but preserves all backend definitions.
*/
* Resets all request expectations, but preserves all backend definitions.
*/
resetExpectations(): void;
/**
* Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
* @param digest Do digest before checking expectation. Pass anything except false to trigger digest. NOTE this flag is purposely undocumented by Angular, which means it's not to be used in normal client code.
*/
* Verifies that all of the requests defined via the `expect` api were made. If any of the
* requests were not made, verifyNoOutstandingExpectation throws an exception.
* @param digest Do digest before checking expectation. Pass anything except false to trigger digest.
* NOTE: this flag is purposely undocumented by Angular, which means it's not to be used in normal client code.
*/
verifyNoOutstandingExpectation(digest?: boolean): void;
/**
* Verifies that there are no outstanding requests that need to be flushed.
*/
* Verifies that there are no outstanding requests that need to be flushed.
*/
verifyNoOutstandingRequest(): void;
/**
* Creates a new request expectation.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expect(
method: string,
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for DELETE requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for DELETE requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectDELETE(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for GET requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for GET requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectGET(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for HEAD requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
* @param keys Array of keys to assign to regex matches in the request url.
*/
/**
* Creates a new request expectation for HEAD requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
expectHEAD(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for JSONP requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for JSONP requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectJSONP(
url: string | RegExp | ((url: string) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for PATCH requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for PATCH requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPATCH(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for POST requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for POST requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPOST(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for PUT requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for PUT requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPUT(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation that compares only with the requested route.
* This method offers colon delimited matching of the url path, ignoring the query string.
* This allows declarations similar to how application routes are configured with `$routeProvider`.
* As this method converts the definition url to regex, declaration order is important.
* @param method HTTP method
* @param url HTTP url string that supports colon param matching
*/
expectRoute(method: string, url: string): mock.IRequestHandler;
/**
* Creates a new backend definition for DELETE requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
when(
method: string,
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for GET requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in request url described above
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for DELETE requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenDELETE(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for HEAD requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for GET requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in request url described above
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenGET(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for JSONP requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for HEAD requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenHEAD(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for PATCH requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for JSONP requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenJSONP(
url: string | RegExp | ((url: string) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for POST requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for PATCH requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPATCH(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for PUT requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for POST requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true
* if the url matches the current definition.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPOST(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for PUT requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true
* if the url matches the current definition.
* @param data HTTP request body or function that receives data string and returns true if the data
* is as expected.
* @param headers HTTP headers or function that receives http header object and returns true if the
* headers match the current definition.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPUT(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition that compares only with the requested route.
* This method offers colon delimited matching of the url path, ignoring the query string.
* This allows declarations similar to how application routes are configured with `$routeProvider`.
* As this method converts the definition url to regex, declaration order is important.
* @param method HTTP method.
* @param url HTTP url string that supports colon param matching.
*/
whenRoute(method: string, url: string): mock.IRequestHandler;
}
///////////////////////////////////////////////////////////////////////////
// AnimateService
// see https://docs.angularjs.org/api/ngMock/service/$animate
///////////////////////////////////////////////////////////////////////////
module animate {
namespace animate {
interface IAnimateService {
/**
* This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining animation frames and/or callbacks.
* This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining
* animation frames and/or callbacks.
*/
closeAndFlush(): void;
/**
* This method is used to flush the pending callbacks and animation frames to either start an animation or conclude an animation. Note that this will not actually close an actively running animation (see `closeAndFlush()` for that).
* This method is used to flush the pending callbacks and animation frames to either start
* an animation or conclude an animation. Note that this will not actually close an
* actively running animation (see `closeAndFlush()`} for that).
*/
flush(): void;
}
}
export module mock {
// returned interface by the the mocked HttpBackendService expect/when methods
namespace mock {
/** Object returned by the the mocked HttpBackendService expect/when methods */
interface IRequestHandler {
/**
* Controls the response for a matched request using a function to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param func Function that receives the request HTTP method, url, data, headers, and an array of keys to regex matches in the request url and returns an array containing response status (number), data, headers, and status text.
*/
respond(func: ((method: string, url: string, data: string | Object, headers: Object, params?: any) => [number, string | Object, Object, string])): IRequestHandler;
/**
* Controls the response for a matched request using supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param status HTTP status code to add to the response.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
/**
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
// Available when ngMockE2E is loaded
/**
* Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.)
*/
* Controls the response for a matched request using a function to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param func Function that receives the request HTTP method, url, data, headers, and an array of keys
* to regex matches in the request url and returns an array containing response status (number), data,
* headers, and status text.
*/
respond(
func: ((
method: string,
url: string,
data: string | object,
headers: IHttpHeaders,
params: { [key: string]: string }
) => [number, string | object, IHttpHeaders, string])
): IRequestHandler;
/**
* Controls the response for a matched request using supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param status HTTP status code to add to the response.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(
status: number,
data: string | object,
headers?: IHttpHeaders,
responseText?: string
): IRequestHandler;
/**
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(
data: string | object,
headers?: IHttpHeaders,
responseText?: string
): IRequestHandler;
/**
* Any request matching a backend definition or expectation with passThrough handler will be
* passed through to the real backend (an XHR request will be made to the server.)
* Available when ngMockE2E is loaded
*/
passThrough(): IRequestHandler;
}
interface IHttpHeaders {
[headerName: string]: any;
}
/**
* Contains additional event data used by the `browserTrigger` function when creating an event.
*/
interface IBrowserTriggerEventData {
/**
* [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles).
* Not applicable to all events.
*/
bubbles?: boolean;
/**
* [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable).
* Not applicable to all events.
*/
cancelable?: boolean;
/**
* [charCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/charcode)
* for keyboard events (keydown, keypress, and keyup).
*/
charcode?: number;
/**
* The elapsedTime for
* [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent)
* and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent).
*/
elapsedTime?: number;
/**
* [keyCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/keycode)
* for keyboard events (keydown, keypress, and keyup).
*/
keycode?: number;
/**
* An array of possible modifier keys (ctrl, alt, shift, meta) for
* [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and
* keyboard events (keydown, keypress, and keyup).
*/
keys?: Array<'ctrl' | 'alt' | 'shift' | 'meta'>;
/**
* The [relatedTarget](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget)
* for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent).
*/
relatedTarget?: Node;
/**
* [which](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/which)
* for keyboard events (keydown, keypress, and keyup).
*/
which?: number;
/**
* x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
*/
x?: number;
/**
* y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
*/
y?: number;
}
}
}
///////////////////////////////////////////////////////////////////////////////
// functions attached to global object (window)
///////////////////////////////////////////////////////////////////////////////
//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
//declare var module: (...modules: any[]) => any;
// Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
// declare var module: (...modules: any[]) => any;
declare global {
export var inject: angular.IInjectStatic;
const inject: angular.IInjectStatic;
/**
* This is a global (window) function that is only available when the `ngMock` module is included.
* It can be used to trigger a native browser event on an element, which is useful for unit testing.
*
* @param element Either a wrapped jQuery/jqLite node or a DOM element
* @param eventType Optional event type. If none is specified, the function tries to determine
* the right event type for the element, e.g. `change` for `input[text]`.
* @param eventData An optional object which contains additional event data used when creating the event.
*/
function browserTrigger(
element: JQuery | Element,
eventType?: string,
eventData?: angular.mock.IBrowserTriggerEventData
): void;
}
+4 -4
View File
@@ -1,14 +1,14 @@
declare module "angular-mocks/ngMock" {
var _: string;
const _: string;
export = _;
}
declare module "angular-mocks/ngMockE2E" {
var _: string;
const _: string;
export = _;
}
declare module "angular-mocks/ngAnimateMock" {
var _: string;
const _: string;
export = _;
}
}
+8 -77
View File
@@ -1,79 +1,10 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
"extends": "dtslint/dt.json",
"rules": {
"callable-types": false,
"interface-name": false,
"no-declare-current-package": false,
"no-unnecessary-generics": false,
"only-arrow-functions": false
}
}
+3 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular Translate (pascalprecht.translate module) 2.15
// Type definitions for Angular Translate (pascalprecht.translate module) 2.16
// Project: https://github.com/PascalPrecht/angular-translate
// Definitions by: Michel Salib <https://github.com/michelsalib>, Gabriel Gil <https://github.com/GabrielGil>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -47,8 +47,8 @@ declare module 'angular' {
}
interface ITranslateService {
(translationId: string, interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string): angular.IPromise<string>;
(translationId: string[], interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string): angular.IPromise<{ [key: string]: string }>;
(translationId: string, interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string, sanitizeStrategy?: string): angular.IPromise<string>;
(translationId: string[], interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string, sanitizeStrategy?: string): angular.IPromise<{ [key: string]: string }>;
cloakClassName(): string;
cloakClassName(name: string): ITranslateProvider;
fallbackLanguage(langKey?: string): string;
+74 -4
View File
@@ -4,6 +4,7 @@
// Georgii Dolzhykov <https://github.com/thorn0>
// Caleb St-Denis <https://github.com/calebstdenis>
// Leonard Thieu <https://github.com/leonard-thieu>
// Steffen Kowalski <https://github.com/scipper>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -484,6 +485,76 @@ declare namespace angular {
$broadcast(name: string, ...args: any[]): IAngularEvent;
$destroy(): void;
$digest(): void;
/**
* Suspend watchers of this scope subtree so that they will not be invoked during digest.
*
* This can be used to optimize your application when you know that running those watchers
* is redundant.
*
* **Warning**
*
* Suspending scopes from the digest cycle can have unwanted and difficult to debug results.
* Only use this approach if you are confident that you know what you are doing and have
* ample tests to ensure that bindings get updated as you expect.
*
* Some of the things to consider are:
*
* * Any external event on a directive/component will not trigger a digest while the hosting
* scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`.
* * Transcluded content exists on a scope that inherits from outside a directive but exists
* as a child of the directive's containing scope. If the containing scope is suspended the
* transcluded scope will also be suspended, even if the scope from which the transcluded
* scope inherits is not suspended.
* * Multiple directives trying to manage the suspended status of a scope can confuse each other:
* * A call to `$suspend()` on an already suspended scope is a no-op.
* * A call to `$resume()` on a non-suspended scope is a no-op.
* * If two directives suspend a scope, then one of them resumes the scope, the scope will no
* longer be suspended. This could result in the other directive believing a scope to be
* suspended when it is not.
* * If a parent scope is suspended then all its descendants will be also excluded from future
* digests whether or not they have been suspended themselves. Note that this also applies to
* isolate child scopes.
* * Calling `$digest()` directly on a descendant of a suspended scope will still run the watchers
* for that scope and its descendants. When digesting we only check whether the current scope is
* locally suspended, rather than checking whether it has a suspended ancestor.
* * Calling `$resume()` on a scope that has a suspended ancestor will not cause the scope to be
* included in future digests until all its ancestors have been resumed.
* * Resolved promises, e.g. from explicit `$q` deferreds and `$http` calls, trigger `$apply()`
* against the `$rootScope` and so will still trigger a global digest even if the promise was
* initiated by a component that lives on a suspended scope.
*/
$suspend(): void;
/**
* Call this method to determine if this scope has been explicitly suspended. It will not
* tell you whether an ancestor has been suspended.
* To determine if this scope will be excluded from a digest triggered at the $rootScope,
* for example, you must check all its ancestors:
*
* ```
* function isExcludedFromDigest(scope) {
* while(scope) {
* if (scope.$isSuspended()) return true;
* scope = scope.$parent;
* }
* return false;
* ```
*
* Be aware that a scope may not be included in digests if it has a suspended ancestor,
* even if `$isSuspended()` returns false.
*
* @returns true if the current scope has been suspended.
*/
$isSuspended(): boolean;
/**
* Resume watchers of this scope subtree in case it was suspended.
*
* See {$rootScope.Scope#$suspend} for information about the dangers of using this approach.
*/
$resume(): void;
/**
* Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners.
*
@@ -1390,10 +1461,9 @@ declare namespace angular {
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, later?: boolean, ident?: string): T;
<T>(controllerConstructor: Function, locals?: IControllerLocals, later?: boolean, ident?: string): T;
<T>(controllerConstructor: Function, locals?: any, later?: boolean, ident?: string): T;
<T>(controllerName: string, locals?: any, later?: boolean, ident?: string): T;
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any): T;
<T>(controllerConstructor: (...args: any[]) => T, locals?: any): T;
<T>(controllerName: string, locals?: any): T;
}
interface IControllerProvider extends IServiceProvider {
+4 -1
View File
@@ -39,7 +39,10 @@ const showOptions : Auth0LockShowOptions = {
type: "error",
text: "an error has occurred"
},
rememberLastLogin: false
rememberLastLogin: false,
languageDictionary: {
title: "test"
}
};
lock.show(showOptions);
+1
View File
@@ -161,6 +161,7 @@ interface Auth0LockShowOptions {
initialScreen?: "login" | "signUp" | "forgotPassword";
flashMessage?: Auth0LockFlashMessageOptions;
rememberLastLogin?: boolean;
languageDictionary?: any;
}
interface AuthResult {
+2 -1
View File
@@ -350,6 +350,7 @@ export interface Identity {
user_id: string;
provider: string;
isSocial: boolean;
access_token?: string;
profileData?: {
email?: string;
email_verified?: boolean;
@@ -882,4 +883,4 @@ export class UsersManager {
impersonate(userId: string, settings: ImpersonateSettingOptions): Promise<any>;
impersonate(userId: string, settings: ImpersonateSettingOptions, cb: (err: Error, data: any) => void): void;
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as t from 'babel-types';
export { t as types };
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Johnny Estilles <https://github.com/johnnyestilles>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as t from 'babel-types';
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import { BabylonOptions } from 'babylon';
import * as t from 'babel-types';
+23 -10
View File
@@ -2,15 +2,17 @@
// Project: https://github.com/babel/babel/tree/master/packages/babel-traverse
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Ryan Petrich <https://github.com/rpetrich>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as t from 'babel-types';
export type Node = t.Node;
export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void;
export default function traverse<S>(parent: Node | Node[], opts: TraverseOptions<S>, scope: Scope, state: S, parentPath?: NodePath): void;
export default function traverse(parent: Node | Node[], opts: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void;
export interface TraverseOptions extends Visitor {
export interface TraverseOptions<S = Node> extends Visitor<S> {
scope?: Scope;
noScope?: boolean;
}
@@ -25,6 +27,7 @@ export class Scope {
bindings: { [name: string]: Binding; };
/** Traverse node with current scope and path. */
traverse<S>(node: Node | Node[], opts: TraverseOptions<S>, state: S): void;
traverse(node: Node | Node[], opts?: TraverseOptions, state?: any): void;
/** Generate a unique identifier and add it to the current scope. */
@@ -339,10 +342,10 @@ export class NodePath<T = Node> {
listKey: string;
inList: boolean;
parentKey: string;
key: string;
key: string | number;
node: T;
scope: Scope;
type: string;
type: T extends undefined | null ? string | null : string;
typeAnnotation: object;
getScope(scope: Scope): Scope;
@@ -353,7 +356,8 @@ export class NodePath<T = Node> {
buildCodeFrameError<TError extends Error>(msg: string, Error?: new (msg: string) => TError): TError;
traverse(visitor: Visitor, state?: any): void;
traverse<T>(visitor: Visitor<T>, state: T): void;
traverse(visitor: Visitor): void;
set(key: string, node: Node): void;
@@ -372,10 +376,10 @@ export class NodePath<T = Node> {
find(callback: (path: NodePath) => boolean): NodePath;
/** Get the parent function of the current path. */
getFunctionParent(): NodePath;
getFunctionParent(): NodePath<t.Function>;
/** Walk up the tree until we hit a parent node path in a list. */
getStatementParent(): NodePath;
getStatementParent(): NodePath<t.Statement>;
/**
* Get the deepest common ancestor and then from it, get the earliest relationship path
@@ -537,6 +541,9 @@ export class NodePath<T = Node> {
/** Get the source code associated with this node. */
getSource(): string;
/** Check if the current path will maybe execute before another path */
willIMaybeExecuteBefore(path: NodePath): boolean;
// ------------------------- context -------------------------
call(key: string): boolean;
@@ -582,9 +589,15 @@ export class NodePath<T = Node> {
getCompletionRecords(): NodePath[];
getSibling(key: string): NodePath;
getSibling(key: string | number): NodePath;
getAllPrevSiblings(): NodePath[];
getAllNextSiblings(): NodePath[];
get(key: string, context?: boolean | TraversalContext): NodePath;
get<K extends keyof T>(key: K, context?: boolean | TraversalContext):
T[K] extends Array<Node | null | undefined> ? Array<NodePath<T[K][number]>> :
T[K] extends Node | null | undefined ? NodePath<T[K]> :
never;
get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[];
getBindingIdentifiers(duplicates?: boolean): Node[];
+3 -3
View File
@@ -5,7 +5,7 @@
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Boris Cherny <https://github.com/bcherny>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
export interface Comment {
value: string;
@@ -772,7 +772,7 @@ export interface VoidTypeAnnotation extends Node {
export interface JSXAttribute extends Node {
type: "JSXAttribute";
name: JSXIdentifier | JSXNamespacedName;
value: JSXElement | StringLiteral | JSXExpressionContainer;
value: JSXElement | StringLiteral | JSXExpressionContainer | null;
}
export interface JSXClosingElement extends Node {
@@ -1424,7 +1424,7 @@ export function objectTypeProperty(key?: Expression, value?: FlowTypeAnnotation)
export function qualifiedTypeIdentifier(id?: Identifier, qualification?: Identifier | QualifiedTypeIdentifier): QualifiedTypeIdentifier;
export function unionTypeAnnotation(types?: FlowTypeAnnotation[]): UnionTypeAnnotation;
export function voidTypeAnnotation(): VoidTypeAnnotation;
export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer): JSXAttribute;
export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer | null): JSXAttribute;
export function jSXClosingElement(name?: JSXIdentifier | JSXMemberExpression): JSXClosingElement;
export function jSXElement(openingElement?: JSXOpeningElement, closingElement?: JSXClosingElement, children?: Array<JSXElement | JSXExpressionContainer | JSXText>, selfClosing?: boolean): JSXElement;
export function jSXEmptyExpression(): JSXEmptyExpression;
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/simlrh/babel-webpack-plugin
// Definitions by: Jed Fox <https://github.com/j-f1>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import { Plugin } from 'webpack';
import { TransformOptions } from 'babel-core';
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: TeamworkGuy2 <https://github.com/TeamworkGuy2>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="node" />
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/pugjs/babylon-walk
// Definitions by: Marek Buchar <https://github.com/czbuchi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as babelTypes from 'babel-types';
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import { File, Expression } from 'babel-types';
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/wardbell/bardjs
// Definitions by: Andrew Archibald <https://github.com/TepigMC>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.4
/// <reference types="angular" />
/// <reference types="chai" />
+12 -8
View File
@@ -3,12 +3,16 @@
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface BlockiesIcon {
toDataURL(): string;
}
interface BlockiesConfig {
seed: string;
}
declare function blockies(config: BlockiesConfig): BlockiesIcon;
declare function blockies(config?: blockies.BlockiesConfig): HTMLCanvasElement;
export = blockies;
declare namespace blockies {
interface BlockiesConfig {
size?: number;
scale?: number;
seed?: string;
color?: string;
bgcolor?: string;
spotcolor?: string;
}
}
+4 -1
View File
@@ -1,7 +1,10 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
+1 -1
View File
@@ -354,7 +354,7 @@ export type TooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.too
// --------------------------------------------------------------------------------------
declare global {
interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement> {
interface JQuery<TElement = HTMLElement> {
alert(action?: "close" | "dispose"): this;
button(action: "toggle" | "dispose"): this;
+52
View File
@@ -1,4 +1,5 @@
import browserSync = require("browser-sync");
import { EventEmitter } from "events";
(() => {
//make sure that the interfaces are correctly exposed
@@ -391,6 +392,57 @@ bs.init({
bs.reload();
browserSync.use(
{
plugin: function(opts: object, bs: browserSync.BrowserSyncInstance) {
console.log(opts);
},
"plugin:name": "test"
},
{ files: "*.css" }
);
browserSync.use({
plugin: function(opts: object, bs: browserSync.BrowserSyncInstance) {
console.log(bs.name);
}
});
browserSync(
{
server: {
baseDir: "test/fixtures"
},
logLevel: "silent",
open: false
}
);
var instanceName = "TestInstance";
var namedInstance = browserSync.create(instanceName);
namedInstance.init({
server: { index: "./app" },
https: true
});
console.log(namedInstance.getOption("https")); // Should output true.
var existingInstance = browserSync.get(instanceName);
browserSync.create("InstanceWithEventEmitter", new EventEmitter());
// Should output something greater than 0.
console.log(browserSync.instances.length);
browserSync.reset();
// Should output 0.
console.log(browserSync.instances.length);
var cleanupTestInstance = browserSync.create("CleanupTest");
cleanupTestInstance.cleanup();
console.log(cleanupTestInstance.active); // Should output false.
function browserSyncInit(): browserSync.BrowserSyncInstance {
var browser = browserSync.create();
browser.init();
+44 -15
View File
@@ -456,11 +456,15 @@ declare namespace browserSync {
* depending on your use-case.
*/
(config?: Options, callback?: (err: Error, bs: object) => any): BrowserSyncInstance;
/**
*
*/
instances: Array<BrowserSyncInstance>;
/**
* Create a Browsersync instance
* @param name an identifier that can used for retrieval later
*/
create(name?: string): BrowserSyncInstance;
create(name?: string, emitter?: NodeJS.EventEmitter): BrowserSyncInstance;
/**
* Get a single instance by name. This is useful if you have your build scripts in separate files
* @param name the identifier used for retrieval
@@ -471,6 +475,11 @@ declare namespace browserSync {
* @param name the name of the instance
*/
has(name: string): boolean;
/**
* Reset the state of the module.
* (should only be needed for test environments)
*/
reset(): void;
}
interface BrowserSyncInstance {
@@ -481,6 +490,24 @@ declare namespace browserSync {
* depending on your use-case.
*/
init(config?: Options, callback?: (err: Error, bs: object) => any): BrowserSyncInstance;
/**
* This method will close any running server, stop file watching & exit the current process.
*/
exit(): void;
/**
* Helper method for browser notifications
* @param message Can be a simple message such as 'Connected' or HTML
* @param timeout How long the message will remain in the browser. @since 1.3.0
*/
notify(message: string, timeout?: number): void;
/**
* Method to pause file change events
*/
pause(): void;
/**
* Method to resume paused watchers
*/
resume(): void;
/**
* Reload the browser
* The reload method will inform all browsers about changed files and will either cause the browser
@@ -510,28 +537,30 @@ declare namespace browserSync {
*/
stream(opts?: StreamOptions): NodeJS.ReadWriteStream;
/**
* Helper method for browser notifications
* @param message Can be a simple message such as 'Connected' or HTML
* @param timeout How long the message will remain in the browser. @since 1.3.0
* Instance Cleanup.
*/
notify(message: string, timeout?: number): void;
cleanup(fn?: (error: NodeJS.ErrnoException, bs: BrowserSyncInstance) => void): void;
/**
* This method will close any running server, stop file watching & exit the current process.
* Register a plugin.
* Must implement at least a 'plugin' property that returns
* callable function.
*
* @method use
* @param {object} module The object to be `required`.
* @param {object} options The
* @param {any} cb A callback function that will return any errors.
*/
exit(): void;
use(module: { "plugin:name"?: string, plugin: (opts: object, bs: BrowserSyncInstance) => any }, options?: object, cb?: any): void;
/**
* Callback helper to examine what options have been set.
* @param {string} name The key to search options map for.
*/
getOption(name: string): any;
/**
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
*/
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any)
: NodeJS.EventEmitter;
/**
* Method to pause file change events
*/
pause(): void;
/**
* Method to resume paused watchers
*/
resume(): void;
/**
* The internal Event Emitter used by the running Browsersync instance (if there is one). You can use
* this to emit your own events, such as changed files, logging etc.
+1 -1
View File
@@ -182,7 +182,7 @@ export class ObjectID {
* @param {number} time optional parameter allowing to pass in a second based timestamp.
* @return {string} return the 12 byte id binary string.
*/
generate(time?: number): string;
generate(time?: number): Buffer;
/**
* Returns the generation date (accurate up to the second) that this ID was generated.
* @return {date} the generation date
+6
View File
@@ -0,0 +1,6 @@
import bufferFrom = require('buffer-from');
bufferFrom([1, 2, 3, 4]); // $ExpectType Buffer
bufferFrom(new Uint8Array([1, 2, 3, 4]).buffer, 1, 2); // $ExpectType Buffer
bufferFrom('test', 'utf8'); // $ExpectType Buffer
bufferFrom(bufferFrom('test')); // $ExpectType Buffer
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for buffer-from 1.1
// Project: https://github.com/LinusU/buffer-from#readme
// Definitions by: Nat Burns <https://github.com/burnnat>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function bufferFrom(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
declare function bufferFrom(str: string, encoding?: string): Buffer;
declare function bufferFrom(data: ReadonlyArray<any> | Buffer): Buffer;
export = bufferFrom;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"buffer-from-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,28 @@
import BufferReader from 'buffer-reader';
const buffer = new Buffer(1000);
const reader = new BufferReader(buffer);
reader.append(new Buffer(1));
reader.tell();
reader.seek(1);
reader.move(2);
reader.restAll();
reader.nextBuffer(2);
reader.nextString(5);
reader.nextString(5, 'utf8');
reader.nextStringZero();
reader.nextStringZero('utf8');
reader.nextInt8();
reader.nextUInt8();
reader.nextInt16LE();
reader.nextUInt16LE();
reader.nextInt16BE();
reader.nextUInt16BE();
reader.nextInt32LE();
reader.nextUInt32LE();
reader.nextInt32BE();
reader.nextUInt32BE();
reader.nextFloatLE();
reader.nextFloatBE();
reader.nextDouble32LE();
reader.nextDouble32BE();
+111
View File
@@ -0,0 +1,111 @@
// Type definitions for buffer-reader 0.1
// Project: https://github.com/villadora/node-buffer-reader
// Definitions by: nrlquaker <https://github.com/nrlquaker>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
/// <reference types="node"/>
export = BufferReader;
declare class BufferReader {
/**
* Create a new reader, if no buffer provided, a empty buffer will be used.
*/
constructor(buffer?: Buffer)
/**
* Append new buffer to the end of current reader.
* @param buffer buffer to append
*/
append(buffer: Buffer): void;
/**
* Return current position of the reader.
*/
tell(): number;
/**
* Set new position of the reader, if the pos is invalid, an exception will be raised.
* @param position new position
*/
seek(position: number): void;
/**
* Move the position of reader by offset, offset can be negative; it can be used to skip some bytes.
* @param offset offset to move by
*/
move(offset: number): void;
/**
* Get all the remaining bytes as a Buffer.
*/
restAll(): Buffer;
/**
* Read a buffer with specified length.
* @param length specified length
*/
nextBuffer(length: number): Buffer;
/**
* Read next length of bytes as String, encoding default is 'utf8'.
* @param length length of the string to read
* @param encoding encoding of the string
*/
nextString(length: number, encoding?: string): string;
/**
* Read next bytes till the end of buffer as null-terminated string, encoding default is 'utf8'.
* @param encoding encoding of the string
*/
nextStringZero(encoding?: string): string;
/**
* Read next bytes as Int8, the value is just as the same format Buffer in nodejs doc.
*/
nextInt8(): number;
/**
* Read next bytes as UInt8, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt8(): number;
/**
* Read next bytes as Int16LE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt16LE(): number;
/**
* Read next bytes as UInt16LE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt16LE(): number;
/**
* Read next bytes as Int16BE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt16BE(): number;
/**
* Read next bytes as UInt16BE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt16BE(): number;
/**
* Read next bytes as Int32LE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt32LE(): number;
/**
* Read next bytes as UInt32LE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt32LE(): number;
/**
* Read next bytes as Int32BE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt32BE(): number;
/**
* Read next bytes as UInt32BE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt32BE(): number;
/**
* Read next bytes as FloatLE, the value is just as the same format Buffer in nodejs doc.
*/
nextFloatLE(): number;
/**
* Read next bytes as FloatBE, the value is just as the same format Buffer in nodejs doc.
*/
nextFloatBE(): number;
/**
* Read next bytes as Double32LE, the value is just as the same format Buffer in nodejs doc.
*/
nextDouble32LE(): number;
/**
* Read next bytes as Double32BE, the value is just as the same format Buffer in nodejs doc.
*/
nextDouble32BE(): number;
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"esModuleInterop": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"buffer-reader-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+23 -2
View File
@@ -24,7 +24,12 @@ let array = [ 1, 2, 3 ];
chai.spy.on(array, 'push');
// or you can track multiple object's methods
chai.spy.on(array, 'push', 'pop');
chai.spy.on(array, ['push', 'pop']);
// or you can track multiple object's methods
chai.spy.on(array, 'push', function(item) {
array.push(item);
});
array.push(5);
@@ -149,4 +154,20 @@ spy.should.not.have.been.called.above(3);
expect(spy).to.have.been.called.below(3);
expect(spy).to.not.have.been.called.lt(3);
spy.should.have.been.called.lt(3);
spy.should.not.have.been.called.below(3);
spy.should.not.have.been.called.below(3);
// You can also create sandbox
let sb = chai.spy.sandbox();
sb.on(array, 'pop', () => {
return 1;
})
let one = array.pop();
expect(one).to.equal(1);
// Can restore methods in sandbox
sb.restore();
array.push(2);
let two = array.pop();
expect(two).to.equal(2);
+108 -54
View File
@@ -1,6 +1,8 @@
// Type definitions for chai-spies
// Type definitions for chai-spies 1.0.0
// Project: https://github.com/chaijs/chai-spies
// Definitions by: Ilya Kuznetsov <https://github.com/kuzn-ilya>
// Harm van der Werf <https://github.com/harm-less>
// Jouni Suorsa <https://github.com/jounisuo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="chai" />
@@ -21,7 +23,7 @@ declare namespace Chai {
* ```ts
* expect(spy).to.be.spy;
* spy.should.be.spy;
* ```
* ```
*/
spy: Assertion;
@@ -32,7 +34,7 @@ declare namespace Chai {
* expect(spy).to.have.been.called();
* spy.should.have.been.called();
* ```
* Note that ```called``` can be used as a chainable method.
* Note that ```called``` can be used as a chainable method.
*/
called: ChaiSpies.Called;
@@ -61,7 +63,32 @@ declare namespace Chai {
}
declare namespace ChaiSpies {
interface Sandbox {
/**
* #### chai.spy.on (function)
*
* Wraps an object method into spy. All calls will pass through to the original function.
*
* @param {Object} object
* @param {String} methodNames names to spy on
* @param {function} fn replacement function
* @returns function to actually call
*/
on(object: Object, methodNames: string | string[], fn?: (parameters: any[]|any) => any): any;
/**
* #### chai.spy.restore (function)
*
* Restores previously wrapped object's method.
* Restores all spied objects of a sandbox if called without parameters.
*
* @function
* @param {Object} [object]
* @param {String|String[]} [methods] name or names
* @return {Sandbox} Sandbox instance
*/
restore(object?: Object, methodNames?: string | string[]): void;
}
interface Spy {
/**
* #### chai.spy (function)
@@ -72,9 +99,9 @@ declare namespace ChaiSpies {
* var spy = chai.spy(original)
* , e_spy = chai.spy();
* ```
* @param fn function to spy on. @default ```function () {}```
* @param fn function to spy on. @default ```function () {}```
* @returns function to actually call
*/
*/
(): SpyFunc0Proxy<void>;
<R>(fn: SpyFunc0<R>): SpyFunc0Proxy<R>;
<A1, R>(fn: SpyFunc1<A1, R>): SpyFunc1Proxy<A1, R>;
@@ -107,10 +134,11 @@ declare namespace ChaiSpies {
* var spy = chai.spy.on(Array, 'isArray');
* ```
* @param {Object} object
* @param {String} method name to spy on
* @param {String} method names to spy on
* @param {function} fn replacement function
* @returns function to actually call
*/
on(object: Object, ...methodNames: string[]): any;
*/
on(object: Object, methodNames: string | string[], fn?: (parameters: any[]|any) => any): any;
/**
* #### chai.spy.object (function)
@@ -123,10 +151,24 @@ declare namespace ChaiSpies {
* @param {String[]|Object} method names or method definitions
* @returns object with spied methods
*/
object(name: string, methods: string[]): any;
object(methods: string[]): any;
object<T>(name: string, methods: T): T;
object<T>(methods: T): T;
object(name: string, methods: string[]): any;
object(methods: string[]): any;
object<T>(name: string, methods: T): T;
object<T>(methods: T): T;
/**
* #### chai.spy.restore (function)
*
* Restores spy assigned to DEFAULT sandbox
*
* Restores previously wrapped object's method.
* Restores all spied objects of a sandbox if called without parameters.
*
* @param {Object} [object]
* @param {String|String[]} [methods] name or names
* @return {Sandbox} Sandbox instance
*/
restore(object?: Object, methodNames?: string | string[]): void;
/**
* #### chai.spy.returns (function)
@@ -141,6 +183,18 @@ declare namespace ChaiSpies {
*/
returns<T>(value: T): SpyFunc0Proxy<T>;
/**
* ### chai.spy.sandbox
*
* Creates a sandbox.
*
* Sandbox is a set of spies.
* Sandbox allows to track methods on objects and restore original methods with on restore call.
*
* @returns {Sandbox}
*/
sandbox(): Sandbox;
}
interface Called {
@@ -158,12 +212,12 @@ declare namespace ChaiSpies {
* spy.should.not.have.been.called.once;
* ```
*/
once: Chai.Assertion;
once: Chai.Assertion;
/**
* ####.twice
* Assert that a spy has been called exactly twice.
* ```ts
* ```ts
* expect(spy).to.have.been.called.twice;
* expect(spy).to.not.have.been.called.twice;
* spy.should.have.been.called.twice;
@@ -215,7 +269,7 @@ declare namespace ChaiSpies {
* ```ts
* expect(spy).to.have.been.called.above(3);
* spy.should.not.have.been.called.above(3);
* ```
* ```
*/
above(n: number): Chai.Assertion;
@@ -225,7 +279,7 @@ declare namespace ChaiSpies {
* ```ts
* expect(spy).to.have.been.called.gt(3);
* spy.should.not.have.been.called.gt(3);
* ```
* ```
*/
gt(n: number): Chai.Assertion;
@@ -235,7 +289,7 @@ declare namespace ChaiSpies {
* ```ts
* expect(spy).to.have.been.called.below(3);
* spy.should.not.have.been.called.below(3);
* ```
* ```
*/
below(n: number): Chai.Assertion;
@@ -245,7 +299,7 @@ declare namespace ChaiSpies {
* ```ts
* expect(spy).to.have.been.called.lt(3);
* spy.should.not.have.been.called.lt(3);
* ```
* ```
*/
lt(n: number): Chai.Assertion;
}
@@ -301,7 +355,7 @@ declare namespace ChaiSpies {
* spy.should.have.been.called.with('foo');
* ```
* Will also pass for ```spy('foo', 'bar')``` and ```spy(); spy('foo')```.
* If used with multiple arguments, assert that a spy has been called with all the given arguments at least once.
* If used with multiple arguments, assert that a spy has been called with all the given arguments at least once.
* ```ts
* spy('foo', 'bar', 1);
* expect(spy).to.have.been.called.with('bar', 'foo');
@@ -389,7 +443,7 @@ declare namespace ChaiSpies {
*
* Resets __spy object parameters for instantiation and reuse
* @returns proxy spy object
*/
*/
reset(): this;
}
@@ -397,77 +451,77 @@ declare namespace ChaiSpies {
(): R;
}
interface SpyFunc1<A1, R> {
(a: A1): R;
interface SpyFunc1<A1, R> {
(a: A1): R;
}
interface SpyFunc2<A1, A2, R> {
(a: A1, b: A2): R;
interface SpyFunc2<A1, A2, R> {
(a: A1, b: A2): R;
}
interface SpyFunc3<A1, A2, A3, R> {
(a: A1, b: A2, c: A3): R;
interface SpyFunc3<A1, A2, A3, R> {
(a: A1, b: A2, c: A3): R;
}
interface SpyFunc4<A1, A2, A3, A4, R> {
(a: A1, b: A2, c: A3, d: A4): R;
interface SpyFunc4<A1, A2, A3, A4, R> {
(a: A1, b: A2, c: A3, d: A4): R;
}
interface SpyFunc5<A1, A2, A3, A4, A5, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5): R;
interface SpyFunc5<A1, A2, A3, A4, A5, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5): R;
}
interface SpyFunc6<A1, A2, A3, A4, A5, A6, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R;
interface SpyFunc6<A1, A2, A3, A4, A5, A6, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R;
}
interface SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R;
interface SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R;
}
interface SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R;
interface SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R;
}
interface SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R;
interface SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R;
}
interface SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R;
interface SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R;
}
interface SpyFunc0Proxy<R> extends SpyFunc0<R>, Resetable {
}
interface SpyFunc1Proxy<A1, R> extends SpyFunc1<A1, R>, Resetable {
interface SpyFunc1Proxy<A1, R> extends SpyFunc1<A1, R>, Resetable {
}
interface SpyFunc2Proxy<A1, A2, R> extends SpyFunc2<A1, A2, R>, Resetable {
interface SpyFunc2Proxy<A1, A2, R> extends SpyFunc2<A1, A2, R>, Resetable {
}
interface SpyFunc3Proxy<A1, A2, A3, R> extends SpyFunc3<A1, A2, A3, R>, Resetable {
interface SpyFunc3Proxy<A1, A2, A3, R> extends SpyFunc3<A1, A2, A3, R>, Resetable {
}
interface SpyFunc4Proxy<A1, A2, A3, A4, R> extends SpyFunc4<A1, A2, A3, A4, R>, Resetable {
interface SpyFunc4Proxy<A1, A2, A3, A4, R> extends SpyFunc4<A1, A2, A3, A4, R>, Resetable {
}
interface SpyFunc5Proxy<A1, A2, A3, A4, A5, R> extends SpyFunc5<A1, A2, A3, A4, A5, R>, Resetable {
interface SpyFunc5Proxy<A1, A2, A3, A4, A5, R> extends SpyFunc5<A1, A2, A3, A4, A5, R>, Resetable {
}
interface SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R> extends SpyFunc6<A1, A2, A3, A4, A5, A6, R>, Resetable {
interface SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R> extends SpyFunc6<A1, A2, A3, A4, A5, A6, R>, Resetable {
}
interface SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R> extends SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>, Resetable {
interface SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R> extends SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>, Resetable {
}
interface SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R> extends SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>, Resetable {
interface SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R> extends SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>, Resetable {
}
interface SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> extends SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>, Resetable {
interface SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> extends SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>, Resetable {
}
interface SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> extends SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>, Resetable {
interface SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> extends SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>, Resetable {
}
}
+33
View File
@@ -1361,6 +1361,39 @@ suite('assert', () => {
assert.notDeepEqual(circularObject, secondCircularObject);
});
test('deepStrictEqual', () => {
assert.deepStrictEqual({tea: 'chai'}, {tea: 'chai'});
assert.throws(() => assert.deepStrictEqual({tea: 'chai'}, {tea: 'black'}));
const obja = Object.create({tea: 'chai'});
const objb = Object.create({tea: 'chai'});
assert.deepStrictEqual(obja, objb);
const obj1 = Object.create({tea: 'chai'});
const obj2 = Object.create({tea: 'black'});
assert.throws(() => assert.deepStrictEqual(obj1, obj2));
});
test('deepStrictEqual (ordering)', () => {
const a = {a: 'b', c: 'd'};
const b = {c: 'd', a: 'b'};
assert.deepStrictEqual(a, b);
});
test('deepStrictEqual (circular)', () => {
const circularObject: any = {};
const secondCircularObject: any = {};
circularObject.field = circularObject;
secondCircularObject.field = secondCircularObject;
assert.deepStrictEqual(circularObject, secondCircularObject);
secondCircularObject.field2 = secondCircularObject;
assert.deepStrictEqual(circularObject, secondCircularObject);
});
test('isNull', () => {
assert.isNull(null);
assert.isNull(undefined);
+12 -2
View File
@@ -353,7 +353,7 @@ declare namespace Chai {
notStrictEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts that actual is deeply equal to expected.
* Asserts that actual is deeply equal (==) to expected.
*
* @type T Type of the objects.
* @param actual Actual value.
@@ -363,7 +363,7 @@ declare namespace Chai {
deepEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts that actual is not deeply equal to expected.
* Asserts that actual is not deeply equal (==) to expected.
*
* @type T Type of the objects.
* @param actual Actual value.
@@ -372,6 +372,16 @@ declare namespace Chai {
*/
notDeepEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts that actual is deeply strict equal (===) to expected.
*
* @type T Type of the objects.
* @param actual Actual value.
* @param expected Potential expected value.
* @param message Message to display on error.
*/
deepStrictEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
*
+1
View File
@@ -506,6 +506,7 @@ declare namespace Chart {
}
interface CommonAxe {
bounds?: string;
type?: ScaleType | string;
display?: boolean;
id?: string;
+1 -1
View File
@@ -247,7 +247,7 @@ new Chartist.Pie('.ct-chart', {
value: 70,
name: 'Series 3',
className: 'my-custom-class-three',
meta: 'Meta Three'
meta: { description: 'Meta Three' }
}]
});
+2 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for Chartist v0.9.81
// Project: https://github.com/gionkunz/chartist-js
// Definitions by: Matt Gibbs <https://github.com/mtgibbs>, Simon Pfeifer <https://github.com/psimonski>, Cassey Lottman <https://github.com/clottman>, Anastasiia Antonova <https://github.com/affilnost>
// Definitions by: Matt Gibbs <https://github.com/mtgibbs>, Simon Pfeifer <https://github.com/psimonski>, Cassey Lottman <https://github.com/clottman>, Anastasiia Antonova <https://github.com/affilnost>, Sunny Juneja <https://github.com/sunnyrjuneja>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Chartist {
@@ -101,7 +101,7 @@ declare namespace Chartist {
value?: number;
data?: Array<number>;
className?: string;
meta?: string; // I assume this could probably be a number as well?
meta?: any;
}
interface IChartistBase<T extends IChartOptions> {
@@ -0,0 +1,92 @@
import { Break, BreakClip } from "./cast.framework.messages";
export = cast.framework.breaks;
declare namespace cast.framework.breaks {
class BreakSeekData {
constructor(seekFrom: number, seekTo: number, breaks: Break[]);
/**
* List of breaks
*/
breaks: Break[];
/**
* Current playback time
*/
seekFrom: number;
/**
* The time to seek to
*/
seekTo: number;
}
/** Provide context information for break clip load interceptor. */
class BreakClipLoadInterceptorContext {
constructor(brk: Break);
/**
* The container break for the break clip
*/
break: Break;
}
/** Interface to manage breaks */
interface BreakManager {
/**
* Get current media break by id.
*/
getBreakById(id: string): Break;
/**
* Get current media break clip by id
*/
getBreakClipById(id: string): BreakClip;
/** Get current media break clips. */
getBreakClips(): BreakClip[];
/** Get current media breaks. */
getBreaks(): Break[];
/** Returns true if watched breaks should be played. */
getPlayWatchedBreak(): boolean;
/**
* Provide an interceptor to allow developer to insert more break clips or modify current break clip before a break is started.
* If interceptor is null it will reset the interceptor to default one.
* By default VAST fetching and parsing logic in default interceptor.
* So if customized interceptor is set by developer;
* the VAST logic will be overridden and developers should implement their own VAST fetching and parsing logic in the provided interceptor.
*/
setBreakClipLoadInterceptor(
interceptor: (
breakClip: BreakClip,
breakClipLoaderContext?: BreakClipLoadInterceptorContext
) => void
): void;
/**
* Provide an interceptor for developer to specify what breaks they want to play after seek.
*/
setBreakSeekInterceptor(
seekInterceptor: (breakSeekData: BreakSeekData) => void
): void;
/**
* Set a flag to control if the watched client stitching break should be played.
*/
setPlayWatchedBreak(playWatchedBreak: boolean): void;
/**
* Provide an interceptor to modify VAST tracking URL before it is being sent to server.
* The input of the interceptor is a string of the tracking URL.
* The interceptor can either return a modified string of URL or a Promise of modified string of URL.
* The interceptor can also return null if you want to send the tracking URL by your own code instead of by CAF.
*/
setVastTrackingInterceptor(
interceptor?: (trackingUrl: string) => void
): void;
}
}
+783
View File
@@ -0,0 +1,783 @@
import { EventType } from "./cast.framework.events";
import {
PlayerState,
PlayStringId,
ErrorType,
ErrorReason,
IdleReason,
MessageType,
Track,
TextTrackStyle,
QueueItem,
LoadRequestData,
QueueData,
Break,
LiveSeekableRange,
MediaInformation,
ErrorData,
RequestData
} from "./cast.framework.messages";
import { BreakManager } from "./cast.framework.breaks";
import { EventHandler, RequestHandler, BinaryHandler } from "./index";
import {
EventType as SystemEventType,
ApplicationData,
Sender,
StandbyState,
SystemState
} from "./cast.framework.system";
export = cast.framework;
type HTMLMediaElement = any;
declare namespace cast.framework {
type LoggerLevel =
| "DEBUG"
| "VERBOSE"
| "INFO"
| "WARNING"
| "ERROR"
| "NONE";
type ContentProtection = "NONE" | "CLEARKEY" | "PLAYREADY" | "WIDEVINE";
/**
* Manages text tracks.
*/
class TextTracksManager {
constructor(params?: any);
/**
* Adds text tracks to the list.
*/
addTracks(tracks: Track[]): void;
/**
* Creates a text track.
*/
createTrack(): Track;
/**
* Gets all active text ids.
*/
getActiveIds(): number[];
/**
* Gets all active text tracks.
*/
getActiveTracks(): Track[];
/**
* Returns the current text track style.
*/
getTextTracksStyle(): TextTrackStyle;
/**
* Gets text track by id.
*/
getTrackById(id: number): Track;
/**
* Returns all text tracks.
*/
getTracks(): Track[];
/**
* Gets text tracks by language.
*/
getTracksByLanguage(language: string): Track[];
/**
* Sets text tracks to be active by id.
*/
setActiveByIds(newIds: number[]): void;
/**
* Sets text tracks to be active by language.
*/
setActiveByLanguage(language: string): void;
/**
* Sets text track style.
*/
setTextTrackStyle(style: TextTrackStyle): void;
}
/**
* QueueManager exposes several queue manipulation APIs to developers.
*/
class QueueManager {
constructor(params?: any);
/**
* Returns the current queue item.
*/
getCurrentItem(): QueueItem;
/**
* Returns the index of the current queue item.
*/
getCurrentItemIndex(): number;
/**
* Returns the queue items.
*/
getItems(): QueueItem[];
/**
* Inserts items into the queue.
*/
insertItems(items: QueueItem[], insertBefore?: number): void;
/**
* Removes items from the queue.
*/
removeItems(itemIds: number[]): void;
/**
* Sets whether to limit the number of queue items to be reported in Media Status (default is true).
*/
setQueueStatusLimit(limitQueueItemsInStatus: boolean): void;
/**
* Updates existing queue items by matching itemId.
*/
updateItems(items: QueueItem[]): void;
}
/**
* Base implementation of a queue.
*/
class QueueBase {
/**
* Fetches a window of items using the specified item id as reference; called by the receiver MediaManager when it needs more queue items;
* often as a request from senders. If only one of nextCount and prevCount is non-zero; fetchItems should only return items after or before
* the reference item; if both nextCount and prevCount are non-zero; a window of items including the reference item should be returned.
*/
fetchItems(
itemId: number,
nextCount: number,
prevCount: number
): QueueItem[] | Promise<QueueItem[]>;
/**
* Initializes the queue with the requestData. This is called when a new LOAD request comes in to the receiver.
* If this returns or resolves to null; our default queueing implementation will create a queue based on queueData.items or the single media
* in the load request data.
*/
initialize(
requestData: LoadRequestData
): QueueData | Promise<QueueData>;
/**
* Returns next items after the reference item; often the end of the current queue; called by the receiver MediaManager.
*/
nextItems(itemId?: number): QueueItem[] | Promise<QueueItem[]>;
/**
* Sets the current item with the itemId; called by the receiver MediaManager when it changes the current playing item.
*/
onCurrentItemIdChanged(itemId: number): void;
/**
* A callback for informing the following items have been inserted into the receiver queue in this session.
* A cloud based implementation can optionally choose to update its queue based on the new information.
*/
onItemsInserted(items: QueueItem[], insertBefore?: number): void;
/**
* A callback for informing the following items have been removed from the receiver queue in this session.
* A cloud based implementation can optionally choose to update its queue based on the new information.
*/
onItemsRemoved(itemIds: number[]): void;
/**
* Returns previous items before the reference item; often at the beginning of the queue; called by the receiver MediaManager.
*/
prevItems(itemId?: number): QueueItem[] | Promise<QueueItem[]>;
/**
* Shuffles the queue and returns new queue items. Returns null if the operation is not supported.
*/
shuffle(): QueueItem[] | Promise<QueueItem[]>;
}
/**
* Controls and monitors media playback.
*/
class PlayerManager {
constructor(params?: any);
/**
* Adds an event listener for player event.
*/
addEventListener: (
eventType: EventType | EventType[],
eventListener: EventHandler
) => void;
/**
* Sends a media status message to all senders (broadcast). Applications use this to send a custom state change.
*/
broadcastStatus(
includeMedia?: boolean,
requestId?: number,
customData?: any,
includeQueueItems?: boolean
): void;
getAudioTracksManager(): AudioTracksManager;
/**
* Returns current time in sec in currently-playing break clip.
*/
getBreakClipCurrentTimeSec(): number;
/**
* Returns duration in sec of currently-playing break clip.
*/
getBreakClipDurationSec(): number;
/**
* Obtain the breaks (Ads) manager.
*/
getBreakManager(): BreakManager;
/**
* Returns list of breaks.
*/
getBreaks(): Break[];
/**
* Gets current time in sec of current media.
*/
getCurrentTimeSec(): number;
/**
* Gets duration in sec of currently playing media.
*/
getDurationSec(): number;
/**
* Returns live seekable range with start and end time in seconds. The values are media time based.
*/
getLiveSeekableRange(): LiveSeekableRange;
/**
* Gets media information of current media.
*/
getMediaInformation(): MediaInformation;
/**
* Returns playback configuration.
*/
getPlaybackConfig(): PlaybackConfig;
/**
* Returns current playback rate.
*/
getPlaybackRate(): number;
/**
* Gets player state.
*/
getPlayerState(): PlayerState;
/**
* Get the preferred playback rate. (Can be used on shutdown event to save latest preferred playback rate to a persistent storage;
* so it can be used in next session in the cast options).
*/
getPreferredPlaybackRate(): number;
/**
* Get the preferred text track language.
*/
getPreferredTextLanguage(): string;
/**
* Obtain QueueManager API.
*/
getQueueManager(): QueueManager;
getTextTracksManager(): TextTracksManager;
/**
* Loads media.
*/
load(loadRequest: LoadRequestData): Promise<void>;
/**
* Pauses currently playing media.
*/
pause(): void;
/**
* Plays currently paused media.
*/
play(): void;
/**
* Requests a text string to be played back locally on the receiver device.
*/
playString(stringId: PlayStringId, args?: string[]): Promise<ErrorData>;
/**
* Request Google Assistant to refresh the credentials. Only works if the original credentials came from the assistant.
*/
refreshCredentials(): Promise<void>;
/**
* Removes the event listener added for given player event. If event listener is not added; it will be ignored.
*/
removeEventListener(
eventType: EventType | EventType[],
eventListener: EventHandler
): void;
/**
* Seeks in current media.
*/
seek(seekTime: number): void;
/**
* Sends an error to a specific sender
*/
sendError(
senderId: string,
requestId: number,
type: ErrorType,
reason?: ErrorReason,
customData?: any
): void;
/**
* Send local media request.
*/
sendLocalMediaRequest(request: RequestData): void;
/**
* Sends a media status message to a specific sender.
*/
sendStatus(
senderId: string,
requestId: number,
includeMedia?: boolean,
customData?: any,
includeQueueItems?: boolean
): void;
/**
* Sets the IDLE reason. This allows applications that want to force the IDLE state to indicate the reason that made the player going to IDLE state
* (a custom error; for example). The idle reason will be sent in the next status message. NOTE: Most applications do not need to set this value;
* it is only needed if they want to make the player go to IDLE in special circumstances and the default idleReason does not reflect their intended
* behavior.
*/
setIdleReason(idleReason: IdleReason): void;
/**
* Sets MediaElement to use. If Promise of MediaElement is set; media begins playback after Promise is resolved.
*/
setMediaElement(mediaElement: HTMLMediaElement): void;
/**
* Sets media information.
*/
setMediaInformation(
mediaInformation: MediaInformation,
opt_broadcast?: boolean
): void;
/**
* Sets a handler to return or modify PlaybackConfig; for a specific load request. The handler paramaters are the load request data
* and default playback config for the receiver (provided in the context options). The handler should returns a modified playback config;
* or null to prevent the media from playing. The return value can be a promise to allow waiting for data from the server.
*/
setMediaPlaybackInfoHandler(
handler: (
loadRequestData: LoadRequestData,
playbackConfig: PlaybackConfig
) => void
): void;
/**
* Sets a handler to return the media url for a load request. This handler can be used to avoid having the media content url published as part
* of the media status. By default the media contentId is used as the content url.
*/
setMediaUrlResolver(
resolver: (loadRequestData: LoadRequestData) => void
): void;
/**
* Provide an interceptor of incoming and outgoing messages.
* The interceptor can update the request data; and return updated data; a promise of
* updated data if need to get more data from the server; or null if the request should not be handled.
* Note that if load message interceptor is provided; and no interceptor is provided for preload -
* the load interceptor will be called for preload messages.
*/
setMessageInterceptor(
type: MessageType,
interceptor: (requestData: RequestData) => Promise<any>
): void;
/**
* Sets playback configuration on the PlayerManager.
*/
setPlaybackConfig(playbackConfig: PlaybackConfig): void;
/**
* Set the preferred playback rate for follow up load or media items. The preferred playback rate will be updated automatically to the latest
* playback rate that was provided by a load request or explicit set of playback rate.
*/
setPreferredPlaybackRate(preferredPlaybackRate: number): void;
/**
* Set the preferred text track language. The preferred text track language will be updated automatically to the latest enabled language
* by a load request or explicit change to text tracks. (Should be called only in idle state; and Will only apply to next loaded media).
*/
setPreferredTextLanguage(preferredTextLanguage: string): void;
/**
* Stops currently playing media.
*/
stop(): void;
}
/**
* Configuration to customize playback behavior.
*/
class PlaybackConfig {
/**
* Duration of buffered media in seconds to start buffering.
*/
autoPauseDuration?: number;
/**
* Duration of buffered media in seconds to start/resume playback after auto-paused due to buffering.
*/
autoResumeDuration?: number;
/**
* Minimum number of buffered segments to start/resume playback.
*/
autoResumeNumberOfSegments?: number;
/**
* A function to customize request to get a caption segment.
*/
captionsRequestHandler?: RequestHandler;
/**
* Initial bandwidth in bits in per second.
*/
initialBandwidth?: number;
/**
* Custom license data.
*/
licenseCustomData?: string;
/**
* Handler to process license data. The handler is passed the license data; and returns the modified license data.
*/
licenseHandler?: BinaryHandler;
/**
* A function to customize request to get a license.
*/
licenseRequestHandler?: RequestHandler;
/**
* Url for acquiring the license.
*/
licenseUrl?: string;
/**
* Handler to process manifest data. The handler is passed the manifest; and returns the modified manifest.
*/
manifestHandler?: (manifest: string) => string;
/**
* A function to customize request to get a manifest.
*/
manifestRequestHandler?: RequestHandler;
/**
* Preferred protection system to use for decrypting content.
*/
protectionSystem: ContentProtection;
/**
* Handler to process segment data. The handler is passed the segment data; and returns the modified segment data.
*/
segmentHandler?: BinaryHandler;
/**
* A function to customize request information to get a media segment.
*/
segmentRequestHandler?: RequestHandler;
/**
* Maximum number of times to retry a network request for a segment.
*/
segmentRequestRetryLimit?: number;
}
/**
* HTTP(s) Request/Response information.
*/
class NetworkRequestInfo {
/**
* The content of the request. Can be used to modify license request body.
*/
content: Uint8Array;
/**
* An object containing properties that you would like to send in the header.
*/
headers: any;
/**
* The URL requested.
*/
url: string;
/**
* Indicates whether CORS Access-Control requests should be made using credentials such as cookies or authorization headers.
*/
withCredentials: boolean;
}
/** Cast receiver context options. All options are optionals. */
class CastReceiverOptions {
/**
* Optional map of custom messages namespaces to initialize and their types.
* Custom messages namespaces need to be initiated before the application started;
* so it is best to provide the namespaces in the receiver options.
* (The default type of a message bus is JSON; if not provided here).
*/
customNamespaces?: any;
/**
* Sender id used for local requests. Default value is 'local'.
*/
localSenderId?: string;
/**
* Maximum time in seconds before closing an idle sender connection.
* Setting this value enables a heartbeat message to keep the connection alive.
* Used to detect unresponsive senders faster than typical TCP timeouts.
* The minimum value is 5 seconds; there is no upper bound enforced but practically it's minutes before platform TCP timeouts come into play.
* Default value is 10 seconds.
*/
maxInactivity?: number;
/**
* Optional media element to play content with. Default behavior is to use the first found media element in the page.
*/
mediaElement?: HTMLMediaElement;
/**
* Optional playback configuration.
*/
playbackConfig?: PlaybackConfig;
/**
* If this is true; the watched client stitching break will also be played.
*/
playWatchedBreak?: boolean;
/**
* Preferred value for player playback rate. It is used if playback rate value is not provided in the load request.
*/
preferredPlaybackRate?: number;
/**
* Preferred text track language. It is used if no active track is provided in the load request.
*/
preferredTextLanguage?: string;
/**
* Optional queue implementation.
*/
queue?: QueueBase;
/**
* Text that represents the application status.
* It should meet internationalization rules as may be displayed by the sender application.
*/
statusText?: string;
/**
* A bitmask of media commands supported by the application.
* LOAD; PLAY; STOP; GET_STATUS must always be supported.
* If this value is not provided; then PAUSE; SEEK; STREAM_VOLUME; STREAM_MUTE are assumed to be supported too.
*/
supportedCommands?: number;
/**
* Indicate that MPL should be used for DASH content.
*/
useLegacyDashSupport?: boolean;
/**
* An integer used as an internal version number.
* This number is used only to distinguish between receiver releases and higher numbers do not necessarily have to represent newer releases.
*/
versionCode?: number;
}
/** Manages loading of underlying libraries and initializes underlying cast receiver SDK. */
class CastReceiverContext {
/** Returns the CastReceiverContext singleton instance. */
static getInstance(): CastReceiverContext;
constructor(params: any);
/**
* Sets message listener on custom message channel.
*/
addCustomMessageListener(
namespace: string,
listener: EventHandler
): void;
/**
* Add listener to cast system events.
*/
addEventListener(
type: SystemEventType | SystemEventType[],
handler: EventHandler
): void;
/**
* Checks if the given media params of video or audio streams are supported by the platform.
*/
canDisplayType(
mimeType: string,
codecs?: string,
width?: number,
height?: number,
framerate?: number
): boolean;
/**
* Provides application information once the system is ready; otherwise it will be null.
*/
getApplicationData(): ApplicationData;
/**
* Provides device capabilities information once the system is ready; otherwise it will be null.
* If an empty object is returned; the device does not expose any capabilities information.
*/
getDeviceCapabilities(): any;
/**
* Get Player instance that can control and monitor media playback.
*/
getPlayerManager(): PlayerManager;
/**
* Get a sender by sender id
*/
getSender(senderId: string): Sender;
/**
* Gets a list of currently-connected senders.
*/
getSenders(): Sender[];
/**
* Reports if the cast application's HDMI input is in standby.
*/
getStandbyState(): StandbyState;
/**
* Provides application information about the system state.
*/
getSystemState(): SystemState;
/**
* Reports if the cast application is the HDMI active input.
*/
getVisibilityState(): any;
/**
* When the application calls start; the system will send the ready event to indicate
* that the application information is ready and the application can send messages as soon as there is one sender connected.
*/
isSystemReady(): boolean;
/**
* Start loading player js. This can be used to start loading the players js code in early stage of starting the receiver before calling start.
* This function is a no-op if players were already loaded (start was called).
*/
loadPlayerLibraries(useLegacyDashSupport?: boolean): void;
/**
* Remove a message listener on custom message channel.
*/
removeCustomMessageListener(
namespace: string,
listener: EventHandler
): void;
/**
* Remove listener to cast system events.
*/
removeEventListener(type: EventType, handler: EventHandler): void;
/**
* Sends a message to a specific sender.
*/
sendCustomMessage(
namespace: string,
senderId: string,
message: any
): void;
/**
* This function should be called in response to the feedbackstarted event if the application
* add debug state information to log in the feedback report.
* It takes in a parameter message that is a string that represents the debug information that the application wants to log.
*/
sendFeedbackMessage(feedbackMessage: string): void;
/**
* Sets the application state. The application should call this when its state changes.
* If undefined or set to an empty string; the value of the Application Name established during application
* registration is used for the application state by default.
*/
setApplicationState(statusText: string): void;
/**
* Sets the receiver inactivity timeout.
* It is recommended to set the maximum inactivity value when calling Start and not changing it.
* This API is just provided for development/debugging purposes.
*/
setInactivityTimeout(maxInactivity: number): void;
/**
* Sets the log verbosity level.
*/
setLoggerLevel(level: LoggerLevel): void;
/**
* Initializes system manager and media manager; so that receiver app can receive requests from senders.
*/
start(options?: CastReceiverOptions): CastReceiverContext;
/**
* Shutdown receiver application.
*/
stop(): void;
}
/** Manages audio tracks. */
class AudioTracksManager {
constructor(params: any);
getActiveId(): number;
getActiveTrack(): Track;
getTrackById(id: number): Track;
getTracks(): Track[];
getTracksByLanguage(language: string): Track[];
setActiveById(id: number): void;
setActiveByLanguage(language: string): void;
}
}
+426
View File
@@ -0,0 +1,426 @@
import {
RequestData,
MediaInformation,
Track,
MediaStatus
} from "./cast.framework.messages";
export = cast.framework.events;
declare namespace cast.framework.events {
type EventType =
| "ALL"
| "ABORT"
| "CAN_PLAY"
| "CAN_PLAY_THROUGH"
| "DURATION_CHANGE"
| "EMPTIED"
| "ENDED"
| "LOADED_DATA"
| "LOADED_METADATA"
| "LOAD_START"
| "PAUSE"
| "PLAY"
| "PLAYING"
| "PROGRESS"
| "RATE_CHANGE"
| "SEEKED"
| "SEEKING"
| "STALLED"
| "TIME_UPDATE"
| "SUSPEND"
| "WAITING"
| "BITRATE_CHANGED"
| "BREAK_STARTED"
| "BREAK_ENDED"
| "BREAK_CLIP_LOADING"
| "BREAK_CLIP_STARTED"
| "BREAK_CLIP_ENDED"
| "BUFFERING"
| "CACHE_LOADED"
| "CACHE_HIT"
| "CACHE_INSERTED"
| "CLIP_STARTED"
| "CLIP_ENDED"
| "EMSG"
| "ERROR"
| "ID3"
| "MEDIA_STATUS"
| "MEDIA_FINISHED"
| "PLAYER_PRELOADING"
| "PLAYER_PRELOADING_CANCELLED"
| "PLAYER_LOAD_COMPLETE"
| "PLAYER_LOADING"
| "SEGMENT_DOWNLOADED"
| "REQUEST_SEEK"
| "REQUEST_LOAD"
| "REQUEST_STOP"
| "REQUEST_PAUSE"
| "REQUEST_PLAY"
| "REQUEST_PLAY_AGAIN"
| "REQUEST_PLAYBACK_RATE_CHANGE"
| "REQUEST_SKIP_AD"
| "REQUEST_VOLUME_CHANGE"
| "REQUEST_EDIT_TRACKS_INFO"
| "REQUEST_EDIT_AUDIO_TRACKS"
| "REQUEST_SET_CREDENTIALS"
| "REQUEST_LOAD_BY_ENTITY"
| "REQUEST_USER_ACTION"
| "REQUEST_DISPLAY_STATUS"
| "REQUEST_CUSTOM_COMMAND"
| "REQUEST_FOCUS_STATE"
| "REQUEST_QUEUE_LOAD"
| "REQUEST_QUEUE_INSERT"
| "REQUEST_QUEUE_UPDATE"
| "REQUEST_QUEUE_REMOVE"
| "REQUEST_QUEUE_REORDER"
| "REQUEST_QUEUE_GET_ITEM_RANGE"
| "REQUEST_QUEUE_GET_ITEMS"
| "REQUEST_QUEUE_GET_ITEM_IDS"
| "REQUEST_PRECACHE";
type DetailedErrorCode =
| "MEDIA_UNKNOWN"
| "MEDIA_ABORTED"
| "MEDIA_DECODE"
| "MEDIA_NETWORK"
| "MEDIA_SRC_NOT_SUPPORTED"
| "SOURCE_BUFFER_FAILURE"
| "MEDIAKEYS_UNKNOWN"
| "MEDIAKEYS_NETWORK"
| "MEDIAKEYS_UNSUPPORTED"
| "MEDIAKEYS_WEBCRYPTO"
| "NETWORK_UNKNOWN"
| "SEGMENT_NETWORK"
| "HLS_NETWORK_MASTER_PLAYLIST"
| "HLS_NETWORK_PLAYLIST"
| "HLS_NETWORK_NO_KEY_RESPONSE"
| "HLS_NETWORK_KEY_LOAD"
| "HLS_NETWORK_INVALID_SEGMENT"
| "HLS_SEGMENT_PARSING"
| "DASH_NETWORK"
| "DASH_NO_INIT"
| "SMOOTH_NETWORK"
| "SMOOTH_NO_MEDIA_DATA"
| "MANIFEST_UNKNOWN"
| "HLS_MANIFEST_MASTER"
| "HLS_MANIFEST_PLAYLIST"
| "DASH_MANIFEST_UNKNOWN"
| "DASH_MANIFEST_NO_PERIODS"
| "DASH_MANIFEST_NO_MIMETYPE"
| "DASH_INVALID_SEGMENT_INFO"
| "SMOOTH_MANIFEST"
| "SEGMENT_UNKNOWN"
| "TEXT_UNKNOWN"
| "APP"
| "BREAK_CLIP_LOADING_ERROR"
| "BREAK_SEEK_INTERCEPTOR_ERROR"
| "IMAGE_ERROR"
| "LOAD_INTERRUPTED"
| "GENERIC";
type EndedReason =
| "END_OF_STREAM"
| "ERROR"
| "STOPPED"
| "INTERRUPTED"
| "SKIPPED"
| "BREAK_SWITCH";
/**
* Event data for @see{@link EventType.SEGMENT_DOWNLOADED} event.
*/
class SegmentDownloadedEvent extends Event {
constructor(downloadTime?: number, size?: number);
/**
* The time it took to download the segment; in milliseconds.
*/
downloadTime?: number;
/**
* The number of bytes in the segment.
*/
size?: number;
}
/**
* Event data for all events that represent requests made to the receiver.
*/
class RequestEvent extends Event {
constructor(
type: EventType,
requestData?: RequestData,
senderId?: string
);
/**
* The data that was sent with the request.
*/
requestData?: RequestData;
/**
* The sender id the request came from.
*/
senderId?: string;
}
/**
* Event data superclass for all events dispatched by @see{@link PlayerManager}
*/
class Event {
constructor(type: EventType);
/**
* Type of the event.
*/
type: EventType;
}
/**
* Event data for @see{@link EventType.MEDIA_STATUS} event.
*/
class MediaStatusEvent extends Event {
constructor(type: EventType, mediaStatus?: MediaStatus);
/**
* The media status that was sent.
*/
mediaStatus?: MediaStatus;
}
/**
* Event data for pause events forwarded from the MediaElement.
*/
class MediaPauseEvent extends Event {
constructor(currentMediaTime?: number, ended?: boolean);
/**
* Indicate if the media ended (indicates the pause was fired due to stream reached the end).
*/
ended?: boolean;
}
/**
* Event data for @see{@link EventType.MEDIA_FINISHED} event.
*/
class MediaFinishedEvent extends Event {
constructor(currentMediaTime?: number, endedReason?: EndedReason);
/**
* The time when the media finished (in seconds). For an item in a queue; this value represents the time in the currently playing queue item ( where 0 means the queue item has just started).
*/
currentTime?: number;
/**
* The reason the media finished.
*/
endedReason?: EndedReason;
}
/**
* Event data for all events forwarded from the MediaElement.
*/
class MediaElementEvent extends Event {
constructor(type: EventType, currentMediaTime?: number);
/**
* The time in the currently playing clip when the event was fired (in seconds). Undefined if playback has not started yet.
*/
currentMediaTime?: number;
}
/**
* Event data for all events pertaining to processing a load / preload request. made to the player.
*/
class LoadEvent extends Event {
constructor(type: EventType, media?: MediaInformation);
/**
* Information about the media being loaded.
*/
media: MediaInformation;
}
/**
* Event data for @see{@link EventType.INBAND_TRACK_ADDED} event.
*/
class InbandTrackAddedEvent {
constructor(track: Track);
/**
* Added track.
*/
track: Track;
}
/** Event data for @see{@link EventType.ID3} event. */
class Id3Event extends Event {
constructor(segmentData: Uint8Array);
/**
* The segment data.
*/
segmentData: Uint8Array;
}
/**
* Event data for @see{@link EventType.EMSG} event.
*/
class EmsgEvent extends Event {
constructor(emsgData: any);
/**
* The time that the event ends (in presentation time). Undefined if using legacy Dash support.
*/
endTime: any;
/**
* The duration of the event (in units of timescale). Undefined if using legacy Dash support.
*/
eventDuration: any;
/**
* A field identifying this instance of the message. Undefined if using legacy Dash support.
*/
id: any;
/**
* Body of the message. Undefined if using legacy Dash support.
*/
messageData: any;
/**
* The offset that the event starts; relative to the start of the segment this is contained in (in units of timescale). Undefined if using legacy Dash support.
*/
presentationTimeDelta: any;
/**
* Identifies the message scheme. Undefined if using legacy Dash support.
*/
schemeIdUri: any;
/**
* The segment data. This is only defined if using legacy Dash support.
*/
segmentData: any;
/**
* The time that the event starts (in presentation time). Undefined if using legacy Dash support.
*/
startTime: any;
/**
* Provides the timescale; in ticks per second. Undefined if using legacy Dash support.
*/
timescale: any;
/**
* Specifies the value for the event. Undefined if using legacy Dash support.
*/
value: any;
}
/**
* Event data for @see{@link EventType.CLIP_ENDED} event.
*/
class ClipEndedEvent extends Event {
constructor(currentMediaTime: number, endedReason?: EndedReason);
/**
* The time in media (in seconds) when clip ended.
*/
currentMediaTime: number;
/**
* The reason the clip ended.
*/
endedReason?: EndedReason;
}
/**
* Event data for @see{@link EventType.CACHE_LOADED} event.
*/
class CacheLoadedEvent extends Event {
constructor(media?: MediaInformation);
/**
* Information about the media being cached.
*/
media: MediaInformation;
}
class CacheItemEvent extends Event {
constructor(type: EventType, url: string);
/**
* The URL of data fetched from cache
*/
url: string;
}
class BufferingEvent extends Event {
constructor(isBuffering: boolean);
/**
* True if the player is entering a buffering state.
*/
isBuffering: boolean;
}
class BreaksEvent extends Event {
constructor(
type: EventType,
currentMediaTime?: number,
index?: number,
total?: number,
whenSkippable?: number,
endedReason?: EndedReason,
breakClipId?: string,
breakId?: string
);
/**
* The break's id. Refer to Break.id
*/
breakId?: string;
/**
* The break clip's id. Refer to BreakClip.id
*/
breakClipId?: string;
/**
* The time in the currently playing media when the break event occurred.
*/
currentMediaTime?: number;
/**
* The reason the break clip ended.
*/
endedReason?: EndedReason;
/**
* Index of break clip; which starts from 1.
*/
index: number;
/**
* Total number of break clips.
*/
total: number;
/**
* When to skip current break clip in sec; after break clip begins to play.
*/
whenSkippable?: number;
}
/**
* Event data for @see {@link EventType.BITRATE_CHANGED} event.
*/
class BitrateChangedEvent {
constructor(totalBitrate?: number);
/** The bitrate of the media (audio and video) in bits per second. */
totalBitrate: number;
}
class ErrorEvent extends Event {
constructor(detailedErrorCode: DetailedErrorCode, error?: any);
detailedErrorCode: DetailedErrorCode;
error?: any;
}
}
File diff suppressed because it is too large Load Diff
+198
View File
@@ -0,0 +1,198 @@
import { EventType } from "./cast.framework.events";
export = cast.framework.system;
declare namespace cast.framework.system {
type EventType =
// Fired when the system is ready.
| "READY"
// Fired when the application is terminated
| "SHUTDOWN"
// Fired when a new sender has connected.
| "SENDER_CONNECTED"
// Fired when a sender has disconnected.
| "SENDER_DISCONNECTED"
// Fired when there is a system error.
| "ERROR"
// Fired when the system volume has changed.
| "SYSTEM_VOLUME_CHANGED"
// Fired when the visibility of the application has changed
// (for example after a HDMI Input change or when the TV is turned
// off/on and the cast device is externally powered).
// Note that this API has the same effect as the webkitvisibilitychange event raised
// by your document, we provided it as CastReceiverManager API for convenience and
// to avoid a dependency on a webkit-prefixed event.
| "VISIBILITY_CHANGED"
// Fired when the standby state of the TV has changed.
// This event is related to the visibility chnaged event, as if the TV is in standby
// the visibility will be false, the visibility is more granular
// (as it also detects that the TV has selected a different channel)
// but it is not reliably detected in all TVs,
// standby can be used in those cases as most TVs implement it.
| "STANDBY_CHANGED"
| "MAX_VIDEO_RESOLUTION_CHANGED"
| "FEEDBACK_STARTED";
type SystemState =
| "NOT_STARTED"
| "STARTING_IN_BACKGROUND"
| "STARTING"
| "READY"
| "STOPPING_IN_BACKGROUND"
| "STOPPING";
type StandbyState = "STANDBY" | "NOT_STANDBY" | "UNKNOWN";
type DisconnectReason = "REQUESTED_BY_SENDER" | "ERROR" | "UNKNOWN";
/**
* Event dispatched by @see{@link CastReceiverManager} when the visibility of the application changes (HDMI input change; TV is turned off).
*/
class VisibilityChangedEvent {
constructor(isVisible: boolean);
/**
* Whether the Cast device is the active input or not.
*/
isVisible: boolean;
}
/**
* Represents the system volume data.
*/
interface SystemVolumeData {
/**
* The level (from 0.0 to 1.0) of the system volume
*/
level: number;
/**
* Whether the system volume is muted or not.
*/
muted: boolean;
}
/**
* Event dispatched by @see{CastReceiverManager} when the system volume changes.
*/
class SystemVolumeChangedEvent extends Event {
constructor(volume: SystemVolumeData);
/**
* The system volume data
*/
data: SystemVolumeData;
}
/**
* Event dispatched by @see{@link CastReceiverManager} when the TV enters/leaves the standby state.
*/
class StandbyChangedEvent {
constructor(isStandby: boolean);
isStandby: boolean;
}
/**
* Whether the TV is in standby or not.
*/
interface ShutdownEvent extends Event {
[key: string]: any;
}
/**
* Event dispatched by @see{@link CastReceiverManager} when a sender is disconnected.
*/
class SenderDisconnectedEvent extends Event {
constructor(senderId: string, userAgent: string);
/**
* The ID of the sender connected.
*/
senderId: string;
/**
* The user agent of the sender.
*/
userAgent: string;
/**
* The reason the sender was disconnected.
*/
reason?: DisconnectReason;
}
/**
* Event dispatched by @see{@link CastReceiverManager} when a sender is connected.
*/
class SenderConnectedEvent extends Event {
constructor(senderId: string, userAgent: string);
/**
* The ID of the sender connected.
*/
senderId: string;
/**
* The user agent of the sender.
*/
userAgent: string;
}
/**
* Represents the data of a connected sender device.
*/
interface Sender {
/**
* The sender Id.
*/
id: string;
/**
* Indicate the sender supports large messages (>64KB)
*/
largeMessageSupported?: boolean;
/**
* The userAgent of the sender.
*/
userAgent?: string;
}
/**
* Event dispatched by CastReceiverManager when the system is ready.
*/
class ReadyEvent {
constructor(applicationData: ApplicationData);
/**
* The application data
*/
data: ApplicationData;
}
/**
* Event dispatched by @see{@link CastReceiverManager} when the system needs to update the restriction on maximum video resolution.
*/
class MaxVideoResolutionChangedEvent extends Event {
constructor(height: number);
/**
* Maximum video resolution requested by the system. The value of 0 means there is no restriction.
*/
height: number;
}
/** Event dispatched by @see{@link CastReceiverManager} when the systems starts to create feedback report. */
interface FeedbackStartedEvent extends Event {
[key: string]: any;
}
/** Event dispatched by @see{@link CastReceiverContext} which contains system information. */
class Event {
constructor(type: EventType, data?: any);
type: EventType;
data?: any;
}
/** Represents the data of the launched application. */
interface ApplicationData {
id(): string;
launchingSenderId(): string;
name(): string;
namespaces(): string[];
sessionId(): number;
}
}
+197
View File
@@ -0,0 +1,197 @@
import { PlayerDataEventType } from "./cast.framework.ui";
import { MediaMetadata } from "./cast.framework.messages";
import { PlayerDataChangedEventHandler } from "./index";
export = cast.framework.ui;
declare namespace cast.framework.ui {
type ContentType = "video" | "audio" | "image";
type State =
| "launching"
| "idle"
| "loading"
| "buffering"
| "paused"
| "playing";
type PlayerDataEventType =
| "ANY_CHANGE"
| "STATE_CHANGED"
| "IS_SEEKING_CHANGED"
| "DURATION_CHANGED"
| "CURRENT_TIME_CHANGED"
| "METADATA_CHANGED"
| "TITLE_CHANGED"
| "SUBTITLE_CHANGED"
| "THUMBNAIL_URL_CHANGED"
| "NEXT_TITLE_CHANGED"
| "NEXT_SUBTITLE_CHANGED"
| "NEXT_THUMBNAIL_URL_CHANGED"
| "PRELOADING_NEXT_CHANGED"
| "CONTENT_TYPE_CHANGED"
| "IS_LIVE_CHANGED"
| "BREAK_PERCENTAGE_POSITIONS_CHANGED"
| "IS_PLAYING_BREAK_CHANGED"
| "IS_BREAK_SKIPPABLE_CHANGED"
| "WHEN_SKIPPABLE_CHANGED"
| "NUMBER_BREAK_CLIPS_CHANGED"
| "CURRENT_BREAK_CLIP_NUMBER_CHANGED"
| "DISPLAY_STATUS_CHANGED";
/**
* Player data changed event. Provides the changed field (type); and new value.
*/
class PlayerDataChangedEvent {
constructor(type: PlayerDataEventType, field: string, value: any);
/**
* The field name that was changed.
*/
field: string;
type: PlayerDataEventType;
/**
* The new field value.
*/
value: any;
}
/**
* Player data binder. Bind a player data object to the player state.
* The player data will be updated to reflect correctly the current player state without firing any change event.
*/
class PlayerDataBinder {
constructor(playerData: PlayerData);
/**
* Add listener to player data changes.
*/
addEventListener: (
type: PlayerDataEventType,
listener: PlayerDataChangedEventHandler
) => void;
/**
* Remove listener to player data changes.
*/
removeEventListener: (
type: PlayerDataEventType,
listener: PlayerDataChangedEventHandler
) => void;
}
/**
* Player data. Provide the player media and break state.
*/
interface PlayerData {
/**
* Array of breaks positions in percentage.
*/
breakPercentagePositions: number[];
/**
* Content Type.
*/
contentType: ContentType;
/**
* The number of the current playing break clip in the break.
*/
currentBreakClipNumber: number;
/**
* Media current position in seconds; or break current position if playing break.
*/
currentTime: number;
/**
* Whether the player metadata (ie: title; currentTime) should be displayed.
* This will be true if at least one field in the metadata should be displayed.
* In some cases; displayStatus will be true; but parts of the metadata should be hidden
* (ie: the media title while media is seeking).
* In these cases; additional css can be applied to hide those elements.
* For cases where the media is audio-only; this will almost always be true.
* In cases where the media is video; this will be true when:
* (1) the video is loading; buffering; or seeking
* (2) a play request was made in the last five seconds while media is already playing;
* (3) there is a request made to show the status in the last five seconds; or
* (4) the media was paused in the last five seconds.
*/
displayStatus: boolean;
/**
* Media duration in seconds; Or break duration if playing break.
*/
duration: number;
/**
* Indicate break clip can be skipped.
*/
isBreakSkippable: boolean;
/**
* Indicate if the content is a live stream.
*/
isLive: boolean;
/**
* Indicate that the receiver is playing a break.
*/
isPlayingBreak: boolean;
/**
* Indicate the player is seeking (can be either during playing or pausing).
*/
isSeeking: boolean;
/**
* Media metadata.
*/
metadata: MediaMetadata;
/**
* Next Item subtitle.
*/
nextSubtitle: string;
/**
* Next Item thumbnail url.
*/
nextThumbnailUrl: string;
/**
* Next Item title.
*/
nextTitle: string;
/**
* Number of break clips in current break.
*/
numberBreakClips: number;
/**
* Flag to show/hide next item metadata.
*/
preloadingNext: boolean;
/**
* Current player state.
*/
state: State;
/**
* Content thumbnail url.
*/
thumbnailUrl: string;
/**
* Content title.
*/
title: string;
/**
* Provide the time a break is skipable - relative to current playback time. Undefined if not skippable.
*/
whenSkippable?: number;
}
}
@@ -0,0 +1,111 @@
import {
PlayerData,
PlayerDataBinder
} from "chromecast-caf-receiver/cast.framework.ui";
import {
ReadyEvent,
ApplicationData
} from "chromecast-caf-receiver/cast.framework.system";
import {
RequestEvent,
Event,
BreaksEvent
} from "chromecast-caf-receiver/cast.framework.events";
import {
QueueBase,
TextTracksManager,
QueueManager,
PlayerManager
} from "chromecast-caf-receiver/cast.framework";
import {
BreakSeekData,
BreakClipLoadInterceptorContext,
BreakManager
} from "chromecast-caf-receiver/cast.framework.breaks";
import {
Break,
BreakClip,
LoadRequestData,
Track,
MediaMetadata
} from "chromecast-caf-receiver/cast.framework.messages";
const breaksEvent = new BreaksEvent('BREAK_STARTED');
breaksEvent.breakId = 'some-break-id';
breaksEvent.breakClipId = 'some-break-clip-id';
const track = new Track(1, "TEXT");
const breakClip = new BreakClip("id");
const adBreak = new Break("id", ["id"], 1);
const rEvent = new RequestEvent("BITRATE_CHANGED", { requestId: 2 });
const pManager = new PlayerManager();
pManager.addEventListener("STALLED", () => { });
const ttManager = new TextTracksManager();
const qManager = new QueueManager();
const qBase = new QueueBase();
const items = qBase.fetchItems(1, 3, 4);
const breakSeekData = new BreakSeekData(0, 100, []);
const breakClipLoadContext = new BreakClipLoadInterceptorContext(adBreak);
const breakManager: BreakManager = {
getBreakById: () => adBreak,
getBreakClipById: () => breakClip,
getBreakClips: () => [breakClip],
getBreaks: () => [adBreak],
getPlayWatchedBreak: () => true,
setBreakClipLoadInterceptor: () => { },
setBreakSeekInterceptor: () => { },
setPlayWatchedBreak: () => { },
setVastTrackingInterceptor: () => { }
};
const lrd: LoadRequestData = {
requestId: 1,
activeTrackIds: [1, 2],
media: {
tracks: [],
textTrackStyle: {},
streamType: "BUFFERED",
metadata: { metadataType: "GENERIC" },
hlsSegmentFormat: "AAC",
contentId: "id",
contentType: "type",
breakClips: [breakClip],
breaks: [adBreak]
},
queueData: {}
};
const appData: ApplicationData = {
id: () => "id",
launchingSenderId: () => "launch-id",
name: () => "name",
namespaces: () => ["namespace"],
sessionId: () => 1
};
const readyEvent = new ReadyEvent(appData);
const data = readyEvent.data;
const pData: PlayerData = {
breakPercentagePositions: [1],
contentType: "video",
currentBreakClipNumber: 2,
currentTime: 1234,
displayStatus: true,
duration: 222,
isBreakSkippable: false,
isLive: true,
isPlayingBreak: false,
isSeeking: true,
metadata: new MediaMetadata("GENERIC"),
nextSubtitle: "sub",
nextThumbnailUrl: "url",
nextTitle: "title",
numberBreakClips: 3,
preloadingNext: false,
state: "paused",
thumbnailUrl: "url",
title: "title",
whenSkippable: 321
};
const binder = new PlayerDataBinder(pData);
binder.addEventListener("ANY_CHANGE", e => { });
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for chromecast-caf-receiver 3.x
// Project: https://github.com/googlecast
// Definitions by: Craig Bruce <https://github.com/craigrbruce>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference path="./cast.framework.d.ts" />
/// <reference path="./cast.framework.breaks.d.ts" />
/// <reference path="./cast.framework.events.d.ts" />
/// <reference path="./cast.framework.messages.d.ts" />
/// <reference path="./cast.framework.system.d.ts" />
/// <reference path="./cast.framework.ui.d.ts" />
import { PlayerDataChangedEvent } from './cast.framework.ui';
import { NetworkRequestInfo } from './cast.framework';
import { Event } from './cast.framework.events';
export as namespace cast;
export type EventHandler = (event: Event) => void;
export type PlayerDataChangedEventHandler = (
event: PlayerDataChangedEvent
) => void;
export type RequestHandler = (request: NetworkRequestInfo) => void;
export type BinaryHandler = (data: Uint8Array) => Uint8Array;
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": false,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"chromecast-caf-receiver-tests.ts",
"cast.framework.d.ts",
"cast.framework.breaks.d.ts",
"cast.framework.events.d.ts",
"cast.framework.messages.d.ts",
"cast.framework.system.d.ts",
"cast.framework.ui.d.ts"
]
}
@@ -0,0 +1,5 @@
{
"extends": "dtslint/dt.json",
"rules": {
}
}
+5
View File
@@ -0,0 +1,5 @@
import yaml = require('config-yaml');
yaml('./simple.yaml');
yaml('./simple.yaml', { encoding: 'gbk' });
yaml('./simple.yaml', { encoding: 'utf-8' });
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for config-yaml 1.1
// Project: https://github.com/neolao/config-yaml#readme
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import * as fs from 'fs';
export = Yaml;
declare namespace Yaml {
interface Options {
encoding: string;
}
}
declare function Yaml(path: fs.PathLike, options?: Partial<Yaml.Options>): any;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"config-yaml-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+9 -1
View File
@@ -1,4 +1,5 @@
import cosmiconfig, { CosmiconfigResult } from "cosmiconfig";
import cosmiconfig = require("cosmiconfig");
import { CosmiconfigResult } from "cosmiconfig";
import * as path from "path";
const explorer = cosmiconfig("yourModuleName", {
@@ -22,6 +23,13 @@ Promise.all([
explorer.loadSync(path.join(__dirname, "sample-config.json")),
]).then(result => result);
const result = explorer.searchSync();
if (result) {
const config = result.config;
const filepath = result.filepath;
const isEmpty = result.isEmpty;
}
explorer.clearLoadCache();
explorer.clearSearchCache();
explorer.clearCaches();
+52 -47
View File
@@ -3,57 +3,62 @@
// Definitions by: ozum <https://github.com/ozum>
// szeck87 <https://github.com/szeck87>
// saadq <https://github.com/saadq>
// jinwoo <https://github.com/jinwoo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
export interface Config {
[key: string]: any;
declare function cosmiconfig(moduleName: string, options?: cosmiconfig.ExplorerOptions): cosmiconfig.Explorer;
declare namespace cosmiconfig {
interface Config {
[key: string]: any;
}
type CosmiconfigResult = {
config: Config;
filepath: string;
isEmpty?: boolean;
} | null;
interface LoaderResult {
config: Config | null;
filepath: string;
}
type SyncLoader = (filepath: string, content: string) => Config | null;
type AsyncLoader = (filepath: string, content: string) => Config | null | Promise<object | null>;
interface LoaderEntry {
sync?: SyncLoader;
async?: AsyncLoader;
}
interface Loaders {
[key: string]: LoaderEntry;
}
interface Explorer {
search(searchFrom?: string): Promise<null | CosmiconfigResult>;
searchSync(searchFrom?: string): null | CosmiconfigResult;
load(loadPath: string): Promise<CosmiconfigResult>;
loadSync(loadPath: string): CosmiconfigResult;
clearLoadCache(): void;
clearSearchCache(): void;
clearCaches(): void;
}
// These are the user options with defaults applied.
interface ExplorerOptions {
stopDir?: string;
cache?: boolean;
transform?: (result: CosmiconfigResult) => Promise<CosmiconfigResult> | CosmiconfigResult;
packageProp?: string;
loaders?: Loaders;
searchPlaces?: string[];
ignoreEmptySearchPlaces?: boolean;
}
}
export type CosmiconfigResult = {
config: Config;
filePath: string;
isEmpty?: boolean;
} | null;
export interface LoaderResult {
config: Config | null;
filepath: string;
}
export type SyncLoader = (filepath: string, content: string) => Config | null;
export type AsyncLoader = (filepath: string, content: string) => Config | null | Promise<object | null>;
export interface LoaderEntry {
sync?: SyncLoader;
async?: AsyncLoader;
}
export interface Loaders {
[key: string]: LoaderEntry;
}
export interface Explorer {
search(searchFrom?: string): Promise<null | CosmiconfigResult>;
searchSync(searchFrom?: string): null | CosmiconfigResult;
load(loadPath: string): Promise<CosmiconfigResult>;
loadSync(loadPath: string): CosmiconfigResult;
clearLoadCache(): void;
clearSearchCache(): void;
clearCaches(): void;
}
// These are the user options with defaults applied.
export interface ExplorerOptions {
stopDir?: string;
cache?: boolean;
transform?: (result: CosmiconfigResult) => Promise<CosmiconfigResult> | CosmiconfigResult;
packageProp?: string;
loaders?: Loaders;
searchPlaces?: string[];
ignoreEmptySearchPlaces?: boolean;
}
export default function cosmiconfig(moduleName: string, options?: ExplorerOptions): Explorer;
export = cosmiconfig;
+402 -3
View File
@@ -1,6 +1,26 @@
'use strict';
import cytoscape = require('cytoscape');
// TODO: document all aliases as aliases, not as duplicates!
const assert = (tag: boolean) => { if (!tag) throw new Error(); };
const aliases = (...obj: Array<{}>) => { if (obj.slice(1).some((alias) => alias !== obj[0])) throw new Error(); };
const events = (obj: any) => {
aliases(obj.on, obj.bind, obj.listen, obj.addListener);
aliases(obj.promiseOn, obj.pon);
aliases(obj.off, obj.unbind, obj.unlisten, obj.removeListener);
aliases(obj.emit, obj.trigger);
};
// definitions
function oneOf<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A | B | C | D | E;
function oneOf<A, B, C, D>(a: A, b: B, c: C, d: D): A | B | C | D;
function oneOf<A, B, C>(a: A, b: B, c: C): A | B | C;
function oneOf<A, B>(a: A, b: B): A | B;
function oneOf<T>(...array: T[]): T {
return array[0];
}
import cytoscape = require('cytoscape');
const parentCSS = {
'padding-top': '10px',
'padding-left': '10px',
@@ -69,6 +89,34 @@ const cy = cytoscape({
]
},
// initial viewport state:
zoom: 1,
pan: { x: 0, y: 0 },
// interaction options:
minZoom: 1e-50,
maxZoom: 1e50,
zoomingEnabled: true,
userZoomingEnabled: true,
panningEnabled: true,
userPanningEnabled: true,
selectionType: 'single',
touchTapThreshold: 8,
desktopTapThreshold: 4,
autolock: false,
autoungrabify: false,
// rendering options:
headless: false,
styleEnabled: true,
hideEdgesOnViewport: false,
hideLabelsOnViewport: false,
textureOnViewport: false,
motionBlur: false,
motionBlurOpacity: 0.2,
wheelSensitivity: 1,
pixelRatio: 'auto',
layout: {
name: 'preset',
padding: 5
@@ -80,6 +128,42 @@ cy.on('zoom', (event) => {
cy.nodes('$node > node').style('opacity', 0);
}
});
cy.off('zoom');
events(cy);
cy.add({ data: { id: 'g' }, position: {x: 200, y: 150} });
cy.add([
{ data: { id: 'h' }, position: {x: 250, y: 100} }
]);
const nodesBeforeDelete = cy.nodes();
const edgesBeforeDelete = cy.edges();
const removed = cy.remove('#g #h');
cy.add(removed);
const diffNodes = nodesBeforeDelete.diff(cy.nodes());
const diffEdges = edgesBeforeDelete.diff(cy.edges());
assert(diffNodes.left.size() === 0 && diffNodes.right.size() === 0 && diffNodes.both.size() === cy.nodes().size());
assert(nodesBeforeDelete.same(cy.nodes()));
assert(edgesBeforeDelete.same(cy.edges()));
const gh = cy.collection().add(cy.$id('g')).union(cy.getElementById('h'));
const gh2 = cy.$('#g #h');
const gh3 = cy.nodes('#g #h');
assert(gh2.same(gh));
assert(gh3.same(gh));
assert(gh.same(removed));
assert(cy.container() === null); // headless mode!
cy.center();
cy.center(gh);
aliases(cy.center, cy.centre);
cy.fit(cy.$('#a #b #h'));
const {x1, y1, x2, y2, w, h} = cy.extent();
aliases(cy.resize, cy.invalidateDimensions);
cy.animate({
fit: {
@@ -89,8 +173,323 @@ cy.animate({
duration: 500
});
const node = cy.nodes()[0];
cy.animate({
center: {eles: node},
center: {eles: cy.nodes()[0]},
duration: 500
});
const anim = cy.animation({
zoom: {
level: 1,
position: {x: 0, y: 0}
},
pan: {x: 100, y: 100},
duration: 100,
easing: 'ease'
});
cy.stop(true, true);
anim.play();
assert(anim.playing());
anim.progress(anim.progress() + 50);
anim.time(anim.time() - 50);
anim.stop();
aliases(cy.layout, cy.createLayout, cy.makeLayout);
// Preconfigured data for layouts (as it could be passed)
const boundingBox = oneOf({x1: 0, x2: 100, y1: 0, y2: 100}, {x1: 0, w: 100, y1: 0, h: 100});
const positions = oneOf({a: {x: 100, y: 100}}, (node: cytoscape.NodeCollection): cytoscape.Position => ({x: 100, y: 100}));
// TODO: uncomment after we have the way to add layout options properties from extensions
// const layouts = [
// cy.layout({
// name: 'null',
// ready: () => {},
// stop: () => {}
// }),
// cy.layout({
// name: 'random',
// fit: true,
// padding: 30,
// boundingBox,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'preset',
// positions,
// zoom: 1,
// pan: {x: 100, y: 100},
// fit: false,
// padding: 30,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-out',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'grid',
// fit: true,
// padding: 30,
// boundingBox,
// avoidOverlap: true,
// avoidOverlapPadding: 10,
// nodeDimensionsIncludeLabels: false,
// spacingFactor: oneOf(1, undefined),
// condense: false,
// rows: oneOf(10, undefined),
// cols: oneOf(10, undefined),
// position: (node) => ({ row: 1, col: 1 }),
// sort: (a, b) => 1,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in-out',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'circle',
// fit: true,
// padding: 30,
// boundingBox,
// avoidOverlap: true,
// nodeDimensionsIncludeLabels: false,
// spacingFactor: oneOf(1, undefined),
// radius: oneOf(1, undefined),
// startAngle: 3 / 2 * Math.PI,
// sweep: oneOf(6, undefined),
// clockwise: true,
// sort: (a, b) => 1,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in-sine',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'concentric',
// fit: true,
// padding: 30,
// startAngle: 3 / 2 * Math.PI,
// sweep: oneOf(6, undefined),
// clockwise: true,
// equidistant: false,
// minNodeSpacing: 10,
// boundingBox,
// avoidOverlap: true,
// nodeDimensionsIncludeLabels: false,
// height: oneOf(500, undefined),
// width: oneOf(500, undefined),
// spacingFactor: oneOf(1, undefined),
// concentric: (node) => 1,
// levelWidth: (nodes) => 1,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-out-sine',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'breadthfirst',
// fit: true,
// directed: false,
// padding: 30,
// circle: false,
// spacingFactor: 1.75,
// boundingBox,
// avoidOverlap: true,
// nodeDimensionsIncludeLabels: false,
// maximalAdjustments: 0,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in-out-sine',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'cose',
// ready: () => {},
// stop: () => {},
// animate: oneOf(true, false, 'end'),
// animationEasing: oneOf('ease-in-quad', undefined),
// animationDuration: oneOf(500, undefined),
// animateFilter: function ( node, i ){ return true; },
// animationThreshold: 250,
// refresh: 20,
// fit: true,
// padding: 30,
// boundingBox: undefined,
// nodeDimensionsIncludeLabels: false,
// randomize: false,
// componentSpacing: 40,
// nodeRepulsion: (node) => 2048,
// nodeOverlap: 4,
// idealEdgeLength: (edge) => 32,
// edgeElasticity: (edge) => 32,
// nestingFactor: 1.2,
// gravity: 1,
// numIter: 1000,
// initialTemp: 1000,
// coolingFactor: 0.99,
// minTemp: 1.0,
// weaver: false
// })
// ];
// const lay = layouts[0];
// aliases(lay.run, lay.start);
// events(lay);
// layouts.map(layout => {
// layout.run();
// layout.stop();
// });
// TODO: cy.style
cy.png({
output: oneOf('base64uri', 'base64', 'blob', undefined),
bg: oneOf('#ffffff', undefined),
full: true,
scale: 2,
maxWidth: 100,
maxHeight: 100
});
aliases(cy.jpg, cy.jpeg);
cy.jpg({
output: oneOf('base64uri', 'base64', 'blob', undefined),
bg: oneOf('#ffffff', undefined),
full: true,
scale: 2,
maxWidth: 100,
maxHeight: 100,
quality: 0.5
});
cy.json(cy.json());
// Types possible to call methods
const ele = oneOf(cy.nodes()[0], cy.edges()[0]);
const eles = cy.elements();
const node = cy.nodes()[0];
const nodes = cy.nodes();
const edge = cy.edges()[0];
const edges = cy.edges();
assert(ele.cy() === cy);
eles.remove();
assert(eles.removed());
assert(!eles.inside());
eles.restore();
([ele, eles, node, nodes, edge, edges] as cytoscape.CollectionReturnValue[]).forEach((elem) => {
aliases(elem.clone, elem.copy);
events(elem);
aliases(elem.data, elem.attr);
aliases(elem.removeData, elem.removeAttr);
});
// TODO: tests for data flow
const loops = oneOf(true, false);
node.degree(loops); node.indegree(loops); node.outdegree(loops);
nodes.totalDegree(loops); nodes.minDegree(loops); nodes.maxDegree(loops);
nodes.minIndegree(loops); nodes.maxIndegree(loops); nodes.minOutdegree(loops); nodes.maxOutdegree(loops);
// tslint:disable-next-line:ban-types
const getsetPos = <T extends Function>(func: T): T => {
func('x', func('x'));
func(func());
func({x: 100, y: 100});
return func;
};
aliases(node.modelPosition, node.point, node.position);
getsetPos(node.position);
nodes.shift('x', 100);
nodes.shift({x: -100, y: 0});
aliases(nodes.modelPositions, nodes.positions, nodes.points);
nodes.positions((node, i) => Object.assign(node.position(), {x: node.position('x') + i}));
aliases(node.renderedPosition, node.renderedPoint);
getsetPos(node.renderedPoint);
// TODO: tests for compound nodes (relativePosition, in particular)
const sizes: number[] = [
ele.width(), ele.outerWidth(), ele.renderedWidth(), ele.renderedOuterWidth(),
ele.height(), ele.outerHeight(), ele.renderedHeight(), ele.renderedOuterHeight()
];
aliases(eles.boundingBox, eles.boundingbox);
aliases(eles.renderedBoundingBox, eles.renderedBoundingbox);
const flags: boolean[] = [
node.grabbed(), node.grabbable(), node.locked(), ele.active(),
];
const edgePoints: cytoscape.Position[] = [
...edge.controlPoints(), ...edge.segmentPoints(), edge.sourceEndpoint(), edge.targetEndpoint(), edge.midpoint()
];
aliases(eles.layout, eles.createLayout, eles.makeLayout);
const layout = eles.layout({name: 'random'}).run();
eles.select();
assert(ele.selected()); // as we selected all, and this too
aliases(eles.unselect, eles.deselect);
eles.selectify();
assert(ele.selectable());
eles.unselectify();
eles.addClass('test');
eles.toggleClass('test', oneOf(true, false, undefined));
eles.removeClass('test');
eles.classes(oneOf('test', undefined));
eles.flashClass('test flash', oneOf(1000, undefined));
assert(ele.hasClass('test'));
eles.style('background-color', 'green');
Object.keys(eles.style()).map(key => eles.style(key));
eles.style(eles.style());
aliases(eles.style, eles.css);
aliases(ele.renderedCss, ele.renderedStyle);
eles.anySame(nodes);
aliases(eles.contains, eles.has);
aliases(eles.allAreNeighbors, eles.allAreNeighbours);
eles.is('#g');
eles.allAre('#g');
eles.some((el, i, els) => true);
eles.every((el, i, els) => true);
aliases(eles.forEach, eles.each);
const selected: cytoscape.SingularElementArgument[] = [eles.eq(0), eles.first(), eles.last()];
const collSel = cy.collection(selected);
const selectedNodes: cytoscape.NodeSingular[] = [nodes.eq(0), nodes.first(), nodes.last()];
const collNodes = cy.collection(selectedNodes);
const selectedEdges: cytoscape.EdgeSingular[] = [edges.eq(0), edges.first(), edges.last()];
eles.slice(0, -1);
eles.toArray();
aliases(eles.getElementById, eles.$id);
aliases(eles.union, eles.add, eles.or, eles.u, eles['+'], eles['|']);
aliases(eles.difference, eles.not, eles.subtract, eles.relativeComplement, eles['\\'], eles['!'], eles['-']);
aliases(eles.absoluteComplement, eles.abscomp, eles.complement);
aliases(eles.intersection, eles.intersect, eles.and, eles.n, eles['&'], eles['.']);
aliases(eles.symmetricDifference, eles.symdiff, eles.xor, eles['^'], eles['(+)'], eles['(-)']);
cy.collection([nodes[0]]).union(nodes[1]).union(eles.$id('g'));
eles.difference(collNodes).abscomp().intersection(collSel).symdiff(collNodes);
const diff = collSel.diff(collNodes);
cy.collection().merge(diff.left).merge(diff.right).merge(diff.both).unmerge(collSel).filter((ele, i, eles) => true);
eles.sort((a, b) => 1).map((ele, i, eles) => [i, ele]);
eles.reduce<any[]>((prev, ele, i, eles) => [...prev, [ele, i]], []).concat(['finish']);
const min = eles.min((ele, i, eles) => ele.id.length + i); min.ele.scratch('min', min.value);
const max = eles.max((ele, i, eles) => ele.id.length + i); max.ele.scratch('max', max.value);
// TODO: traversing (need to actively check the nodes/edeges distinction)
// TODO: algorithms
// TODO: compound nodes (there aren't any in current test case)
+389 -135
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3277,7 +3277,7 @@ declare namespace d3 {
round(round: boolean): Treemap<T>;
sticky(): boolean;
sticky(sticky: boolean): boolean;
sticky(sticky: boolean): Treemap<T>;
mode(): string;
mode(mode: "squarify"): Treemap<T>;
+5
View File
@@ -1432,6 +1432,11 @@ declare namespace DataTables {
*/
tabIndex?: number;
/**
* Enable or disable datatables responsive. Since: 1.10
*/
responsive?: boolean | object;
//#endregion "Options"
//#region "Callbacks"
+5
View File
@@ -1,3 +1,8 @@
import * as CrossFilter from 'crossfilter';
import * as d3 from "d3";
import * as dc from "dc";
interface IYelpData {
city: string;
review_count: number;
-4
View File
@@ -5,10 +5,6 @@
// matthias jobst <https://github.com/MatthiasJobst>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// this makes only sense together with d3 and crossfilter so you need the d3.d.ts and crossfilter.d.ts files
///<reference types="crossfilter" />
import * as d3 from "d3";
export = dc;
+21
View File
@@ -19,3 +19,24 @@ decompress('unicorn.zip', 'dist', {
}).then((files: decompress.File[]) => {
console.log('done!');
});
// Test decompress with no output to filesystem
decompress('unicorn.zip')
.then(
(files: decompress.File[]) => {
console.log(`Decompressed ${files.length} files with no write to filesystem`);
}
);
// Test decompress with DecompressOptions as second argument
decompress(
'unicorn.zip',
{
filter: file => path.extname(file.path) !== '.exe'
}
)
.then(
(files: decompress.File[]) => {
console.log(`Decompressed ${files.length} files with filter options`);
}
);
+2 -1
View File
@@ -1,13 +1,14 @@
// Type definitions for decompress 4.2
// Project: https://github.com/kevva/decompress#readme
// Definitions by: York Yao <https://github.com/plantain-00>
// Jesse Bethke <https://github.com/jbethke>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = decompress;
declare function decompress(input: string | Buffer, output: string, opts?: decompress.DecompressOptions): Promise<decompress.File[]>;
declare function decompress(input: string | Buffer, output?: string | decompress.DecompressOptions, opts?: decompress.DecompressOptions): Promise<decompress.File[]>;
declare namespace decompress {
interface File {
@@ -0,0 +1,13 @@
declare let button: DevExpress.AspNetCore.BootstrapButton;
button.on('click', e => {});
button.doClick();
button.once('click', e => {});
declare let accordion: DevExpress.AspNetCore.BootstrapAccordion;
accordion.on('init', e => {});
const firstGroup = accordion.getGroup(0);
if (firstGroup) {
const groupText = firstGroup.getText();
const item = firstGroup.getItemByName('item10');
item && item.getEnabled();
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"devexpress-aspnetcore-bootstrap-tests.ts"
]
}
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+5
View File
@@ -21,6 +21,11 @@ declare namespace dygraphs {
* A per-series color definition. Used in conjunction with, and overrides, the colors option.
*/
color?: string;
/**
* A function which plot data for this series on the chart.
*/
plotter?: any;
/**
* Draw a small dot at each point, in addition to a line going through the point. This makes
+1 -1
View File
@@ -3,7 +3,7 @@ import {
setResolver, setupAcceptanceTest, setupComponentTest,
setupModelTest, setupTest
} from 'ember-mocha';
import { context, describe, it, beforeEach, afterEach, before, after } from 'mocha';
import { describe, it, beforeEach, afterEach, before, after } from 'mocha';
import chai = require('chai');
import Ember from "ember";
import hbs from 'htmlbars-inline-precompile';
+1 -2
View File
@@ -60,6 +60,5 @@ declare module 'ember-mocha' {
declare module 'mocha' {
// augment test callback context
interface ITestCallbackContext extends TestContext {}
interface IHookCallbackContext extends TestContext {}
interface Context extends TestContext {}
}
+2 -2
View File
@@ -1173,7 +1173,7 @@ declare module 'ember' {
* key. You can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to false.
*/
rejectBy(key: string, value?: string): NativeArray<T>;
rejectBy(key: string, value?: any): NativeArray<T>;
/**
* Returns the first item in the array for which the callback returns true.
* This method works similar to the `filter()` method defined in JavaScript 1.6
@@ -2368,7 +2368,7 @@ declare module 'ember' {
function Exception(message: string): void;
class SafeString {
constructor(str: string);
static toString(): string;
toString(): string;
}
function parse(string: string): any;
function print(ast: any): void;
-2
View File
@@ -24,8 +24,6 @@
"only-arrow-functions": false,
"no-submodule-imports": false,
"no-unnecessary-class": false,
// false positives
"unified-signatures": false
}
+19 -11
View File
@@ -1,15 +1,15 @@
// Type definitions for ethereumjs-util 5.1
// Type definitions for ethereumjs-util 5.2
// Project: https://github.com/ethereumjs/ethereumjs-util#readme
// Definitions by: Juan J. Jimenez-Anca <https://github.com/cortopy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
// TODO: import types for [`BN`](https://github.com/indutny/bn.js)
// TODO: MAX_INTEGER as type of BN
// TODO: import types for [`rlp`](https://github.com/ethereumjs/rlp)
// TODO: import types for [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)
import BN = require("bn.js");
export const SHA3_NULL_S: string;
export const SHA3_RLP_ARRAY_S: string;
@@ -18,13 +18,11 @@ export const SHA3_RLP_S: string;
export function addHexPrefix(str: string): string;
export function arrayContainsArray(superset: any, subset: any, some: any): any;
export function baToJSON(ba: Buffer | Uint8Array | string[]): Buffer | Uint8Array | string[];
export function baToJSON(ba: Buffer | Uint8Array | string[]): Buffer | Uint8Array | string[] | null;
export function bufferToHex(buf: Buffer | Uint8Array): string;
export function bufferToInt(buf: Buffer | Uint8Array): string;
export function bufferToInt(buf: Buffer | Uint8Array): number;
export function defineProperties(self: {[k: string]: any}, fields: string[], data: {[k: string]: any}): {[k: string]: any};
@@ -34,14 +32,16 @@ export function ecsign(msgHash: Buffer | Uint8Array, privateKey: Buffer | Uint8A
export function fromRpcSig(sig: string): {[k: string]: any};
export function fromSigned(num: Buffer | Uint8Array): any;
export function fromSigned(num: Buffer | Uint8Array): BN;
export function generateAddress(from: Buffer | Uint8Array, nonce: Buffer | Uint8Array): Buffer | Uint8Array;
export function hashPersonalMessage(message: string): Buffer | Uint8Array;
export function hashPersonalMessage(message: Buffer | Uint8Array | any[]): Buffer | Uint8Array;
export function importPublic(publicKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function isPrecompiled(address: Buffer | Uint8Array): boolean;
export function isValidAddress(address: string): boolean;
export function isValidChecksumAddress(address: Buffer | Uint8Array): boolean;
@@ -52,11 +52,17 @@ export function isValidPublic(publicKey: Buffer | Uint8Array, sanitize?: boolean
export function isValidSignature(v: Buffer | Uint8Array, r: Buffer | Uint8Array, s: Buffer | Uint8Array, homestead?: boolean): boolean;
export function isZeroAddress(address: string): boolean;
export function keccak(a: Buffer | Uint8Array | any[] | string | number, bits?: number): Buffer | Uint8Array;
export function keccak256(a: Buffer | Uint8Array | any[] | string | number): Buffer | Uint8Array;
export function privateToAddress(privateKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function privateToPublic(privateKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function pubToAddress(pubKey: Buffer | Uint8Array, sanitize: boolean): Buffer | Uint8Array;
export function pubToAddress(pubKey: Buffer | Uint8Array, sanitize?: boolean): Buffer | Uint8Array;
export function ripemd160(a: Buffer | Uint8Array | any[] | string | number, padded: boolean): Buffer | Uint8Array;
@@ -76,8 +82,10 @@ export function toChecksumAddress(address: string): string;
export function toRpcSig(v: number, r: Buffer | Uint8Array, s: Buffer | Uint8Array): string;
export function toUnsigned(num: any): Buffer | Uint8Array;
export function toUnsigned(num: BN): Buffer | Uint8Array;
export function unpad<T extends Buffer | Uint8Array | any[] | string>(a: T): T;
export function zeros(bytes: number): Buffer | Uint8Array;
export function zeroAddress(): string;
+30 -8
View File
@@ -1,17 +1,39 @@
import EventSource = require("eventsource");
const eventSource = new EventSource("http://foobar");
eventSource.onmessage = (x: any) => {};
eventSource.onerror = (x: any) => {};
eventSource.onopen = (x: any) => {};
eventSource.addEventListener = (type: string, x: any) => {};
let readyState: number = eventSource.readyState;
let closedState: number = eventSource.CLOSED;
closedState = EventSource.CLOSED;
let connectingState: number = eventSource.CONNECTING;
connectingState = EventSource.CONNECTING;
let openState: number = eventSource.OPEN;
openState = EventSource.OPEN;
let url: string = eventSource.url;
let withCredentials: boolean = eventSource.withCredentials;
eventSource.onmessage = (event: Event) => {};
eventSource.onerror = (event: Event) => {};
eventSource.onopen = (event: Event) => {};
eventSource.addEventListener = (type: string, listener: (e: Event) => void) => {};
eventSource.dispatchEvent = (event: Event) => true;
eventSource.removeEventListener = (type: string, listener: (e: Event) => void) => {};
eventSource.close();
import EventSourcePolyfill = require("eventsource/lib/eventsource-polyfill");
const eventSourcePolyfill = new EventSourcePolyfill("http://foobar");
eventSourcePolyfill.onmessage = (x: any) => {};
eventSourcePolyfill.onerror = (x: any) => {};
eventSourcePolyfill.onopen = (x: any) => {};
eventSourcePolyfill.addEventListener = (type: string, x: any) => {};
readyState = eventSourcePolyfill.readyState;
closedState = eventSource.CLOSED;
closedState = EventSource.CLOSED;
connectingState = eventSource.CONNECTING;
connectingState = EventSource.CONNECTING;
openState = eventSource.OPEN;
openState = EventSource.OPEN;
url = eventSourcePolyfill.url;
withCredentials = eventSource.withCredentials;
eventSourcePolyfill.onmessage = (event: Event) => {};
eventSourcePolyfill.onerror = (event: Event) => {};
eventSourcePolyfill.onopen = (event: Event) => {};
eventSourcePolyfill.addEventListener = (type: string, listener: (e: Event) => void) => {};
eventSourcePolyfill.dispatchEvent = (event: Event) => true;
eventSourcePolyfill.removeEventListener = (type: string, listener: (e: Event) => void) => {};
eventSourcePolyfill.close();
+14 -7
View File
@@ -1,22 +1,29 @@
// Type definitions for eventsource 1.0
// Project: http://github.com/EventSource/eventsource
// Definitions by: Scott Lee Davis <https://github.com/scottleedavis>
// Ali Afroozeh <https://github.com/afroozeh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.8
declare class EventSource {
static readonly CLOSED: number;
static readonly CONNECTING: number;
static readonly OPEN: number;
constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict);
static CLOSED: EventSource.ReadyState;
static CONNECTING: EventSource.ReadyState;
static OPEN: EventSource.ReadyState;
url: string;
readyState: EventSource.ReadyState;
readonly CLOSED: number;
readonly CONNECTING: number;
readonly OPEN: number;
readonly url: string;
readonly readyState: number;
readonly withCredentials: boolean;
onopen: EventListener;
onmessage: EventListener;
onerror: EventListener;
addEventListener(type: string, listener: EventListener): void;
dispatchEvent(evt: Event): boolean;
removeEventListener(type: string, listener?: EventListener): void;
close(): void;
}
+12 -6
View File
@@ -1,16 +1,22 @@
declare class EventSource {
static readonly CLOSED: number;
static readonly CONNECTING: number;
static readonly OPEN: number;
constructor(url: string, eventSourceInitDict?: EventSource.EventSourceInitDict);
static CLOSED: EventSource.ReadyState;
static CONNECTING: EventSource.ReadyState;
static OPEN: EventSource.ReadyState;
url: string;
readyState: EventSource.ReadyState;
readonly CLOSED: number;
readonly CONNECTING: number;
readonly OPEN: number;
readonly url: string;
readonly readyState: number;
readonly withCredentials: boolean;
onopen: EventListener;
onmessage: EventListener;
onerror: EventListener;
addEventListener(type: string, listener: EventListener): void;
dispatchEvent(evt: Event): boolean;
removeEventListener(type: string, listener?: EventListener): void;
close(): void;
}
@@ -0,0 +1,8 @@
import I18n from 'ex-react-native-i18n';
I18n.defaultLocale = 'en';
I18n.fallbacks = true;
I18n.translations = {};
I18n.locale = 'zh';
const deviceLocale: string = I18n.locale;
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for ex-react-native-i18n 0.0
// Project: https://github.com/xcarpentier/ex-react-native-i18n/
// Definitions by: LikKee Richie <https://github.com/maplerichie>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Actual version for ex-react-native-i18n is 0.0.4 but 'npm run lint' doesn't allow patch version to pass
import I18n = require("i18n-js");
// import I18n from 'ex-react-native-i18n';
export default I18n;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ex-react-native-i18n-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+44 -9
View File
@@ -7,6 +7,8 @@
// Fernando Helwanger <https://github.com/fhelwanger>
// Umidbek Karimov <https://github.com/umidbekkarimov>
// Moshe Feuchtwanger <https://github.com/moshfeu>
// Michael Prokopchuk <https://github.com/prokopcm>
// Tina Roh <https://github.com/tinaroh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -788,11 +790,31 @@ export interface CameraProps extends ViewProps {
}
export interface CameraConstants {
readonly Type: string;
readonly FlashMode: string;
readonly AutoFocus: string;
readonly WhiteBalance: string;
readonly VideoQuality: string;
readonly Type: {
back: string;
front: string;
};
readonly FlashMode: {
on: string;
off: string;
auto: string;
torch: string;
};
readonly AutoFocus: {
on: string;
off: string;
};
readonly WhiteBalance: {
auto: string;
sunny: string;
cloudy: string;
shadow: string;
fluorescent: string;
incandescent: string;
};
readonly VideoQuality: {
[videoQuality: string]: number;
};
readonly BarCodeType: {
aztec: string;
codabar: string;
@@ -878,7 +900,7 @@ export namespace Constants {
};
appKey?: string;
androidStatusBar?: {
barStyle?: 'lignt-content' | 'dark-content',
barStyle?: 'light-content' | 'dark-content',
backgroundColor?: string
};
androidShowExponentNotificationInShellApp?: boolean;
@@ -1390,12 +1412,24 @@ export namespace Font {
}
// #region GLView
export interface ExpoWebGLRenderingContext extends WebGLRenderingContext {
endFrameEXP(): void;
}
/**
* GLView
* A View that acts as an OpenGL ES render target. On mounting, an OpenGL ES
* context is created. Its drawing buffer is presented as the contents of
* the View every frame.
*/
export interface GLViewProps extends ViewProps {
onContextCreate(): void;
msaaSamples: number;
/**
* A function that will be called when the OpenGL ES context is created.
* Passes an object with a WebGLRenderingContext interface as an argument.
*/
onContextCreate(gl: ExpoWebGLRenderingContext): void;
/** Number of MSAA samples to use on iOS. Defaults to 4. Ignored on Android. */
msaaSamples?: number;
}
export class GLView extends Component<GLViewProps, { msaaSamples: number }> { }
@@ -2188,6 +2222,7 @@ export interface VideoProps {
translateY?: number;
rotation?: number;
ref?: Ref<PlaybackObject>;
style?: StyleProp<ViewStyle>;
}
export interface VideoState {
+28 -6
View File
@@ -6,6 +6,7 @@
// Sergio Sánchez <https://github.com/ssanchezmarc>
// Fernando Helwanger <https://github.com/fhelwanger>
// Umidbek Karimov <https://github.com/umidbekkarimov>
// Tina Roh <https://github.com/tinaroh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -787,11 +788,31 @@ export interface CameraProps extends ViewProps {
}
export interface CameraConstants {
readonly Type: string;
readonly FlashMode: string;
readonly AutoFocus: string;
readonly WhiteBalance: string;
readonly VideoQuality: string;
readonly Type: {
back: string;
front: string;
};
readonly FlashMode: {
on: string;
off: string;
auto: string;
torch: string;
};
readonly AutoFocus: {
on: string;
off: string;
};
readonly WhiteBalance: {
auto: string;
sunny: string;
cloudy: string;
shadow: string;
fluorescent: string;
incandescent: string;
};
readonly VideoQuality: {
[videoQuality: string]: number;
};
readonly BarCodeType: {
aztec: string;
codabar: string;
@@ -877,7 +898,7 @@ export namespace Constants {
};
appKey?: string;
androidStatusBar?: {
barStyle?: 'lignt-content' | 'dark-content',
barStyle?: 'light-content' | 'dark-content',
backgroundColor?: string
};
androidShowExponentNotificationInShellApp?: boolean;
@@ -2181,6 +2202,7 @@ export interface VideoProps {
translateY?: number;
rotation?: number;
ref?: Ref<PlaybackObject>;
style?: StyleProp<ViewStyle>;
}
export interface VideoState {
@@ -0,0 +1,11 @@
import StatusBarHeight from '@expo/status-bar-height';
const onChangeHeight = (height: number) => console.log(`New height: ${height}`);
StatusBarHeight.addEventListener(onChangeHeight);
StatusBarHeight.getAsync()
.then((height: number) => console.log(`Current height: ${height}`))
.catch((error: Error) => console.error('Threw an error in StatusBarHeight.getAsync():', error));
StatusBarHeight.removeEventListener(onChangeHeight);
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for @expo/status-bar-height 0.0
// Project: https://github.com/expo/status-bar-height
// Definitions by: Janeene Beeforth <https://github.com/dawnmist>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export type StatusBarHeightHandler = (height: number) => void;
export class StatusBarHeight {
/**
* Get the current status bar height
*/
getAsync(): Promise<number>;
/**
* Add 'willChange' event listener
*/
addEventListener(handler: StatusBarHeightHandler): void;
/**
* Remove 'willChange' event listener
*/
removeEventListener(handler: StatusBarHeightHandler): void;
}
declare const StatusBarHeightStatic: StatusBarHeight;
export default StatusBarHeightStatic;
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"paths": {
"@expo/status-bar-height": [
"expo__status-bar-height"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"expo__status-bar-height-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+11 -3
View File
@@ -67,19 +67,19 @@ declare namespace ExpressBrute {
* @summary Allows you to override the value of failCallback for this middleware.
* @type {Function}
*/
failCallback: Function;
failCallback?: Function;
/**
* @summary Disregard IP address when matching requests if set to true. Defaults to false.
* @type {boolean}
*/
ignoreIP: boolean;
ignoreIP?: boolean;
/**
* @summary Key.
* @type {any}
*/
key: any;
key?: any;
}
/**
@@ -156,5 +156,13 @@ declare namespace ExpressBrute {
reset(key: string, callback: (error: any) => void): void;
}
}
declare module "express-serve-static-core" {
export interface Request {
brute?: {
reset?: (callback?: () => void) => void
};
}
}
export = ExpressBrute;
@@ -26,3 +26,19 @@ io.use(sharedsession(session));
io.use(sharedsession(session, { autoSave: true, saveUninitialized: true }));
io.use(sharedsession(session, cookieParser));
io.use(sharedsession(session, cookieParser, { autoSave: true, saveUninitialized: true }));
io.on('connection', (socket) => {
const sessionID = [
socket.handshake.sessionID,
socket.handshake.session!.id
];
const sessionData = [
socket.handshake.session!['sessionEntry'],
socket.handshake.session!.anotherSessionEntry
];
socket.handshake.session!.touch(() => {});
socket.handshake.session!.regenerate(() => {});
socket.handshake.session!.save(() => {});
socket.handshake.session!.reload(() => {});
socket.handshake.session!.destroy(() => {});
});
+7
View File
@@ -7,6 +7,13 @@
import socketio = require('socket.io');
import express = require('express');
declare module "socket.io" {
interface Handshake {
session?: Express.Session;
sessionID?: string;
}
}
declare function sharedsession(
expressSessionMiddleware: express.RequestHandler,
cookieParserMiddleware: express.RequestHandler,
+1
View File
@@ -0,0 +1 @@
declare/_test_env.d.ts
+1131
View File
File diff suppressed because it is too large Load Diff
+144
View File
@@ -0,0 +1,144 @@
/***************************************************************************
* *
* This file was automatically generated with idlc.js *
* build info: *
* - fibjs : 0.25.0 *
* - date : Jun 11 2018 14:17:22 *
* *
***************************************************************************/
/**
* @author Richard <richardo2016@gmail.com>
*
*/
/// <reference path="object.d.ts" />
/** module Or Internal Object */
/**
* @brief
* @detail BufferedReader utf-8 ,```JavaScript,var reader = new io.BufferedStream(stream);,```
*/
/// <reference path="Stream.d.ts" />
declare class Class_BufferedStream extends Class_Stream {
/**
* class prop
*
*
* @brief
*
* @readonly
* @type Stream
*/
stream: Class_Stream
/**
* class prop
*
*
* @brief utf-8
*
*
* @type String
*/
charset: string
/**
* class prop
*
*
* @brief posix:\"\\n\"windows:\"\\r\\n\"
*
*
* @type String
*/
EOL: string
/**
*
* @brief BufferedStream
* @param stm BufferedStream
*
*
*
*/
constructor(stm: Class_Stream);
/**
*
* @brief
* @param size utf8
* @return null
*
*
* @async
*/
readText(size: number): string;
/**
*
* @brief EOL posix:\"\\n\"windows:\"\\r\\n\"
* @param maxlen utf8
* @return null
*
*
* @async
*/
readLine(maxlen?: number/** = -1*/): string;
/**
*
* @brief EOL posix:\"\\n\"windows:\"\\r\\n\"
* @param maxlines
* @return
*
*
*
*/
readLines(maxlines?: number/** = -1*/): any[];
/**
*
* @brief
* @param mk
* @param maxlen utf8
* @return null
*
*
* @async
*/
readUntil(mk: string, maxlen?: number/** = -1*/): string;
/**
*
* @brief
* @param txt
*
*
* @async
*/
writeText(txt: string): void;
/**
*
* @brief
* @param txt
*
*
* @async
*/
writeLine(txt: string): void;
} /** endof class */
/** } /** endof `module Or Internal Object` */
+63
View File
@@ -0,0 +1,63 @@
/***************************************************************************
* *
* This file was automatically generated with idlc.js *
* build info: *
* - fibjs : 0.25.0 *
* - date : Jun 11 2018 14:17:22 *
* *
***************************************************************************/
/**
* @author Richard <richardo2016@gmail.com>
*
*/
/// <reference path="object.d.ts" />
/** module Or Internal Object */
/**
* @brief
* @detail ,```JavaScript,var chain = new mq.Chain([, func1, func2,]);,```
*/
/// <reference path="Handler.d.ts" />
declare class Class_Chain extends Class_Handler {
/**
*
* @brief
* @param hdlrs
*
*
*
*/
constructor(hdlrs: any[]);
/**
*
* @brief
* @param hdlrs
*
*
*
*/
append(hdlrs: any[]): void;
/**
*
* @brief
* @param hdlr mq.Handler
*
*
*
*/
append(hdlr: Class_Handler): void;
} /** endof class */
/** } /** endof `module Or Internal Object` */
+149
View File
@@ -0,0 +1,149 @@
/***************************************************************************
* *
* This file was automatically generated with idlc.js *
* build info: *
* - fibjs : 0.25.0 *
* - date : Jun 11 2018 14:17:22 *
* *
***************************************************************************/
/**
* @author Richard <richardo2016@gmail.com>
*
*/
/// <reference path="object.d.ts" />
/** module Or Internal Object */
/**
* @brief
* @detail Cipher crypto ,```JavaScript,var c = new crypto.Cipher(crypto.AES, crypto.ECB, ...);,```
*/
declare class Class_Cipher extends Class__object {
/**
* class prop
*
*
* @brief
*
* @readonly
* @type String
*/
name: string
/**
* class prop
*
*
* @brief
*
* @readonly
* @type Integer
*/
keySize: number
/**
* class prop
*
*
* @brief
*
* @readonly
* @type Integer
*/
ivSize: number
/**
* class prop
*
*
* @brief
*
* @readonly
* @type Integer
*/
blockSize: number
/**
*
* @brief Cipher ARC4
* @param provider
* @param key
*
*
*
*/
constructor(provider: number, key: Class_Buffer);
/**
*
* @brief Cipher
* @param provider
* @param mode
* @param key
*
*
*
*/
constructor(provider: number, mode: number, key: Class_Buffer);
/**
*
* @brief Cipher
* @param provider
* @param mode
* @param key
* @param iv
*
*
*
*/
constructor(provider: number, mode: number, key: Class_Buffer, iv: Class_Buffer);
/**
*
* @brief 使
* @param mode PADDING_PKCS7
*
*
*
*/
paddingMode(mode: number): void;
/**
*
* @brief 使
* @param data
* @return
*
*
* @async
*/
encrypt(data: Class_Buffer): Class_Buffer;
/**
*
* @brief 使
* @param data
* @return
*
*
* @async
*/
decrypt(data: Class_Buffer): Class_Buffer;
} /** endof class */
/** } /** endof `module Or Internal Object` */
+75
View File
@@ -0,0 +1,75 @@
/***************************************************************************
* *
* This file was automatically generated with idlc.js *
* build info: *
* - fibjs : 0.25.0 *
* - date : Jun 11 2018 14:17:22 *
* *
***************************************************************************/
/**
* @author Richard <richardo2016@gmail.com>
*
*/
/// <reference path="object.d.ts" />
/** module Or Internal Object */
/**
* @brief
* @detail ,1线,2线使,,Lock的配合Lock可自行显式创建并传递进来fibjs为您创建,,使,,,```JavaScript,var coroutine = require("coroutine");,var cond = new coroutine.Condition();,var ready = false;,var state = "ready";,,function funcwait() {, cond.acquire();, while (!ready), cond.wait();, state = "go", cond.release();,},,coroutine.start(funcwait);,,cond.acquire();,console.log(state),ready = true;,cond.notify();,coroutine.sleep();,console.log(state);,```,will output:,```sh,ready,go,```
*/
/// <reference path="Lock.d.ts" />
declare class Class_Condition extends Class_Lock {
/**
*
* @brief fibjs内部构造
*
*
*/
constructor();
/**
*
* @brief
* @param lock 使
*
*
*
*/
constructor(lock: Class_Lock);
/**
*
* @brief 使
*
*
*/
wait(): void;
/**
*
* @brief
*
*
*/
notify(): void;
/**
*
* @brief
*
*
*/
notifyAll(): void;
} /** endof class */
/** } /** endof `module Or Internal Object` */

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