mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
+1
-1
@@ -5,5 +5,5 @@ indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{*.json,*.yml}]
|
||||
[{*.json,*.yml,*.ts}]
|
||||
indent_style = space
|
||||
|
||||
+4952
-4869
File diff suppressed because it is too large
Load Diff
@@ -174,6 +174,12 @@
|
||||
"sourceRepoURL": "https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions",
|
||||
"asOfVersion": "2.0.15"
|
||||
},
|
||||
{
|
||||
"libraryName": "bitwise",
|
||||
"typingsPackageName": "bitwise",
|
||||
"sourceRepoURL": "https://github.com/dodekeract/bitwise",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "botvs",
|
||||
"typingsPackageName": "botvs",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"ajv": "*"
|
||||
}
|
||||
}
|
||||
@@ -132,9 +132,8 @@ myApp.controller('sortableController', function ($scope: MySortableControllerSco
|
||||
$scope.sortableOptions.tolerance = 'pointer';
|
||||
$scope.sortableOptions.zIndex = 9999;
|
||||
|
||||
$scope.sortableOptions['ui-floating'] = undefined;
|
||||
$scope.sortableOptions['ui-floating'] = null;
|
||||
$scope.sortableOptions['ui-floating'] = false;
|
||||
$scope.sortableOptions['ui-floating'] = true;
|
||||
$scope.sortableOptions['ui-floating'] = "auto";
|
||||
const sortableFloatingOption0: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': undefined };
|
||||
const sortableFloatingOption1: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': false };
|
||||
const sortableFloatingOption2: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': true };
|
||||
const sortableFloatingOption3: ng.ui.UISortableOptions<SortableModelInfo> = { 'ui-floating': 'auto' };
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@ declare module 'angular' {
|
||||
export namespace ui {
|
||||
|
||||
interface UISortableOptions<T> extends SortableOptions<T> {
|
||||
'ui-floating'?: string | boolean;
|
||||
'ui-floating'?: 'auto' | boolean;
|
||||
}
|
||||
|
||||
interface UISortableProperties<T> {
|
||||
|
||||
Vendored
+1
-1
@@ -1316,7 +1316,7 @@ declare namespace angular {
|
||||
*
|
||||
* @param key the key of the data to be retrieved
|
||||
*/
|
||||
get<T>(key: string): T;
|
||||
get<T>(key: string): T | undefined;
|
||||
|
||||
/**
|
||||
* Removes an entry from the Cache object.
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { AposModuleOptions } from "apostrophe";
|
||||
|
||||
type CustomModules = "first-custom-widgets";
|
||||
|
||||
const firstCustomWidgetOptions: AposModuleOptions = {
|
||||
extend: "apostrophe-widgets",
|
||||
label: "First Custom Widget",
|
||||
addFields: [
|
||||
{
|
||||
name: "title",
|
||||
label: "Custom Widget Title",
|
||||
type: "string"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
const secondCustomWidgetOptions: AposModuleOptions<CustomModules> = {
|
||||
extend: "first-custom-widgets",
|
||||
label: "Second Custom Widget",
|
||||
addFields: [
|
||||
{
|
||||
name: "title",
|
||||
label: "Custom Widget Title",
|
||||
type: "string"
|
||||
}
|
||||
]
|
||||
};
|
||||
Vendored
+300
@@ -0,0 +1,300 @@
|
||||
// Type definitions for apostrophe 2.67
|
||||
// Project: https://github.com/apostrophecms/apostrophe#readme
|
||||
// Definitions by: Aaron Holderman <https://github.com/afholderman>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export = apostrophe;
|
||||
export as namespace apos;
|
||||
|
||||
declare function apostrophe(options: any, ...args: any[]): any;
|
||||
|
||||
declare namespace apostrophe {
|
||||
const moogBundle: {
|
||||
directory: string;
|
||||
modules: string[];
|
||||
};
|
||||
|
||||
const ui: {
|
||||
globalBusy: (state: any) => any;
|
||||
link: (
|
||||
sel: string,
|
||||
verb: string,
|
||||
object: object,
|
||||
callback?: () => any
|
||||
) => any;
|
||||
};
|
||||
|
||||
const pages: {
|
||||
page: { _id: string; type: string; _url?: string };
|
||||
};
|
||||
|
||||
const adminBar: {
|
||||
link: (name: string, callback: () => any) => void;
|
||||
};
|
||||
|
||||
function change(arg: object | string): any;
|
||||
|
||||
function create(type: string, options: any, callback?: () => any): any;
|
||||
|
||||
const contextPiece: {
|
||||
_id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
type: string;
|
||||
};
|
||||
|
||||
function define(
|
||||
type: string | string[],
|
||||
definition: any,
|
||||
extending?: any
|
||||
): any;
|
||||
|
||||
const docs: {
|
||||
getManager: (type: string) => void;
|
||||
setManager: (type: string, manager: any) => void;
|
||||
lock: (id: string, callback?: () => any) => void;
|
||||
lockAndWatch: (id: string, callback?: () => any) => void;
|
||||
unlock: (_id: string, sync: any, callback?: () => any) => any;
|
||||
};
|
||||
|
||||
function emit(name: string, arg?: any): any;
|
||||
|
||||
const modules: object;
|
||||
|
||||
const modalSupport: {
|
||||
stack: any[];
|
||||
initialized: boolean;
|
||||
depth: number;
|
||||
all: any[];
|
||||
getTopModalOrBody: () => string;
|
||||
getLatestModal: () => null | string;
|
||||
closeTopModal: () => void;
|
||||
cancelTopModal: () => void;
|
||||
};
|
||||
|
||||
function notify(message: string | object, options: AposObject): any;
|
||||
|
||||
function off(eventName: string, fn?: () => any): any;
|
||||
|
||||
function on(eventName: string, fn?: () => any): any;
|
||||
|
||||
const schemas: {
|
||||
convert: (
|
||||
$el: HTMLElement,
|
||||
schema: Schema,
|
||||
data: any,
|
||||
options: any,
|
||||
callback?: () => any
|
||||
) => any;
|
||||
newInstance: (schema: Schema) => any;
|
||||
populate: (
|
||||
data: any,
|
||||
name: string,
|
||||
$field: any,
|
||||
callback?: () => void,
|
||||
$el?: HTMLElement,
|
||||
field?: any
|
||||
) => any;
|
||||
returnToError: (
|
||||
$el: HTMLElement,
|
||||
schema: Schema,
|
||||
errorPath: any,
|
||||
error: any,
|
||||
callback: () => any
|
||||
) => void;
|
||||
};
|
||||
|
||||
const utils: {
|
||||
capitalizeFirst: (s: string) => string;
|
||||
camelName: (s: string) => string;
|
||||
error: (msg: string) => void;
|
||||
generateId: () => string;
|
||||
};
|
||||
|
||||
const versions: {
|
||||
edit: (id: string, afterRevert?: () => void) => any;
|
||||
};
|
||||
|
||||
interface AposObject {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface Field {
|
||||
name: string;
|
||||
type: string;
|
||||
label: string;
|
||||
required?: boolean;
|
||||
options?: AposObject;
|
||||
}
|
||||
|
||||
type Fields = Field[];
|
||||
|
||||
interface AposType {
|
||||
name: string;
|
||||
converters: {
|
||||
string(
|
||||
req: any,
|
||||
data: any,
|
||||
name: string,
|
||||
object: AposObject,
|
||||
field: any,
|
||||
callback: () => any
|
||||
): void;
|
||||
form(
|
||||
req: any,
|
||||
data: any,
|
||||
name: string,
|
||||
object: AposObject,
|
||||
field: any,
|
||||
callback: () => any
|
||||
): void;
|
||||
};
|
||||
empty?(field: any, value: any): void;
|
||||
bless?(req: any, field: any): void;
|
||||
index(value: any, field: any, texts: any): void;
|
||||
}
|
||||
|
||||
interface Schema {
|
||||
createRoutes(): any[];
|
||||
pushAssets(): void;
|
||||
pushCreateSingleton(): void;
|
||||
compose(options: AposObject): void;
|
||||
refine(schema: Schema, options: AposObject): void;
|
||||
toGroups(fields: Fields): void;
|
||||
subset(schema: Schema, fields: Fields): Schema;
|
||||
newInstance(schema: Schema): any;
|
||||
subsetInstance(schema: Schema, instance: AposObject): any;
|
||||
empty(schema: Schema, object: AposObject): void;
|
||||
indexFields(schema: Schema, object: AposObject, texts: any): void;
|
||||
convert(
|
||||
req: any,
|
||||
schema: Schema,
|
||||
to: any,
|
||||
object: AposObject,
|
||||
output: any,
|
||||
callback: () => any
|
||||
): void;
|
||||
isVisible(schema: Schema, object: AposObject, name: string): void;
|
||||
export(
|
||||
req: any,
|
||||
schema: Schema,
|
||||
to: any,
|
||||
object: AposObject,
|
||||
output: any,
|
||||
callback: () => any
|
||||
): void;
|
||||
joinDriver(
|
||||
req: any,
|
||||
method: any,
|
||||
reverse: any,
|
||||
items: any,
|
||||
idField: any,
|
||||
relationshipsField: any,
|
||||
objectField: any,
|
||||
options: any,
|
||||
callback: () => any
|
||||
): void;
|
||||
join(
|
||||
req: any,
|
||||
schema: Schema,
|
||||
objectOrArray: any,
|
||||
withJoins: any,
|
||||
callback: () => any
|
||||
): void;
|
||||
addFieldType(type: AposType): void;
|
||||
getFieldType(typeName: string): void;
|
||||
addFilters(schema: Schema, options: any, cursor: any): void;
|
||||
joinFilterChoices(field: any, cursor: any, valueField: any): void;
|
||||
addJoinSlugFilter(field: any, cursor: any, suffix: any): void;
|
||||
pageServe(req: any): void;
|
||||
sortedDistinct(property: any, cursor: any, callback: () => any): void;
|
||||
cursorFilterInterested(cursor: any, name: string): void;
|
||||
afterInit(): void;
|
||||
validate(schema: Schema, options: any): void;
|
||||
}
|
||||
|
||||
interface AposModule {
|
||||
emit(name: string): void;
|
||||
on(name: string, methodName: any, fn: () => any): void;
|
||||
}
|
||||
|
||||
type AposCoreModules =
|
||||
| "apostrophe-admin-bar"
|
||||
| "apostrophe-any-page-manager"
|
||||
| "apostrophe-areas"
|
||||
| "apostrophe-assets"
|
||||
| "apostrophe-attachments"
|
||||
| "apostrophe-browser-utils"
|
||||
| "apostrophe-caches"
|
||||
| "apostrophe-custom-pages"
|
||||
| "apostrophe-db"
|
||||
| "apostrophe-doc-type-manager"
|
||||
| "apostrophe-docs"
|
||||
| "apostrophe-email"
|
||||
| "apostrophe-express"
|
||||
| "apostrophe-files"
|
||||
| "apostrophe-files-widgets"
|
||||
| "apostrophe-global"
|
||||
| "apostrophe-groups"
|
||||
| "apostrophe-html-widgets"
|
||||
| "apostrophe-i18n"
|
||||
| "apostrophe-images"
|
||||
| "apostrophe-images-widgets"
|
||||
| "apostrophe-jobs"
|
||||
| "apostrophe-launder"
|
||||
| "apostrophe-locks"
|
||||
| "apostrophe-login"
|
||||
| "apostrophe-migrations"
|
||||
| "apostrophe-modal"
|
||||
| "apostrophe-module"
|
||||
| "apostrophe-notifications"
|
||||
| "apostrophe-oembed"
|
||||
| "apostrophe-pager"
|
||||
| "apostrophe-pages"
|
||||
| "apostrophe-permissions"
|
||||
| "apostrophe-pieces"
|
||||
| "apostrophe-pieces-pages"
|
||||
| "apostrophe-pieces-widgets"
|
||||
| "apostrophe-polymorphic-manager"
|
||||
| "apostrophe-push"
|
||||
| "apostrophe-rich-text-widgets"
|
||||
| "apostrophe-schemas"
|
||||
| "apostrophe-search"
|
||||
| "apostrophe-service-bridge"
|
||||
| "apostrophe-soft-redirects"
|
||||
| "apostrophe-tags"
|
||||
| "apostrophe-tasks"
|
||||
| "apostrophe-templates"
|
||||
| "apostrophe-ui"
|
||||
| "apostrophe-urls"
|
||||
| "apostrophe-users"
|
||||
| "apostrophe-utils"
|
||||
| "apostrophe-versions"
|
||||
| "apostrophe-video-fields"
|
||||
| "apostrophe-video-widgets"
|
||||
| "apostrophe-widgets";
|
||||
|
||||
// Pass in custom modules to AposModuleOptions to allow them in extend
|
||||
interface AposModuleOptions<C = {}> {
|
||||
extend: AposCoreModules | C;
|
||||
name?: string;
|
||||
label: string;
|
||||
pluralLabel?: string;
|
||||
playerData?: false | string[];
|
||||
scene?: "user";
|
||||
addFields?: Field[];
|
||||
removeFields?: Field[];
|
||||
arrangeFields?: {
|
||||
name: string;
|
||||
label: string;
|
||||
fields: string[];
|
||||
}[];
|
||||
defer?: boolean;
|
||||
filters?: {
|
||||
projection?: {
|
||||
[key: string]: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
"apostrophe-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"array-type": [true, "array"]
|
||||
}
|
||||
}
|
||||
@@ -27,3 +27,6 @@ const mockContext = {
|
||||
};
|
||||
|
||||
awsServerlessExpress.proxy(server, mockEvent, mockContext);
|
||||
awsServerlessExpress.proxy(server, mockEvent, mockContext, 'CALLBACK', () => {});
|
||||
awsServerlessExpress.proxy(server, mockEvent, mockContext, 'CONTEXT_SUCCEED');
|
||||
awsServerlessExpress.proxy(server, mockEvent, mockContext, 'PROMISE').promise.then((response: awsServerlessExpress.Response) => {}).catch(err => {});
|
||||
|
||||
+34
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for aws-serverless-express 3.0
|
||||
// Type definitions for aws-serverless-express 3.3
|
||||
// Project: https://github.com/awslabs/aws-serverless-express
|
||||
// Definitions by: Ben Speakman <https://github.com/threesquared>
|
||||
// Josh Caffey <https://github.com/jcaffey>
|
||||
@@ -11,6 +11,16 @@
|
||||
import * as http from 'http';
|
||||
import * as lambda from 'aws-lambda';
|
||||
|
||||
export interface Response {
|
||||
statusCode: number;
|
||||
body: string;
|
||||
headers: {};
|
||||
}
|
||||
|
||||
export interface ProxyResult {
|
||||
promise: Promise<Response>;
|
||||
}
|
||||
|
||||
export function createServer(
|
||||
requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => void,
|
||||
serverListenCallback?: () => any,
|
||||
@@ -20,5 +30,27 @@ export function createServer(
|
||||
export function proxy(
|
||||
server: http.Server,
|
||||
event: any,
|
||||
context: lambda.Context
|
||||
context: lambda.Context,
|
||||
): http.Server;
|
||||
|
||||
export function proxy(
|
||||
server: http.Server,
|
||||
event: any,
|
||||
context: lambda.Context,
|
||||
resolutionMode: 'CONTEXT_SUCCEED',
|
||||
): void;
|
||||
|
||||
export function proxy(
|
||||
server: http.Server,
|
||||
event: any,
|
||||
context: lambda.Context,
|
||||
resolutionMode: 'PROMISE'
|
||||
): ProxyResult;
|
||||
|
||||
export function proxy(
|
||||
server: http.Server,
|
||||
event: any,
|
||||
context: lambda.Context,
|
||||
resolutionMode: 'CALLBACK',
|
||||
callback?: (error: any, response: Response) => void
|
||||
): void;
|
||||
|
||||
@@ -3,6 +3,7 @@ import bcryptjs = require("bcryptjs");
|
||||
let str: string;
|
||||
let num: number;
|
||||
let bool: boolean;
|
||||
let arr: number[];
|
||||
let error: Error;
|
||||
|
||||
str = bcryptjs.genSaltSync();
|
||||
@@ -63,3 +64,7 @@ bcryptjs.compare("string1", "string2")
|
||||
num = bcryptjs.getRounds("string");
|
||||
|
||||
str = bcryptjs.getSalt("string");
|
||||
|
||||
str = bcryptjs.encodeBase64([1, 2, 3, 4, 5], 5);
|
||||
|
||||
arr = bcryptjs.decodeBase64("string", 5);
|
||||
|
||||
Vendored
+20
-2
@@ -1,8 +1,10 @@
|
||||
// Type definitions for bcryptjs v2.4.0
|
||||
// Project: https://github.com/dcodeIO/bcrypt.js
|
||||
// Definitions by: Joshua Filby <https://github.com/Joshua-F/>, Rafael Kraut <https://github.com/RafaelKr>
|
||||
// Definitions by: Joshua Filby <https://github.com/Joshua-F/>
|
||||
// Rafael Kraut <https://github.com/RafaelKr>
|
||||
// Branislav Holý <https://github.com/branoholy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
|
||||
/**
|
||||
@@ -103,3 +105,19 @@ export declare function getRounds(hash: string): number;
|
||||
* @return Extracted salt part
|
||||
*/
|
||||
export declare function getSalt(hash: string): string;
|
||||
|
||||
/**
|
||||
* Encodes a byte array to base64 with up to len bytes of input, using the custom bcrypt alphabet.
|
||||
* @function
|
||||
* @param b Byte array
|
||||
* @param len Maximum input length
|
||||
*/
|
||||
export declare function encodeBase64(b: Readonly<ArrayLike<number>>, len: number): string;
|
||||
|
||||
/**
|
||||
* Decodes a base64 encoded string to up to len bytes of output, using the custom bcrypt alphabet.
|
||||
* @function
|
||||
* @param s String to decode
|
||||
* @param len Maximum output length
|
||||
*/
|
||||
export declare function decodeBase64(s: string, len: number): number[];
|
||||
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
export default function and(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
-33
@@ -1,33 +0,0 @@
|
||||
import bitsAnd from './and';
|
||||
import bitsNor from './nor';
|
||||
import bitsNot from './not';
|
||||
import bitsOr from './or';
|
||||
import bitsReduceAnd from './reduce-and';
|
||||
import bitsReduceNand from './reduce-nand';
|
||||
import bitsReduceNor from './reduce-nor';
|
||||
import bitsReduceOr from './reduce-or';
|
||||
import bitsReduceXnor from './reduce-xnor';
|
||||
import bitsReduceXor from './reduce-xor';
|
||||
import bitsToBoolean from './to-boolean';
|
||||
import bitsToString from './to-string';
|
||||
import bitsXnor from './xnor';
|
||||
import bitsXor from './xor';
|
||||
|
||||
declare namespace bits {
|
||||
const and: typeof bitsAnd;
|
||||
const nor: typeof bitsNor;
|
||||
const not: typeof bitsNot;
|
||||
const or: typeof bitsOr;
|
||||
const reduceAnd: typeof bitsReduceAnd;
|
||||
const reduceNand: typeof bitsReduceNand;
|
||||
const reduceNor: typeof bitsReduceNor;
|
||||
const reduceOr: typeof bitsReduceOr;
|
||||
const reduceXnor: typeof bitsReduceXnor;
|
||||
const reduceXor: typeof bitsReduceXor;
|
||||
const toBoolean: typeof bitsToBoolean;
|
||||
const toString: typeof bitsToString;
|
||||
const xnor: typeof bitsXnor;
|
||||
const xor: typeof bitsXor;
|
||||
}
|
||||
|
||||
export default bits;
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
export default function nand(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
export default function nor(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
export default function not(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
export default function or(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function reduceAnd(bits: ReadonlyArray<number>): number;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function reduceNand(bits: ReadonlyArray<number>): number;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function reduceNor(bits: ReadonlyArray<number>): number;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function reduceOr(bits: ReadonlyArray<number>): number;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function reduceXnor(bits: ReadonlyArray<number>): number;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function reduceXor(bits: ReadonlyArray<number>): number;
|
||||
Vendored
-3
@@ -1,3 +0,0 @@
|
||||
export default function toBoolean(
|
||||
bits: ReadonlyArray<number>
|
||||
): ReadonlyArray<boolean>;
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
export default function toString(
|
||||
bit: ReadonlyArray<number>,
|
||||
spacing?: number,
|
||||
spacer?: string
|
||||
): string;
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
export default function xnor(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
export default function xor(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
@@ -1,56 +0,0 @@
|
||||
// Demonstrating cherry-picking
|
||||
import bitwise from 'bitwise';
|
||||
|
||||
import bits from 'bitwise/bits';
|
||||
import toBoolean from 'bitwise/bits/to-boolean';
|
||||
|
||||
import buffer from 'bitwise/buffer';
|
||||
import create from 'bitwise/buffer/create';
|
||||
|
||||
import byte from 'bitwise/byte';
|
||||
import read from 'bitwise/byte/read';
|
||||
|
||||
import integer from 'bitwise/integer';
|
||||
import setBit from 'bitwise/integer/set-bit';
|
||||
|
||||
import nibble from 'bitwise/nibble';
|
||||
import nibbleRead from 'bitwise/nibble/read';
|
||||
|
||||
import string from 'bitwise/string';
|
||||
import toBits from 'bitwise/string/to-bits';
|
||||
|
||||
// Testing basic functions
|
||||
const testBits = [0, 1, 1, 0, 1];
|
||||
|
||||
// $ExpectType string
|
||||
bitwise.bits.toString(testBits);
|
||||
|
||||
// $ExpectType ReadonlyArray<boolean>
|
||||
bits.toBoolean(testBits);
|
||||
// $ExpectType ReadonlyArray<boolean>
|
||||
toBoolean(testBits);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
byte.read(12);
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
read(12);
|
||||
|
||||
// $ExpectType Buffer
|
||||
buffer.create(testBits);
|
||||
// $ExpectType Buffer
|
||||
create(testBits);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
integer.setBit(12, 1, 0);
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
setBit(12, 1, 0);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
nibble.read(15);
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
nibbleRead(15);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
string.toBits('10 10 12$%_.0');
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
toBits('10 10 12$%_.0');
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function and(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
-3
@@ -1,3 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function create(bits: ReadonlyArray<number>): Buffer;
|
||||
Vendored
-31
@@ -1,31 +0,0 @@
|
||||
import bufferAnd from './and';
|
||||
import bufferCreate from './create';
|
||||
import bufferModify from './modify';
|
||||
import bufferNand from './nand';
|
||||
import bufferNor from './nor';
|
||||
import bufferNot from './not';
|
||||
import bufferOr from './or';
|
||||
import bufferRead from './read';
|
||||
import bufferReadCInt from './read-c-int';
|
||||
import bufferReadInt from './read-int';
|
||||
import bufferReadUInt from './read-u-int';
|
||||
import bufferXnor from './xnor';
|
||||
import bufferXor from './xor';
|
||||
|
||||
declare namespace buffer {
|
||||
const and: typeof bufferAnd;
|
||||
const create: typeof bufferCreate;
|
||||
const modify: typeof bufferModify;
|
||||
const nand: typeof bufferNand;
|
||||
const nor: typeof bufferNor;
|
||||
const not: typeof bufferNot;
|
||||
const or: typeof bufferOr;
|
||||
const read: typeof bufferRead;
|
||||
const readCInt: typeof bufferReadCInt;
|
||||
const readInt: typeof bufferReadInt;
|
||||
const readUInt: typeof bufferReadUInt;
|
||||
const xnor: typeof bufferXnor;
|
||||
const xor: typeof bufferXor;
|
||||
}
|
||||
|
||||
export default buffer;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function modify(
|
||||
buffer: Buffer,
|
||||
newBits: ReadonlyArray<number>,
|
||||
bitOffset?: number
|
||||
): void;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function nand(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function nor(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping: boolean
|
||||
): Buffer;
|
||||
Vendored
-3
@@ -1,3 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function not(buffer: Buffer): Buffer;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function or(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function readCInt(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): number;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function readInt(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): number;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function readUInt(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): number;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function read(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function xnor(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function xor(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
import byteRead from './read';
|
||||
import byteWrite from './write';
|
||||
|
||||
declare namespace byte {
|
||||
const read: typeof byteRead;
|
||||
const write: typeof byteWrite;
|
||||
}
|
||||
|
||||
export default byte;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function read(byte: number): ReadonlyArray<number>;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function write(bits: ReadonlyArray<number>): number;
|
||||
Vendored
-22
@@ -1,22 +0,0 @@
|
||||
// Type definitions for bitwise 1.5
|
||||
// Project: https://github.com/dodekeract/bitwise
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import bitwiseBits from './bits';
|
||||
import bitwiseBuffer from './buffer';
|
||||
import bitwiseByte from './byte';
|
||||
import bitwiseInteger from './integer';
|
||||
import bitwiseNibble from './nibble';
|
||||
import bitwiseString from './string';
|
||||
|
||||
declare namespace bitwise {
|
||||
const bits: typeof bitwiseBits;
|
||||
const buffer: typeof bitwiseBuffer;
|
||||
const byte: typeof bitwiseByte;
|
||||
const integer: typeof bitwiseInteger;
|
||||
const nibble: typeof bitwiseNibble;
|
||||
const string: typeof bitwiseString;
|
||||
}
|
||||
|
||||
export default bitwise;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function getBit(number: number, position: number): number;
|
||||
Vendored
-11
@@ -1,11 +0,0 @@
|
||||
import integerGetBit from './get-bit';
|
||||
import integerSetBit from './set-bit';
|
||||
import integerToggleBit from './toggle-bit';
|
||||
|
||||
declare namespace integer {
|
||||
const getBit: typeof integerGetBit;
|
||||
const setBit: typeof integerSetBit;
|
||||
const toggleBit: typeof integerToggleBit;
|
||||
}
|
||||
|
||||
export default integer;
|
||||
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
export default function setBit(
|
||||
number: number,
|
||||
position: number,
|
||||
value: number
|
||||
): ReadonlyArray<number>;
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
export default function toggleBit(
|
||||
number: number,
|
||||
position: number
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
import nibbleRead from './read';
|
||||
import nibbleWrite from './write';
|
||||
|
||||
declare namespace nibble {
|
||||
const read: typeof nibbleRead;
|
||||
const write: typeof nibbleWrite;
|
||||
}
|
||||
|
||||
export default nibble;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function read(nibble: number): ReadonlyArray<number>;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function write(nibble: ReadonlyArray<number>): number;
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
import stringToBits from './to-bits';
|
||||
|
||||
declare namespace string {
|
||||
const toBits: typeof stringToBits;
|
||||
}
|
||||
|
||||
export default string;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
export default function toBits(string: string): ReadonlyArray<number>;
|
||||
@@ -1,60 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bitwise-tests.ts",
|
||||
"bits/and.d.ts",
|
||||
"bits/index.d.ts",
|
||||
"bits/nand.d.ts",
|
||||
"bits/nor.d.ts",
|
||||
"bits/not.d.ts",
|
||||
"bits/or.d.ts",
|
||||
"bits/reduce-and.d.ts",
|
||||
"bits/reduce-nand.d.ts",
|
||||
"bits/reduce-nor.d.ts",
|
||||
"bits/reduce-or.d.ts",
|
||||
"bits/reduce-xnor.d.ts",
|
||||
"bits/reduce-xor.d.ts",
|
||||
"bits/to-boolean.d.ts",
|
||||
"bits/to-string.d.ts",
|
||||
"bits/xnor.d.ts",
|
||||
"bits/xor.d.ts",
|
||||
"buffer/and.d.ts",
|
||||
"buffer/create.d.ts",
|
||||
"buffer/modify.d.ts",
|
||||
"buffer/nand.d.ts",
|
||||
"buffer/nor.d.ts",
|
||||
"buffer/not.d.ts",
|
||||
"buffer/or.d.ts",
|
||||
"buffer/read-c-int.d.ts",
|
||||
"buffer/read-int.d.ts",
|
||||
"buffer/read-u-int.d.ts",
|
||||
"buffer/read.d.ts",
|
||||
"buffer/xnor.d.ts",
|
||||
"buffer/xor.d.ts",
|
||||
"byte/index.d.ts",
|
||||
"byte/read.d.ts",
|
||||
"byte/write.d.ts",
|
||||
"integer/get-bit.d.ts",
|
||||
"integer/index.d.ts",
|
||||
"integer/set-bit.d.ts",
|
||||
"integer/toggle-bit.d.ts",
|
||||
"nibble/index.d.ts",
|
||||
"nibble/read.d.ts",
|
||||
"nibble/write.d.ts",
|
||||
"string/index.d.ts",
|
||||
"string/to-bits.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import BloomFilter = require('bloom-filter');
|
||||
|
||||
const numElements = 3;
|
||||
const falsePositiveRate = 0.01;
|
||||
const filter = BloomFilter.create(numElements, falsePositiveRate);
|
||||
|
||||
// elements
|
||||
const a = Buffer.from('99108ad8ed9bb6274d3980bab5a85c048f0950c8', 'hex');
|
||||
const c = Buffer.from('b5a2c786d9ef4658287ced5914b37a1b4aa32eee', 'hex');
|
||||
|
||||
// insert elements
|
||||
// $ExpectType void
|
||||
filter.insert(a);
|
||||
|
||||
// $ExpectType boolean
|
||||
!filter.contains(c);
|
||||
|
||||
// reinstantiate from an object
|
||||
const serialized = filter.toObject();
|
||||
const woahFilter = new BloomFilter(serialized);
|
||||
|
||||
// initialize directly
|
||||
const newFilter = new BloomFilter({
|
||||
vData: Buffer.from('123', 'hex'), // the data of the filter
|
||||
nHashFuncs: 3, // the number of hash functions to use
|
||||
nTweak: 2147483649, // the seed used for the hash fuctions
|
||||
nFlags: 0 // flags used to update the filter when matched
|
||||
});
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for bloom-filter 0.2
|
||||
// Project: https://github.com/bitpay/bloom-filter
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare class Filter {
|
||||
constructor(options: Filter.FilterOptions);
|
||||
static create(elements: number, falsePositiveRate: number, nTweak?: number, nFlags?: number): Filter;
|
||||
toObject(): Filter.FilterOptions;
|
||||
hash(nHashNum: number, vDataToHash: Buffer): number;
|
||||
insert(data: Buffer): void;
|
||||
contains(data: Buffer): boolean;
|
||||
clear(): void;
|
||||
inspect(): string;
|
||||
BLOOM_UPDATE_NONE: number;
|
||||
BLOOM_UPDATE_ALL: number;
|
||||
BLOOM_UPDATE_P2PUBKEY_ONLY: number;
|
||||
MAX_BLOOM_FILTER_SIZE: number;
|
||||
MAX_HASH_FUNCS: number;
|
||||
MIN_HASH_FUNCS: number;
|
||||
LN2SQUARED: number;
|
||||
LN2: number;
|
||||
}
|
||||
|
||||
declare namespace Filter {
|
||||
interface FilterOptions {
|
||||
vData: Buffer;
|
||||
nHashFuncs: number;
|
||||
nTweak?: number;
|
||||
nFlags?: number;
|
||||
}
|
||||
|
||||
function MurmurHash3(seed: number, data: Buffer): number;
|
||||
}
|
||||
|
||||
export = Filter;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bloom-filter-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -5,3 +5,6 @@ let bn = new BN(42);
|
||||
bn = bn.add(bn);
|
||||
bn.isZero();
|
||||
bn.byteLength;
|
||||
|
||||
bn.toArrayLike(Buffer, 'le', 2);
|
||||
const test = new BN(1, 'le');
|
||||
|
||||
Vendored
+22
-2
@@ -48,6 +48,10 @@ declare class BN {
|
||||
base?: number,
|
||||
endian?: Endianness
|
||||
);
|
||||
constructor(
|
||||
number: number | string | number[] | Buffer | BN,
|
||||
endian?: Endianness
|
||||
)
|
||||
|
||||
/**
|
||||
* @description create a reduction context
|
||||
@@ -64,6 +68,16 @@ declare class BN {
|
||||
*/
|
||||
static isBN(b: any): b is BN;
|
||||
|
||||
/**
|
||||
* @description returns the maximum of 2 BN instances.
|
||||
*/
|
||||
static max(left: BN, right: BN): BN;
|
||||
|
||||
/**
|
||||
* @description returns the minimum of 2 BN instances.
|
||||
*/
|
||||
static min(left: BN, right: BN): BN;
|
||||
|
||||
/**
|
||||
* @description Convert number to red
|
||||
*/
|
||||
@@ -98,10 +112,16 @@ declare class BN {
|
||||
* @description convert to an instance of `type`, which must behave like an Array
|
||||
*/
|
||||
toArrayLike(
|
||||
ArrayType: Buffer | any[],
|
||||
ArrayType: typeof Buffer,
|
||||
endian?: Endianness,
|
||||
length?: number
|
||||
): Buffer | any[];
|
||||
): Buffer;
|
||||
|
||||
toArrayLike(
|
||||
ArrayType: any[],
|
||||
endian?: Endianness,
|
||||
length?: number
|
||||
): any[];
|
||||
|
||||
/**
|
||||
* @description convert to Node.js Buffer (if available). For compatibility with browserify and similar tools, use this instead: a.toArrayLike(Buffer, endian, length)
|
||||
|
||||
Vendored
+3
-3
@@ -368,7 +368,7 @@ declare namespace browserSync {
|
||||
ws?: boolean;
|
||||
reqHeaders?: (config: object) => Hash<object>;
|
||||
proxyRes?: ProxyResponseMiddleware | ProxyResponseMiddleware[];
|
||||
proxyReq?: ((res: http.ServerRequest) => void)[] | ((res: http.ServerRequest) => void);
|
||||
proxyReq?: ((res: http.IncomingMessage) => void)[] | ((res: http.IncomingMessage) => void);
|
||||
error?: (err: NodeJS.ErrnoException, req: http.IncomingMessage, res: http.ServerResponse) => void;
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ declare namespace browserSync {
|
||||
*/
|
||||
(config?: Options, callback?: (err: Error, bs: object) => any): BrowserSyncInstance;
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
instances: Array<BrowserSyncInstance>;
|
||||
/**
|
||||
@@ -547,7 +547,7 @@ declare namespace browserSync {
|
||||
*
|
||||
* @method use
|
||||
* @param {object} module The object to be `required`.
|
||||
* @param {object} options The
|
||||
* @param {object} options The
|
||||
* @param {any} cb A callback function that will return any errors.
|
||||
*/
|
||||
use(module: { "plugin:name"?: string, plugin: (opts: object, bs: BrowserSyncInstance) => any }, options?: object, cb?: any): void;
|
||||
|
||||
@@ -60,3 +60,6 @@ Object.keys(insertGlobals.vars).forEach((x) => {
|
||||
var b = browserify('./browser/main.js', {
|
||||
insertGlobalVars: insertGlobalVars
|
||||
});
|
||||
|
||||
declare const file: string | string[];
|
||||
b.add(file);
|
||||
|
||||
Vendored
+5
-3
@@ -1,6 +1,9 @@
|
||||
// Type definitions for Browserify 12.0
|
||||
// Project: http://browserify.org/
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar>, John Vilk <https://github.com/jvilk>, Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar>
|
||||
// John Vilk <https://github.com/jvilk>
|
||||
// Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Linus Unnebäck <https://github.com/LinusU>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -102,8 +105,7 @@ interface BrowserifyObject extends NodeJS.EventEmitter {
|
||||
* Add an entry file from file that will be executed when the bundle loads.
|
||||
* If file is an array, each item in file will be added as an entry file.
|
||||
*/
|
||||
add(file: InputFile[], opts?: FileOptions): BrowserifyObject;
|
||||
add(file: InputFile, opts?: FileOptions): BrowserifyObject;
|
||||
add(file: InputFile | InputFile[], opts?: FileOptions): BrowserifyObject;
|
||||
/**
|
||||
* Make file available from outside the bundle with require(file).
|
||||
* The file param is anything that can be resolved by require.resolve().
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import bytewise = require('bytewise');
|
||||
|
||||
// $ExpectType Buffer
|
||||
bytewise.encode([1, 2, 3]);
|
||||
|
||||
// $ExpectType any
|
||||
bytewise.decode(bytewise.encode([1, 2 , 3]));
|
||||
|
||||
// $ExpectType Buffer
|
||||
bytewise.encode(bytewise.sorts.array.bound.lower(['123', -1, 0x123, Buffer.from('test')]));
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for bytewise 1.1
|
||||
// Project: https://github.com/deanlandolt/bytewise
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types= "node" />
|
||||
|
||||
interface Bytewise {
|
||||
encode: (value: any) => Buffer;
|
||||
decode: (value: Buffer) => any;
|
||||
[k: string]: any;
|
||||
}
|
||||
|
||||
declare const bytewise: Bytewise;
|
||||
export = bytewise;
|
||||
@@ -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",
|
||||
"bytewise-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -13,6 +13,7 @@ function test() {
|
||||
expect(testElement).to.have.id('id');
|
||||
expect(testElement).to.have.html('foo');
|
||||
expect(testElement).to.have.text('foo');
|
||||
expect(testElement).to.have.trimmed.text('foo');
|
||||
expect(testElement).to.have.text(['foo', 'bar']);
|
||||
expect(testElement).to.have.value('foo');
|
||||
expect(testElement).to.be.empty;
|
||||
|
||||
Vendored
+2
@@ -35,6 +35,8 @@ declare namespace Chai {
|
||||
|
||||
displayed: Assertion;
|
||||
|
||||
trimmed: Assertion;
|
||||
|
||||
}
|
||||
|
||||
interface Include {
|
||||
|
||||
Vendored
+1
@@ -186,6 +186,7 @@ declare namespace Chai {
|
||||
property: Property;
|
||||
members: Members;
|
||||
ordered: Ordered;
|
||||
nested: Nested;
|
||||
}
|
||||
|
||||
interface Ordered {
|
||||
|
||||
Vendored
+2
-2
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
import { ClientResponse, IncomingHttpHeaders } from 'http';
|
||||
import { IncomingMessage, IncomingHttpHeaders } from 'http';
|
||||
|
||||
/**
|
||||
* guess data charset from req.headers, xml, html content-type meta tag
|
||||
@@ -27,7 +27,7 @@ import { ClientResponse, IncomingHttpHeaders } from 'http';
|
||||
* @return charset, lower case, e.g.: utf8, gbk, gb2312, .... If can\'t guess, return null
|
||||
*/
|
||||
// tslint:disable-next-line strict-export-declare-modifiers
|
||||
declare function charset(obj: string | IncomingHttpHeaders | ClientResponse, data?: Buffer, peekSize?: number): string | null;
|
||||
declare function charset(obj: string | IncomingHttpHeaders | IncomingMessage, data?: Buffer, peekSize?: number): string | null;
|
||||
|
||||
// tslint:disable-next-line strict-export-declare-modifiers
|
||||
export = charset;
|
||||
|
||||
@@ -5,8 +5,8 @@ import { Chart, ChartData, Point } from "chart.js";
|
||||
// => chartjs.Chart
|
||||
|
||||
const plugin = {
|
||||
afterDraw: (chartInstance: Chart, easing: string, options?: any) => {
|
||||
}
|
||||
afterDraw: (chartInstance: Chart, easing: string, options?: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
|
||||
@@ -82,6 +82,18 @@ if (chart.chartArea) {
|
||||
console.log(chart.chartArea.left);
|
||||
}
|
||||
|
||||
// Testing custom legends
|
||||
chart.config.options = {
|
||||
...chart.config.options,
|
||||
legend: {
|
||||
display: false,
|
||||
},
|
||||
legendCallback: () => 'legend replacement'
|
||||
};
|
||||
chart.update();
|
||||
const customLegend = chart.generateLegend();
|
||||
console.log(customLegend === 'legend replacement');
|
||||
|
||||
// Testing radial chart
|
||||
const tickOptions: Chart.LinearTickOptions = {
|
||||
max: 100,
|
||||
@@ -107,14 +119,14 @@ const chartConfig: Chart.ChartConfiguration = {
|
||||
data: {
|
||||
labels: ['#apples', '#pears', '#apricots', '#acorns', '#amigas', "#orics"],
|
||||
datasets: [{
|
||||
label: "test",
|
||||
lineTension: 0.15,
|
||||
data: [1, 1, 2, 3, 5],
|
||||
backgroundColor: '#37738353',
|
||||
borderColor: '#37738353',
|
||||
borderWidth: 3,
|
||||
fill: true
|
||||
}]
|
||||
label: "test",
|
||||
lineTension: 0.15,
|
||||
data: [1, 1, 2, 3, 5],
|
||||
backgroundColor: '#37738353',
|
||||
borderColor: '#37738353',
|
||||
borderWidth: 3,
|
||||
fill: true
|
||||
}]
|
||||
},
|
||||
options: radarChartOptions
|
||||
};
|
||||
|
||||
Vendored
+6
-1
@@ -14,6 +14,7 @@
|
||||
// Francesco Benedetto <https://github.com/frabnt>
|
||||
// Alexandros Dorodoulis <https://github.com/alexdor>
|
||||
// Manuel Heidrich <https://github.com/mahnuh>
|
||||
// Conrad Holtzhausen <https://github.com/Conrad777>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -163,7 +164,7 @@ interface Model {
|
||||
}
|
||||
|
||||
declare namespace Chart {
|
||||
type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie';
|
||||
type ChartType = 'line' | 'bar' | 'horizontalBar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble' | 'pie' | 'scatter';
|
||||
|
||||
type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
||||
|
||||
@@ -264,6 +265,7 @@ declare namespace Chart {
|
||||
aspectRatio?: number;
|
||||
maintainAspectRatio?: boolean;
|
||||
events?: string[];
|
||||
legendCallback?(chart: Chart): string;
|
||||
onHover?(this: Chart, event: MouseEvent, activeElements: Array<{}>): any;
|
||||
onClick?(event?: MouseEvent, activeElements?: Array<{}>): any;
|
||||
onResize?(this: Chart, newSize: ChartSize): void;
|
||||
@@ -491,6 +493,7 @@ declare namespace Chart {
|
||||
fontSize?: number;
|
||||
fontStyle?: string;
|
||||
labelOffset?: number;
|
||||
lineHeight?: number;
|
||||
max?: any;
|
||||
maxRotation?: number;
|
||||
maxTicksLimit?: number;
|
||||
@@ -501,6 +504,8 @@ declare namespace Chart {
|
||||
reverse?: boolean;
|
||||
showLabelBackdrop?: boolean;
|
||||
source?: 'auto' | 'data' | 'labels';
|
||||
suggestedMax?: number;
|
||||
suggestedMin?: number;
|
||||
}
|
||||
|
||||
interface AngleLineOptions {
|
||||
|
||||
Vendored
+3
-2
@@ -124,7 +124,7 @@ declare namespace chroma {
|
||||
* Computes the eucledian distance between two colors in a given color space (default is 'lab').
|
||||
* {@link https://en.wikipedia.org/wiki/Euclidean_distance#Three_dimensions}
|
||||
*/
|
||||
distance(color1: string | Color, color2: string | Color, colorSpace?: keyof ColorSpaces): Color;
|
||||
distance(color1: string | Color, color2: string | Color, colorSpace?: keyof ColorSpaces): number;
|
||||
|
||||
/**
|
||||
* Computes color difference {@link https://en.wikipedia.org/wiki/Color_difference#CMC_l:c_.281984.29} as
|
||||
@@ -133,7 +133,7 @@ declare namespace chroma {
|
||||
* {@link https://web.archive.org/web/20160306044036/http://www.brucelindbloom.com/javascript/ColorDiff.js}
|
||||
* The parameters L (default 1) and C (default 1) are weighting factors for lightness and chromacity.
|
||||
*/
|
||||
deltaE(color1: string | Color, color2: string | Color, L?: number, C?: number): Color;
|
||||
deltaE(color1: string | Color, color2: string | Color, L?: number, C?: number): number;
|
||||
|
||||
/**
|
||||
* chroma.brewer is an map of ColorBrewer scales that are included in chroma.js for convenience.
|
||||
@@ -322,6 +322,7 @@ declare namespace chroma {
|
||||
*/
|
||||
out(format: null): Scale;
|
||||
out<K extends keyof ColorSpaces>(format: K): Scale<ColorSpaces[K]>;
|
||||
out(format: 'hex'): Scale<string>;
|
||||
}
|
||||
|
||||
interface Cubehelix {
|
||||
|
||||
Vendored
+8
@@ -195,6 +195,14 @@ declare namespace chrome.cast {
|
||||
errorCallback: (error: chrome.cast.Error) => void
|
||||
): void
|
||||
|
||||
/**
|
||||
* @param {string} escaped A string to unescape.
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/chrome.cast#.unescape
|
||||
*/
|
||||
export function unescape(
|
||||
escaped: string
|
||||
): string
|
||||
|
||||
export class ApiConfig {
|
||||
/**
|
||||
* @param {!chrome.cast.SessionRequest} sessionRequest
|
||||
|
||||
@@ -43,7 +43,7 @@ context.requestSession().then(err => {
|
||||
|
||||
session.getSessionObj().sessionId === session.getSessionId();
|
||||
session.getSessionState() === cast.framework.SessionState.SESSION_STARTED;
|
||||
session.getCastDevice().name;
|
||||
session.getCastDevice().friendlyName;
|
||||
session.getApplicationMetadata().applicationId;
|
||||
session.getApplicationStatus() === "";
|
||||
session.getActiveInputState() ===
|
||||
|
||||
+142
-146
@@ -1,14 +1,12 @@
|
||||
|
||||
|
||||
function test_CKEDITOR() {
|
||||
CKEDITOR.basePath = 'test';
|
||||
CKEDITOR.replaceClass = 'rich_editor';
|
||||
CKEDITOR.skinName = 'moono';
|
||||
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
|
||||
var editor = new CKEDITOR.editor();
|
||||
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection(false).getType() == CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection(true).getType() == CKEDITOR.SELECTION_TEXT)
|
||||
var editor: CKEDITOR.editor = new CKEDITOR.editor();
|
||||
if (editor.getSelection(true).getType() === CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection(false).getType() === CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection(true).getType() === CKEDITOR.SELECTION_TEXT)
|
||||
alert(CKEDITOR.basePath);
|
||||
if (CKEDITOR.currentInstance)
|
||||
alert(CKEDITOR.currentInstance.name);
|
||||
@@ -17,7 +15,7 @@ function test_CKEDITOR() {
|
||||
CKEDITOR.loadFullCoreTimeout = 5;
|
||||
alert(CKEDITOR.revision);
|
||||
alert(CKEDITOR.rnd);
|
||||
if (CKEDITOR.status == 'loaded') {
|
||||
if (CKEDITOR.status === 'loaded') {
|
||||
CKEDITOR.loadFullCore();
|
||||
}
|
||||
alert(CKEDITOR.timestamp);
|
||||
@@ -29,15 +27,16 @@ function test_CKEDITOR() {
|
||||
CKEDITOR.inline('content');
|
||||
if (CKEDITOR.loadFullCore)
|
||||
CKEDITOR.loadFullCore();
|
||||
CKEDITOR.replace('myfield');
|
||||
|
||||
var textarea = document.createElement('textarea');
|
||||
CKEDITOR.replace('myfield');
|
||||
CKEDITOR.replace(textarea);
|
||||
CKEDITOR.replaceAll();
|
||||
CKEDITOR.replaceAll('myClassName');
|
||||
CKEDITOR.replaceAll((textarea, config) => false);
|
||||
|
||||
var editor: CKEDITOR.editor = CKEDITOR.appendTo('append here', CKEDITOR.config, 'data');
|
||||
var editor: CKEDITOR.editor = CKEDITOR.appendTo(document.createElement('div'));
|
||||
editor = CKEDITOR.appendTo('append here', CKEDITOR.config, 'data');
|
||||
editor = CKEDITOR.appendTo(document.createElement('div'));
|
||||
CKEDITOR.error('code');
|
||||
CKEDITOR.error('500', { moreData: true });
|
||||
CKEDITOR.warn('danger');
|
||||
@@ -45,7 +44,7 @@ function test_CKEDITOR() {
|
||||
}
|
||||
|
||||
function test_CKEDITOR_events() {
|
||||
CKEDITOR.on('instanceCreated', function(event) {
|
||||
CKEDITOR.on('instanceCreated', (event) => {
|
||||
// $ExpectType editor
|
||||
event.editor;
|
||||
});
|
||||
@@ -82,7 +81,7 @@ function test_config() {
|
||||
{ name: 'styles', groups: [ 'styles' ] },
|
||||
{ name: 'colors', groups: [ 'colors' ] },
|
||||
],
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function test_dom_comment() {
|
||||
@@ -96,13 +95,13 @@ function test_dom_comment() {
|
||||
|
||||
function test_dom_document() {
|
||||
var document = new CKEDITOR.dom.document(window.document);
|
||||
var type = CKEDITOR.NODE_DOCUMENT;
|
||||
var type: number = CKEDITOR.NODE_DOCUMENT;
|
||||
CKEDITOR.document.appendStyleSheet('/mystyles.css');
|
||||
var element = CKEDITOR.document.getBody();
|
||||
var element: CKEDITOR.dom.element = CKEDITOR.document.getBody();
|
||||
alert(element.getName());
|
||||
var element2 = CKEDITOR.document.getById('myElement');
|
||||
element = CKEDITOR.document.getById('myElement');
|
||||
alert(element.getId());
|
||||
var element3 = CKEDITOR.document.getHead();
|
||||
element = CKEDITOR.document.getHead();
|
||||
alert(element.getName());
|
||||
var selection = CKEDITOR.instances[0].document.getSelection();
|
||||
alert(selection.getType());
|
||||
@@ -113,10 +112,10 @@ function test_dom_document() {
|
||||
'</html>'
|
||||
);
|
||||
var styles: CSSStyleSheet = document.appendStyleText('some styles');
|
||||
var element: CKEDITOR.dom.element = document.createElement('div');
|
||||
var element2: CKEDITOR.dom.element = document.createElement('div', { styles: { height: '1234' } });
|
||||
var element3: CKEDITOR.dom.element = document.createElement('div', { attributes: { id: '1234' } });
|
||||
var element4: CKEDITOR.dom.element = document.createElement('div', { attributes: { tabIndex: '1234' }, styles: { width: '1234' } });
|
||||
element = document.createElement('div');
|
||||
element = document.createElement('div', { styles: { height: '1234' } });
|
||||
element = document.createElement('div', { attributes: { id: '1234' } });
|
||||
element = document.createElement('div', { attributes: { tabIndex: '1234' }, styles: { width: '1234' } });
|
||||
}
|
||||
|
||||
function test_dom_documentFragment() {
|
||||
@@ -130,7 +129,7 @@ function test_dom_domObject() {
|
||||
var nativeElement = element.$;
|
||||
var doc = new CKEDITOR.dom.document(document);
|
||||
alert(doc.equals(CKEDITOR.document));
|
||||
alert(doc == CKEDITOR.document);
|
||||
alert(doc === CKEDITOR.document);
|
||||
var element2 = new CKEDITOR.dom.element('span');
|
||||
alert(element.getCustomData('hasCustomData'));
|
||||
alert(element.getCustomData('nonExistingKey'));
|
||||
@@ -153,7 +152,7 @@ function test_dom_element() {
|
||||
var strong = new CKEDITOR.dom.element('strong');
|
||||
p.append(strong);
|
||||
var em = p.append('em');
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
p = new CKEDITOR.dom.element('p');
|
||||
p.appendText('This is');
|
||||
p.appendText(' some text');
|
||||
element.breakParent(strong);
|
||||
@@ -164,7 +163,7 @@ function test_dom_element() {
|
||||
element.focus();
|
||||
element.focusNext();
|
||||
element.focusPrevious();
|
||||
element.forEach(node=> {
|
||||
element.forEach(node => {
|
||||
console.log(node);
|
||||
});
|
||||
var element2 = CKEDITOR.dom.element.createFromHtml('<input type="text" />');
|
||||
@@ -177,7 +176,7 @@ function test_dom_element() {
|
||||
alert(element.getHtml());
|
||||
alert(element.getId());
|
||||
alert(element.getName());
|
||||
alert('<b>' + element.getNameAtt() + '</b>');
|
||||
alert(`<b>${element.getNameAtt()}</b>`);
|
||||
alert(element.getOuterHtml());
|
||||
alert(element.getTabIndex());
|
||||
alert(element.getText());
|
||||
@@ -198,7 +197,7 @@ function test_dom_element() {
|
||||
element.setAttribute('class', 'myClass');
|
||||
element.setAttribute('title', 'This is an example');
|
||||
element.setAttributes({
|
||||
'class': 'myClass',
|
||||
class: 'myClass',
|
||||
title: 'This is an example'
|
||||
});
|
||||
p.setHtml('<b>Inner</b> HTML');
|
||||
@@ -214,20 +213,20 @@ function test_dom_element() {
|
||||
element.show();
|
||||
element.unselectable();
|
||||
alert(element.getName());
|
||||
alert(element == CKEDITOR.dom.element.get(element));
|
||||
alert(element === CKEDITOR.dom.element.get(element));
|
||||
var htmlElement = document.getElementById('myElement');
|
||||
alert(CKEDITOR.dom.element.get(htmlElement).getName());
|
||||
|
||||
var dtd: CKEDITOR.dtdDefinition = element.getDtd();
|
||||
var last: CKEDITOR.dom.node = element.getLast();
|
||||
var last2: CKEDITOR.dom.node = element.getLast((node: CKEDITOR.dom.node) => node.equals(document.body));
|
||||
if (element.isBlockBoundary({ 'div': 1, 'span': 1 })) {
|
||||
if (element.isBlockBoundary({ div: 1, span: 1 })) {
|
||||
element.setState(1, 'hex', false);
|
||||
}
|
||||
|
||||
CKEDITOR.dom.element.clearMarkers({}, element, true);
|
||||
var element1: CKEDITOR.dom.element = CKEDITOR.dom.element.get('div');
|
||||
var element2: CKEDITOR.dom.element = CKEDITOR.dom.element.get(document.createElement('div'));
|
||||
var element6: CKEDITOR.dom.element = CKEDITOR.dom.element.get(document.createElement('div'));
|
||||
var element3: CKEDITOR.dom.element = CKEDITOR.dom.element.get(element2);
|
||||
var markedElement: CKEDITOR.dom.element = CKEDITOR.dom.element.setMarker({}, element, 'key', 0);
|
||||
}
|
||||
@@ -242,20 +241,20 @@ function test_dom_elementPath() {
|
||||
function test_dom_event() {
|
||||
var event = new CKEDITOR.dom.event(new Event(""));
|
||||
alert(event.getKey());
|
||||
alert(event.getKeystroke() == 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
|
||||
alert(event.getKeystroke() === 65);
|
||||
alert(event.getKeystroke() === CKEDITOR.CTRL + 65);
|
||||
alert(event.getKeystroke() === CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
|
||||
var element = new CKEDITOR.dom.element('div');
|
||||
element.on('mousemouse', ev=> {
|
||||
element.on('mousemouse', ev => {
|
||||
var pageOffset = ev.data.getPageOffset();
|
||||
alert(pageOffset.x);
|
||||
alert(pageOffset.y);
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
element.on('click', ev => {
|
||||
var domEvent = ev.data;
|
||||
domEvent.getTarget().addClass('clicked');
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
element.on('click', ev => {
|
||||
var domEvent = ev.data as CKEDITOR.dom.event;
|
||||
domEvent.preventDefault();
|
||||
});
|
||||
@@ -266,7 +265,7 @@ function test_dom_iterator() {
|
||||
var iterator = range.createIterator();
|
||||
var paragrah1: CKEDITOR.dom.element = iterator.getNextParagraph();
|
||||
var paragrah2: CKEDITOR.dom.element = iterator.getNextParagraph('div');
|
||||
alert(iterator.forceBrBreak === false);
|
||||
alert(!iterator.forceBrBreak);
|
||||
var itRange: CKEDITOR.dom.range = iterator.range;
|
||||
}
|
||||
|
||||
@@ -335,7 +334,7 @@ function test_dom_selection() {
|
||||
element = selection.getSelectedElement();
|
||||
var text: string = selection.getSelectedText();
|
||||
element = selection.getStartElement();
|
||||
|
||||
|
||||
var type: number = selection.getType();
|
||||
|
||||
var isSomething: boolean = selection.isCollapsed();
|
||||
@@ -361,18 +360,18 @@ function test_dom_walker() {
|
||||
var range: CKEDITOR.dom.range = new CKEDITOR.dom.range(element);
|
||||
|
||||
var walker: CKEDITOR.dom.walker = new CKEDITOR.dom.walker(range);
|
||||
|
||||
|
||||
var isSomething: boolean = walker.checkBackward();
|
||||
isSomething = walker.checkForward();
|
||||
walker.end();
|
||||
|
||||
|
||||
var node: CKEDITOR.dom.node = walker.lastBackward();
|
||||
node = walker.lastForward();
|
||||
node = walker.next();
|
||||
node = walker.previous();
|
||||
walker.reset();
|
||||
|
||||
isSomething = CKEDITOR.dom.walker.blockBoundary({ 'div': 1 })(node);
|
||||
isSomething = CKEDITOR.dom.walker.blockBoundary({ div: 1 })(node);
|
||||
isSomething = CKEDITOR.dom.walker.bogus()(node);
|
||||
isSomething = CKEDITOR.dom.walker.bogus(isSomething)(node);
|
||||
isSomething = CKEDITOR.dom.walker.bookmark()(node);
|
||||
@@ -471,8 +470,8 @@ function test_dialog() {
|
||||
dialog.showPage('1234');
|
||||
dialog.updateStyle();
|
||||
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
CKEDITOR.dialog.add('abbrDialog', 'PATH/dialogs/abbr.js');
|
||||
CKEDITOR.dialog.add('abbrDialog', (editor: CKEDITOR.editor) => {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
@@ -486,7 +485,7 @@ function test_dialog() {
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
elements: <any[]> []
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
@@ -566,7 +565,7 @@ function test_fileTools_fileLoader() {
|
||||
var loader: CKEDITOR.fileTools.fileLoader = new CKEDITOR.fileTools.fileLoader(editor, 'data');
|
||||
loader = new CKEDITOR.fileTools.fileLoader(editor, blob);
|
||||
loader = new CKEDITOR.fileTools.fileLoader(editor, blob, 'name');
|
||||
|
||||
|
||||
loader.abort();
|
||||
var finished: boolean = loader.isFinished();
|
||||
loader.load();
|
||||
@@ -582,7 +581,7 @@ function test_fileTools_uploadRepository() {
|
||||
var editor: CKEDITOR.editor;
|
||||
var blob: Blob;
|
||||
var repo: CKEDITOR.fileTools.uploadRepository = new CKEDITOR.fileTools.uploadRepository(editor);
|
||||
|
||||
|
||||
var loader: CKEDITOR.fileTools.fileLoader = repo.create('data', 'name');
|
||||
loader = repo.create(blob, 'name', 'type');
|
||||
|
||||
@@ -603,7 +602,7 @@ function test_filter() {
|
||||
filter.addElementCallback((el: CKEDITOR.htmlParser.element) => 4);
|
||||
filter.addFeature({ allowedContent: style });
|
||||
filter.addTransformations([ [ 'transform1', { right: (element: CKEDITOR.htmlParser.element, tools: string | CKEDITOR.filter.transformationTools) => true } ] ]);
|
||||
|
||||
|
||||
var allowed: boolean = filter.allow(style);
|
||||
allowed = filter.allow([style], 'name');
|
||||
allowed = filter.allow('rule', 'name', false);
|
||||
@@ -645,7 +644,6 @@ function test_focusManager() {
|
||||
var bool: boolean = focusManager.hasFocus;
|
||||
}
|
||||
|
||||
|
||||
function test_htmlParser_basicWriter() {
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
writer.attribute('class', 'MyClass');
|
||||
@@ -680,12 +678,12 @@ function test_htmlParser_cssStyle() {
|
||||
|
||||
style.populate(element);
|
||||
style.populate(new CKEDITOR.dom.element('div'));
|
||||
style.populate({ 'width': 1 });
|
||||
style.populate({ width: 1 });
|
||||
}
|
||||
|
||||
function test_htmlParser_element() {
|
||||
var element: CKEDITOR.htmlParser.element = new CKEDITOR.htmlParser.element('el', { 'id': '1'});
|
||||
|
||||
var element: CKEDITOR.htmlParser.element = new CKEDITOR.htmlParser.element('el', { id: '1'});
|
||||
|
||||
var node: CKEDITOR.htmlParser.node;
|
||||
element.add(node);
|
||||
element.add(node, 5);
|
||||
@@ -703,8 +701,8 @@ function test_htmlParser_element() {
|
||||
element.forEach((el: CKEDITOR.htmlParser.node) => console.log('node'), 1);
|
||||
element.forEach((el: CKEDITOR.htmlParser.node) => false, 2, true);
|
||||
|
||||
var node: CKEDITOR.htmlParser.node = element.getFirst('*');
|
||||
node = element.getFirst({ 'id': '1' });
|
||||
node = element.getFirst('*');
|
||||
node = element.getFirst({ id: '1' });
|
||||
node = element.getFirst((el: CKEDITOR.htmlParser.node) => true);
|
||||
|
||||
var html: string = element.getHtml();
|
||||
@@ -728,7 +726,7 @@ function test_htmlParser_filter() {
|
||||
filter = new CKEDITOR.htmlParser.filter();
|
||||
|
||||
filter.addRules({ text: 'text' });
|
||||
filter.addRules({ attributes: { 'id': '1234' }}, 1);
|
||||
filter.addRules({ attributes: { id: '1234' }}, 1);
|
||||
filter.addRules({ comment: 'hey', text: 'text' }, { priority: 1 });
|
||||
filter.addRules({ root: document.body }, { applyToAll: false });
|
||||
|
||||
@@ -736,7 +734,6 @@ function test_htmlParser_filter() {
|
||||
filter.applyTo(node);
|
||||
}
|
||||
|
||||
|
||||
function test_htmlParser_filterRulesGroup() {
|
||||
var rules: CKEDITOR.htmlParser.filterRulesGroup = new CKEDITOR.htmlParser.filterRulesGroup();
|
||||
|
||||
@@ -786,7 +783,7 @@ function test_htmlParser_node() {
|
||||
var node: CKEDITOR.htmlParser.node = new CKEDITOR.htmlParser.node();
|
||||
|
||||
var el: CKEDITOR.htmlParser.element = node.getAscendant('condition');
|
||||
el = node.getAscendant({ 'id': '1234' });
|
||||
el = node.getAscendant({ id: '1234' });
|
||||
el = node.getAscendant((node: CKEDITOR.htmlParser.element) => false);
|
||||
|
||||
var idx: number = node.getIndex();
|
||||
@@ -795,7 +792,6 @@ function test_htmlParser_node() {
|
||||
node.remove();
|
||||
node.replaceWith(node);
|
||||
el = node.wrapWith(el);
|
||||
|
||||
}
|
||||
|
||||
function test_htmlParser_text() {
|
||||
@@ -825,9 +821,9 @@ function test_htmlWriter() {
|
||||
function test_htmlParser() {
|
||||
var html = '<div><span>text</span></div>';
|
||||
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
|
||||
fragment.forEach(function(node) {
|
||||
fragment.forEach((node) => {
|
||||
if (node instanceof CKEDITOR.htmlParser.element) {
|
||||
node.forEach(function(node) {
|
||||
node.forEach((node) => {
|
||||
console.log(node);
|
||||
});
|
||||
}
|
||||
@@ -836,13 +832,13 @@ function test_htmlParser() {
|
||||
|
||||
function test_keystrokeHandler() {
|
||||
var handler: CKEDITOR.keystrokeHandler = new CKEDITOR.keystrokeHandler(CKEDITOR.instances[0]);
|
||||
handler.attach(new CKEDITOR.dom.domObject(document.body));
|
||||
handler.attach(new CKEDITOR.dom.domObject(document.body));
|
||||
}
|
||||
|
||||
function test_lang() {
|
||||
var lang: string = CKEDITOR.lang.detect('en');
|
||||
lang = CKEDITOR.lang.detect('zh', 'sw');
|
||||
|
||||
|
||||
CKEDITOR.lang.load('tk', 'pr', (code: string, entries: any) => console.log('loaded'));
|
||||
}
|
||||
|
||||
@@ -869,8 +865,8 @@ function test_menu() {
|
||||
}
|
||||
|
||||
function test_plugins() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
CKEDITOR.plugins.add('abbr', {
|
||||
init: (editor: CKEDITOR.editor) => {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
@@ -921,7 +917,7 @@ function test_skin() {
|
||||
}
|
||||
|
||||
function test_style() {
|
||||
var style: CKEDITOR.style = new CKEDITOR.style({ element: 'div' }, { 'key': 'value '});
|
||||
var style: CKEDITOR.style = new CKEDITOR.style({ element: 'div' }, { key: 'value '});
|
||||
style.apply(CKEDITOR.instances[0]);
|
||||
|
||||
var el: CKEDITOR.dom.element;
|
||||
@@ -945,7 +941,7 @@ function test_style() {
|
||||
var def: CKEDITOR.style.definition = style.getDefintion();
|
||||
style.remove(CKEDITOR.instances[0]);
|
||||
style.removeFromRange(range, CKEDITOR.instances[0]);
|
||||
|
||||
|
||||
var rules: CKEDITOR.filter.allowedContentRules;
|
||||
rules = style.toAllowedContentRules();
|
||||
rules = style.toAllowedContentRules(CKEDITOR.instances[0]);
|
||||
@@ -955,14 +951,14 @@ function test_adding_command_and_buttons() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
|
||||
instance.addCommand( 'aCommand', {
|
||||
exec: function( editor: CKEDITOR.editor ) {
|
||||
instance.addCommand('aCommand', {
|
||||
exec: (editor: CKEDITOR.editor) => {
|
||||
// empty logic
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
instance.ui.addButton( 'firstButton', {
|
||||
instance.ui.addButton('firstButton', {
|
||||
icon: 'http://www.example.com/assets/images/icons.png',
|
||||
iconOffset: -32,
|
||||
label: 'Label 1',
|
||||
@@ -970,7 +966,7 @@ function test_adding_command_and_buttons() {
|
||||
toolbar: 'tools'
|
||||
});
|
||||
|
||||
instance.ui.addButton( 'secondButton', {
|
||||
instance.ui.addButton('secondButton', {
|
||||
label: 'Label 2',
|
||||
command: 'aCommand',
|
||||
toolbar: 'tools'
|
||||
@@ -983,7 +979,7 @@ function test_adding_widget() {
|
||||
button: "Activate widgetty",
|
||||
template: "<imaginary-element>",
|
||||
dialog: "widgetty",
|
||||
init: function() {
|
||||
init: () => {
|
||||
// no logic
|
||||
}
|
||||
});
|
||||
@@ -1012,80 +1008,80 @@ function test_editor_instance_event() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea, {
|
||||
on: {
|
||||
activeEnterModeChange: function() {},
|
||||
activeFilterChange: function() {},
|
||||
afterCommandExec: function() {},
|
||||
afterInsertHtml: function() {},
|
||||
afterPaste: function() {},
|
||||
afterPasteFromWord: function() {},
|
||||
afterSetData: function() {},
|
||||
afterUndoImage: function() {},
|
||||
ariaEditorHelpLabel: function() {},
|
||||
ariaWidget: function() {},
|
||||
autogrow: function() {},
|
||||
beforeCommandExec: function() {},
|
||||
beforeDestroy: function() {},
|
||||
beforeModeUnload: function() {},
|
||||
beforeSetMode: function() {},
|
||||
beforeUndoImage: function() {},
|
||||
blur: function() {},
|
||||
change: function() {},
|
||||
configLoaded: function() {},
|
||||
contentDirChanged: function() {},
|
||||
contentDom: function() {},
|
||||
contentDomInvalidated: function() {},
|
||||
contentDomUnload: function() {},
|
||||
customConfigLoaded: function() {},
|
||||
dataFiltered: function() {},
|
||||
dataReady: function() {},
|
||||
destroy: function() {},
|
||||
dialogHide: function() {},
|
||||
dialogShow: function() {},
|
||||
dirChanged: function() {},
|
||||
doubleclick: function() {},
|
||||
dragend: function() {},
|
||||
dragstart: function() {},
|
||||
drop: function() {},
|
||||
elementsPathUpdate: function() {},
|
||||
fileUploadRequest: function() {},
|
||||
fileUploadResponse: function() {},
|
||||
floatingSpaceLayout: function() {},
|
||||
focus: function() {},
|
||||
getData: function() {},
|
||||
getSnapshot: function() {},
|
||||
insertElement: function() {},
|
||||
insertHtml: function() {},
|
||||
insertText: function() {},
|
||||
instanceReady: function() {},
|
||||
key: function() {},
|
||||
langLoaded: function() {},
|
||||
loadSnapshot: function() {},
|
||||
loaded: function() {},
|
||||
lockSnapshot: function() {},
|
||||
maximize: function() {},
|
||||
menuShow: function() {},
|
||||
mode: function() {},
|
||||
notificationHide: function() {},
|
||||
notificationShow: function() {},
|
||||
notificationUpdate: function() {},
|
||||
paste: function() {},
|
||||
pasteFromWord: function() {},
|
||||
pluginsLoaded: function() {},
|
||||
readOnly: function() {},
|
||||
removeFormatCleanup: function() {},
|
||||
required: function() {},
|
||||
resize: function() {},
|
||||
save: function() {},
|
||||
saveSnapshot: function() {},
|
||||
selectionChange: function() {},
|
||||
setData: function() {},
|
||||
stylesSet: function() {},
|
||||
template: function() {},
|
||||
toDataFormat: function() {},
|
||||
toHtml: function() {},
|
||||
unlockSnapshot: function() {},
|
||||
updateSnapshot: function() {},
|
||||
widgetDefinition: function() {}
|
||||
activeEnterModeChange: () => {},
|
||||
activeFilterChange: () => {},
|
||||
afterCommandExec: () => {},
|
||||
afterInsertHtml: () => {},
|
||||
afterPaste: () => {},
|
||||
afterPasteFromWord: () => {},
|
||||
afterSetData: () => {},
|
||||
afterUndoImage: () => {},
|
||||
ariaEditorHelpLabel: () => {},
|
||||
ariaWidget: () => {},
|
||||
autogrow: () => {},
|
||||
beforeCommandExec: () => {},
|
||||
beforeDestroy: () => {},
|
||||
beforeModeUnload: () => {},
|
||||
beforeSetMode: () => {},
|
||||
beforeUndoImage: () => {},
|
||||
blur: () => {},
|
||||
change: () => {},
|
||||
configLoaded: () => {},
|
||||
contentDirChanged: () => {},
|
||||
contentDom: () => {},
|
||||
contentDomInvalidated: () => {},
|
||||
contentDomUnload: () => {},
|
||||
customConfigLoaded: () => {},
|
||||
dataFiltered: () => {},
|
||||
dataReady: () => {},
|
||||
destroy: () => {},
|
||||
dialogHide: () => {},
|
||||
dialogShow: () => {},
|
||||
dirChanged: () => {},
|
||||
doubleclick: () => {},
|
||||
dragend: () => {},
|
||||
dragstart: () => {},
|
||||
drop: () => {},
|
||||
elementsPathUpdate: () => {},
|
||||
fileUploadRequest: () => {},
|
||||
fileUploadResponse: () => {},
|
||||
floatingSpaceLayout: () => {},
|
||||
focus: () => {},
|
||||
getData: () => {},
|
||||
getSnapshot: () => {},
|
||||
insertElement: () => {},
|
||||
insertHtml: () => {},
|
||||
insertText: () => {},
|
||||
instanceReady: () => {},
|
||||
key: () => {},
|
||||
langLoaded: () => {},
|
||||
loadSnapshot: () => {},
|
||||
loaded: () => {},
|
||||
lockSnapshot: () => {},
|
||||
maximize: () => {},
|
||||
menuShow: () => {},
|
||||
mode: () => {},
|
||||
notificationHide: () => {},
|
||||
notificationShow: () => {},
|
||||
notificationUpdate: () => {},
|
||||
paste: () => {},
|
||||
pasteFromWord: () => {},
|
||||
pluginsLoaded: () => {},
|
||||
readOnly: () => {},
|
||||
removeFormatCleanup: () => {},
|
||||
required: () => {},
|
||||
resize: () => {},
|
||||
save: () => {},
|
||||
saveSnapshot: () => {},
|
||||
selectionChange: () => {},
|
||||
setData: () => {},
|
||||
stylesSet: () => {},
|
||||
template: () => {},
|
||||
toDataFormat: () => {},
|
||||
toHtml: () => {},
|
||||
unlockSnapshot: () => {},
|
||||
updateSnapshot: () => {},
|
||||
widgetDefinition: () => {}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1151,7 +1147,7 @@ function test_tools() {
|
||||
var str = CKEDITOR.tools.cssStyleToDomStyle('style');
|
||||
var prefixes: { [cssClass: string]: string | number } = CKEDITOR.tools.cssVendorPrefix('prop', 'val');
|
||||
prefixes = CKEDITOR.tools.cssVendorPrefix('prop', 'val', true);
|
||||
var fn: (param: any) => boolean
|
||||
var fn: (param: any) => boolean;
|
||||
fn = CKEDITOR.tools.defer<(param: any) => boolean>(fn);
|
||||
CKEDITOR.tools.enableHtml5Elements(document);
|
||||
CKEDITOR.tools.enableHtml5Elements(document.createDocumentFragment(), true);
|
||||
@@ -1172,7 +1168,7 @@ function test_tools() {
|
||||
str = CKEDITOR.tools.htmlEncode(str);
|
||||
str = CKEDITOR.tools.htmlEncodeAttr(str);
|
||||
numb = CKEDITOR.tools.indexOf<string>(['string', 'array'], 'string');
|
||||
numb = CKEDITOR.tools.indexOf<boolean>([true, false], (val: boolean) => false);
|
||||
numb = CKEDITOR.tools.indexOf<boolean>([true, false], (val: boolean) => false);
|
||||
console.log(CKEDITOR.tools.isArray([1])); // true
|
||||
console.log(CKEDITOR.tools.isArray(obj)); // false
|
||||
console.log(CKEDITOR.tools.isArray(null)); // false
|
||||
@@ -1186,8 +1182,8 @@ function test_tools() {
|
||||
bool = CKEDITOR.tools.objectCompare(obj, obj);
|
||||
bool = CKEDITOR.tools.objectCompare(obj, obj, true);
|
||||
var strArr: string[] = CKEDITOR.tools.objectKeys(obj);
|
||||
CKEDITOR.tools.override(parseInt, function(_parseInt) {
|
||||
return function(value: any, radix?: number) {
|
||||
CKEDITOR.tools.override(parseInt, (_parseInt) => {
|
||||
return (value: any, radix?: number) => {
|
||||
return _parseInt(value, radix);
|
||||
};
|
||||
});
|
||||
|
||||
Vendored
+57
-81
@@ -6,12 +6,12 @@
|
||||
|
||||
// WORK-IN-PROGRESS: Any contribution support welcomed.
|
||||
// See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/1827 for more informations.
|
||||
|
||||
interface Window {
|
||||
CKEDITOR_BASEPATH: string;
|
||||
CKEDITOR_BASEPATH?: string;
|
||||
}
|
||||
|
||||
declare namespace CKEDITOR {
|
||||
|
||||
// Config options
|
||||
var disableAutoInline: boolean;
|
||||
var replaceClass: string;
|
||||
@@ -131,12 +131,11 @@ declare namespace CKEDITOR {
|
||||
function removeAllListeners(): void;
|
||||
function removeListener(eventName: string, listenerFunction: (eventInfo: eventInfo) => void): void;
|
||||
|
||||
type listenerRegistration = {
|
||||
interface listenerRegistration {
|
||||
removeListener: () => void;
|
||||
}
|
||||
|
||||
namespace dom {
|
||||
|
||||
interface bookmark {
|
||||
startNode: dom.node | string;
|
||||
endNode: dom.node | string;
|
||||
@@ -210,8 +209,7 @@ declare namespace CKEDITOR {
|
||||
readonly $: HTMLElement;
|
||||
readonly type: number;
|
||||
|
||||
constructor(element: string, ownerDocument?: document);
|
||||
constructor(element: HTMLElement, ownerDocument?: document);
|
||||
constructor(element: string | HTMLElement, ownerDocument?: document);
|
||||
addClass(className: string): void;
|
||||
append(node: node | string, toStart?: boolean): node;
|
||||
appendBogus(force: boolean): void;
|
||||
@@ -273,8 +271,7 @@ declare namespace CKEDITOR {
|
||||
removeClass(className: string): void;
|
||||
removeStyle(name: string): void;
|
||||
renameNode(newTag: string): void;
|
||||
scrollIntoParent(parent: element, alignToTop: boolean, hscroll: boolean): void;
|
||||
scrollIntoParent(parent: window, alignToTop: boolean, hscroll: boolean): void;
|
||||
scrollIntoParent(parent: element | window, alignToTop: boolean, hscroll: boolean): void;
|
||||
scrollIntoView(alignToTop?: boolean): void;
|
||||
setAttribute(name: string, value: string): element;
|
||||
setAttributes(attributesPairs: { [key: string]: string }): element;
|
||||
@@ -289,7 +286,7 @@ declare namespace CKEDITOR {
|
||||
show(): void;
|
||||
unselectable(): void;
|
||||
|
||||
//static method
|
||||
// static method
|
||||
static clearAllMarkers(database: any): any;
|
||||
static clearMarkers(database: any, element: dom.element, removeFromDatabase: boolean): void;
|
||||
static createFromHtml(html: string): element;
|
||||
@@ -437,8 +434,8 @@ declare namespace CKEDITOR {
|
||||
}
|
||||
|
||||
interface shrinkOptions {
|
||||
shrinkOnBlockBoundary?: boolean,
|
||||
skipBogus?: boolean
|
||||
shrinkOnBlockBoundary?: boolean;
|
||||
skipBogus?: boolean;
|
||||
}
|
||||
|
||||
class rangeList {
|
||||
@@ -449,7 +446,6 @@ declare namespace CKEDITOR {
|
||||
moveToBookmarks(bookmarks: bookmark[]): void;
|
||||
}
|
||||
|
||||
|
||||
interface rangeListIterator {
|
||||
getNextRange(mergeConsequent?: boolean): range;
|
||||
}
|
||||
@@ -481,7 +477,7 @@ declare namespace CKEDITOR {
|
||||
removeAllRanges(): void;
|
||||
reset(): void;
|
||||
scrollIntoView(): void;
|
||||
selectBookmarks(bookmarks: (bookmark | bookmark2)[]): selection;
|
||||
selectBookmarks(bookmarks: Array<bookmark | bookmark2>): selection;
|
||||
selectElement(element: element): void;
|
||||
selectRanges(ranges: range[]): void;
|
||||
unlock(restore: boolean): void;
|
||||
@@ -547,14 +543,12 @@ declare namespace CKEDITOR {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace ajax {
|
||||
function load(url: string, callback?: (data: any) => void): string;
|
||||
function loadXml(url: string, callback?: (data: any) => void): xml;
|
||||
function post(url: string, data: any, contentType?: string, callback?: (data: any) => void): void;
|
||||
}
|
||||
|
||||
|
||||
class command extends event implements commandDefinition {
|
||||
fakeKeystroke: number;
|
||||
previousState: number;
|
||||
@@ -570,7 +564,6 @@ declare namespace CKEDITOR {
|
||||
refresh(editor: editor, path: dom.elementPath): void;
|
||||
setState(newState: number): boolean;
|
||||
toggleState(): void;
|
||||
|
||||
}
|
||||
|
||||
interface commandDefinition {
|
||||
@@ -737,7 +730,7 @@ declare namespace CKEDITOR {
|
||||
jqueryOverrideVal?: boolean;
|
||||
justifyClasses?: string[];
|
||||
|
||||
keystrokes?: [number, string][];
|
||||
keystrokes?: Array<[number, string]>;
|
||||
|
||||
language?: string;
|
||||
language_list?: string[];
|
||||
@@ -745,7 +738,7 @@ declare namespace CKEDITOR {
|
||||
linkShowAdvancedTab?: boolean;
|
||||
linkShowTargetTab?: boolean;
|
||||
|
||||
magicline_color?: string
|
||||
magicline_color?: string;
|
||||
magicline_everywhere?: boolean;
|
||||
magicline_holdDistance?: number;
|
||||
magicline_keystrokeNext?: number;
|
||||
@@ -822,7 +815,7 @@ declare namespace CKEDITOR {
|
||||
smiley_images?: string[];
|
||||
smiley_path?: string;
|
||||
sourceAreaTabSize?: number;
|
||||
specialChars?: (string | [string, string])[];
|
||||
specialChars?: Array<string | [string, string]>;
|
||||
startupFocus?: string | boolean;
|
||||
startupMode?: string;
|
||||
startupOutlineBlocks?: boolean;
|
||||
@@ -837,10 +830,10 @@ declare namespace CKEDITOR {
|
||||
templates_files?: { [key: string]: any };
|
||||
templates_replaceContent?: boolean;
|
||||
title?: string | boolean;
|
||||
toolbar?: string | (string | string[] | { name: string, items?: string[], groups?: string[] })[] | null;
|
||||
toolbar?: string | Array<string | string[] | { name: string, items?: string[], groups?: string[] }> | null;
|
||||
toolbarCanCollapse?: boolean;
|
||||
toolbarGroupCycling?: boolean;
|
||||
toolbarGroups?: (toolbarGroups | string)[];
|
||||
toolbarGroups?: Array<toolbarGroups | string>;
|
||||
toolbarLocation?: string;
|
||||
toolbarStartupExpanded?: boolean;
|
||||
|
||||
@@ -914,9 +907,7 @@ declare namespace CKEDITOR {
|
||||
}
|
||||
|
||||
namespace dialog {
|
||||
|
||||
namespace definition {
|
||||
|
||||
interface button extends uiElement {
|
||||
disabled?: boolean;
|
||||
}
|
||||
@@ -968,13 +959,13 @@ declare namespace CKEDITOR {
|
||||
|
||||
interface radio extends labeledElement {
|
||||
default?: string;
|
||||
items?: string[] | (string[])[];
|
||||
items?: string[] | string[][];
|
||||
validate?: () => boolean;
|
||||
}
|
||||
|
||||
interface select extends labeledElement {
|
||||
default?: string;
|
||||
items?: string[] | (string[])[];
|
||||
items?: string[] | string[][];
|
||||
multiple?: boolean;
|
||||
size?: number;
|
||||
validate?: () => boolean;
|
||||
@@ -1172,7 +1163,7 @@ declare namespace CKEDITOR {
|
||||
setActiveFilter(filter: filter): void;
|
||||
setData(data: string, options?: { internal?: boolean; callback?: () => void; noSnapshot?: boolean; }): void;
|
||||
setKeystroke(keystroke: number, behavior: string | boolean): void;
|
||||
setKeystroke(keystroke: [number, string | boolean][]): void;
|
||||
setKeystroke(keystroke: Array<[number, string | boolean]>): void;
|
||||
setMode(newMode: string, callback: () => void): void;
|
||||
setReadOnly(isReadOnly?: boolean): void;
|
||||
setUiColor(color: string): void;
|
||||
@@ -1432,7 +1423,7 @@ declare namespace CKEDITOR {
|
||||
readonly disabled: boolean;
|
||||
readonly disallowedContent: any[];
|
||||
readonly editor: editor;
|
||||
readonly elementCallbacks: ((element: htmlParser.element) => number)[];
|
||||
readonly elementCallbacks: Array<(element: htmlParser.element) => number>;
|
||||
readonly id: number;
|
||||
|
||||
static instances: { [id: string]: filter };
|
||||
@@ -1441,7 +1432,7 @@ declare namespace CKEDITOR {
|
||||
addContentForms(forms: any[]): void;
|
||||
addElementCallback(callback: (element: htmlParser.element) => number): void;
|
||||
addFeature(feature: feature): boolean;
|
||||
addTransformations(transformations: (string | filter.transformation)[][]): void;
|
||||
addTransformations(transformations: Array<Array<string | filter.transformation>>): void;
|
||||
allow(newRules: filter.allowedContentRules, featureName?: string, overrideCustom?: boolean): boolean;
|
||||
applyTo(fragment: htmlParser.fragment | htmlParser.element, toHrml: boolean, transformOnly: boolean, enterMode: number): boolean;
|
||||
check(test: filter.contentRule, applyTransformations?: boolean, strictCheck?: boolean): boolean;
|
||||
@@ -1571,10 +1562,10 @@ declare namespace CKEDITOR {
|
||||
}
|
||||
|
||||
class filterRulesGroup {
|
||||
rules: { value: rule, priority: number, option: ruleOptions }[];
|
||||
rules: Array<{ value: rule, priority: number, option: ruleOptions }>;
|
||||
|
||||
add(rule: rule, priority: number, options: ruleOptions): void;
|
||||
addMany(rules: { [key: string]: any }[], priority: number, options: ruleOptions): void;
|
||||
addMany(rules: Array<{ [key: string]: any }>, priority: number, options: ruleOptions): void;
|
||||
exec(currentValue: htmlParser.node | htmlParser.fragment | string): htmlParser.node | htmlParser.fragment | string;
|
||||
execOnName(currentName: string): string;
|
||||
findIndex(priority: number): number;
|
||||
@@ -1612,8 +1603,8 @@ declare namespace CKEDITOR {
|
||||
type rule = ((value: htmlParser.node | htmlParser.fragment | string) => boolean) | [string, string];
|
||||
|
||||
interface ruleOptions {
|
||||
applyToAll?: boolean,
|
||||
excludeNestedEditable?: boolean
|
||||
applyToAll?: boolean;
|
||||
excludeNestedEditable?: boolean;
|
||||
}
|
||||
|
||||
class text extends node {
|
||||
@@ -1682,7 +1673,6 @@ declare namespace CKEDITOR {
|
||||
}
|
||||
|
||||
namespace plugins {
|
||||
|
||||
namespace cloudservices {
|
||||
class cloudServicesLoader extends fileTools.fileLoader {
|
||||
customToken: string;
|
||||
@@ -1778,7 +1768,7 @@ declare namespace CKEDITOR {
|
||||
highlighter: (code: string, lang: string, callback: (highlightedCode: string) => void) => void;
|
||||
init: (ready: () => void) => void;
|
||||
languages: { [lang: string]: string };
|
||||
readonly queue: ((code: string, lang: string, callback: (highlightedCode: string) => void) => void)[];
|
||||
readonly queue: Array<(code: string, lang: string, callback: (highlightedCode: string) => void) => void>;
|
||||
readonly ready: boolean;
|
||||
|
||||
highlight(code: string, lang: string, callback: (highlightedCode: string) => void): void;
|
||||
@@ -1809,9 +1799,7 @@ declare namespace CKEDITOR {
|
||||
}
|
||||
}
|
||||
|
||||
namespace easyimage {
|
||||
|
||||
}
|
||||
namespace easyimage {}
|
||||
|
||||
namespace embedBase {
|
||||
function createWidgetBaseDefinition(editor: editor): baseDefinition;
|
||||
@@ -1856,9 +1844,7 @@ declare namespace CKEDITOR {
|
||||
|
||||
class progressBar extends progressReporter {
|
||||
bar: dom.element;
|
||||
|
||||
constructor();
|
||||
|
||||
}
|
||||
|
||||
class progressReporter {
|
||||
@@ -1922,7 +1908,7 @@ declare namespace CKEDITOR {
|
||||
const synAnchorSelector: boolean;
|
||||
|
||||
function getEditorAnchors(editor: editor): dom.element[];
|
||||
function getLinkAttributes(editor: editor, data: { [key: string]: any }): { set: { [key: string]: string }, removed: string[] }
|
||||
function getLinkAttributes(editor: editor, data: { [key: string]: any }): { set: { [key: string]: string }, removed: string[] };
|
||||
function getSelectedLink(editor: editor, returnMultiple?: boolean): dom.element | dom.element[];
|
||||
function parseLinkAttributes(editor: editor, element: dom.element): { [key: string]: any };
|
||||
function showDisplayTextForElement(element: dom.element, editor: editor): boolean;
|
||||
@@ -2057,7 +2043,6 @@ declare namespace CKEDITOR {
|
||||
setData(data: string): void;
|
||||
}
|
||||
|
||||
|
||||
interface definition extends feature {
|
||||
button?: string;
|
||||
data?: (evt: eventInfo) => void;
|
||||
@@ -2100,8 +2085,7 @@ declare namespace CKEDITOR {
|
||||
destroyAll(offline?: boolean): void;
|
||||
finalizeCreation(container: any): void;
|
||||
getByElement(element: any, checkWrapperOnly: boolean): plugins.widget;
|
||||
initOn(element: dom.element, widgetDef?: plugins.widget.definition, startupData?: { [key: string]: any }): plugins.widget;
|
||||
initOn(element: dom.element, widgetDef?: string, startupData?: { [key: string]: any }): plugins.widget;
|
||||
initOn(element: dom.element, widgetDef?: string | plugins.widget.definition, startupData?: { [key: string]: any }): plugins.widget;
|
||||
initOnAll(container?: dom.element): plugins.widget[];
|
||||
parseElementClasses(classes: string): any;
|
||||
wrapElement(element: any, widgetName?: string): any;
|
||||
@@ -2118,7 +2102,7 @@ declare namespace CKEDITOR {
|
||||
readonly definition: plugins.widget.definition;
|
||||
readonly editor: editor;
|
||||
readonly element: dom.element;
|
||||
readonly focusedEditable: plugins.widget.nestedEditable
|
||||
readonly focusedEditable: plugins.widget.nestedEditable;
|
||||
readonly id: number;
|
||||
readonly inited: boolean;
|
||||
readonly ready: boolean;
|
||||
@@ -2147,8 +2131,7 @@ declare namespace CKEDITOR {
|
||||
updateDragHandlerPosition(): void;
|
||||
}
|
||||
|
||||
function add(name: string, definition: pluginDefinition): void;
|
||||
function add(name: string): void;
|
||||
function add(name: string, definition?: pluginDefinition): void;
|
||||
function addExternal(name: string, path: string, fileName?: string): void;
|
||||
function get(name: string): any;
|
||||
function getFilePath(name: string): string;
|
||||
@@ -2182,6 +2165,7 @@ declare namespace CKEDITOR {
|
||||
|
||||
namespace skin {
|
||||
var icons: { [name: string]: { path: string } };
|
||||
// tslint:disable-next-line:no-duplicate-variable
|
||||
var name: string;
|
||||
var ua: { [name: string]: any };
|
||||
|
||||
@@ -2209,11 +2193,11 @@ declare namespace CKEDITOR {
|
||||
}
|
||||
|
||||
interface definition {
|
||||
attributes?: { [att: string]: string },
|
||||
element: string,
|
||||
name?: string,
|
||||
styles?: { [att: string]: string },
|
||||
type?: string | number
|
||||
attributes?: { [att: string]: string };
|
||||
element: string;
|
||||
name?: string;
|
||||
styles?: { [att: string]: string };
|
||||
type?: string | number;
|
||||
}
|
||||
|
||||
interface customHandler {
|
||||
@@ -2414,13 +2398,13 @@ declare namespace CKEDITOR {
|
||||
interface radio {
|
||||
default: any;
|
||||
validate?: () => boolean;
|
||||
items: ([string, string] | [string])[];
|
||||
items: Array<[string, string] | [string]>;
|
||||
}
|
||||
|
||||
interface select {
|
||||
default: any;
|
||||
validate?: () => boolean;
|
||||
items: ([string, string] | [string])[];
|
||||
items: Array<[string, string] | [string]>;
|
||||
multiple?: boolean;
|
||||
size?: number;
|
||||
}
|
||||
@@ -2462,7 +2446,6 @@ declare namespace CKEDITOR {
|
||||
constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.fieldSet);
|
||||
}
|
||||
|
||||
|
||||
class file extends ui.dialog.labeledElement {
|
||||
constructor(dialog: dialog, elementDefinition: definitions.file, htmlList: any[]);
|
||||
|
||||
@@ -2473,12 +2456,10 @@ declare namespace CKEDITOR {
|
||||
submit(): file;
|
||||
}
|
||||
|
||||
|
||||
class fileButton extends button {
|
||||
constructor(dialog: dialog, elementDefinition: definitions.fileButton, htmlList: any[]);
|
||||
}
|
||||
|
||||
|
||||
class hbox extends uiElement {
|
||||
constructor(dialog: dialog, childObjList: any[], childHtmlList: any[], htmlList: any[], elementDefinition: definitions.hbox);
|
||||
|
||||
@@ -2486,17 +2467,11 @@ declare namespace CKEDITOR {
|
||||
getChild(indices: number[]): ui.dialog.uiElement[];
|
||||
}
|
||||
|
||||
|
||||
class html extends uiElement {
|
||||
constructor(dialog: dialog, elementDefinition: definitions.html, htmlList: any[]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
class iframeElement extends uiElement {
|
||||
|
||||
}
|
||||
|
||||
class iframeElement extends uiElement {}
|
||||
|
||||
class labeledElement extends uiElement {
|
||||
constructor(dialog: dialog, elementDefinition: definitions.labeledElement, htmlList: any[], contentHtml: () => string);
|
||||
@@ -2505,7 +2480,6 @@ declare namespace CKEDITOR {
|
||||
setlabel(label: string): ui.dialog.labeledElement;
|
||||
}
|
||||
|
||||
|
||||
class radio extends ui.dialog.labeledElement {
|
||||
constructor(dialog: dialog, elementDefinition: definitions.radio, htmlList: any[]);
|
||||
|
||||
@@ -2514,7 +2488,6 @@ declare namespace CKEDITOR {
|
||||
setValue(value: string, noChangeEvent: boolean): undefined;
|
||||
}
|
||||
|
||||
|
||||
class select extends uiElement {
|
||||
constructor(dialog: dialog, elementDefinition: definitions.select, htmlList: any[]);
|
||||
|
||||
@@ -2523,12 +2496,10 @@ declare namespace CKEDITOR {
|
||||
remove(index: number): select;
|
||||
}
|
||||
|
||||
|
||||
class textarea extends labeledElement {
|
||||
constructor(dialog: dialog, elementDefinition: definitions.textarea, htmlList: any[]);
|
||||
}
|
||||
|
||||
|
||||
class textInput extends ui.dialog.labeledElement {
|
||||
constructor(dialog: dialog, elementDefinition: definitions.textInput, htmlList: any[]);
|
||||
|
||||
@@ -2544,13 +2515,22 @@ declare namespace CKEDITOR {
|
||||
class uiElement {
|
||||
eventProcessors: any;
|
||||
|
||||
constructor(dialog: dialog, elementDefinition: definitions.uiElement, htmlList: any[], nodeNameArg?: () => string | string, stylesArg?: () => { [key: string]: any } | { [key: string]: any }, attributesArg?: () => { [key: string]: any } | { [key: string]: any }, contentsArg?: () => { [key: string]: any } | string); // Not sure that the htmlList array type is right.
|
||||
// Not sure that the htmlList array type is right.
|
||||
constructor(
|
||||
dialog: dialog,
|
||||
elementDefinition: definitions.uiElement,
|
||||
htmlList: any[],
|
||||
nodeNameArg?: () => string | string,
|
||||
stylesArg?: () => { [key: string]: any } | { [key: string]: any },
|
||||
attributesArg?: () => { [key: string]: any } | { [key: string]: any },
|
||||
contentsArg?: () => { [key: string]: any } | string
|
||||
);
|
||||
|
||||
accessKeyDown(dialog: dialog, key: string): void;
|
||||
accessKeyUp(dialog: dialog, key: string): void;
|
||||
disable(): void;
|
||||
enable(): void;
|
||||
focus(): ui.dialog.uiElement;
|
||||
focus(): ui.dialog.uiElement | undefined;
|
||||
getDialog(): dialog;
|
||||
getElement(): dom.element;
|
||||
getInputElement(): dom.element;
|
||||
@@ -2561,7 +2541,7 @@ declare namespace CKEDITOR {
|
||||
isVisible(): boolean;
|
||||
registerEvents(definition: CKEDITOR.dialog.definition.uiElement): ui.dialog.uiElement;
|
||||
selectParentTab(): ui.dialog.uiElement;
|
||||
setValue(value: any, noChangeEvent: boolean): ui.dialog.uiElement;
|
||||
setValue(value: any, noChangeEvent: boolean): ui.dialog.uiElement | undefined;
|
||||
}
|
||||
|
||||
class vbox extends hbox {
|
||||
@@ -2692,9 +2672,7 @@ declare namespace CKEDITOR {
|
||||
create(definition: { [key: string]: any }): T;
|
||||
}
|
||||
|
||||
class menuButton extends button {
|
||||
|
||||
}
|
||||
class menuButton extends button {}
|
||||
|
||||
class panel {
|
||||
constructor(document: dom.document, definition: { [key: string]: any });
|
||||
@@ -2713,9 +2691,7 @@ declare namespace CKEDITOR {
|
||||
const handler: handlerDefinition<panel>;
|
||||
}
|
||||
|
||||
class panelButton extends button {
|
||||
|
||||
}
|
||||
class panelButton extends button {}
|
||||
|
||||
class richCombo {
|
||||
static readonly handler: handlerDefinition<richCombo>;
|
||||
@@ -2753,11 +2729,11 @@ declare namespace CKEDITOR {
|
||||
}
|
||||
|
||||
interface IMenuItemDefinition {
|
||||
label: string,
|
||||
command: string,
|
||||
icon: string
|
||||
group: string,
|
||||
order: number
|
||||
label: string;
|
||||
command: string;
|
||||
icon: string;
|
||||
group: string;
|
||||
order: number;
|
||||
}
|
||||
|
||||
interface buttonDefinition {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
|
||||
@@ -1,79 +1,14 @@
|
||||
{
|
||||
"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
|
||||
"prefer-const": false
|
||||
}
|
||||
}
|
||||
|
||||
+106
-108
@@ -1,14 +1,12 @@
|
||||
|
||||
|
||||
function test_CKEDITOR() {
|
||||
CKEDITOR.basePath = 'test';
|
||||
CKEDITOR.replaceClass = 'rich_editor';
|
||||
CKEDITOR.skinName = 'moono';
|
||||
CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
|
||||
var editor = new CKEDITOR.editor();
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT)
|
||||
if (editor.getSelection().getType() === CKEDITOR.SELECTION_ELEMENT)
|
||||
if (editor.getSelection().getType() === CKEDITOR.SELECTION_NONE)
|
||||
if (editor.getSelection().getType() === CKEDITOR.SELECTION_TEXT)
|
||||
alert(CKEDITOR.basePath);
|
||||
if (CKEDITOR.currentInstance)
|
||||
alert(CKEDITOR.currentInstance.name);
|
||||
@@ -17,7 +15,7 @@ function test_CKEDITOR() {
|
||||
CKEDITOR.loadFullCoreTimeout = 5;
|
||||
alert(CKEDITOR.revision);
|
||||
alert(CKEDITOR.rnd);
|
||||
if (CKEDITOR.status == 'loaded') {
|
||||
if (CKEDITOR.status === 'loaded') {
|
||||
CKEDITOR.loadFullCore();
|
||||
}
|
||||
alert(CKEDITOR.timestamp);
|
||||
@@ -38,7 +36,7 @@ function test_CKEDITOR() {
|
||||
}
|
||||
|
||||
function test_CKEDITOR_events() {
|
||||
CKEDITOR.on('instanceCreated', function(event) {
|
||||
CKEDITOR.on('instanceCreated', (event) => {
|
||||
// $ExpectType editor
|
||||
event.editor;
|
||||
});
|
||||
@@ -75,7 +73,7 @@ function test_config() {
|
||||
{ name: 'styles', groups: [ 'styles' ] },
|
||||
{ name: 'colors', groups: [ 'colors' ] },
|
||||
],
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function test_dom_comment() {
|
||||
@@ -115,7 +113,7 @@ function test_dom_domObject() {
|
||||
var nativeElement = element.$;
|
||||
var doc = new CKEDITOR.dom.document(document);
|
||||
alert(doc.equals(CKEDITOR.document));
|
||||
alert(doc == CKEDITOR.document);
|
||||
alert(doc === CKEDITOR.document);
|
||||
var element2 = new CKEDITOR.dom.element('span');
|
||||
alert(element.getCustomData('hasCustomData'));
|
||||
alert(element.getCustomData('nonExistingKey'));
|
||||
@@ -136,7 +134,7 @@ function test_dom_element() {
|
||||
var strong = new CKEDITOR.dom.element('strong');
|
||||
p.append(strong);
|
||||
var em = p.append('em');
|
||||
var p = new CKEDITOR.dom.element('p');
|
||||
p = new CKEDITOR.dom.element('p');
|
||||
p.appendText('This is');
|
||||
p.appendText(' some text');
|
||||
element.breakParent(strong);
|
||||
@@ -147,7 +145,7 @@ function test_dom_element() {
|
||||
element.focus();
|
||||
element.focusNext();
|
||||
element.focusPrevious();
|
||||
element.forEach(node=> {
|
||||
element.forEach(node => {
|
||||
console.log(node);
|
||||
});
|
||||
var element2 = CKEDITOR.dom.element.createFromHtml('<input type="text" />');
|
||||
@@ -159,7 +157,7 @@ function test_dom_element() {
|
||||
alert(element.getHtml());
|
||||
alert(element.getId());
|
||||
alert(element.getName());
|
||||
alert('<b>' + element.getNameAtt() + '</b>');
|
||||
alert(`<b>${element.getNameAtt()}</b>`);
|
||||
alert(element.getOuterHtml());
|
||||
alert(element.getTabIndex());
|
||||
alert(element.getText());
|
||||
@@ -180,7 +178,7 @@ function test_dom_element() {
|
||||
element.setAttribute('class', 'myClass');
|
||||
element.setAttribute('title', 'This is an example');
|
||||
element.setAttributes({
|
||||
'class': 'myClass',
|
||||
class: 'myClass',
|
||||
title: 'This is an example'
|
||||
});
|
||||
p.setHtml('<b>Inner</b> HTML');
|
||||
@@ -196,7 +194,7 @@ function test_dom_element() {
|
||||
element.show();
|
||||
element.unselectable();
|
||||
alert(element.getName());
|
||||
alert(element == CKEDITOR.dom.element.get(element));
|
||||
alert(element === CKEDITOR.dom.element.get(element));
|
||||
var htmlElement = document.getElementById('myElement');
|
||||
alert(CKEDITOR.dom.element.get(htmlElement).getName());
|
||||
}
|
||||
@@ -204,20 +202,20 @@ function test_dom_element() {
|
||||
function test_dom_event() {
|
||||
var event = new CKEDITOR.dom.event(new Event(""));
|
||||
alert(event.getKey());
|
||||
alert(event.getKeystroke() == 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + 65);
|
||||
alert(event.getKeystroke() == CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
|
||||
alert(event.getKeystroke() === 65);
|
||||
alert(event.getKeystroke() === CKEDITOR.CTRL + 65);
|
||||
alert(event.getKeystroke() === CKEDITOR.CTRL + CKEDITOR.SHIFT + 65);
|
||||
var element = new CKEDITOR.dom.element('div');
|
||||
element.on('mousemouse', ev=> {
|
||||
element.on('mousemouse', ev => {
|
||||
var pageOffset = ev.data.getPageOffset();
|
||||
alert(pageOffset.x);
|
||||
alert(pageOffset.y);
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
element.on('click', ev => {
|
||||
var domEvent = ev.data;
|
||||
domEvent.getTarget().addClass('clicked');
|
||||
});
|
||||
element.on('click', ev=> {
|
||||
element.on('click', ev => {
|
||||
var domEvent = ev.data as CKEDITOR.dom.event;
|
||||
domEvent.preventDefault();
|
||||
});
|
||||
@@ -298,14 +296,14 @@ function test_adding_command_and_buttons() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea);
|
||||
|
||||
instance.addCommand( 'aCommand', {
|
||||
exec: function( editor: CKEDITOR.editor ) {
|
||||
instance.addCommand('aCommand', {
|
||||
exec: (editor: CKEDITOR.editor) => {
|
||||
// empty logic
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
instance.ui.addButton( 'firstButton', {
|
||||
instance.ui.addButton('firstButton', {
|
||||
icon: 'http://www.example.com/assets/images/icons.png',
|
||||
iconOffset: -32,
|
||||
label: 'Label 1',
|
||||
@@ -313,7 +311,7 @@ function test_adding_command_and_buttons() {
|
||||
toolbar: 'tools'
|
||||
});
|
||||
|
||||
instance.ui.addButton( 'secondButton', {
|
||||
instance.ui.addButton('secondButton', {
|
||||
label: 'Label 2',
|
||||
command: 'aCommand',
|
||||
toolbar: 'tools'
|
||||
@@ -321,11 +319,11 @@ function test_adding_command_and_buttons() {
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_path() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
CKEDITOR.dialog.add('abbrDialog', 'PATH/dialogs/abbr.js');
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_definition() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
CKEDITOR.dialog.add('abbrDialog', (editor: CKEDITOR.editor) => {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
@@ -339,7 +337,7 @@ function test_adding_dialog_by_definition() {
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
elements: <any[]> []
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
@@ -352,8 +350,8 @@ function test_adding_dialog_by_definition() {
|
||||
}
|
||||
|
||||
function test_plugins() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
CKEDITOR.plugins.add('abbr', {
|
||||
init: (editor: CKEDITOR.editor) => {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
@@ -367,7 +365,7 @@ function test_adding_widget() {
|
||||
button: "Activate widgetty",
|
||||
template: "<imaginary-element>",
|
||||
dialog: "widgetty",
|
||||
init: function() {
|
||||
init: () => {
|
||||
// no logic
|
||||
}
|
||||
});
|
||||
@@ -442,80 +440,80 @@ function test_editor_instance_event() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea, {
|
||||
on: {
|
||||
activeEnterModeChange: function() {},
|
||||
activeFilterChange: function() {},
|
||||
afterCommandExec: function() {},
|
||||
afterInsertHtml: function() {},
|
||||
afterPaste: function() {},
|
||||
afterPasteFromWord: function() {},
|
||||
afterSetData: function() {},
|
||||
afterUndoImage: function() {},
|
||||
ariaEditorHelpLabel: function() {},
|
||||
ariaWidget: function() {},
|
||||
autogrow: function() {},
|
||||
beforeCommandExec: function() {},
|
||||
beforeDestroy: function() {},
|
||||
beforeModeUnload: function() {},
|
||||
beforeSetMode: function() {},
|
||||
beforeUndoImage: function() {},
|
||||
blur: function() {},
|
||||
change: function() {},
|
||||
configLoaded: function() {},
|
||||
contentDirChanged: function() {},
|
||||
contentDom: function() {},
|
||||
contentDomInvalidated: function() {},
|
||||
contentDomUnload: function() {},
|
||||
customConfigLoaded: function() {},
|
||||
dataFiltered: function() {},
|
||||
dataReady: function() {},
|
||||
destroy: function() {},
|
||||
dialogHide: function() {},
|
||||
dialogShow: function() {},
|
||||
dirChanged: function() {},
|
||||
doubleclick: function() {},
|
||||
dragend: function() {},
|
||||
dragstart: function() {},
|
||||
drop: function() {},
|
||||
elementsPathUpdate: function() {},
|
||||
fileUploadRequest: function() {},
|
||||
fileUploadResponse: function() {},
|
||||
floatingSpaceLayout: function() {},
|
||||
focus: function() {},
|
||||
getData: function() {},
|
||||
getSnapshot: function() {},
|
||||
insertElement: function() {},
|
||||
insertHtml: function() {},
|
||||
insertText: function() {},
|
||||
instanceReady: function() {},
|
||||
key: function() {},
|
||||
langLoaded: function() {},
|
||||
loadSnapshot: function() {},
|
||||
loaded: function() {},
|
||||
lockSnapshot: function() {},
|
||||
maximize: function() {},
|
||||
menuShow: function() {},
|
||||
mode: function() {},
|
||||
notificationHide: function() {},
|
||||
notificationShow: function() {},
|
||||
notificationUpdate: function() {},
|
||||
paste: function() {},
|
||||
pasteFromWord: function() {},
|
||||
pluginsLoaded: function() {},
|
||||
readOnly: function() {},
|
||||
removeFormatCleanup: function() {},
|
||||
required: function() {},
|
||||
resize: function() {},
|
||||
save: function() {},
|
||||
saveSnapshot: function() {},
|
||||
selectionChange: function() {},
|
||||
setData: function() {},
|
||||
stylesSet: function() {},
|
||||
template: function() {},
|
||||
toDataFormat: function() {},
|
||||
toHtml: function() {},
|
||||
unlockSnapshot: function() {},
|
||||
updateSnapshot: function() {},
|
||||
widgetDefinition: function() {}
|
||||
activeEnterModeChange: () => {},
|
||||
activeFilterChange: () => {},
|
||||
afterCommandExec: () => {},
|
||||
afterInsertHtml: () => {},
|
||||
afterPaste: () => {},
|
||||
afterPasteFromWord: () => {},
|
||||
afterSetData: () => {},
|
||||
afterUndoImage: () => {},
|
||||
ariaEditorHelpLabel: () => {},
|
||||
ariaWidget: () => {},
|
||||
autogrow: () => {},
|
||||
beforeCommandExec: () => {},
|
||||
beforeDestroy: () => {},
|
||||
beforeModeUnload: () => {},
|
||||
beforeSetMode: () => {},
|
||||
beforeUndoImage: () => {},
|
||||
blur: () => {},
|
||||
change: () => {},
|
||||
configLoaded: () => {},
|
||||
contentDirChanged: () => {},
|
||||
contentDom: () => {},
|
||||
contentDomInvalidated: () => {},
|
||||
contentDomUnload: () => {},
|
||||
customConfigLoaded: () => {},
|
||||
dataFiltered: () => {},
|
||||
dataReady: () => {},
|
||||
destroy: () => {},
|
||||
dialogHide: () => {},
|
||||
dialogShow: () => {},
|
||||
dirChanged: () => {},
|
||||
doubleclick: () => {},
|
||||
dragend: () => {},
|
||||
dragstart: () => {},
|
||||
drop: () => {},
|
||||
elementsPathUpdate: () => {},
|
||||
fileUploadRequest: () => {},
|
||||
fileUploadResponse: () => {},
|
||||
floatingSpaceLayout: () => {},
|
||||
focus: () => {},
|
||||
getData: () => {},
|
||||
getSnapshot: () => {},
|
||||
insertElement: () => {},
|
||||
insertHtml: () => {},
|
||||
insertText: () => {},
|
||||
instanceReady: () => {},
|
||||
key: () => {},
|
||||
langLoaded: () => {},
|
||||
loadSnapshot: () => {},
|
||||
loaded: () => {},
|
||||
lockSnapshot: () => {},
|
||||
maximize: () => {},
|
||||
menuShow: () => {},
|
||||
mode: () => {},
|
||||
notificationHide: () => {},
|
||||
notificationShow: () => {},
|
||||
notificationUpdate: () => {},
|
||||
paste: () => {},
|
||||
pasteFromWord: () => {},
|
||||
pluginsLoaded: () => {},
|
||||
readOnly: () => {},
|
||||
removeFormatCleanup: () => {},
|
||||
required: () => {},
|
||||
resize: () => {},
|
||||
save: () => {},
|
||||
saveSnapshot: () => {},
|
||||
selectionChange: () => {},
|
||||
setData: () => {},
|
||||
stylesSet: () => {},
|
||||
template: () => {},
|
||||
toDataFormat: () => {},
|
||||
toHtml: () => {},
|
||||
unlockSnapshot: () => {},
|
||||
updateSnapshot: () => {},
|
||||
widgetDefinition: () => {}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -580,8 +578,8 @@ function test_tools() {
|
||||
console.log(CKEDITOR.tools.isArray(null)); // false
|
||||
console.log(CKEDITOR.tools.isArray(undefined)); // false
|
||||
|
||||
CKEDITOR.tools.override(parseInt, function(_parseInt) {
|
||||
return function(value: any, radix?: number) {
|
||||
CKEDITOR.tools.override(parseInt, (_parseInt) => {
|
||||
return (value: any, radix?: number) => {
|
||||
return _parseInt(value, radix);
|
||||
};
|
||||
});
|
||||
@@ -590,9 +588,9 @@ function test_tools() {
|
||||
function test_htmlParser() {
|
||||
var html = '<div><span>text</span></div>';
|
||||
var fragment = CKEDITOR.htmlParser.fragment.fromHtml(html);
|
||||
fragment.forEach(function(node) {
|
||||
fragment.forEach((node) => {
|
||||
if (node instanceof CKEDITOR.htmlParser.element) {
|
||||
node.forEach(function(node) {
|
||||
node.forEach((node) => {
|
||||
console.log(node);
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+108
-256
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
|
||||
@@ -1,79 +1,14 @@
|
||||
{
|
||||
"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
|
||||
"prefer-const": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import * as cliInteract from 'cli-interact';
|
||||
|
||||
cliInteract.getChar('Tell me one of', 'abcdef');
|
||||
cliInteract.getChoiceByChar('frequency', ['daily', 'weekly', 'monthly']);
|
||||
cliInteract.getChoiceByChar('frequency', ['daily', 'weekly', 'monthly'], true);
|
||||
cliInteract.getChoice('frequency', ['daily', 'weekly', 'monthly']);
|
||||
cliInteract.getChoice('frequency', ['daily', 'weekly', 'monthly'], {
|
||||
returnNumeric: true,
|
||||
});
|
||||
cliInteract.getIPversion(true);
|
||||
cliInteract.getNumber('Case 1: You MAY give me a number: ', {allowNoAnswer: true});
|
||||
cliInteract.getNumber('Case 2: You MUST give me a number: ');
|
||||
cliInteract.getNumber('Case 3: You MUST give me an integer: ', true);
|
||||
cliInteract.getNumber('Case 4: You MAY give me an answer. If you do, it MUST be an integer', {
|
||||
allowNoAnswer: true,
|
||||
requireInteger: true,
|
||||
});
|
||||
cliInteract.getYesNo('Is it true', true);
|
||||
cliInteract.getYesNo('Is it true');
|
||||
cliInteract.question('Tell me what do you want: ', {
|
||||
charlist: 'yn'
|
||||
});
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for cli-interact 0.1
|
||||
// Project: https://github.com/zhami/cli-interact
|
||||
// Definitions by: Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { BasicOptions } from 'readline-sync';
|
||||
|
||||
export interface ChoiceOptions {
|
||||
allowNoAnswer?: boolean;
|
||||
returnNumeric?: boolean;
|
||||
}
|
||||
|
||||
export interface NumberOptions {
|
||||
allowNoAnswer?: boolean;
|
||||
requireInteger?: boolean;
|
||||
}
|
||||
|
||||
export function getChar(promptText: string, allowedCharsAsString: string, flagAllowNoAnswer?: boolean): string;
|
||||
export function getChoice(title: string, choices: string[], opts: ChoiceOptions & {returnNumeric: true}): number;
|
||||
export function getChoice(title: string, choices: string[], opts?: ChoiceOptions): string;
|
||||
export function getChoiceByChar(title: string, choices: string[], flagAllowNoAnswer?: boolean): string;
|
||||
export function getInteger(promptText: string): number;
|
||||
export function getIPversion(flagAllowNoAnswer?: boolean): string;
|
||||
export function getNumber(promptText: string, opts?: boolean | NumberOptions): number;
|
||||
export function getYesNo(title: string, flagAllowNoAnswer: true): boolean | undefined;
|
||||
export function getYesNo(title: string, flagAllowNoAnswer?: false): boolean;
|
||||
export function question(prompt: string, options?: BasicOptions): string;
|
||||
@@ -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",
|
||||
"cli-interact-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+4
-4
@@ -262,13 +262,13 @@ declare namespace CodeMirror {
|
||||
Note that the widget node will become a descendant of nodes with CodeMirror-specific CSS classes, and those classes might in some cases affect it. */
|
||||
addLineWidget(line: any, node: HTMLElement, options?: {
|
||||
/** Whether the widget should cover the gutter. */
|
||||
coverGutter: boolean;
|
||||
coverGutter?: boolean;
|
||||
/** Whether the widget should stay fixed in the face of horizontal scrolling. */
|
||||
noHScroll: boolean;
|
||||
noHScroll?: boolean;
|
||||
/** Causes the widget to be placed above instead of below the text of the line. */
|
||||
above: boolean;
|
||||
above?: boolean;
|
||||
/** When true, will cause the widget to be rendered even if the line it is associated with is hidden. */
|
||||
showIfHidden: boolean;
|
||||
showIfHidden?: boolean;
|
||||
}): CodeMirror.LineWidget;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
import { CometD, Listener, Message } from "cometd";
|
||||
|
||||
const cometd = new CometD();
|
||||
|
||||
// Configuring
|
||||
// ===========
|
||||
|
||||
cometd.configure("http://localhost:8080/cometd");
|
||||
|
||||
cometd.configure({
|
||||
url: "http://localhost:8080/cometd"
|
||||
});
|
||||
|
||||
cometd.registerExtension("ack", { incoming: () => {}, outgoing: () => {} });
|
||||
|
||||
cometd.unregisterTransport("websocket");
|
||||
|
||||
// Handshaking
|
||||
// ===========
|
||||
|
||||
cometd.handshake(handshakeReply => {
|
||||
if (handshakeReply.successful) {
|
||||
// Successfully connected to the server.
|
||||
}
|
||||
});
|
||||
|
||||
const additionalInfoHandshake = {
|
||||
"com.acme.credentials": {
|
||||
user: "cometd",
|
||||
token: "xyzsecretabc"
|
||||
}
|
||||
};
|
||||
cometd.handshake(additionalInfoHandshake, handshakeReply => {
|
||||
if (handshakeReply.successful) {
|
||||
// Successfully connected to the server.
|
||||
}
|
||||
});
|
||||
|
||||
cometd.init("http://host1:8080/cometd");
|
||||
|
||||
// Subscribing and Unsubscribing
|
||||
// =============================
|
||||
|
||||
cometd.subscribe(
|
||||
"/foo",
|
||||
message => {},
|
||||
subscribeReply => {
|
||||
if (subscribeReply.successful) {
|
||||
// The server successfully subscribed this client to the "/foo" channel.
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const additionalInfoSubscribe = {
|
||||
"com.acme.priority": 10
|
||||
};
|
||||
cometd.subscribe("/foo", message => {}, additionalInfoSubscribe, subscribeReply => {
|
||||
if (subscribeReply.successful) {
|
||||
// The server successfully subscribed this client to the "/foo" channel.
|
||||
}
|
||||
});
|
||||
|
||||
const subscription1 = cometd.addListener("/meta/connect", () => {});
|
||||
const subscription2 = cometd.subscribe("/foo/bar/", () => {});
|
||||
|
||||
cometd.unsubscribe(subscription2);
|
||||
cometd.removeListener(subscription1);
|
||||
|
||||
const subscription3 = cometd.subscribe("/foo/bar/", () => {});
|
||||
|
||||
const additionalInfoUnsubscribe = {
|
||||
"com.acme.discard": true
|
||||
};
|
||||
cometd.unsubscribe(subscription3, additionalInfoUnsubscribe, unsubscribeReply => {
|
||||
// Your logic here.
|
||||
});
|
||||
|
||||
// Subscribers versus Listeners
|
||||
// ============================
|
||||
|
||||
let _reportListener: Listener | undefined;
|
||||
|
||||
cometd.addListener("/meta/handshake", message => {
|
||||
// Only subscribe if the handshake is successful
|
||||
if (message.successful) {
|
||||
// Batch all subscriptions together
|
||||
cometd.batch(() => {
|
||||
// Correct to subscribe to broadcast channels
|
||||
cometd.subscribe("/members", m => {});
|
||||
|
||||
// Correct to subscribe to service channels
|
||||
cometd.subscribe("/service/status", m => {});
|
||||
|
||||
// Messy to add listeners after removal, prefer using cometd.subscribe(...)
|
||||
if (_reportListener) {
|
||||
cometd.removeListener(_reportListener);
|
||||
_reportListener = cometd.addListener("/service/report", m => {});
|
||||
}
|
||||
|
||||
// Wrong to add listeners without removal
|
||||
cometd.addListener("/service/notification", m => {});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Dynamic Resubscription
|
||||
// ======================
|
||||
|
||||
let _subscription: Listener | undefined;
|
||||
|
||||
class Controller {
|
||||
dynamicSubscribe = () => {
|
||||
_subscription = cometd.subscribe("/dynamic", this.onEvent);
|
||||
}
|
||||
|
||||
onEvent = (message: Message) => {
|
||||
if (message.successful) {
|
||||
// Your logic here.
|
||||
}
|
||||
}
|
||||
|
||||
dynamicUnsubscribe = () => {
|
||||
if (_subscription) {
|
||||
cometd.unsubscribe(_subscription);
|
||||
_subscription = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cometd.addListener("/meta/handshake", message => {
|
||||
if (message.successful) {
|
||||
cometd.batch(() => {
|
||||
// Static subscription, no need to remember the subscription handle
|
||||
cometd.subscribe("/static", () => {});
|
||||
|
||||
// Dynamic re-subscription
|
||||
if (_subscription) {
|
||||
_subscription = cometd.resubscribe(_subscription);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Listeners and Subscribers Exception Handling
|
||||
// ============================================
|
||||
|
||||
cometd.onListenerException = function(exception, subscriptionHandle, isListener, message) {
|
||||
// Uh-oh, something went wrong, disable this listener/subscriber
|
||||
// Object "this" points to the CometD object
|
||||
if (isListener) {
|
||||
this.removeListener(subscriptionHandle);
|
||||
} else {
|
||||
this.unsubscribe(subscriptionHandle);
|
||||
}
|
||||
};
|
||||
|
||||
// Meta Channel List
|
||||
// =================
|
||||
|
||||
let _connected = false;
|
||||
|
||||
cometd.addListener("/meta/connect", message => {
|
||||
if (cometd.isDisconnected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const wasConnected = _connected;
|
||||
_connected = message.successful;
|
||||
if (!wasConnected && _connected) {
|
||||
// Reconnected
|
||||
} else if (wasConnected && !_connected) {
|
||||
// Disconnected
|
||||
}
|
||||
});
|
||||
|
||||
cometd.addListener("/meta/disconnect", message => {
|
||||
if (message.successful) {
|
||||
_connected = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Publishing
|
||||
// ==========
|
||||
|
||||
cometd.publish("/mychannel", { mydata: { foo: "bar" } });
|
||||
|
||||
cometd.publish("/mychannel", { mydata: { foo: "bar" } }, publishAck => {
|
||||
if (publishAck.successful) {
|
||||
// The message reached the server
|
||||
}
|
||||
});
|
||||
|
||||
// Publishing Binary Data
|
||||
// ======================
|
||||
|
||||
// Create an ArrayBuffer.
|
||||
const buffer = new ArrayBuffer(4);
|
||||
|
||||
// Fill it with the bytes.
|
||||
const view = new DataView(buffer);
|
||||
view.setUint8(0, 0xca);
|
||||
view.setUint8(1, 0xfe);
|
||||
view.setUint8(2, 0xba);
|
||||
view.setUint8(3, 0xbe);
|
||||
|
||||
// Send it.
|
||||
cometd.publishBinary("/binary", view, true, { prolog: "java" });
|
||||
|
||||
// Disconnecting
|
||||
// =============
|
||||
|
||||
cometd.disconnect(disconnectReply => {
|
||||
if (disconnectReply.successful) {
|
||||
// Server truly received the disconnect request
|
||||
}
|
||||
});
|
||||
|
||||
const additionalInfoDisconnect = {
|
||||
"com.acme.reset": false
|
||||
};
|
||||
cometd.disconnect(additionalInfoDisconnect, disconnectReply => {
|
||||
if (disconnectReply.successful) {
|
||||
// Server truly received the disconnect request
|
||||
}
|
||||
});
|
||||
|
||||
// Message Batching
|
||||
// ================
|
||||
|
||||
cometd.batch(() => {
|
||||
cometd.publish("/channel1", { product: "foo" });
|
||||
cometd.publish("/channel2", { notificationType: "all" });
|
||||
cometd.publish("/channel3", { update: false });
|
||||
});
|
||||
|
||||
// Alternatively, but not recommended:
|
||||
cometd.startBatch();
|
||||
cometd.publish("/channel1", { product: "foo" });
|
||||
cometd.publish("/channel2", { notificationType: "all" });
|
||||
cometd.publish("/channel3", { update: false });
|
||||
cometd.endBatch();
|
||||
Vendored
+445
-33
@@ -1,55 +1,467 @@
|
||||
// Type definitions for CometD 2.5.1
|
||||
// Type definitions for CometD 4.0
|
||||
// Project: http://cometd.org
|
||||
// Definitions by: Derek Cicerone <https://github.com/derekcicerone>
|
||||
// Definitions by: Derek Cicerone <https://github.com/derekcicerone>, Daniel Perez Alvarez <https://github.com/unindented>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare namespace CometD {
|
||||
|
||||
interface ConfigurationOptions {
|
||||
url: string;
|
||||
logLevel?: string;
|
||||
maxConnections?: number;
|
||||
backoffIncrement?: number;
|
||||
maxBackoff?: number;
|
||||
reverseIncomingExtensions?: boolean;
|
||||
maxNetworkDelay?: number;
|
||||
requestHeaders?: any;
|
||||
appendMessageTypeToURL?: boolean;
|
||||
autoBatch?: boolean;
|
||||
}
|
||||
|
||||
export interface Configuration {
|
||||
/**
|
||||
* The URL of the Bayeux server this client will connect to.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* The log level. Possible values are: "warn", "info", "debug". Output to `window.console` if
|
||||
* available.
|
||||
*/
|
||||
logLevel?: string;
|
||||
/**
|
||||
* The maximum number of connections used to connect to the Bayeux server. Change this value
|
||||
* only if you know exactly the client’s connection limit and what "request queued behind long
|
||||
* poll" means.
|
||||
*/
|
||||
maxConnections?: number;
|
||||
/**
|
||||
* The number of milliseconds that the backoff time increments every time a connection with the
|
||||
* Bayeux server fails. CometD attempts to reconnect after the backoff time elapses.
|
||||
*/
|
||||
backoffIncrement?: number;
|
||||
/**
|
||||
* The maximum number of milliseconds of the backoff time after which the backoff time is not
|
||||
* incremented further.
|
||||
*/
|
||||
maxBackoff?: number;
|
||||
/**
|
||||
* The maximum number of milliseconds to wait before considering a request to the Bayeux server
|
||||
* failed.
|
||||
*/
|
||||
maxNetworkDelay?: number;
|
||||
/**
|
||||
* An object containing the request headers to be sent for every Bayeux request (for example,
|
||||
* `{"My-Custom-Header": "MyValue"}`).
|
||||
*/
|
||||
requestHeaders?: object;
|
||||
/**
|
||||
* Determines whether or not the Bayeux message type (handshake, connect, disconnect) is
|
||||
* appended to the URL of the Bayeux server (see above).
|
||||
*/
|
||||
appendMessageTypeToURL?: boolean;
|
||||
/**
|
||||
* Determines whether multiple publishes that get queued are sent as a batch on the first
|
||||
* occasion, without requiring explicit batching.
|
||||
*/
|
||||
autoBatch?: boolean;
|
||||
/**
|
||||
* The maximum number of milliseconds to wait for a WebSocket connection to be opened. It does
|
||||
* not apply to HTTP connections. A timeout value of 0 means to wait forever.
|
||||
*/
|
||||
connectTimeout?: number;
|
||||
/**
|
||||
* Only applies to the websocket transport. Determines whether to stick using the websocket
|
||||
* transport when a websocket transport failure has been detected after the websocket transport
|
||||
* was able to successfully connect to the server.
|
||||
*/
|
||||
stickyReconnect?: boolean;
|
||||
/**
|
||||
* The max length of the URI for a request made with the callback-polling transport. Microsoft
|
||||
* Internet Explorer 7 and 8 are known to limit the URI length, so single large messages sent by
|
||||
* CometD may fail to remain within the max URI length when encoded in JSON.
|
||||
*/
|
||||
maxURILength?: number;
|
||||
}
|
||||
|
||||
interface CometD {
|
||||
|
||||
websocketEnabled?: boolean;
|
||||
export interface Message {
|
||||
successful: boolean;
|
||||
data: any;
|
||||
}
|
||||
|
||||
onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void;
|
||||
export type Listener = (message: Message) => void;
|
||||
|
||||
init(options: CometD.ConfigurationOptions): void;
|
||||
export interface Extension {
|
||||
incoming?: Listener;
|
||||
outgoing?: Listener;
|
||||
}
|
||||
|
||||
configure(config: CometD.ConfigurationOptions): void;
|
||||
|
||||
subscribe(channel: string, listener: (message: any) => void): void;
|
||||
export class CometD {
|
||||
constructor(options?: Configuration);
|
||||
|
||||
addListener(channel: string, listener: (message: any) => void): void;
|
||||
removeListener(listener: (message: any) => void): void;
|
||||
/**
|
||||
* Registers the given transport under the given transport type.
|
||||
*
|
||||
* The optional index parameter specifies the priority at which the transport is registered
|
||||
* (where `0` is the max priority).
|
||||
*
|
||||
* If a transport with the same type is already registered, this function does nothing and
|
||||
* returns `false`.
|
||||
*
|
||||
* @param type the transport type
|
||||
* @param transport the transport object
|
||||
* @param index the index at which this transport is to be registered
|
||||
* @return true if the transport has been registered, false otherwise
|
||||
*/
|
||||
registerTransport(type: string, transport: object, index?: number): boolean;
|
||||
|
||||
/**
|
||||
* Unregisters the transport with the given transport type.
|
||||
*
|
||||
* @param type the transport type to unregister
|
||||
* @return the transport that has been unregistered, or null if no transport was previously
|
||||
* registered under the given transport type
|
||||
*/
|
||||
unregisterTransport(type: string): void;
|
||||
|
||||
/**
|
||||
* Unregisters all transports.
|
||||
*/
|
||||
unregisterTransports(): void;
|
||||
|
||||
/**
|
||||
* Configures and establishes the Bayeux communication with the Bayeux server via a handshake
|
||||
* and a subsequent connect.
|
||||
*
|
||||
* @param configuration the configuration object
|
||||
* @param handshakeProps an object to be merged with the handshake message
|
||||
*/
|
||||
init(configuration: string | Configuration, handshakeProps?: object): void;
|
||||
|
||||
/**
|
||||
* Configures the initial Bayeux communication with the Bayeux server.
|
||||
*
|
||||
* @param configuration the URL of the Bayeux server, or a configuration object that must
|
||||
* contain a mandatory field `url`
|
||||
*/
|
||||
configure(config: string | Configuration): void;
|
||||
|
||||
/**
|
||||
* Establishes the Bayeux communication with the Bayeux server via a handshake and a subsequent
|
||||
* connect.
|
||||
*
|
||||
* @param handshakeCallback a function to be invoked when the handshake is acknowledged
|
||||
*/
|
||||
handshake(handshakeCallback: Listener): void;
|
||||
|
||||
/**
|
||||
* Establishes the Bayeux communication with the Bayeux server via a handshake and a subsequent
|
||||
* connect.
|
||||
*
|
||||
* @param handshakeProps an object to be merged with the handshake message
|
||||
* @param handshakeCallback a function to be invoked when the handshake is acknowledged
|
||||
*/
|
||||
handshake(handshakeProps: object, handshakeCallback: Listener): void;
|
||||
|
||||
/**
|
||||
* Disconnects from the Bayeux server.
|
||||
*
|
||||
* @param disconnectCallback a function to be invoked when the disconnect is acknowledged
|
||||
*/
|
||||
disconnect(disconnectCallback: Listener): void;
|
||||
|
||||
/**
|
||||
* Disconnects from the Bayeux server.
|
||||
*
|
||||
* @param disconnectProps an object to be merged with the disconnect message
|
||||
* @param disconnectCallback a function to be invoked when the disconnect is acknowledged
|
||||
*/
|
||||
disconnect(disconnectProps: object, disconnectCallback: Listener): void;
|
||||
|
||||
/**
|
||||
* Marks the start of a batch of application messages to be sent to the server in a single
|
||||
* request, obtaining a single response containing (possibly) many application reply messages.
|
||||
*
|
||||
* Messages are held in a queue and not sent until `endBatch` is called. If `startBatch` is
|
||||
* called multiple times, then an equal number of `endBatch` calls must be made to close and
|
||||
* send the batch of messages.
|
||||
*/
|
||||
startBatch(): void;
|
||||
|
||||
/**
|
||||
* Marks the end of a batch of application messages to be sent to the server in a single
|
||||
* request.
|
||||
*/
|
||||
endBatch(): void;
|
||||
|
||||
/**
|
||||
* Executes the given callback in the given scope, surrounded by a `startBatch` and `endBatch`
|
||||
* calls.
|
||||
*
|
||||
* @param callback the callback to be executed within `startBatch` and `endBatch` calls
|
||||
*/
|
||||
batch(callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Adds a listener for Bayeux messages, performing the given callback in the given scope when a
|
||||
* message for the given channel arrives.
|
||||
*
|
||||
* - Must be used to listen to meta channel messages.
|
||||
* - May be used to listen to service channel messages.
|
||||
* - Should not be used to listen broadcast channel messages (use `subscribe` instead).
|
||||
* - Does not involve any communication with the Bayeux server, and as such can be called before
|
||||
* calling `handshake`.
|
||||
* - Is synchronous: when it returns, you are guaranteed that the listener has been added.
|
||||
*
|
||||
* @param channel the channel the listener is interested to
|
||||
* @param callback the callback to call when a message is sent to the channel
|
||||
* @returns the subscription handle to be passed to `removeListener`
|
||||
*/
|
||||
addListener(channel: string, callback: Listener): Listener;
|
||||
|
||||
/**
|
||||
* Removes the subscription obtained with a call to `addListener`.
|
||||
*
|
||||
* @param subscription the subscription to unsubscribe.
|
||||
*/
|
||||
removeListener(subscription: Listener): void;
|
||||
|
||||
/**
|
||||
* Removes all listeners registered with `addListener` or `subscribe`.
|
||||
*/
|
||||
clearListeners(): void;
|
||||
|
||||
/**
|
||||
* Subscribes to the given channel, performing the given callback in the given scope when a
|
||||
* message for the channel arrives.
|
||||
*
|
||||
* - Must not be used to listen to meta channels messages (if attempted, the server returns an
|
||||
* error).
|
||||
* - May be used to listen to service channel messages.
|
||||
* - Should be used to listen to broadcast channel messages.
|
||||
* - Involves a communication with the Bayeux server and as such cannot be called before calling
|
||||
* `handshake`.
|
||||
* - Is asynchronous: it returns immediately, well before the Bayeux server has received the
|
||||
* subscription request.
|
||||
*
|
||||
* @param channel the channel to subscribe to
|
||||
* @param callback the callback to call when a message is sent to the channel
|
||||
* @param subscribeCallback a function to be invoked when the subscription is acknowledged
|
||||
* @return the subscription handle to be passed to `unsubscribe`
|
||||
*/
|
||||
subscribe(channel: string, callback: Listener, subscribeCallback?: Listener): Listener;
|
||||
|
||||
/**
|
||||
* Subscribes to the given channel, performing the given callback in the given scope when a
|
||||
* message for the channel arrives.
|
||||
*
|
||||
* - Must not be used to listen to meta channels messages (if attempted, the server returns an
|
||||
* error).
|
||||
* - May be used to listen to service channel messages.
|
||||
* - Should be used to listen to broadcast channel messages.
|
||||
* - Involves a communication with the Bayeux server and as such cannot be called before calling
|
||||
* `handshake`.
|
||||
* - Is asynchronous: it returns immediately, well before the Bayeux server has received the
|
||||
* subscription request.
|
||||
*
|
||||
* @param channel the channel to subscribe to
|
||||
* @param callback the callback to call when a message is sent to the channel
|
||||
* @param subscribeProps an object to be merged with the subscribe message
|
||||
* @param subscribeCallback a function to be invoked when the subscription is acknowledged
|
||||
* @return the subscription handle to be passed to `unsubscribe`
|
||||
*/
|
||||
subscribe(channel: string, callback: Listener, subscribeProps: object, subscribeCallback?: Listener): Listener;
|
||||
|
||||
/**
|
||||
* Unsubscribes the subscription obtained with a call to `subscribe`.
|
||||
*
|
||||
* @param subscription the subscription to unsubscribe.
|
||||
* @param unsubscribeCallback a function to be invoked when the unsubscription is acknowledged
|
||||
*/
|
||||
unsubscribe(subscription: Listener, unsubscribeCallback?: Listener): void;
|
||||
|
||||
/**
|
||||
* Unsubscribes the subscription obtained with a call to `subscribe`.
|
||||
*
|
||||
* @param subscription the subscription to unsubscribe.
|
||||
* @param unsubscribeProps an object to be merged with the unsubscribe message
|
||||
* @param unsubscribeCallback a function to be invoked when the unsubscription is acknowledged
|
||||
*/
|
||||
unsubscribe(subscription: Listener, unsubscribeProps: object, unsubscribeCallback?: Listener): void;
|
||||
|
||||
/**
|
||||
* Resubscribes as necessary in case of a re-handshake.
|
||||
*/
|
||||
resubscribe(subscription: Listener, subscribeProps?: object): Listener;
|
||||
|
||||
/**
|
||||
* Removes all subscriptions added via `subscribe`, but does not remove the listeners added via
|
||||
* `addListener`.
|
||||
*/
|
||||
clearSubscriptions(): void;
|
||||
|
||||
handshake(handshake_params: any): void;
|
||||
/**
|
||||
* Publishes a message on the given channel, containing the given content.
|
||||
*
|
||||
* @param channel the channel to publish the message to
|
||||
* @param content the content of the message
|
||||
* @param publishCallback a function to be invoked when the publish is acknowledged by the
|
||||
* server
|
||||
*/
|
||||
publish(channel: string, content: object, publishCallback?: Listener): void;
|
||||
|
||||
publish(channel: string, message: any): void;
|
||||
/**
|
||||
* Publishes a message on the given channel, containing the given content.
|
||||
*
|
||||
* @param channel the channel to publish the message to
|
||||
* @param content the content of the message
|
||||
* @param publishProps an object to be merged with the publish message
|
||||
* @param publishCallback a function to be invoked when the publish is acknowledged by the
|
||||
* server
|
||||
*/
|
||||
publish(channel: string, content: object, publishProps: object, publishCallback?: Listener): void;
|
||||
|
||||
/**
|
||||
* Publishes a message with binary data on the given channel.
|
||||
*
|
||||
* The binary data chunk may be an `ArrayBuffer`, a `DataView`, a `TypedArray` (such as
|
||||
* `Uint8Array`) or a plain integer array.
|
||||
*
|
||||
* The meta data object may contain additional application data such as a file name, a mime
|
||||
* type, etc.
|
||||
*
|
||||
* @param channel the channel to publish the message to
|
||||
* @param data the binary data to publish
|
||||
* @param last whether the binary data chunk is the last
|
||||
* @param meta an object containing meta data associated to the binary chunk
|
||||
* @param callback a function to be invoked when the publish is acknowledged by the server
|
||||
*/
|
||||
publishBinary(
|
||||
channel: string,
|
||||
data: ArrayBuffer | DataView | Uint8Array | Uint16Array | Uint32Array,
|
||||
last: boolean,
|
||||
meta?: object,
|
||||
callback?: Listener
|
||||
): void;
|
||||
|
||||
disconnect(): void;
|
||||
/**
|
||||
* Returns a string representing the status of the Bayeux communication with the Bayeux server.
|
||||
*
|
||||
* @return the status of the Bayeux communication
|
||||
*/
|
||||
getStatus(): string;
|
||||
|
||||
}
|
||||
/**
|
||||
* Returns whether this instance has been disconnected.
|
||||
*
|
||||
* @return whether this instance has been disconnected.
|
||||
*/
|
||||
isDisconnected(): boolean;
|
||||
|
||||
/**
|
||||
* Sets the backoff period used to increase the backoff time when retrying an unsuccessful or
|
||||
* failed message.
|
||||
*
|
||||
* Default value is 1 second, which means if there is a persistent failure the retries will
|
||||
* happen after 1 second, then after 2 seconds, then after 3 seconds, etc. So for example with
|
||||
* 15 seconds of elapsed time, there will be 5 retries (at 1, 3, 6, 10 and 15 seconds elapsed).
|
||||
*
|
||||
* @param period the backoff period to set
|
||||
*/
|
||||
setBackoffIncrement(period: number): void;
|
||||
|
||||
/**
|
||||
* Returns the backoff period used to increase the backoff time when retrying an unsuccessful or
|
||||
* failed message.
|
||||
*
|
||||
* @returns the backoff increment
|
||||
*/
|
||||
getBackoffIncrement(): void;
|
||||
|
||||
interface JQueryStatic {
|
||||
cometd: CometD;
|
||||
/**
|
||||
* Returns the backoff period to wait before retrying an unsuccessful or failed message.
|
||||
*
|
||||
* @returns the backoff period
|
||||
*/
|
||||
getBackoffPeriod(): void;
|
||||
|
||||
/**
|
||||
* Increases the backoff period up to the maximum value configured.
|
||||
*
|
||||
* @returns the backoff period after increment
|
||||
*/
|
||||
increaseBackoffPeriod(): number;
|
||||
|
||||
/**
|
||||
* Resets the backoff period to zero.
|
||||
*/
|
||||
resetBackoffPeriod(): void;
|
||||
|
||||
/**
|
||||
* Sets the log level for console logging.
|
||||
*
|
||||
* @param level the log level string
|
||||
*/
|
||||
setLogLevel(level: "error" | "warn" | "info" | "debug"): void;
|
||||
|
||||
/**
|
||||
* Registers an extension whose callbacks are called for every incoming message (that comes from
|
||||
* the server to this client implementation) and for every outgoing message (that originates
|
||||
* from this client implementation for the server).
|
||||
*
|
||||
* The format of the extension object is the following:
|
||||
*
|
||||
* {
|
||||
* incoming: (message) => { ... },
|
||||
* outgoing: (message) => { ... }
|
||||
* }
|
||||
*
|
||||
* Both properties are optional, but if they are present they will be called respectively for
|
||||
* each incoming message and for each outgoing message.
|
||||
*
|
||||
* @param name the name of the extension
|
||||
* @param extension the extension to register
|
||||
* @return true if the extension was registered, false otherwise
|
||||
*/
|
||||
registerExtension(name: string, extension: Extension): boolean;
|
||||
|
||||
/**
|
||||
* Unregister an extension previously registered with `registerExtension`.
|
||||
*
|
||||
* @param name the name of the extension to unregister.
|
||||
* @return true if the extension was unregistered, false otherwise
|
||||
*/
|
||||
unregisterExtension(name: string): boolean;
|
||||
|
||||
/**
|
||||
* Find the extension registered with the given name.
|
||||
*
|
||||
* @param name the name of the extension to find
|
||||
* @return the extension found or null if no extension with the given name has been registered
|
||||
*/
|
||||
getExtension(name: string): Extension;
|
||||
|
||||
/**
|
||||
* Returns the name assigned to this CometD object, or the string 'default' if no name has been
|
||||
* explicitly passed as parameter to the constructor.
|
||||
*
|
||||
* @return the name assigned to this CometD object, or `'default'`
|
||||
*/
|
||||
getName(): string;
|
||||
|
||||
/**
|
||||
* Returns the client ID assigned by the Bayeux server during handshake.
|
||||
*
|
||||
* @return the client ID assigned by the Bayeux server
|
||||
*/
|
||||
getClientId(): string;
|
||||
|
||||
/**
|
||||
* Returns the URL of the Bayeux server.
|
||||
*
|
||||
* @return the URL of the Bayeux server
|
||||
*/
|
||||
getURL(): string;
|
||||
|
||||
/**
|
||||
* Returns the configuration for this CometD object.
|
||||
*
|
||||
* @return the configuration for this CometD object
|
||||
*/
|
||||
getConfiguration(): Configuration;
|
||||
|
||||
/**
|
||||
* Handler invoked every time a listener or subscriber throws an exception.
|
||||
*
|
||||
* @param exception the exception thrown
|
||||
* @param subscriptionHandle the listener or subscription that threw the exception
|
||||
* @param isListener whether it was a listener
|
||||
* @param message the message received from the Bayeux server
|
||||
*/
|
||||
onListenerException: (exception: any, subscriptionHandle: Listener, isListener: boolean, message: string) => void;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
@@ -17,6 +17,7 @@
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
"index.d.ts",
|
||||
"cometd-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +1,3 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
|
||||
@@ -1,42 +1,44 @@
|
||||
import Complex from 'complex';
|
||||
|
||||
var z: Complex = new Complex(2, 3);
|
||||
var z: Complex = Complex.from(2, 3);
|
||||
var z: Complex = Complex.from(2, 4);
|
||||
var z: Complex = Complex.from(5);
|
||||
var z: Complex = Complex.from('2+5i');
|
||||
var z: Complex = Complex.fromPolar(3, Math.PI);
|
||||
var z: Complex = Complex.i;
|
||||
var z: Complex = Complex.one;
|
||||
var z: Complex = z.fromRect(2, 3);
|
||||
var z: Complex = z.fromPolar(3, Math.PI);
|
||||
var z: Complex = z.toPrecision(3);
|
||||
var z: Complex = z.toFixed(3);
|
||||
var z: Complex = z.finalize();
|
||||
var x: number = z.magnitude();
|
||||
var x: number = z.abs();
|
||||
var x: number = z.angle();
|
||||
var x: number = z.arg();
|
||||
var x: number = z.phase();
|
||||
var z: Complex = z.conjugate();
|
||||
var z: Complex = z.negate();
|
||||
var z: Complex = z.multiply(z);
|
||||
var z: Complex = z.mult(3);
|
||||
var z: Complex = z.divide(z);
|
||||
var z: Complex = z.div(3);
|
||||
var z: Complex = z.add(z);
|
||||
var z: Complex = z.subtract(z);
|
||||
var z: Complex = z.sub(3);
|
||||
var z: Complex = z.pow(z);
|
||||
var z: Complex = z.sqrt();
|
||||
var z: Complex = z.log(2);
|
||||
var z: Complex = z.exp();
|
||||
var z: Complex = z.sin();
|
||||
var z: Complex = z.cos();
|
||||
var z: Complex = z.tan();
|
||||
var z: Complex = z.sinh();
|
||||
var z: Complex = z.cosh();
|
||||
var z: Complex = z.tanh();
|
||||
var z: Complex = z.clone();
|
||||
var s: string = z.toString();
|
||||
var b: boolean = z.equals(z);
|
||||
let z: Complex = new Complex(2, 3);
|
||||
z = Complex.from(2, 3);
|
||||
z = Complex.from(2, 4);
|
||||
z = Complex.from(5);
|
||||
z = Complex.from('2+5i');
|
||||
z = Complex.fromPolar(3, Math.PI);
|
||||
z = Complex.i;
|
||||
z = Complex.one;
|
||||
z = z.fromRect(2, 3);
|
||||
z = z.fromPolar(3, Math.PI);
|
||||
z = z.toPrecision(3);
|
||||
z = z.toFixed(3);
|
||||
z = z.finalize();
|
||||
let x: number = z.magnitude();
|
||||
x = z.abs();
|
||||
x = z.angle();
|
||||
x = z.arg();
|
||||
x = z.phase();
|
||||
z = z.conjugate();
|
||||
z = z.negate();
|
||||
z = z.multiply(z);
|
||||
z = z.mult(3);
|
||||
z = z.divide(z);
|
||||
z = z.div(3);
|
||||
z = z.add(z);
|
||||
z = z.subtract(z);
|
||||
z = z.sub(3);
|
||||
z = z.pow(z);
|
||||
z = z.sqrt();
|
||||
z = z.log(2);
|
||||
z = z.exp();
|
||||
z = z.sin();
|
||||
z = z.cos();
|
||||
z = z.tan();
|
||||
z = z.sinh();
|
||||
z = z.cosh();
|
||||
z = z.tanh();
|
||||
z = z.clone();
|
||||
const s: string = z.toString();
|
||||
const b: boolean = z.equals(z);
|
||||
const n: number = z.real;
|
||||
const i: number = z.im;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user