diff --git a/.gitignore b/.gitignore index c2773bb5ad..f7927724d5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ *.cs *.sln *.csproj -*.txt *.map *.swp .DS_Store diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 68f322eddc..4d9a7aab6f 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -14,6 +14,7 @@ If adding a new definition: - [ ] The package does not provide its own types, and you can not add them. - [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package. - [ ] Create it with `npm run new-package package-name`, not by basing it on an existing project. +- [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, and `strictNullChecks` set to `true`. If changing an existing definition: - [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <> diff --git a/README.md b/README.md index a724009cf3..0b1a79ae7c 100644 --- a/README.md +++ b/README.md @@ -121,17 +121,11 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D #### Common mistakes * First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html). -* Formatting: Either use all tabs, or always use 4 spaces. Also, always use semicolons, and use egyptian braces. -* `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object. -* `interface IFoo {}`: Don't add `I` to the front of an interface name. +* Formatting: Either use all tabs, or always use 4 spaces. * `interface Foo { new(): Foo; }`: This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }`. * `const Class: { new(): IClass; }`: Prefer to use a class declaration `class Class { constructor(); }` instead of a new-able constant. -* `namespace foo {}`: - Do not add a namespace just so that the `import * as foo` syntax will work. - If it is commonJs module with a single export, you should use the `import foo = require("foo")` syntax. - See more explanation [here](https://stackoverflow.com/questions/39415661/why-cant-i-import-a-class-or-function-with-import-as-x-from-y). * `getMeAT(): T`: If a type parameter does not appear in the types of any parameters, you don't really have a generic function, you just have a disguised type assertion. Prefer to use a real type assertion, e.g. `getMeAT() as number`. diff --git a/accounting/accounting-tests.ts b/accounting/accounting-tests.ts index eff00e33b9..0c11683c65 100644 --- a/accounting/accounting-tests.ts +++ b/accounting/accounting-tests.ts @@ -1,4 +1,4 @@ -// formatMoney +// formatMoney // Default usage: accounting.formatMoney(12345678); // $12,345,678.00 diff --git a/ace/all-tests.ts b/ace/all-tests.ts deleted file mode 100644 index 7a7ef50a75..0000000000 --- a/ace/all-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ - - -var exports: any; -var assert: any; -var MockRenderer: any = null; -var JavaScriptMode: any = null; - -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// - - - diff --git a/ace/tests/ace-anchor-tests.ts b/ace/tests/ace-anchor-tests.ts index 2cec45ce1d..c92e45bb0a 100644 --- a/ace/tests/ace-anchor-tests.ts +++ b/ace/tests/ace-anchor-tests.ts @@ -1,132 +1,129 @@ - - -var assert: any; -var exports = { +const aceAnchorTests = { "test create anchor" : function() { var doc = new AceAjax.Document("juhu"); var anchor = new AceAjax.Anchor(doc, 0, 0); - + assert.position(anchor.getPosition(), 0, 0); assert.equal(anchor.getDocument(), doc); }, - + "test insert text in same row before cursor should move anchor column": function() { var doc = new AceAjax.Document("juhu\nkinners"); var anchor = new AceAjax.Anchor(doc, 1, 4); - + doc.insert({row: 1, column: 1}, "123"); assert.position(anchor.getPosition(), 1, 7); }, - + "test insert lines before cursor should move anchor row": function() { var doc = new AceAjax.Document("juhu\nkinners"); var anchor = new AceAjax.Anchor(doc, 1, 4); - + doc.insertLines(1, ["123", "456"]); - assert.position(anchor.getPosition(), 3, 4); + assert.position(anchor.getPosition(), 3, 4); }, - + "test insert new line before cursor should move anchor column": function() { var doc = new AceAjax.Document("juhu\nkinners"); var anchor = new AceAjax.Anchor(doc, 1, 4); - + doc.insertNewLine({row: 0, column: 0}); - assert.position(anchor.getPosition(), 2, 4); + assert.position(anchor.getPosition(), 2, 4); }, - + "test insert new line in anchor line before anchor should move anchor column and row": function() { var doc = new AceAjax.Document("juhu\nkinners"); var anchor = new AceAjax.Anchor(doc, 1, 4); - + doc.insertNewLine({row: 1, column: 2}); assert.position(anchor.getPosition(), 2, 2); }, - + "test delete text in anchor line before anchor should move anchor column": function() { var doc = new AceAjax.Document("juhu\nkinners"); var anchor = new AceAjax.Anchor(doc, 1, 4); - + doc.remove(new AceAjax.Range(1, 1, 1, 3)); assert.position(anchor.getPosition(), 1, 2); }, - + "test remove range which contains the anchor should move the anchor to the start of the range": function() { var doc = new AceAjax.Document("juhu\nkinners"); var anchor = new AceAjax.Anchor(doc, 0, 3); - + doc.remove(new AceAjax.Range(0, 1, 1, 3)); assert.position(anchor.getPosition(), 0, 1); }, - + "test delete character before the anchor should have no effect": function() { var doc = new AceAjax.Document("juhu\nkinners"); var anchor = new AceAjax.Anchor(doc, 1, 4); - + doc.remove(new AceAjax.Range(1, 4, 1, 5)); assert.position(anchor.getPosition(), 1, 4); }, - + "test delete lines in anchor line before anchor should move anchor row": function() { var doc = new AceAjax.Document("juhu\n1\n2\nkinners"); var anchor = new AceAjax.Anchor(doc, 3, 4); - + doc.removeLines(1, 2); assert.position(anchor.getPosition(), 1, 4); }, - + "test remove new line before the cursor": function() { var doc = new AceAjax.Document("juhu\nkinners"); var anchor = new AceAjax.Anchor(doc, 1, 4); - + doc.removeNewLine(0); assert.position(anchor.getPosition(), 0, 8); }, - + "test delete range which contains the anchor should move anchor to the end of the range": function() { var doc = new AceAjax.Document("juhu\nkinners"); var anchor = new AceAjax.Anchor(doc, 1, 4); - + doc.remove(new AceAjax.Range(0, 2, 1, 2)); assert.position(anchor.getPosition(), 0, 4); }, - + "test delete line which contains the anchor should move anchor to the end of the range": function() { var doc = new AceAjax.Document("juhu\nkinners\n123"); var anchor = new AceAjax.Anchor(doc, 1, 5); - + doc.removeLines(1, 1); assert.position(anchor.getPosition(), 1, 0); }, - + "test remove after the anchor should have no effect": function() { var doc = new AceAjax.Document("juhu\nkinners\n123"); var anchor = new AceAjax.Anchor(doc, 1, 2); - + doc.remove(new AceAjax.Range(1, 4, 2, 2)); assert.position(anchor.getPosition(), 1, 2); }, - + "test anchor changes triggered by document changes should emit change event": function(next) { var doc = new AceAjax.Document("juhu\nkinners\n123"); var anchor = new AceAjax.Anchor(doc, 1, 5); - + anchor.on("change", function(e) { assert.position(anchor.getPosition(), 0, 0); next(); }); - + doc.remove(new AceAjax.Range(0, 0, 2, 1)); }, - + "test only fire change event if position changes": function() { var doc = new AceAjax.Document("juhu\nkinners\n123"); var anchor = new AceAjax.Anchor(doc, 1, 5); - + anchor.on("change", function(e) { assert.fail(); }); - + doc.remove(new AceAjax.Range(2, 0, 2, 1)); } }; diff --git a/ace/tests/ace-background_tokenizer-tests.ts b/ace/tests/ace-background_tokenizer-tests.ts index b77a9e0072..b053ba21b2 100644 --- a/ace/tests/ace-background_tokenizer-tests.ts +++ b/ace/tests/ace-background_tokenizer-tests.ts @@ -1,7 +1,3 @@ - - -var assert: any; - function forceTokenize(session) { for (var i = 0, l = session.getLength(); i < l; i++) session.getTokens(i) @@ -13,7 +9,7 @@ function testStates(session, states) { assert.ok(l == states.length) } -var exports = { +const aceBackgroundTokenizerTests = { "test background tokenizer update on session change": function() { var doc = new AceAjax.EditSession([ diff --git a/ace/tests/ace-default-tests.ts b/ace/tests/ace-default-tests.ts index 5ea89425ad..a9c74326b2 100644 --- a/ace/tests/ace-default-tests.ts +++ b/ace/tests/ace-default-tests.ts @@ -1,6 +1,3 @@ - - -var assert: any; var editor = ace.edit("editor"); editor.setTheme("ace/theme/monokai"); editor.getSession().setMode("ace/mode/javascript"); diff --git a/ace/tests/ace-document-tests.ts b/ace/tests/ace-document-tests.ts index 8760717d61..2f9c2e4b30 100644 --- a/ace/tests/ace-document-tests.ts +++ b/ace/tests/ace-document-tests.ts @@ -1,7 +1,4 @@ - - -var assert: any; -var exports = { +const aceDocumentTests = { "test: insert text in line": function() { var doc = new AceAjax.Document(["12", "34"]); diff --git a/ace/tests/ace-edit_session-tests.ts b/ace/tests/ace-edit_session-tests.ts index c057cb1297..4713495f7a 100644 --- a/ace/tests/ace-edit_session-tests.ts +++ b/ace/tests/ace-edit_session-tests.ts @@ -1,7 +1,6 @@ var lang: any; -var assert: any; function createFoldTestSession() { var lines = [ @@ -27,7 +26,7 @@ function assertArray(a, b) { } } -var exports = { +const aceEditSessionTests = { "test: find matching opening bracket in Text mode": function() { var session = new AceAjax.EditSession(["(()(", "())))"]); diff --git a/ace/tests/ace-editor1-tests.ts b/ace/tests/ace-editor1-tests.ts index c14d344dae..c2dd625aba 100644 --- a/ace/tests/ace-editor1-tests.ts +++ b/ace/tests/ace-editor1-tests.ts @@ -1,7 +1,4 @@ - - -var assert: any; -var exports = { +const aceEditor1Tests = { setUp: function(next) { this.session1 = new AceAjax.EditSession(["abc", "def"]); diff --git a/ace/tests/ace-editor_highlight_selected_word-tests.ts b/ace/tests/ace-editor_highlight_selected_word-tests.ts index da17d37c81..5c5ad7ec27 100644 --- a/ace/tests/ace-editor_highlight_selected_word-tests.ts +++ b/ace/tests/ace-editor_highlight_selected_word-tests.ts @@ -30,7 +30,7 @@ function callHighlighterUpdate(session: AceAjax.IEditSession, firstRow: number, var assert: any; var renderer: AceAjax.VirtualRenderer; -var exports = { +const aceEditorHighlighSelectedWorkTests = { setUp: function(next) { var session = new AceAjax.EditSession(lipsum); var editor = new AceAjax.Editor(renderer, session); diff --git a/ace/tests/ace-editor_navigation-tests.ts b/ace/tests/ace-editor_navigation-tests.ts index 407b1af5de..3813eda98b 100644 --- a/ace/tests/ace-editor_navigation-tests.ts +++ b/ace/tests/ace-editor_navigation-tests.ts @@ -1,8 +1,5 @@ - - -var assert: any; var renderer: AceAjax.VirtualRenderer; -var exports = { +const aceEditorNavigationTests = { createEditSession: function (rows, cols) { var line = new Array(cols + 1).join("a"); var text = new Array(rows).join(line + "\n") + line; diff --git a/ace/tests/ace-editor_text_edit-tests.ts b/ace/tests/ace-editor_text_edit-tests.ts index b170fd051c..6eb1ea0cf4 100644 --- a/ace/tests/ace-editor_text_edit-tests.ts +++ b/ace/tests/ace-editor_text_edit-tests.ts @@ -1,9 +1,6 @@ - - -var assert: any; var renderer: AceAjax.VirtualRenderer; var mode: any; -var exports = { +const aceEditorTextEditTests = { "test: delete line from the middle": function () { var session = new AceAjax.EditSession(["a", "b", "c", "d"].join("\n")); var editor = new AceAjax.Editor(renderer, session); diff --git a/ace/tests/ace-multi_select-tests.ts b/ace/tests/ace-multi_select-tests.ts index cc571cfee3..b43012360f 100644 --- a/ace/tests/ace-multi_select-tests.ts +++ b/ace/tests/ace-multi_select-tests.ts @@ -1,8 +1,3 @@ - - -var assert: any; -var editor: any; -var renderer: any; var exec = function (name?, times?, args?) { do { editor.commands.exec(name, editor, args); @@ -12,7 +7,7 @@ var testRanges = function (str) { assert.equal(editor.selection.getAllRanges() + "", str + ""); } -var exports = { +const aceMultiSelectTests = { name: "ACE multi_select.js", diff --git a/ace/tests/ace-placeholder-tests.ts b/ace/tests/ace-placeholder-tests.ts index ba0b27ca88..b5a7ac15c6 100644 --- a/ace/tests/ace-placeholder-tests.ts +++ b/ace/tests/ace-placeholder-tests.ts @@ -1,9 +1,6 @@ - - -var assert: any; var renderer: AceAjax.VirtualRenderer; var mode: any; -var exports = { +const acePlaceholderTests = { "test: simple at the end appending of text": function () { var session = new AceAjax.EditSession("var a = 10;\nconsole.log(a, a);", mode); diff --git a/ace/tests/ace-range-tests.ts b/ace/tests/ace-range-tests.ts index a32c74fbde..bf71dfc3b7 100644 --- a/ace/tests/ace-range-tests.ts +++ b/ace/tests/ace-range-tests.ts @@ -1,7 +1,4 @@ - - -var assert: any; -var exports = { +const aceRangeTests = { name: "ACE range.js", diff --git a/ace/tests/ace-range_list-tests.ts b/ace/tests/ace-range_list-tests.ts index f1f06214f9..900a360dc5 100644 --- a/ace/tests/ace-range_list-tests.ts +++ b/ace/tests/ace-range_list-tests.ts @@ -1,6 +1,3 @@ - - -var assert: any; function flatten(rangeList) { var points = []; rangeList.ranges.forEach(function (r) { @@ -12,7 +9,7 @@ function testRangeList(rangeList, points) { assert.equal("" + flatten(rangeList), "" + points); } -var exports = { +const aceRangeListTests = { name: "ACE range_list.js", diff --git a/ace/tests/ace-search-tests.ts b/ace/tests/ace-search-tests.ts index 4857d5bfdc..c3a1a7c598 100644 --- a/ace/tests/ace-search-tests.ts +++ b/ace/tests/ace-search-tests.ts @@ -1,7 +1,4 @@ - - -var assert: any; -var exports = { +const aceSearchTests = { "test: configure the search object": function () { var search = new AceAjax.Search(); search.set({ diff --git a/ace/tests/ace-selection-tests.ts b/ace/tests/ace-selection-tests.ts index ab151b88bc..be7da64331 100644 --- a/ace/tests/ace-selection-tests.ts +++ b/ace/tests/ace-selection-tests.ts @@ -1,7 +1,4 @@ - - -var assert: any; -var exports = { +const aceSelectionTests = { createSession: function (rows, cols) { var line = new Array(cols + 1).join("a"); var text = new Array(rows).join(line + "\n") + line; @@ -126,7 +123,7 @@ var exports = { }, "test: moveCursor word left with umlauts": function () { - var session = new AceAjax.EditSession(" Fuß Füße"); + var session = new AceAjax.EditSession(" Fu� F��e"); var selection = session.getSelection(); selection.moveCursorTo(0, 9) diff --git a/ace/tests/ace-token_iterator-tests.ts b/ace/tests/ace-token_iterator-tests.ts index 27856a7434..dbec07052d 100644 --- a/ace/tests/ace-token_iterator-tests.ts +++ b/ace/tests/ace-token_iterator-tests.ts @@ -1,8 +1,4 @@ - - -var assert: any; -var mode: any; -var exports = { +const aceTokenIteratorTests = { "test: token iterator initialization in JavaScript document": function () { var lines = [ "function foo(items) {", diff --git a/ace/tests/ace-virtual_renderer-tests.ts b/ace/tests/ace-virtual_renderer-tests.ts index 71b1d86bf1..74bcec2fa8 100644 --- a/ace/tests/ace-virtual_renderer-tests.ts +++ b/ace/tests/ace-virtual_renderer-tests.ts @@ -1,7 +1,4 @@ - - -var assert: any; -var exports = { +const aceVirtualRendererTests = { "test: screen2text the column should be rounded to the next character edge": function () { var el = document.createElement("div"); diff --git a/ace/tsconfig.json b/ace/tsconfig.json index bde471bd60..e5a0d270c3 100644 --- a/ace/tsconfig.json +++ b/ace/tsconfig.json @@ -1,13 +1,9 @@ { - "files": [ - "index.d.ts", - "all-tests.ts" - ], "compilerOptions": { "module": "commonjs", "target": "es6", - "noImplicitAny": true, - "noImplicitThis": true, + "noImplicitAny": false, + "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ @@ -16,5 +12,25 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true - } + }, + "files": [ + "index.d.ts", + "tests/ace-anchor-tests.ts", + "tests/ace-background_tokenizer-tests.ts", + "tests/ace-default-tests.ts", + "tests/ace-document-tests.ts", + "tests/ace-edit_session-tests.ts", + "tests/ace-editor1-tests.ts", + "tests/ace-editor_highlight_selected_word-tests.ts", + "tests/ace-editor_navigation-tests.ts", + "tests/ace-editor_text_edit-tests.ts", + "tests/ace-multi_select-tests.ts", + "tests/ace-placeholder-tests.ts", + "tests/ace-range-tests.ts", + "tests/ace-range_list-tests.ts", + "tests/ace-search-tests.ts", + "tests/ace-selection-tests.ts", + "tests/ace-token_iterator-tests.ts", + "tests/ace-virtual_renderer-tests.ts" + ] } \ No newline at end of file diff --git a/acl/tsconfig.json b/acl/tsconfig.json index 96724a58aa..d4ffafa7de 100644 --- a/acl/tsconfig.json +++ b/acl/tsconfig.json @@ -15,6 +15,8 @@ }, "files": [ "index.d.ts", - "acl-tests.ts" + "acl-tests.ts", + "acl-mongodbBackend-tests.ts", + "acl-redisBackend-tests.ts" ] } \ No newline at end of file diff --git a/adal/tsconfig.json b/adal/tsconfig.json index 6afc0c793f..e8a928a6ac 100644 --- a/adal/tsconfig.json +++ b/adal/tsconfig.json @@ -15,6 +15,8 @@ }, "files": [ "index.d.ts", - "adal-tests.ts" + "adal-tests.ts", + "adal-angular.d.ts", + "adal-angular-tests.ts" ] } \ No newline at end of file diff --git a/ag-grid/ag-grid.d-2.1.2.ts b/ag-grid/ag-grid.d-2.1.2.ts deleted file mode 100644 index 615dc066cb..0000000000 --- a/ag-grid/ag-grid.d-2.1.2.ts +++ /dev/null @@ -1,1992 +0,0 @@ -// Type definitions for ag-grid v2.1.2 -// Project: http://www.ag-grid.com/ -// Definitions by: Niall Crosby -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace ag.grid { - class ColumnChangeEvent { - private type; - private column; - private columnGroup; - private fromIndex; - private toIndex; - private pinnedColumnCount; - constructor(type: string); - toString(): string; - withColumn(column: Column): ColumnChangeEvent; - withColumnGroup(columnGroup: ColumnGroup): ColumnChangeEvent; - withFromIndex(fromIndex: number): ColumnChangeEvent; - withPinnedColumnCount(pinnedColumnCount: number): ColumnChangeEvent; - withToIndex(toIndex: number): ColumnChangeEvent; - getFromIndex(): number; - getToIndex(): number; - getPinnedColumnCount(): number; - getType(): string; - getColumn(): Column; - getColumnGroup(): ColumnGroup; - isPivotChanged(): boolean; - isValueChanged(): boolean; - isIndividualColumnResized(): boolean; - } -} -declare namespace ag.grid { - class Utils { - private static isSafari; - private static isIE; - static iterateObject(object: any, callback: (key: string, value: any) => void): void; - static cloneObject(object: any): any; - static map(array: TItem[], callback: (item: TItem) => TResult): TResult[]; - static forEach(array: T[], callback: (item: T, index: number) => void): void; - static filter(array: T[], callback: (item: T) => boolean): T[]; - static assign(object: any, source: any): void; - static getFunctionParameters(func: any): any; - static find(collection: any, predicate: any, value: any): any; - static toStrings(array: T[]): string[]; - static iterateArray(array: T[], callback: (item: T, index: number) => void): void; - static isNode(o: any): boolean; - static isElement(o: any): boolean; - static isNodeOrElement(o: any): boolean; - static addChangeListener(element: HTMLElement, listener: EventListener): void; - static makeNull(value: any): any; - static removeAllChildren(node: HTMLElement): void; - static removeElement(parent: HTMLElement, cssSelector: string): void; - static removeFromParent(node: Element): void; - static isVisible(element: HTMLElement): boolean; - /** - * loads the template and returns it as an element. makes up for no simple way in - * the dom api to load html directly, eg we cannot do this: document.createElement(template) - */ - static loadTemplate(template: string): Node; - static querySelectorAll_addCssClass(eParent: any, selector: string, cssClass: string): void; - static querySelectorAll_removeCssClass(eParent: any, selector: string, cssClass: string): void; - static querySelectorAll_replaceCssClass(eParent: any, selector: string, cssClassToRemove: string, cssClassToAdd: string): void; - static addOrRemoveCssClass(element: HTMLElement, className: string, addOrRemove: boolean): void; - static addCssClass(element: HTMLElement, className: string): void; - static offsetHeight(element: HTMLElement): number; - static offsetWidth(element: HTMLElement): number; - static removeCssClass(element: HTMLElement, className: string): void; - static removeFromArray(array: T[], object: T): void; - static defaultComparator(valueA: any, valueB: any): number; - static formatWidth(width: number | string): string; - /** - * Tries to use the provided renderer. - */ - static useRenderer(eParent: Element, eRenderer: (params: TParams) => Node | string, params: TParams): void; - /** - * If icon provided, use this (either a string, or a function callback). - * if not, then use the second parameter, which is the svgFactory function - */ - static createIcon(iconName: any, gridOptionsWrapper: any, colDefWrapper: any, svgFactoryFunc: () => Node): HTMLSpanElement; - static addStylesToElement(eElement: any, styles: any): void; - static getScrollbarWidth(): number; - static isKeyPressed(event: KeyboardEvent, keyToCheck: number): boolean; - static setVisible(element: HTMLElement, visible: boolean): void; - static isBrowserIE(): boolean; - static isBrowserSafari(): boolean; - } -} -declare namespace ag.grid { - class Constants { - static STEP_EVERYTHING: number; - static STEP_FILTER: number; - static STEP_SORT: number; - static STEP_MAP: number; - static ASC: string; - static DESC: string; - static ROW_BUFFER_SIZE: number; - static MIN_COL_WIDTH: number; - static SUM: string; - static MIN: string; - static MAX: string; - static KEY_TAB: number; - static KEY_ENTER: number; - static KEY_BACKSPACE: number; - static KEY_DELETE: number; - static KEY_ESCAPE: number; - static KEY_SPACE: number; - static KEY_DOWN: number; - static KEY_UP: number; - static KEY_LEFT: number; - static KEY_RIGHT: number; - } -} -declare namespace ag.grid { - class Column { - static colIdSequence: number; - colDef: ColDef; - actualWidth: any; - visible: any; - colId: any; - pinned: boolean; - index: number; - aggFunc: string; - pivotIndex: number; - sort: string; - sortedAt: number; - constructor(colDef: ColDef, actualWidth: any); - isGreaterThanMax(width: number): boolean; - getMinimumWidth(): number; - setMinimum(): void; - } -} -declare namespace ag.grid { - class ColumnGroup { - pinned: any; - name: any; - allColumns: Column[]; - displayedColumns: Column[]; - expandable: boolean; - expanded: boolean; - actualWidth: number; - constructor(pinned: any, name: any); - getMinimumWidth(): number; - addColumn(column: any): void; - calculateExpandable(): void; - calculateActualWidth(): void; - calculateDisplayedColumns(): void; - addToVisibleColumns(colsToAdd: any): void; - } -} -declare namespace ag.grid { - class GridOptionsWrapper { - private gridOptions; - private groupHeaders; - private headerHeight; - private rowHeight; - private floatingTopRowData; - private floatingBottomRowData; - init(gridOptions: GridOptions, eventService: EventService): void; - isRowSelection(): boolean; - isRowDeselection(): boolean; - isRowSelectionMulti(): boolean; - getContext(): any; - isVirtualPaging(): boolean; - isShowToolPanel(): boolean; - isToolPanelSuppressPivot(): boolean; - isToolPanelSuppressValues(): boolean; - isRowsAlreadyGrouped(): boolean; - isGroupSelectsChildren(): boolean; - isGroupHidePivotColumns(): boolean; - isGroupIncludeFooter(): boolean; - isGroupSuppressBlankHeader(): boolean; - isSuppressRowClickSelection(): boolean; - isSuppressCellSelection(): boolean; - isSuppressMultiSort(): boolean; - isGroupSuppressAutoColumn(): boolean; - isForPrint(): boolean; - isSuppressHorizontalScroll(): boolean; - isUnSortIcon(): boolean; - isSuppressMenuHide(): boolean; - getRowStyle(): any; - getRowClass(): any; - getRowStyleFunc(): any; - getRowClassFunc(): any; - getHeaderCellRenderer(): any; - getApi(): GridApi; - isEnableColResize(): boolean; - isSingleClickEdit(): boolean; - getGroupDefaultExpanded(): any; - getGroupKeys(): string[]; - getGroupAggFunction(): (nodes: any[]) => any; - getGroupAggFields(): string[]; - getRowData(): any[]; - isGroupUseEntireRow(): boolean; - getGroupColumnDef(): any; - isGroupSuppressRow(): boolean; - isAngularCompileRows(): boolean; - isAngularCompileFilters(): boolean; - isAngularCompileHeaders(): boolean; - isDebug(): boolean; - getColumnDefs(): any[]; - getDatasource(): any; - getRowBuffer(): number; - isEnableSorting(): boolean; - isEnableCellExpressions(): boolean; - isEnableServerSideSorting(): boolean; - isEnableFilter(): boolean; - isEnableServerSideFilter(): boolean; - isSuppressScrollLag(): boolean; - getIcons(): any; - getIsScrollLag(): () => boolean; - getSortingOrder(): string[]; - getSlaveGrids(): GridOptions[]; - getGroupRowRenderer(): Object | Function; - getRowHeight(): number; - getHeaderHeight(): number; - setHeaderHeight(headerHeight: number): void; - isGroupHeaders(): boolean; - setGroupHeaders(groupHeaders: boolean): void; - getFloatingTopRowData(): any[]; - setFloatingTopRowData(rows: any[]): void; - getFloatingBottomRowData(): any[]; - setFloatingBottomRowData(rows: any[]): void; - isExternalFilterPresent(): boolean; - doesExternalFilterPass(node: RowNode): boolean; - getGroupRowInnerRenderer(): (params: any) => void; - getColWidth(): number; - private checkForDeprecated(); - getPinnedColCount(): number; - getLocaleTextFunc(): Function; - globalEventHandler(eventName: string, event?: any): void; - private getCallbackForEvent(eventName); - } -} -declare namespace ag.grid { - class LoggerFactory { - private logging; - init(gridOptionsWrapper: GridOptionsWrapper): void; - create(name: string): Logger; - } - class Logger { - private logging; - private name; - constructor(name: string, logging: boolean); - log(message: string): void; - } -} -declare namespace ag.grid { - class Events { - /** A new set of columns has been entered, everything has potentially changed. */ - static EVENT_COLUMN_EVERYTHING_CHANGED: string; - /** A pivot column was added, removed or order changed. */ - static EVENT_COLUMN_PIVOT_CHANGE: string; - /** A value column was added, removed or agg function was changed. */ - static EVENT_COLUMN_VALUE_CHANGE: string; - /** A column was moved */ - static EVENT_COLUMN_MOVED: string; - /** One or more columns was shown / hidden */ - static EVENT_COLUMN_VISIBLE: string; - /** A column group was opened / closed */ - static EVENT_COLUMN_GROUP_OPENED: string; - /** One or more columns was resized. If just one, the column in the event is set. */ - static EVENT_COLUMN_RESIZED: string; - /** One or more columns was resized. If just one, the column in the event is set. */ - static EVENT_COLUMN_PINNED_COUNT_CHANGED: string; - static EVENT_MODEL_UPDATED: string; - static EVENT_CELL_CLICKED: string; - static EVENT_CELL_DOUBLE_CLICKED: string; - static EVENT_CELL_CONTEXT_MENU: string; - static EVENT_CELL_VALUE_CHANGED: string; - static EVENT_CELL_FOCUSED: string; - static EVENT_ROW_SELECTED: string; - static EVENT_SELECTION_CHANGED: string; - static EVENT_BEFORE_FILTER_CHANGED: string; - static EVENT_AFTER_FILTER_CHANGED: string; - static EVENT_FILTER_MODIFIED: string; - static EVENT_BEFORE_SORT_CHANGED: string; - static EVENT_AFTER_SORT_CHANGED: string; - static EVENT_VIRTUAL_ROW_REMOVED: string; - static EVENT_ROW_CLICKED: string; - static EVENT_READY: string; - } -} -declare namespace ag.grid { - class EventService { - private allListeners; - private globalListeners; - private getListenerList(eventType); - addEventListener(eventType: string, listener: Function): void; - addGlobalListener(listener: Function): void; - removeEventListener(eventType: string, listener: Function): void; - removeGlobalListener(listener: Function): void; - dispatchEvent(eventType: string, event?: any): void; - } -} -declare namespace ag.grid { - class MasterSlaveService { - private gridOptionsWrapper; - private columnController; - private gridPanel; - private logger; - private eventService; - private consuming; - init(gridOptionsWrapper: GridOptionsWrapper, columnController: ColumnController, gridPanel: GridPanel, loggerFactory: LoggerFactory, eventService: EventService): void; - private fireEvent(callback); - private onEvent(callback); - private fireColumnEvent(event); - fireHorizontalScrollEvent(horizontalScroll: number): void; - onScrollEvent(horizontalScroll: number): void; - onColumnEvent(event: ColumnChangeEvent): void; - } -} -declare namespace ag.grid { - class ColumnApi { - private _columnController; - constructor(_columnController: ColumnController); - sizeColumnsToFit(gridWidth: any): void; - hideColumns(colIds: any, hide: any): void; - columnGroupOpened(group: ColumnGroup, newValue: boolean): void; - getColumnGroup(name: string): ColumnGroup; - getDisplayNameForCol(column: any): string; - getColumn(key: any): Column; - setState(columnState: any): void; - getState(): [any]; - isPinning(): boolean; - getVisibleColAfter(col: Column): Column; - getVisibleColBefore(col: Column): Column; - setColumnVisible(column: Column, visible: boolean): void; - getAllColumns(): Column[]; - getDisplayedColumns(): Column[]; - getPivotedColumns(): Column[]; - getValueColumns(): Column[]; - moveColumn(fromIndex: number, toIndex: number): void; - movePivotColumn(fromIndex: number, toIndex: number): void; - setColumnAggFunction(column: Column, aggFunc: string): void; - setColumnWidth(column: Column, newWidth: number): void; - removeValueColumn(column: Column): void; - addValueColumn(column: Column): void; - removePivotColumn(column: Column): void; - setPinnedColumnCount(count: number): void; - addPivotColumn(column: Column): void; - getHeaderGroups(): ColumnGroup[]; - hideColumn(colId: any, hide: any): void; - } - class ColumnController { - private gridOptionsWrapper; - private angularGrid; - private selectionRendererFactory; - private expressionService; - private masterSlaveController; - private allColumns; - private visibleColumns; - private displayedColumns; - private pivotColumns; - private valueColumns; - private columnGroups; - private setupComplete; - private valueService; - private pinnedColumnCount; - private eventService; - constructor(); - init(angularGrid: Grid, selectionRendererFactory: SelectionRendererFactory, gridOptionsWrapper: GridOptionsWrapper, expressionService: ExpressionService, valueService: ValueService, masterSlaveController: MasterSlaveService, eventService: EventService): void; - getColumnApi(): ColumnApi; - isSetupComplete(): boolean; - getHeaderGroups(): ColumnGroup[]; - getPinnedContainerWidth(): number; - addPivotColumn(column: Column): void; - setPinnedColumnCount(count: number): void; - removePivotColumn(column: Column): void; - addValueColumn(column: Column): void; - removeValueColumn(column: Column): void; - private doesColumnExistInGrid(column); - setColumnWidth(column: Column, newWidth: number): void; - private updateGroupWidthsAfterColumnResize(column); - setColumnAggFunction(column: Column, aggFunc: string): void; - movePivotColumn(fromIndex: number, toIndex: number): void; - moveColumn(fromIndex: number, toIndex: number): void; - getBodyContainerWidth(): number; - getValueColumns(): Column[]; - getPivotedColumns(): Column[]; - getDisplayedColumns(): Column[]; - getAllColumns(): Column[]; - setColumnVisible(column: Column, visible: boolean): void; - getVisibleColBefore(col: any): Column; - getVisibleColAfter(col: Column): Column; - isPinning(): boolean; - getState(): [any]; - setState(columnState: any): void; - getColumns(keys: any[]): Column[]; - getColumn(key: any): Column; - getDisplayNameForCol(column: any): string; - getColumnGroup(name: string): ColumnGroup; - onColumnsChanged(): void; - private checkForDeprecatedItems(columnDefs); - columnGroupOpened(group: ColumnGroup, newValue: boolean): void; - hideColumns(colIds: any, hide: any): void; - private updateModel(); - private updateDisplayedColumns(); - sizeColumnsToFit(gridWidth: any): void; - private buildGroups(); - private updateGroups(); - private updateVisibleColumns(); - private updatePinnedColumns(); - private createColumns(colDefs); - private createPivotColumns(); - private createValueColumns(); - private createDummyColumn(field); - private calculateColInitialWidth(colDef); - private getTotalColWidth(includePinned); - } -} -declare namespace ag.grid { - interface CsvExportParams { - skipHeader?: boolean; - skipFooters?: boolean; - skipGroups?: boolean; - fileName?: string; - } - class CsvCreator { - private rowController; - private columnController; - private grid; - private valueService; - constructor(rowController: InMemoryRowController, columnController: ColumnController, grid: Grid, valueService: ValueService); - exportDataAsCsv(params?: CsvExportParams): void; - getDataAsCsv(params?: CsvExportParams): string; - private createValueForGroupNode(node); - private escape(value); - } -} -declare namespace ag.grid { - class ExpressionService { - private expressionToFunctionCache; - private logger; - init(loggerFactory: LoggerFactory): void; - evaluate(expression: string, params: any): any; - private createExpressionFunction(expression); - private createFunctionBody(expression); - } -} -declare namespace ag.grid { - interface TextAndNumberFilterParameters { - /** What to do when new rows are loaded. The default is to reset the filter, to keep it in line with 'set' filters. If you want to keep the selection, then set this value to 'keep'. */ - newRowsAction?: string; - } -} -declare namespace ag.grid { - class TextFilter implements Filter { - private filterParams; - private filterChangedCallback; - private filterModifiedCallback; - private localeTextFunc; - private valueGetter; - private filterText; - private filterType; - private api; - private eGui; - private eFilterTextField; - private eTypeSelect; - private applyActive; - private eApplyButton; - init(params: any): void; - onNewRowsLoaded(): void; - afterGuiAttached(): void; - doesFilterPass(node: any): boolean; - getGui(): any; - isFilterActive(): boolean; - private createTemplate(); - private createGui(); - private setupApply(); - private onTypeChanged(); - private onFilterChanged(); - private filterChanged(); - private createApi(); - private getApi(); - } -} -declare namespace ag.grid { - class NumberFilter implements Filter { - private filterParams; - private filterChangedCallback; - private filterModifiedCallback; - private localeTextFunc; - private valueGetter; - private filterNumber; - private filterType; - private api; - private eGui; - private eFilterTextField; - private eTypeSelect; - private applyActive; - private eApplyButton; - init(params: any): void; - onNewRowsLoaded(): void; - afterGuiAttached(): void; - doesFilterPass(node: any): boolean; - getGui(): any; - isFilterActive(): boolean; - private createTemplate(); - private createGui(); - private setupApply(); - private onTypeChanged(); - private filterChanged(); - private onFilterChanged(); - private createApi(); - private getApi(); - } -} -declare namespace ag.grid { - interface ColDef { - /** If sorting by default, set it here. Set to 'asc' or 'desc' */ - sort?: string; - /** If sorting more than one column by default, the milliseconds when this column was sorted, so we know what order to sort the columns in. */ - sortedAt?: number; - /** The sort order, provide an array with any of the following in any order ['asc','desc',null] */ - sortingOrder?: string[]; - /** The name to render in the column header */ - headerName: string; - /** The field of the row to get the cells data from */ - field: string; - /** Expression or function to get the cells value. */ - headerValueGetter?: string | Function; - /** The unique ID to give the column. This is optional. If missing, the ID will default to the field. If both field and colId are missing, a unique ID will be generated. - * This ID is used to identify the column in the API for sorting, filtering etc. */ - colId?: string; - /** Set to true for this column to be hidden. Naturally you might think, it would make more sense to call this field 'visible' and mark it false to hide, - * however we want all default values to be false and we want columns to be visible by default. */ - hide?: boolean; - /** Tooltip for the column header */ - headerTooltip?: string; - /** Expression or function to get the cells value. */ - valueGetter?: string | Function; - /** To provide custom rendering to the header. */ - headerCellRenderer?: Function | Object; - /** CSS class for the header */ - headerClass?: string | string[] | ((params: any) => string | string[]); - /** Initial width, in pixels, of the cell */ - width?: number; - /** Min width, in pixels, of the cell */ - minWidth?: number; - /** Max width, in pixels, of the cell */ - maxWidth?: number; - /** Class to use for the cell. Can be string, array of strings, or function. */ - cellClass?: string | string[] | ((cellClassParams: any) => string | string[]); - /** An object of css values. Or a function returning an object of css values. */ - cellStyle?: {} | ((params: any) => {}); - /** A function for rendering a cell. */ - cellRenderer?: Function | {}; - /** A function for rendering a floating cell. */ - floatingCellRenderer?: Function | {}; - /** Name of function to use for aggregation. One of [sum,min,max]. */ - aggFunc?: string; - /** Comparator function for custom sorting. */ - comparator?: Function; - /** Set to true to render a selection checkbox in the column. */ - checkboxSelection?: boolean; - /** Set to true if no menu should be shown for this column header. */ - suppressMenu?: boolean; - /** Set to true if no sorting should be done for this column. */ - suppressSorting?: boolean; - /** Set to true if you want the unsorted icon to be shown when no sort is applied to this column. */ - unSortIcon?: boolean; - /** Set to true if you want this columns width to be fixed during 'size to fit' operation. */ - suppressSizeToFit?: boolean; - /** Set to true if you do not want this column to be resizable by dragging it's edge. */ - suppressResize?: boolean; - /** If grouping columns, the group this column belongs to. */ - headerGroup?: string; - /** Whether to show the column when the group is open / closed. */ - headerGroupShow?: string; - /** Set to true if this col is editable, otherwise false. Can also be a function to have different rows editable. */ - editable?: boolean | (Function); - /** Callbacks for editing.See editing section for further details. */ - newValueHandler?: Function; - /** If true, this cell gets refreshed when api.softRefreshView() gets called. */ - volatile?: boolean; - /** Cell template to use for cell. Useful for AngularJS cells. */ - template?: string; - /** Cell template URL to load template from to use for cell. Useful for AngularJS cells. */ - templateUrl?: string; - /** one of the built in filter names: [set, number, text], or a filter function*/ - filter?: string | Function; - /** The filter params are specific to each filter! */ - filterParams?: SetFilterParameters | TextAndNumberFilterParameters; - /** Rules for applying css classes */ - cellClassRules?: { - [cssClassName: string]: (Function | string); - }; - /** Callbacks for editing.See editing section for further details. */ - onCellValueChanged?: Function; - /** Function callback, gets called when a cell is clicked. */ - onCellClicked?: Function; - /** Function callback, gets called when a cell is double clicked. */ - onCellDoubleClicked?: Function; - /** Function callback, gets called when a cell is right clicked. */ - onCellContextMenu?: Function; - } -} -declare namespace ag.grid { - class SetFilterModel { - private colDef; - private filterParams; - private rowModel; - private valueGetter; - private allUniqueValues; - private availableUniqueValues; - private displayedValues; - private miniFilter; - private selectedValuesCount; - private selectedValuesMap; - private showingAvailableOnly; - private usingProvidedSet; - private doesRowPassOtherFilters; - constructor(colDef: ColDef, rowModel: any, valueGetter: any, doesRowPassOtherFilters: any); - refreshAfterNewRowsLoaded(keepSelection: any, isSelectAll: boolean): void; - refreshAfterAnyFilterChanged(): void; - private createAllUniqueValues(); - private createAvailableUniqueValues(); - private getUniqueValues(filterOutNotAvailable); - setMiniFilter(newMiniFilter: any): boolean; - getMiniFilter(): any; - private processMiniFilter(); - getDisplayedValueCount(): any; - getDisplayedValue(index: any): any; - selectEverything(): void; - isFilterActive(): boolean; - selectNothing(): void; - getUniqueValueCount(): any; - getUniqueValue(index: any): any; - unselectValue(value: any): void; - selectValue(value: any): void; - isValueSelected(value: any): boolean; - isEverythingSelected(): boolean; - isNothingSelected(): boolean; - getModel(): any; - setModel(model: any, isSelectAll: boolean): void; - } -} -/** The filter parameters for set filter */ -declare namespace ag.grid { - interface SetFilterParameters { - /** Same as cell renderer for grid (you can use the same one in both locations). Setting it separatly here allows for the value to be rendered differently in the filter. */ - cellRenderer?: Function; - /** The height of the cell. */ - cellHeight?: number; - /** The values to display in the filter. */ - values?: any; - /** What to do when new rows are loaded. The default is to reset the filter, as the set of values to select from can have changed. If you want to keep the selection, then set this value to 'keep'. */ - newRowsAction?: string; - /** If true, the filter will not remove items that are no longer availabe due to other filters. */ - suppressRemoveEntries?: boolean; - } -} -declare namespace ag.grid { - class SetFilter implements Filter { - private eGui; - private filterParams; - private rowHeight; - private model; - private filterChangedCallback; - private filterModifiedCallback; - private valueGetter; - private rowsInBodyContainer; - private colDef; - private localeTextFunc; - private cellRenderer; - private eListContainer; - private eFilterValueTemplate; - private eSelectAll; - private eListViewport; - private eMiniFilter; - private api; - private applyActive; - private eApplyButton; - init(params: any): void; - afterGuiAttached(): void; - isFilterActive(): boolean; - doesFilterPass(node: any): boolean; - getGui(): any; - onNewRowsLoaded(): void; - onAnyFilterChanged(): void; - private createTemplate(); - private createGui(); - private setupApply(); - private setContainerHeight(); - private drawVirtualRows(); - private ensureRowsRendered(start, finish); - private removeVirtualRows(rowsToRemove); - private insertRow(value, rowIndex); - private onCheckboxClicked(eCheckbox, value); - private filterChanged(); - private onMiniFilterChanged(); - private refreshVirtualRows(); - private clearVirtualRows(); - private onSelectAll(); - private updateAllCheckboxes(checked); - private addScrollListener(); - getApi(): any; - private createApi(); - } -} -declare namespace ag.grid { - class PopupService { - private ePopupParent; - init(ePopupParent: any): void; - positionPopup(eventSource: any, ePopup: any, minWidth: any): void; - addAsModalPopup(eChild: any, closeOnEsc: boolean): (event: any) => void; - } -} -declare namespace ag.grid { - interface RowNode { - /** Unique ID for the node. Can be though of as the index of the row in the original list, - * however exceptions apply so don't depend on uniqueness. */ - id?: number; - /** The user provided data */ - data?: any; - /** The parent node to this node, or empty if top level */ - parent?: RowNode; - /** How many levels this node is from the top */ - level?: number; - /** True if this node is a group node (ie has children) */ - group?: boolean; - /** True if this is the first child in this group */ - firstChild?: boolean; - /** True if this is the last child in this group */ - lastChild?: boolean; - /** The index of this node in the group */ - childIndex?: number; - /** True if this row is a floating row */ - floating?: boolean; - /** True if this row is a floating top row */ - floatingTop?: boolean; - /** True if this row is a floating bottom row */ - floatingBottom?: boolean; - /** If using quick filter, stores a string representation of the row for searching against */ - quickFilterAggregateText?: string; - /** Groups only - True if row is a footer. Footers have group = true and footer = true */ - footer?: boolean; - /** Groups only - Children of this group */ - children?: RowNode[]; - /** Groups only - The field we are pivoting on eg Country*/ - field?: string; - /** Groups only - The key for the pivot eg Ireland, UK, USA */ - key?: any; - /** Groups only - Filtered children of this group */ - childrenAfterFilter?: RowNode[]; - /** Groups only - Sorted children of this group */ - childrenAfterSort?: RowNode[]; - /** Groups only - Number of children and grand children */ - allChildrenCount?: number; - /** Groups only - True if group is expanded, otherwise false */ - expanded?: boolean; - /** Groups only - If doing footers, reference to the footer node for this group */ - sibling?: RowNode; - /** Not to be used, internal temporary map used by the grid when creating groups */ - _childrenMap?: {}; - } -} -declare namespace ag.grid { - class FilterManager { - private $compile; - private $scope; - private gridOptionsWrapper; - private grid; - private allFilters; - private rowModel; - private popupService; - private valueService; - private columnController; - private quickFilter; - private advancedFilterPresent; - private externalFilterPresent; - init(grid: Grid, gridOptionsWrapper: GridOptionsWrapper, $compile: any, $scope: any, columnController: ColumnController, popupService: PopupService, valueService: ValueService): void; - setFilterModel(model: any): void; - private setModelOnFilterWrapper(filter, newModel); - getFilterModel(): any; - setRowModel(rowModel: any): void; - isAdvancedFilterPresent(): boolean; - isAnyFilterPresent(): boolean; - isFilterPresentForCol(colId: any): any; - private doesFilterPass(node, filterToSkip?); - setQuickFilter(newFilter: any): boolean; - onFilterChanged(): void; - isQuickFilterPresent(): boolean; - doesRowPassOtherFilters(filterToSkip: any, node: any): boolean; - doesRowPassFilter(node: any, filterToSkip?: any): boolean; - private aggregateRowForQuickFilter(node); - refreshDisplayedValues(): void; - onNewRowsLoaded(): void; - private createValueGetter(column); - getFilterApi(column: Column): any; - private getOrCreateFilterWrapper(column); - private createFilterWrapper(column); - private assertMethodHasNoParameters(theMethod); - showFilter(column: Column, eventSource: any): void; - } -} -declare namespace ag.grid { - class TemplateService { - templateCache: any; - waitingCallbacks: any; - $scope: any; - init($scope: any): void; - getTemplate(url: any, callback: any): any; - handleHttpResult(httpResult: any, url: any): void; - } -} -declare namespace ag.grid { - class SelectionRendererFactory { - private angularGrid; - private selectionController; - init(angularGrid: any, selectionController: any): void; - createSelectionCheckbox(node: any, rowIndex: any): HTMLInputElement; - } -} -declare namespace ag.vdom { - class VElement { - static idSequence: number; - private id; - private elementAttachedListeners; - constructor(); - getId(): number; - addElementAttachedListener(listener: (element: Element) => void): void; - protected fireElementAttached(element: Element): void; - elementAttached(element: Element): void; - toHtmlString(): string; - } -} -declare namespace ag.vdom { - class VHtmlElement extends VElement { - private type; - private classes; - private eventListeners; - private attributes; - private children; - private innerHtml; - private style; - private bound; - private element; - constructor(type: string); - getElement(): HTMLElement; - setInnerHtml(innerHtml: string): void; - addStyles(styles: any): void; - private attachEventListeners(node); - addClass(newClass: string): void; - removeClass(oldClass: string): void; - addClasses(classes: string[]): void; - toHtmlString(): string; - private toHtmlStringChildren(); - private toHtmlStringAttributes(); - private toHtmlStringClasses(); - private toHtmlStringStyles(); - appendChild(child: any): void; - setAttribute(key: string, value: string): void; - addEventListener(event: string, listener: EventListener): void; - elementAttached(element: Element): void; - fireElementAttachedToChildren(element: Element): void; - } -} -declare namespace ag.vdom { - class VWrapperElement extends VElement { - private wrappedElement; - constructor(wrappedElement: Element); - toHtmlString(): string; - elementAttached(element: Element): void; - } -} -declare namespace ag.grid { - class RenderedCell { - private vGridCell; - private vSpanWithValue; - private vCellWrapper; - private vParentOfValue; - private checkboxOnChangeListener; - private column; - private data; - private node; - private rowIndex; - private editingCell; - private scope; - private isFirstColumn; - private gridOptionsWrapper; - private expressionService; - private selectionRendererFactory; - private rowRenderer; - private selectionController; - private $compile; - private templateService; - private cellRendererMap; - private eCheckbox; - private columnController; - private valueService; - private eventService; - private value; - private checkboxSelection; - constructor(isFirstColumn: any, column: any, $compile: any, rowRenderer: RowRenderer, gridOptionsWrapper: GridOptionsWrapper, expressionService: ExpressionService, selectionRendererFactory: SelectionRendererFactory, selectionController: SelectionController, templateService: TemplateService, cellRendererMap: { - [key: string]: any; - }, node: any, rowIndex: number, scope: any, columnController: ColumnController, valueService: ValueService, eventService: EventService); - getColumn(): Column; - private getValue(); - getVGridCell(): ag.vdom.VHtmlElement; - private getDataForRow(); - private setupComponents(); - startEditing(key?: number): void; - focusCell(forceBrowserFocus: boolean): void; - private stopEditing(eInput, blurListener, reset?); - createParams(): any; - createEvent(event: any, eventSource: any): any; - private addCellDoubleClickedHandler(); - private addCellContextMenuHandler(); - isCellEditable(): any; - private addCellClickedHandler(); - private populateCell(); - private addStylesFromCollDef(); - private addClassesFromCollDef(); - private addClassesFromRules(); - private addCellNavigationHandler(); - private isKeycodeForStartEditing(key); - createSelectionCheckbox(): void; - setSelected(state: boolean): void; - private createParentOfValue(); - isVolatile(): boolean; - refreshCell(): void; - private putDataIntoCell(); - private useCellRenderer(cellRenderer); - private addClasses(); - } -} -declare namespace ag.grid { - class RenderedRow { - vPinnedRow: any; - vBodyRow: any; - private renderedCells; - private scope; - private node; - private rowIndex; - private cellRendererMap; - private gridOptionsWrapper; - private parentScope; - private angularGrid; - private columnController; - private expressionService; - private rowRenderer; - private selectionRendererFactory; - private $compile; - private templateService; - private selectionController; - private pinning; - private eBodyContainer; - private ePinnedContainer; - private valueService; - private eventService; - constructor(gridOptionsWrapper: GridOptionsWrapper, valueService: ValueService, parentScope: any, angularGrid: Grid, columnController: ColumnController, expressionService: ExpressionService, cellRendererMap: { - [key: string]: any; - }, selectionRendererFactory: SelectionRendererFactory, $compile: any, templateService: TemplateService, selectionController: SelectionController, rowRenderer: RowRenderer, eBodyContainer: HTMLElement, ePinnedContainer: HTMLElement, node: any, rowIndex: number, eventService: EventService); - onRowSelected(selected: boolean): void; - softRefresh(): void; - getRenderedCellForColumn(column: Column): RenderedCell; - getCellForCol(column: Column): any; - destroy(): void; - private destroyScope(); - isDataInList(rows: any[]): boolean; - isNodeInList(nodes: RowNode[]): boolean; - isGroup(): boolean; - private drawNormalRow(); - private bindVirtualElement(vElement); - private createGroupRow(); - private createGroupSpanningEntireRowCell(padding); - setMainRowWidth(width: number): void; - private createChildScopeOrNull(data); - private addDynamicStyles(); - private createRowContainer(); - getRowNode(): any; - getRowIndex(): any; - refreshCells(colIds: string[]): void; - private addDynamicClasses(); - } -} -declare namespace ag.grid { - class SvgFactory { - static theInstance: SvgFactory; - static getInstance(): SvgFactory; - createFilterSvg(): Element; - createColumnShowingSvg(): Element; - createColumnHiddenSvg(): Element; - createMenuSvg(): Element; - createArrowUpSvg(): Element; - createArrowLeftSvg(): Element; - createArrowDownSvg(): Element; - createArrowRightSvg(): Element; - createSmallArrowDownSvg(): Element; - createArrowUpDownSvg(): Element; - } -} -declare namespace ag.grid { - function groupCellRendererFactory(gridOptionsWrapper: GridOptionsWrapper, selectionRendererFactory: SelectionRendererFactory, expressionService: ExpressionService): (params: any) => HTMLSpanElement; -} -declare namespace ag.grid { - class RowRenderer { - private columnModel; - private gridOptionsWrapper; - private angularGrid; - private selectionRendererFactory; - private gridPanel; - private $compile; - private $scope; - private selectionController; - private expressionService; - private templateService; - private cellRendererMap; - private rowModel; - private firstVirtualRenderedRow; - private lastVirtualRenderedRow; - private focusedCell; - private valueService; - private eventService; - private renderedRows; - private renderedTopFloatingRows; - private renderedBottomFloatingRows; - private eAllBodyContainers; - private eAllPinnedContainers; - private eBodyContainer; - private eBodyViewport; - private ePinnedColsContainer; - private eFloatingTopContainer; - private eFloatingTopPinnedContainer; - private eFloatingBottomContainer; - private eFloatingBottomPinnedContainer; - private eParentsOfRows; - init(columnModel: any, gridOptionsWrapper: GridOptionsWrapper, gridPanel: GridPanel, angularGrid: Grid, selectionRendererFactory: SelectionRendererFactory, $compile: any, $scope: any, selectionController: SelectionController, expressionService: ExpressionService, templateService: TemplateService, valueService: ValueService, eventService: EventService): void; - setRowModel(rowModel: any): void; - onIndividualColumnResized(column: Column): void; - setMainRowWidths(): void; - private findAllElements(gridPanel); - refreshAllFloatingRows(): void; - private refreshFloatingRows(renderedRows, rowData, pinnedContainer, bodyContainer, isTop); - refreshView(refreshFromIndex?: any): void; - softRefreshView(): void; - refreshRows(rowNodes: RowNode[]): void; - refreshCells(rowNodes: RowNode[], colIds: string[]): void; - rowDataChanged(rows: any): void; - private refreshAllVirtualRows(fromIndex); - refreshGroupRows(): void; - private removeVirtualRow(rowsToRemove, fromIndex?); - private unbindVirtualRow(indexToRemove); - drawVirtualRows(): void; - getFirstVirtualRenderedRow(): number; - getLastVirtualRenderedRow(): number; - private ensureRowsRendered(); - private insertRow(node, rowIndex, mainRowWidth); - getRenderedNodes(): any[]; - getIndexOfRenderedNode(node: any): number; - navigateToNextCell(key: any, rowIndex: number, column: Column): void; - private getNextCellToFocus(key, lastCellToFocus); - onRowSelected(rowIndex: number, selected: boolean): void; - focusCell(eCell: any, rowIndex: number, colIndex: number, colDef: ColDef, forceBrowserFocus: any): void; - getFocusedCell(): any; - setFocusedCell(rowIndex: any, colIndex: any): void; - startEditingNextCell(rowIndex: any, column: any, shiftKey: any): void; - } -} -declare namespace ag.grid { - class SelectionController { - private eParentsOfRows; - private angularGrid; - private gridOptionsWrapper; - private $scope; - private rowRenderer; - private selectedRows; - private selectedNodesById; - private rowModel; - private eventService; - init(angularGrid: Grid, gridPanel: GridPanel, gridOptionsWrapper: GridOptionsWrapper, $scope: any, rowRenderer: RowRenderer, eventService: EventService): void; - private initSelectedNodesById(); - getSelectedNodesById(): any; - getSelectedRows(): any; - getSelectedNodes(): any; - getBestCostNodeSelection(): any; - setRowModel(rowModel: any): void; - deselectAll(): void; - selectAll(): void; - selectNode(node: any, tryMulti: any, suppressEvents?: any): void; - private recursivelySelectAllChildren(node, suppressEvents?); - private recursivelyDeselectAllChildren(node); - private doWorkOfSelectNode(node, suppressEvents); - private addCssClassForNode_andInformVirtualRowListener(node); - private doWorkOfDeselectAllNodes(nodeToKeepSelected?); - private deselectRealNode(node); - private removeCssClassForNode(node); - deselectIndex(rowIndex: any): void; - deselectNode(node: any): void; - selectIndex(index: any, tryMulti: any, suppressEvents?: any): void; - private syncSelectedRowsAndCallListener(suppressEvents?); - private recursivelyCheckIfSelected(node); - isNodeSelected(node: any): boolean; - private updateGroupParentsIfNeeded(); - } -} -declare namespace ag.grid { - class RenderedHeaderElement { - private eRoot; - private dragStartX; - constructor(eRoot: HTMLElement); - getERoot(): HTMLElement; - destroy(): void; - refreshFilterIcon(): void; - refreshSortIcon(): void; - onDragStart(): void; - onDragging(dragChange: number): void; - onIndividualColumnResized(column: Column): void; - addDragHandler(eDraggableElement: any): void; - stopDragging(listenersToRemove: any): void; - } -} -declare namespace ag.grid { - class RenderedHeaderCell extends RenderedHeaderElement { - private static DEFAULT_SORTING_ORDER; - private eHeaderCell; - private eSortAsc; - private eSortDesc; - private eSortNone; - private eFilterIcon; - private column; - private gridOptionsWrapper; - private parentScope; - private childScope; - private filterManager; - private columnController; - private $compile; - private angularGrid; - private parentGroup; - private startWidth; - constructor(column: Column, parentGroup: RenderedHeaderGroupCell, gridOptionsWrapper: GridOptionsWrapper, parentScope: any, filterManager: FilterManager, columnController: ColumnController, $compile: any, angularGrid: Grid, eRoot: HTMLElement); - getGui(): HTMLElement; - destroy(): void; - private createScope(); - private addAttributes(); - private addClasses(); - private addMenu(); - private addSortIcons(headerCellLabel); - private setupComponents(); - private useRenderer(headerNameValue, headerCellRenderer, headerCellLabel); - refreshFilterIcon(): void; - refreshSortIcon(): void; - private getNextSortDirection(); - private addSortHandling(headerCellLabel); - onDragStart(): void; - onDragging(dragChange: number): void; - onIndividualColumnResized(column: Column): void; - private addHeaderClassesFromCollDef(); - } -} -declare namespace ag.grid { - class RenderedHeaderGroupCell extends RenderedHeaderElement { - private eHeaderGroup; - private eHeaderGroupCell; - private eHeaderCellResize; - private columnGroup; - private gridOptionsWrapper; - private columnController; - private children; - private groupWidthStart; - private childrenWidthStarts; - private minWidth; - private parentScope; - private filterManager; - private $compile; - private angularGrid; - constructor(columnGroup: ColumnGroup, gridOptionsWrapper: GridOptionsWrapper, columnController: ColumnController, eRoot: HTMLElement, angularGrid: Grid, parentScope: any, filterManager: FilterManager, $compile: any); - getGui(): HTMLElement; - destroy(): void; - refreshFilterIcon(): void; - refreshSortIcon(): void; - onIndividualColumnResized(column: Column): void; - private setupComponents(); - private isColumnInOurDisplayedGroup(column); - private setWidthOfGroupHeaderCell(); - private addGroupExpandIcon(eGroupCellLabel); - onDragStart(): void; - onDragging(dragChange: any): void; - } -} -declare namespace ag.grid { - class HeaderRenderer { - private gridOptionsWrapper; - private columnController; - private angularGrid; - private filterManager; - private $scope; - private $compile; - private ePinnedHeader; - private eHeaderContainer; - private eRoot; - private headerElements; - init(gridOptionsWrapper: GridOptionsWrapper, columnController: ColumnController, gridPanel: GridPanel, angularGrid: Grid, filterManager: FilterManager, $scope: any, $compile: any): void; - private findAllElements(gridPanel); - refreshHeader(): void; - private insertHeadersWithGrouping(); - private insertHeadersWithoutGrouping(); - updateSortIcons(): void; - updateFilterIcons(): void; - onIndividualColumnResized(column: Column): void; - } -} -declare namespace ag.grid { - class GroupCreator { - private valueService; - init(valueService: ValueService): void; - group(rowNodes: RowNode[], groupedCols: Column[], expandByDefault: any): RowNode[]; - isExpanded(expandByDefault: any, level: any): boolean; - } -} -declare namespace ag.grid { - class InMemoryRowController { - private gridOptionsWrapper; - private columnController; - private angularGrid; - private filterManager; - private $scope; - private allRows; - private rowsAfterGroup; - private rowsAfterFilter; - private rowsAfterSort; - private rowsAfterMap; - private model; - private groupCreator; - private valueService; - private eventService; - constructor(); - init(gridOptionsWrapper: GridOptionsWrapper, columnController: ColumnController, angularGrid: any, filterManager: FilterManager, $scope: any, groupCreator: GroupCreator, valueService: ValueService, eventService: EventService): void; - private createModel(); - getModel(): any; - forEachInMemory(callback: Function): void; - forEachNode(callback: Function): void; - forEachNodeAfterFilter(callback: Function): void; - forEachNodeAfterFilterAndSort(callback: Function): void; - private recursivelyWalkNodesAndCallback(list, callback); - updateModel(step: any): void; - private defaultGroupAggFunctionFactory(valueColumns, valueKeys); - doAggregate(): void; - expandOrCollapseAll(expand: boolean, rowNodes: RowNode[]): void; - private recursivelyClearAggData(nodes); - private recursivelyCreateAggData(nodes, groupAggFunction, level); - private doSort(); - private recursivelyResetSort(rowNodes); - private sortList(nodes, sortOptions); - private updateChildIndexes(nodes); - onPivotChanged(): void; - private doPivoting(); - private doFilter(); - private filterItems(rowNodes); - private recursivelyResetFilter(nodes); - setAllRows(rows: RowNode[], firstId?: number): void; - private recursivelyAddIdToNodes(nodes, index); - private recursivelyCheckUserProvidedNodes(nodes, parent, level); - private getTotalChildCount(rowNodes); - private doGroupMapping(); - private addToMap(mappedData, originalNodes); - private createFooterNode(groupNode); - } -} -declare namespace ag.grid { - class VirtualPageRowController { - rowRenderer: any; - datasourceVersion: any; - gridOptionsWrapper: any; - angularGrid: any; - datasource: any; - virtualRowCount: any; - foundMaxRow: any; - pageCache: any; - pageCacheSize: any; - pageLoadsInProgress: any; - pageLoadsQueued: any; - pageAccessTimes: any; - accessTime: any; - maxConcurrentDatasourceRequests: any; - maxPagesInCache: any; - pageSize: any; - overflowSize: any; - init(rowRenderer: any, gridOptionsWrapper: any, angularGrid: any): void; - setDatasource(datasource: any): void; - reset(): void; - createNodesFromRows(pageNumber: any, rows: any): any; - removeFromLoading(pageNumber: any): void; - pageLoadFailed(pageNumber: any): void; - pageLoaded(pageNumber: any, rows: any, lastRow: any): void; - putPageIntoCacheAndPurge(pageNumber: any, rows: any): void; - checkMaxRowAndInformRowRenderer(pageNumber: any, lastRow: any): void; - isPageAlreadyLoading(pageNumber: any): boolean; - doLoadOrQueue(pageNumber: any): void; - addToQueueAndPurgeQueue(pageNumber: any): void; - findLeastRecentlyAccessedPage(pageIndexes: any): number; - checkQueueForNextLoad(): void; - loadPage(pageNumber: any): void; - requestIsDaemon(datasourceVersionCopy: any): boolean; - getVirtualRow(rowIndex: any): any; - forEachNode(callback: any): void; - getModel(): { - getVirtualRow: (index: any) => any; - getVirtualRowCount: () => any; - forEachInMemory: (callback: any) => void; - forEachNode: (callback: any) => void; - forEachNodeAfterFilter: (callback: any) => void; - forEachNodeAfterFilterAndSort: (callback: any) => void; - }; - } -} -declare namespace ag.grid { - class PaginationController { - eGui: any; - btNext: any; - btPrevious: any; - btFirst: any; - btLast: any; - lbCurrent: any; - lbTotal: any; - lbRecordCount: any; - lbFirstRowOnPage: any; - lbLastRowOnPage: any; - ePageRowSummaryPanel: any; - angularGrid: any; - callVersion: any; - gridOptionsWrapper: any; - datasource: any; - pageSize: any; - rowCount: any; - foundMaxRow: any; - totalPages: any; - currentPage: any; - init(angularGrid: any, gridOptionsWrapper: any): void; - setDatasource(datasource: any): void; - reset(): void; - setTotalLabels(): void; - calculateTotalPages(): void; - pageLoaded(rows: any, lastRowIndex: any): void; - updateRowLabels(): void; - loadPage(): void; - isCallDaemon(versionCopy: any): boolean; - onBtNext(): void; - onBtPrevious(): void; - onBtFirst(): void; - onBtLast(): void; - isZeroPagesToDisplay(): boolean; - enableOrDisableButtons(): void; - createTemplate(): string; - getGui(): any; - setupComponents(): void; - } -} -declare namespace ag.grid { - class BorderLayout { - private eNorthWrapper; - private eSouthWrapper; - private eEastWrapper; - private eWestWrapper; - private eCenterWrapper; - private eOverlayWrapper; - private eCenterRow; - private eNorthChildLayout; - private eSouthChildLayout; - private eEastChildLayout; - private eWestChildLayout; - private eCenterChildLayout; - private isLayoutPanel; - private fullHeight; - private layoutActive; - private eGui; - private id; - private childPanels; - private centerHeightLastTime; - private sizeChangeListners; - constructor(params: any); - addSizeChangeListener(listener: Function): void; - fireSizeChanged(): void; - private setupPanels(params); - private setupPanel(content, ePanel); - getGui(): any; - doLayout(): boolean; - private layoutChild(childPanel); - private layoutHeight(); - private layoutHeightFullHeight(); - private layoutHeightNormal(); - getCentreHeight(): number; - private layoutWidth(); - setEastVisible(visible: any): void; - setOverlayVisible(visible: any): void; - setSouthVisible(visible: any): void; - } -} -declare namespace ag.grid { - class GridPanel { - private masterSlaveService; - private gridOptionsWrapper; - private columnModel; - private rowRenderer; - private rowModel; - private layout; - private forPrint; - private scrollWidth; - private scrollLagCounter; - private eBodyViewport; - private eRoot; - private eBody; - private eBodyContainer; - private ePinnedColsContainer; - private eHeaderContainer; - private ePinnedHeader; - private eHeader; - private eParentsOfRows; - private eBodyViewportWrapper; - private ePinnedColsViewport; - private eFloatingTop; - private ePinnedFloatingTop; - private eFloatingTopContainer; - private eFloatingBottom; - private ePinnedFloatingBottom; - private eFloatingBottomContainer; - init(gridOptionsWrapper: GridOptionsWrapper, columnModel: ColumnController, rowRenderer: RowRenderer, masterSlaveService: MasterSlaveService): void; - getLayout(): BorderLayout; - private setupComponents(); - getPinnedFloatingTop(): HTMLElement; - getFloatingTopContainer(): HTMLElement; - getPinnedFloatingBottom(): HTMLElement; - getFloatingBottomContainer(): HTMLElement; - private createTemplate(); - ensureIndexVisible(index: any): void; - ensureColIndexVisible(index: any): void; - showLoading(loading: any): void; - getWidthForSizeColsToFit(): number; - setRowModel(rowModel: any): void; - getBodyContainer(): HTMLElement; - getBodyViewport(): HTMLElement; - getPinnedColsContainer(): HTMLElement; - getHeaderContainer(): HTMLElement; - getRoot(): HTMLElement; - getPinnedHeader(): HTMLElement; - getRowsParent(): HTMLElement[]; - private queryHtmlElement(selector); - private findElements(); - private mouseWheelListener(event); - setBodyContainerWidth(): void; - setPinnedColContainerWidth(): void; - showPinnedColContainersIfNeeded(): void; - onBodyHeightChange(): void; - private sizeHeaderAndBody(); - private sizeHeaderAndBodyNormal(); - private sizeHeaderAndBodyForPrint(); - setHorizontalScrollPosition(hScrollPosition: number): void; - private addScrollListener(); - private requestDrawVirtualRows(); - private scrollHeader(bodyLeftPosition); - private scrollPinned(bodyTopPosition); - } -} -declare namespace ag.grid { - class DragAndDropService { - static theInstance: DragAndDropService; - static getInstance(): DragAndDropService; - dragItem: any; - constructor(); - stopDragging(): void; - setDragCssClasses(eListItem: any, dragging: any): void; - addDragSource(eDragSource: any, dragSourceCallback: any): void; - onMouseDownDragSource(eDragSource: any, dragSourceCallback: any): void; - addDropTarget(eDropTarget: any, dropTargetCallback: any): void; - } -} -declare function require(name: string): any; -declare namespace ag.grid { - class AgList { - private eGui; - private uniqueId; - private modelChangedListeners; - private itemSelectedListeners; - private beforeDropListeners; - private itemMovedListeners; - private dragSources; - private emptyMessage; - private eFilterValueTemplate; - private eListParent; - private model; - private cellRenderer; - private readOnly; - constructor(); - setReadOnly(readOnly: boolean): void; - setEmptyMessage(emptyMessage: any): void; - getUniqueId(): any; - addStyles(styles: any): void; - addCssClass(cssClass: any): void; - addDragSource(dragSource: any): void; - addModelChangedListener(listener: Function): void; - addItemSelectedListener(listener: any): void; - addItemMovedListener(listener: any): void; - addBeforeDropListener(listener: any): void; - private fireItemMoved(fromIndex, toIndex); - private fireModelChanged(); - private fireItemSelected(item); - private fireBeforeDrop(item); - private setupComponents(); - setModel(model: any): void; - getModel(): any; - setCellRenderer(cellRenderer: any): void; - refreshView(): void; - private insertRows(); - private insertBlankMessage(); - private setupAsDropTarget(); - private externalAcceptDrag(dragEvent); - private externalDrop(dragEvent); - private externalNoDrop(); - private addItemToList(newItem); - private addDragAndDropToListItem(eListItem, item); - private internalAcceptDrag(targetColumn, dragItem, eListItem); - private internalDrop(targetColumn, draggedColumn); - private internalNoDrop(eListItem); - private dragAfterThisItem(targetColumn, draggedColumn); - private setDropCssClasses(eListItem, state); - getGui(): any; - } -} -declare namespace ag.grid { - class ColumnSelectionPanel { - private gridOptionsWrapper; - private columnController; - private cColumnList; - layout: any; - private eRootPanel; - constructor(columnController: ColumnController, gridOptionsWrapper: GridOptionsWrapper, eventService: EventService); - private columnsChanged(); - getDragSource(): any; - private columnCellRenderer(params); - private setupComponents(); - private onItemMoved(fromIndex, toIndex); - getGui(): any; - } -} -declare namespace ag.grid { - class GroupSelectionPanel { - gridOptionsWrapper: any; - columnController: ColumnController; - inMemoryRowController: any; - cColumnList: any; - layout: any; - constructor(columnController: ColumnController, inMemoryRowController: any, gridOptionsWrapper: GridOptionsWrapper, eventService: EventService); - private columnsChanged(); - addDragSource(dragSource: any): void; - private columnCellRenderer(params); - private setupComponents(); - private onBeforeDrop(newItem); - private onItemMoved(fromIndex, toIndex); - } -} -declare namespace ag.grid { - class AgDropdownList { - private itemSelectedListeners; - private eValue; - private agList; - private eGui; - private hidePopupCallback; - private selectedItem; - private cellRenderer; - private popupService; - constructor(popupService: PopupService); - setWidth(width: any): void; - addItemSelectedListener(listener: any): void; - fireItemSelected(item: any): void; - setupComponents(): void; - itemSelected(item: any): void; - onClick(): void; - getGui(): any; - setSelected(item: any): void; - setCellRenderer(cellRenderer: any): void; - refreshView(): void; - setModel(model: any): void; - } -} -declare namespace ag.grid { - class ValuesSelectionPanel { - private gridOptionsWrapper; - private columnController; - private cColumnList; - private layout; - private popupService; - constructor(columnController: ColumnController, gridOptionsWrapper: GridOptionsWrapper, popupService: PopupService, eventService: EventService); - getLayout(): any; - private columnsChanged(); - addDragSource(dragSource: any): void; - private cellRenderer(params); - private setupComponents(); - private beforeDropListener(newItem); - } -} -declare namespace ag.grid { - class VerticalStack { - isLayoutPanel: any; - childPanels: any; - eGui: any; - constructor(); - addPanel(panel: any, height: any): void; - getGui(): any; - doLayout(): void; - } -} -declare namespace ag.grid { - class ToolPanel { - layout: any; - constructor(); - init(columnController: any, inMemoryRowController: any, gridOptionsWrapper: GridOptionsWrapper, popupService: PopupService, eventService: EventService): void; - } -} -declare namespace ag.grid { - interface GridOptions { - virtualPaging?: boolean; - toolPanelSuppressPivot?: boolean; - toolPanelSuppressValues?: boolean; - rowsAlreadyGrouped?: boolean; - suppressRowClickSelection?: boolean; - suppressCellSelection?: boolean; - sortingOrder?: string[]; - suppressMultiSort?: boolean; - suppressHorizontalScroll?: boolean; - unSortIcon?: boolean; - rowHeight?: number; - rowBuffer?: number; - enableColResize?: boolean; - enableCellExpressions?: boolean; - enableSorting?: boolean; - enableServerSideSorting?: boolean; - enableFilter?: boolean; - enableServerSideFilter?: boolean; - colWidth?: number; - suppressMenuHide?: boolean; - singleClickEdit?: boolean; - debug?: boolean; - icons?: any; - angularCompileRows?: boolean; - angularCompileFilters?: boolean; - angularCompileHeaders?: boolean; - localeText?: any; - localeTextFunc?: Function; - suppressScrollLag?: boolean; - groupSuppressAutoColumn?: boolean; - groupSelectsChildren?: boolean; - groupHidePivotColumns?: boolean; - groupIncludeFooter?: boolean; - groupUseEntireRow?: boolean; - groupSuppressRow?: boolean; - groupSuppressBlankHeader?: boolean; - forPrint?: boolean; - groupColumnDef?: any; - context?: any; - rowStyle?: any; - rowClass?: any; - groupDefaultExpanded?: any; - slaveGrids?: GridOptions[]; - rowSelection?: string; - rowDeselection?: boolean; - rowData?: any[]; - floatingTopRowData?: any[]; - floatingBottomRowData?: any[]; - showToolPanel?: boolean; - groupKeys?: string[]; - groupAggFields?: string[]; - columnDefs?: any[]; - datasource?: any; - pinnedColumnCount?: number; - groupHeaders?: boolean; - headerHeight?: number; - groupRowInnerRenderer?(params: any): void; - groupRowRenderer?: Function | Object; - isScrollLag?(): boolean; - isExternalFilterPresent?(): boolean; - doesExternalFilterPass?(node: RowNode): boolean; - getRowStyle?: any; - getRowClass?: any; - headerCellRenderer?: any; - groupAggFunction?(nodes: any[]): any; - onReady?(api: any): void; - onModelUpdated?(): void; - onCellClicked?(params: any): void; - onCellDoubleClicked?(params: any): void; - onCellContextMenu?(params: any): void; - onCellValueChanged?(params: any): void; - onCellFocused?(params: any): void; - onRowSelected?(params: any): void; - onSelectionChanged?(): void; - onBeforeFilterChanged?(): void; - onAfterFilterChanged?(): void; - onFilterModified?(): void; - onBeforeSortChanged?(): void; - onAfterSortChanged?(): void; - onVirtualRowRemoved?(params: any): void; - onRowClicked?(params: any): void; - api?: GridApi; - columnApi?: ColumnApi; - } -} -declare namespace ag.grid { - class GridApi { - private grid; - private rowRenderer; - private headerRenderer; - private filterManager; - private columnController; - private inMemoryRowController; - private selectionController; - private gridOptionsWrapper; - private gridPanel; - private valueService; - private masterSlaveService; - private eventService; - private csvCreator; - constructor(grid: Grid, rowRenderer: RowRenderer, headerRenderer: HeaderRenderer, filterManager: FilterManager, columnController: ColumnController, inMemoryRowController: InMemoryRowController, selectionController: SelectionController, gridOptionsWrapper: GridOptionsWrapper, gridPanel: GridPanel, valueService: ValueService, masterSlaveService: MasterSlaveService, eventService: EventService); - /** Used internally by grid. Not intended to be used by the client. Interface may change between releases. */ - __getMasterSlaveService(): MasterSlaveService; - getDataAsCsv(params?: CsvExportParams): string; - exportDataAsCsv(params?: CsvExportParams): void; - setDatasource(datasource: any): void; - onNewDatasource(): void; - setRowData(rowData: any): void; - setRows(rows: any): void; - onNewRows(): void; - setFloatingTopRowData(rows: any[]): void; - setFloatingBottomRowData(rows: any[]): void; - onNewCols(): void; - setColumnDefs(colDefs: ColDef[]): void; - unselectAll(): void; - refreshRows(rowNodes: RowNode[]): void; - refreshCells(rowNodes: RowNode[], colIds: string[]): void; - rowDataChanged(rows: any): void; - refreshView(): void; - softRefreshView(): void; - refreshGroupRows(): void; - refreshHeader(): void; - isAnyFilterPresent(): boolean; - isAdvancedFilterPresent(): boolean; - isQuickFilterPresent(): boolean; - getModel(): any; - onGroupExpandedOrCollapsed(refreshFromIndex: any): void; - expandAll(): void; - collapseAll(): void; - addVirtualRowListener(rowIndex: any, callback: any): void; - setQuickFilter(newFilter: any): void; - selectIndex(index: any, tryMulti: any, suppressEvents: any): void; - deselectIndex(index: any): void; - selectNode(node: any, tryMulti: any, suppressEvents: any): void; - deselectNode(node: any): void; - selectAll(): void; - deselectAll(): void; - recomputeAggregates(): void; - sizeColumnsToFit(): void; - showLoading(show: any): void; - isNodeSelected(node: any): boolean; - getSelectedNodesById(): { - [nodeId: number]: RowNode; - }; - getSelectedNodes(): RowNode[]; - getSelectedRows(): any[]; - getBestCostNodeSelection(): any; - getRenderedNodes(): any[]; - ensureColIndexVisible(index: any): void; - ensureIndexVisible(index: any): void; - ensureNodeVisible(comparator: any): void; - forEachInMemory(callback: Function): void; - forEachNode(callback: Function): void; - forEachNodeAfterFilter(callback: Function): void; - forEachNodeAfterFilterAndSort(callback: Function): void; - getFilterApiForColDef(colDef: any): any; - getFilterApi(key: any): any; - getColumnDef(key: any): ColDef; - onFilterChanged(): void; - setSortModel(sortModel: any): void; - getSortModel(): any; - setFilterModel(model: any): void; - getFilterModel(): any; - getFocusedCell(): any; - setFocusedCell(rowIndex: any, colIndex: any): void; - setHeaderHeight(headerHeight: number): void; - setGroupHeaders(groupHeaders: boolean): void; - showToolPanel(show: any): void; - isToolPanelShowing(): boolean; - hideColumn(colId: any, hide: any): void; - hideColumns(colIds: any, hide: any): void; - getColumnState(): [any]; - setColumnState(state: any): void; - doLayout(): void; - getValue(colDef: ColDef, data: any, node: any): any; - addEventListener(eventType: string, listener: Function): void; - addGlobalListener(listener: Function): void; - removeEventListener(eventType: string, listener: Function): void; - removeGlobalListener(listener: Function): void; - refreshPivot(): void; - } -} -declare namespace ag.grid { - class ValueService { - private gridOptionsWrapper; - private expressionService; - private columnController; - init(gridOptionsWrapper: GridOptionsWrapper, expressionService: ExpressionService, columnController: ColumnController): void; - getValue(colDef: ColDef, data: any, node: any): any; - private executeValueGetter(valueGetter, data, colDef, node); - private getValueCallback(data, node, field); - } -} -declare namespace ag.grid { - class Grid { - private virtualRowCallbacks; - private gridOptions; - private gridOptionsWrapper; - private inMemoryRowController; - private doingVirtualPaging; - private paginationController; - private virtualPageRowController; - private finished; - private selectionController; - private columnController; - private rowRenderer; - private headerRenderer; - private filterManager; - private valueService; - private masterSlaveService; - private eventService; - private toolPanel; - private gridPanel; - private eRootPanel; - private toolPanelShowing; - private doingPagination; - private usingInMemoryModel; - private rowModel; - constructor(eGridDiv: any, gridOptions: any, globalEventListener?: Function, $scope?: any, $compile?: any, quickFilterOnScope?: any); - getRowModel(): any; - private periodicallyDoLayout(); - private setupComponents($scope, $compile, eUserProvidedDiv, globalEventListener); - private onColumnChanged(event); - refreshPivot(): void; - getEventService(): EventService; - private onIndividualColumnResized(column); - showToolPanel(show: any): void; - isToolPanelShowing(): boolean; - isUsingInMemoryModel(): boolean; - setDatasource(datasource?: any): void; - private refreshHeaderAndBody(); - setFinished(): void; - onQuickFilterChanged(newFilter: any): void; - onFilterModified(): void; - onFilterChanged(): void; - onRowClicked(event: any, rowIndex: any, node: any): void; - showLoadingPanel(show: any): void; - private setupColumns(); - updateModelAndRefresh(step: any, refreshFromIndex?: any): void; - setRows(rows?: any, firstId?: any): void; - ensureNodeVisible(comparator: any): void; - getFilterModel(): any; - setFocusedCell(rowIndex: any, colIndex: any): void; - getSortModel(): any; - setSortModel(sortModel: any): void; - onSortingChanged(): void; - addVirtualRowListener(rowIndex: any, callback: any): void; - onVirtualRowSelected(rowIndex: any, selected: any): void; - onVirtualRowRemoved(rowIndex: any): void; - setColumnDefs(colDefs?: ColDef[]): void; - updateBodyContainerWidthAfterColResize(): void; - updatePinnedColContainerWidthAfterColResize(): void; - doLayout(): void; - } -} -declare namespace ag.grid { - class ComponentUtil { - static SIMPLE_PROPERTIES: string[]; - static SIMPLE_NUMBER_PROPERTIES: string[]; - static SIMPLE_BOOLEAN_PROPERTIES: string[]; - static WITH_IMPACT_NUMBER_PROPERTIES: string[]; - static WITH_IMPACT_BOOLEAN_PROPERTIES: string[]; - static WITH_IMPACT_OTHER_PROPERTIES: string[]; - static CALLBACKS: string[]; - static ALL_PROPERTIES: string[]; - static copyAttributesToGridOptions(gridOptions: GridOptions, component: any): GridOptions; - static processOnChange(changes: any, gridOptions: GridOptions, component: any): void; - static toBoolean(value: any): boolean; - static toNumber(value: any): number; - } -} -declare namespace ag.grid { - class AgGridNg2 { - private elementDef; - private _agGrid; - private _initialised; - private gridOptions; - private api; - private columnApi; - modelUpdated: any; - cellClicked: any; - cellDoubleClicked: any; - cellContextMenu: any; - cellValueChanged: any; - cellFocused: any; - rowSelected: any; - selectionChanged: any; - beforeFilterChanged: any; - afterFilterChanged: any; - filterModified: any; - beforeSortChanged: any; - afterSortChanged: any; - virtualRowRemoved: any; - rowClicked: any; - ready: any; - columnEverythingChanged: any; - columnPivotChanged: any; - columnValueChanged: any; - columnMoved: any; - columnVisible: any; - columnGroupOpened: any; - columnResized: any; - columnPinnedCountChanged: any; - virtualPaging: boolean; - toolPanelSuppressPivot: boolean; - toolPanelSuppressValues: boolean; - rowsAlreadyGrouped: boolean; - suppressRowClickSelection: boolean; - suppressCellSelection: boolean; - sortingOrder: string[]; - suppressMultiSort: boolean; - suppressHorizontalScroll: boolean; - unSortIcon: boolean; - rowHeight: number; - rowBuffer: number; - enableColResize: boolean; - enableCellExpressions: boolean; - enableSorting: boolean; - enableServerSideSorting: boolean; - enableFilter: boolean; - enableServerSideFilter: boolean; - colWidth: number; - suppressMenuHide: boolean; - debug: boolean; - icons: any; - angularCompileRows: boolean; - angularCompileFilters: boolean; - angularCompileHeaders: boolean; - localeText: any; - localeTextFunc: Function; - groupSuppressAutoColumn: boolean; - groupSelectsChildren: boolean; - groupHidePivotColumns: boolean; - groupIncludeFooter: boolean; - groupUseEntireRow: boolean; - groupSuppressRow: boolean; - groupSuppressBlankHeader: boolean; - groupColumnDef: any; - forPrint: boolean; - context: any; - rowStyle: any; - rowClass: any; - headerCellRenderer: any; - groupDefaultExpanded: any; - slaveGrids: GridOptions[]; - rowSelection: string; - rowDeselection: boolean; - rowData: any[]; - floatingTopRowData: any[]; - floatingBottomRowData: any[]; - showToolPanel: boolean; - groupKeys: string[]; - groupAggFunction: (nodes: any[]) => void; - groupAggFields: string[]; - columnDefs: any[]; - datasource: any; - pinnedColumnCount: number; - quickFilterText: string; - groupHeaders: boolean; - headerHeight: number; - constructor(elementDef: any); - onInit(): void; - onChange(changes: any): void; - private globalEventListener(eventType, event); - } -} -declare namespace ag.grid { -} -declare var exports: any; -declare var module: any; -declare namespace ag.grid { - interface Filter { - getGui(): any; - isFilterActive(): boolean; - doesFilterPass(params: any): boolean; - afterGuiAttached?(params?: { - hidePopup?: Function; - }): void; - onNewRowsLoaded?(): void; - } -} diff --git a/amqplib/amqplib-0.3.d.ts b/amqplib/amqplib-0.3.d.ts deleted file mode 100644 index 3138f7494e..0000000000 --- a/amqplib/amqplib-0.3.d.ts +++ /dev/null @@ -1,219 +0,0 @@ -// Type definitions for amqplib 0.3.x -// Project: https://github.com/squaremo/amqp.node -// Definitions by: Michael Nahkies , Ab Reitsma -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -/// - -declare module "amqplib/properties" { - namespace Replies { - interface Empty { - } - interface AssertQueue { - queue: string; - messageCount: number; - consumerCount: number; - } - interface PurgeQueue { - messageCount: number; - } - interface DeleteQueue { - messageCount: number; - } - interface AssertExchange { - exchange: string; - } - interface Consume { - consumerTag: string; - } - } - - namespace Options { - interface AssertQueue { - exclusive?: boolean; - durable?: boolean; - autoDelete?: boolean; - arguments?: any; - messageTtl?: number; - expires?: number; - deadLetterExchange?: string; - deadLetterRoutingKey?: string; - maxLength?: number; - } - interface DeleteQueue { - ifUnused?: boolean; - ifEmpty?: boolean; - } - interface AssertExchange { - durable?: boolean; - internal?: boolean; - autoDelete?: boolean; - alternateExchange?: string; - arguments?: any; - } - interface DeleteExchange { - ifUnused?: boolean; - } - interface Publish { - expiration?: string; - userId?: string; - CC?: string | string[]; - - mandatory?: boolean; - persistent?: boolean; - deliveryMode?: boolean | number; - BCC?: string | string[]; - - contentType?: string; - contentEncoding?: string; - headers?: any; - priority?: number; - correlationId?: string; - replyTo?: string; - messageId?: string; - timestamp?: number; - type?: string; - appId?: string; - } - interface Consume { - consumerTag?: string; - noLocal?: boolean; - noAck?: boolean; - exclusive?: boolean; - priority?: number; - arguments?: any; - } - interface Get { - noAck?: boolean; - } - } - - interface Message { - content: Buffer; - fields: any; - properties: any; - } -} - -declare module "amqplib" { - - import events = require("events"); - import when = require("when"); - import shared = require("amqplib/properties") - export import Replies = shared.Replies; - export import Options = shared.Options; - export import Message = shared.Message; - - interface Connection extends events.EventEmitter { - close(): when.Promise; - createChannel(): when.Promise; - createConfirmChannel(): when.Promise; - } - - interface Channel extends events.EventEmitter { - close(): when.Promise; - - assertQueue(queue: string, options?: Options.AssertQueue): when.Promise; - checkQueue(queue: string): when.Promise; - - deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise; - purgeQueue(queue: string): when.Promise; - - bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; - unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise; - - assertExchange(exchange: string, type: string, options?: Options.AssertExchange): when.Promise; - checkExchange(exchange: string): when.Promise; - - deleteExchange(exchange: string, options?: Options.DeleteExchange): when.Promise; - - bindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; - unbindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise; - - publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; - sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; - - consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): when.Promise; - - cancel(consumerTag: string): when.Promise; - get(queue: string, options?: Options.Get): when.Promise; - - ack(message: Message, allUpTo?: boolean): void; - ackAll(): void; - - nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; - nackAll(requeue?: boolean): void; - reject(message: Message, requeue?: boolean): void; - - prefetch(count: number, global?: boolean): when.Promise; - recover(): when.Promise; - } - - function connect(url: string, socketOptions?: any): when.Promise; -} - -declare module "amqplib/callback_api" { - - import events = require("events"); - import shared = require("amqplib/properties") - export import Replies = shared.Replies; - export import Options = shared.Options; - export import Message = shared.Message; - - interface Connection extends events.EventEmitter { - close(callback?: (err: any) => void): void; - createChannel(callback: (err: any, channel: Channel) => void): void; - createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void; - } - - interface Channel extends events.EventEmitter { - close(callback: (err: any) => void): void; - - assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void; - checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void; - - deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void; - purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void; - - bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; - unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; - - assertExchange(exchange: string, type: string, options?: Options.AssertExchange, callback?: (err: any, ok: Replies.AssertExchange) => void): void; - checkExchange(exchange: string, callback?: (err: any, ok: Replies.Empty) => void): void; - - deleteExchange(exchange: string, options?: Options.DeleteExchange, callback?: (err: any, ok: Replies.Empty) => void): void; - - bindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; - unbindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void; - - publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; - sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; - - consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void; - - cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void; - get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | boolean) => void): void; - - ack(message: Message, allUpTo?: boolean): void; - ackAll(): void; - - nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; - nackAll(requeue?: boolean): void; - reject(message: Message, requeue?: boolean): void; - - prefetch(count: number, global?: boolean): void; - recover(callback?: (err: any, ok: Replies.Empty) => void): void; - } - - interface ConfirmChannel extends Channel { - publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; - sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; - - waitForConfirms(callback?: (err: any) => void): void; - } - - function connect(callback: (err: any, connection: Connection) => void): void; - function connect(url: string, callback: (err: any, connection: Connection) => void): void; - function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void; -} diff --git a/angular-clipboard/angular-clipboard-tests.ts b/angular-clipboard/angular-clipboard-tests.ts index ccb1c7ce9a..b043a85d5a 100644 --- a/angular-clipboard/angular-clipboard-tests.ts +++ b/angular-clipboard/angular-clipboard-tests.ts @@ -1,6 +1,3 @@ -/// -/// - import * as angular from "angular"; import {ClipboardService} from "angular-clipboard"; diff --git a/angular-gettext/angular-gettext-tests.ts b/angular-gettext/angular-gettext-tests.ts index 4529b97e4c..d7c330c3eb 100644 --- a/angular-gettext/angular-gettext-tests.ts +++ b/angular-gettext/angular-gettext-tests.ts @@ -1,4 +1,4 @@ - + namespace angular_gettext_tests { diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts index c1232dcab4..b20b2eea9d 100644 --- a/angular-jwt/angular-jwt-tests.ts +++ b/angular-jwt/angular-jwt-tests.ts @@ -1,4 +1,4 @@ -/// +/// var app = angular.module("angular-jwt-tests", ["angular-jwt"]); diff --git a/angular-material/angular-material-0.8.3.d.ts b/angular-material/angular-material-0.8.3.d.ts deleted file mode 100644 index 0a19ec3764..0000000000 --- a/angular-material/angular-material-0.8.3.d.ts +++ /dev/null @@ -1,195 +0,0 @@ -// Type definitions for Angular Material 0.8.3+ (angular.material module) -// Project: https://github.com/angular/material -// Definitions by: Matt Traynham -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -declare namespace angular.material { - - interface MDBottomSheetOptions { - templateUrl?: string; - template?: string; - controller?: any; - locals?: {[index: string]: any}; - targetEvent?: any; - resolve?: {[index: string]: angular.IPromise} - controllerAs?: string; - parent?: Element; - disableParentScroll?: boolean; - } - - interface MDBottomSheetService { - show(options: MDBottomSheetOptions): angular.IPromise; - hide(response?: any): void; - cancel(response?: any): void; - } - - interface MDPresetDialog { - title(title: string): T; - content(content: string): T; - ok(content: string): T; - theme(theme: string): T; - } - - interface MDAlertDialog extends MDPresetDialog { - } - - interface MDConfirmDialog extends MDPresetDialog { - cancel(reason?: string): MDConfirmDialog; - } - - interface MDDialogOptions { - templateUrl?: string; - template?: string; - domClickEvent?: any; - disableParentScroll?: boolean; - clickOutsideToClose?: boolean; - hasBackdrop?: boolean; - escapeToClose?: boolean; - controller?: any; - locals?: {[index: string]: any}; - bindToController?: boolean; - resolve?: {[index: string]: angular.IPromise} - controllerAs?: string; - parent?: Element; - onComplete?: Function; - } - - interface MDDialogService { - show(dialog: MDDialogOptions|MDPresetDialog): angular.IPromise; - confirm(): MDConfirmDialog; - alert(): MDAlertDialog; - hide(response?: any): angular.IPromise; - cancel(response?: any): void; - } - - interface MDIcon { - (path: string): angular.IPromise; - } - - interface MDIconProvider { - icon(id: string, url: string, iconSize?: string): MDIconProvider; - iconSet(id: string, url: string, iconSize?: string): MDIconProvider; - defaultIconSet(url: string, iconSize?: string): MDIconProvider; - defaultIconSize(iconSize: string): MDIconProvider; - } - - interface MDMedia { - (media: string): boolean; - } - - interface MDSidenavObject { - toggle(): void; - open(): void; - close(): void; - isOpen(): boolean; - isLockedOpen(): boolean; - } - - interface MDSidenavService { - (component: string): MDSidenavObject; - } - - interface MDToastPreset { - content(content: string): T; - action(action: string): T; - highlightAction(highlightAction: boolean): T; - capsule(capsule: boolean): T; - theme(theme: string): T; - hideDelay(delay: number): T; - } - - interface MDSimpleToastPreset extends MDToastPreset { - } - - interface MDToastOptions { - templateUrl?: string; - template?: string; - hideDelay?: number; - position?: string; - controller?: any; - locals?: {[index: string]: any}; - bindToController?: boolean; - resolve?: {[index: string]: angular.IPromise} - controllerAs?: string; - parent?: Element; - } - - interface MDToastService { - show(optionsOrPreset: MDToastOptions|MDToastPreset): angular.IPromise; - showSimple(): angular.IPromise; - simple(): MDSimpleToastPreset; - build(): MDToastPreset; - updateContent(): void; - hide(response?: any): void; - cancel(response?: any): void; - } - - interface MDPalette { - 0?: string; - 50?: string; - 100?: string; - 200?: string; - 300?: string; - 400?: string; - 500?: string; - 600?: string; - 700?: string; - 800?: string; - 900?: string; - A100?: string; - A200?: string; - A400?: string; - A700?: string; - contrastDefaultColor?: string; - contrastDarkColors?: string; - contrastStrongLightColors?: string; - } - - interface MDThemeHues { - default?: string; - 'hue-1'?: string; - 'hue-2'?: string; - 'hue-3'?: string; - } - - interface MDThemePalette { - name: string; - hues: MDThemeHues; - } - - interface MDThemeColors { - accent: MDThemePalette; - background: MDThemePalette; - primary: MDThemePalette; - warn: MDThemePalette; - } - - interface MDThemeGrayScalePalette { - 1: string; - 2: string; - 3: string; - 4: string; - name: string; - } - - interface MDTheme { - name: string; - colors: MDThemeColors; - foregroundPalette: MDThemeGrayScalePalette; - foregroundShadow: string; - accentPalette(name: string, hues?: MDThemeHues): MDTheme; - primaryPalette(name: string, hues?: MDThemeHues): MDTheme; - warnPalette(name: string, hues?: MDThemeHues): MDTheme; - backgroundPalette(name: string, hues?: MDThemeHues): MDTheme; - dark(isDark?: boolean): MDTheme; - } - - interface MDThemingProvider { - theme(name: string, inheritFrom?: string): MDTheme; - definePalette(name: string, palette: MDPalette): MDThemingProvider; - extendPalette(name: string, palette: MDPalette): MDPalette; - setDefaultTheme(theme: string): void; - alwaysWatchTheme(alwaysWatch: boolean): void; - } -} diff --git a/angular-material/angular-material-0.9.0.d.ts b/angular-material/angular-material-0.9.0.d.ts deleted file mode 100644 index 6ab01e7b13..0000000000 --- a/angular-material/angular-material-0.9.0.d.ts +++ /dev/null @@ -1,204 +0,0 @@ -// Type definitions for Angular Material 0.9.0-rc1+ (angular.material module) -// Project: https://github.com/angular/material -// Definitions by: Matt Traynham -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// -declare namespace angular.material { - - interface MDBottomSheetOptions { - templateUrl?: string; - template?: string; - scope?: angular.IScope; // default: new child scope - preserveScope?: boolean; // default: false - controller?: string|Function; - locals?: {[index: string]: any}; - targetEvent?: MouseEvent; - resolve?: {[index: string]: angular.IPromise} - controllerAs?: string; - parent?: string|Element|JQuery; // default: root node - disableParentScroll?: boolean; // default: true - } - - interface MDBottomSheetService { - show(options: MDBottomSheetOptions): angular.IPromise; - hide(response?: any): void; - cancel(response?: any): void; - } - - interface MDPresetDialog { - title(title: string): T; - content(content: string): T; - ok(ok: string): T; - theme(theme: string): T; - } - - interface MDAlertDialog extends MDPresetDialog { - } - - interface MDConfirmDialog extends MDPresetDialog { - cancel(cancel: string): MDConfirmDialog; - } - - interface MDDialogOptions { - templateUrl?: string; - template?: string; - targetEvent?: MouseEvent; - scope?: angular.IScope; // default: new child scope - preserveScope?: boolean; // default: false - disableParentScroll?: boolean; // default: true - hasBackdrop?: boolean // default: true - clickOutsideToClose?: boolean; // default: false - escapeToClose?: boolean; // default: true - focusOnOpen?: boolean; // default: true - controller?: string|Function; - locals?: {[index: string]: any}; - bindToController?: boolean; // default: false - resolve?: {[index: string]: angular.IPromise} - controllerAs?: string; - parent?: string|Element|JQuery; // default: root node - onComplete?: Function; - } - - interface MDDialogService { - show(dialog: MDDialogOptions|MDAlertDialog|MDConfirmDialog): angular.IPromise; - confirm(): MDConfirmDialog; - alert(): MDAlertDialog; - hide(response?: any): angular.IPromise; - cancel(response?: any): void; - } - - interface MDIcon { - (id: string): angular.IPromise; // id is a unique ID or URL - } - - interface MDIconProvider { - icon(id: string, url: string, iconSize?: string): MDIconProvider; // iconSize default: '24px' - iconSet(id: string, url: string, iconSize?: string): MDIconProvider; // iconSize default: '24px' - defaultIconSet(url: string, iconSize?: string): MDIconProvider; // iconSize default: '24px' - defaultIconSize(iconSize: string): MDIconProvider; // default: '24px' - } - - interface MDMedia { - (media: string): boolean; - } - - interface MDSidenavObject { - toggle(): angular.IPromise; - open(): angular.IPromise; - close(): angular.IPromise; - isOpen(): boolean; - isLockedOpen(): boolean; - } - - interface MDSidenavService { - (component: string): MDSidenavObject; - } - - interface MDToastPreset { - content(content: string): T; - action(action: string): T; - highlightAction(highlightAction: boolean): T; - capsule(capsule: boolean): T; - theme(theme: string): T; - hideDelay(delay: number): T; - position(position: string): T; - } - - interface MDSimpleToastPreset extends MDToastPreset { - } - - interface MDToastOptions { - templateUrl?: string; - template?: string; - scope?: angular.IScope; // default: new child scope - preserveScope?: boolean; // default: false - hideDelay?: number; // default (ms): 3000 - position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left' - controller?: string|Function; - locals?: {[index: string]: any}; - bindToController?: boolean; // default: false - resolve?: {[index: string]: angular.IPromise} - controllerAs?: string; - parent?: string|Element|JQuery; // default: root node - } - - interface MDToastService { - show(optionsOrPreset: MDToastOptions|MDToastPreset): angular.IPromise; - showSimple(): angular.IPromise; - simple(): MDSimpleToastPreset; - build(): MDToastPreset; - updateContent(): void; - hide(response?: any): void; - cancel(response?: any): void; - } - - interface MDPalette { - 0?: string; - 50?: string; - 100?: string; - 200?: string; - 300?: string; - 400?: string; - 500?: string; - 600?: string; - 700?: string; - 800?: string; - 900?: string; - A100?: string; - A200?: string; - A400?: string; - A700?: string; - contrastDefaultColor?: string; - contrastDarkColors?: string|string[]; - contrastLightColors?: string|string[]; - } - - interface MDThemeHues { - default?: string; - 'hue-1'?: string; - 'hue-2'?: string; - 'hue-3'?: string; - } - - interface MDThemePalette { - name: string; - hues: MDThemeHues; - } - - interface MDThemeColors { - accent: MDThemePalette; - background: MDThemePalette; - primary: MDThemePalette; - warn: MDThemePalette; - } - - interface MDThemeGrayScalePalette { - 1: string; - 2: string; - 3: string; - 4: string; - name: string; - } - - interface MDTheme { - name: string; - isDark: boolean; - colors: MDThemeColors; - foregroundPalette: MDThemeGrayScalePalette; - foregroundShadow: string; - accentPalette(name: string, hues?: MDThemeHues): MDTheme; - primaryPalette(name: string, hues?: MDThemeHues): MDTheme; - warnPalette(name: string, hues?: MDThemeHues): MDTheme; - backgroundPalette(name: string, hues?: MDThemeHues): MDTheme; - dark(isDark?: boolean): MDTheme; - } - - interface MDThemingProvider { - theme(name: string, inheritFrom?: string): MDTheme; - definePalette(name: string, palette: MDPalette): MDThemingProvider; - extendPalette(name: string, palette: MDPalette): MDPalette; - setDefaultTheme(theme: string): void; - alwaysWatchTheme(alwaysWatch: boolean): void; - } -} diff --git a/angular-media-queries/match-media-tests.ts b/angular-media-queries/match-media-tests.ts index e24c43c073..a652b982d8 100644 --- a/angular-media-queries/match-media-tests.ts +++ b/angular-media-queries/match-media-tests.ts @@ -1,4 +1,4 @@ - + var myApp = angular.module('testModule', ['matchMedia']); diff --git a/angular-permission/angular-permission-2.3.1-tests.ts b/angular-permission/angular-permission-2.3.1-tests.ts deleted file mode 100644 index f0a3176d97..0000000000 --- a/angular-permission/angular-permission-2.3.1-tests.ts +++ /dev/null @@ -1,92 +0,0 @@ - - -import permission = angular.permission; - -angular - .module('fooModule', ['permission', 'user']) - .run(function (PermissionStore: permission.PermissionStore, User: any) { - // Define anonymous permission - PermissionStore - .definePermission('anonymous', function (stateParams) { - // If the returned value is *truthy* then the user has the permission, otherwise they don't - if (!User) { - return true; // Is anonymous - } - return false; - }); - }); - - interface BackendUserService { - checkSession(): angular.IPromise; - getAccessLevel(): angular.IPromise<{accessLevel: string}>; - hasPermissionDefinition(permission: string) : angular.IPromise; - } - - angular.module('barModule', ['permission', 'user']) - .run(function (PermissionStore: permission.PermissionStore, User: BackendUserService, $q: angular.IQService) { - PermissionStore - // Define user permission calling back-end - .definePermission('user', function (stateParams) { - // This time we will return a promise - // If the promise *resolves* then the user has the permission, if it *rejects* (you guessed it) - - // Let's assume this returns a promise that resolves or rejects if session is active - return User.checkSession(); - }); - - PermissionStore - // A different example for admin - .definePermission('admin', function (stateParams) { - var deferred = $q.defer(); - - User.getAccessLevel() - .then(function (data) { - if (data.accessLevel === 'admin') { - deferred.resolve(); - } else { - deferred.reject(); - } - }) - .catch(function () { - // Error with request - deferred.reject(); - }); - - return deferred.promise; - }); - - let arrayOfPermissionNames = ['p1', 'p2']; - PermissionStore.defineManyPermissions(arrayOfPermissionNames, function (stateParams: angular.ui.IStateParamsService, permissionName: string) { - return User.hasPermissionDefinition(permissionName); - }); - - PermissionStore.clearStore(); - - PermissionStore.removePermissionDefinition('user'); - - let permissions: Array = PermissionStore.getStore(); - - - }); - -angular - .module('fooModule', ['permission', 'user']) - .run(function (RoleStore: permission.RoleStore, User: any) { - RoleStore - // Permission array validated role - // Library will internally validate if 'user' and 'editor' permissions are valid when checking if role is valid - .defineRole('admin', ['user', 'editor']); - - RoleStore - // Server side validated role - .defineRole('accountant', [], function (stateParams) { - // Let's assume that we are making a request to server here and return response as promise - return User.hasRole('accountant'); - }); - - RoleStore.clearStore(); - - RoleStore.removeRoleDefinition('user'); - - let roles: Array = RoleStore.getStore(); - }); diff --git a/angular-permission/angular-permission-2.3.1.d.ts b/angular-permission/angular-permission-2.3.1.d.ts deleted file mode 100644 index 015ee62801..0000000000 --- a/angular-permission/angular-permission-2.3.1.d.ts +++ /dev/null @@ -1,165 +0,0 @@ -// Type definitions for angular-permission 2.3.1 -// Project: https://github.com/Narzerus/angular-permission -// Definitions by: Voislav Mishevski -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -/// - -declare namespace angular.permission { - - export interface PermissionStore { - /** - * Allows to define permission on application configuration - * @method - * - * @param permissionName {String} Name of defined permission - * @param validationFunction {Function} Function used to validate if permission is valid - */ - definePermission( - name: string, - validationFunction: (stateParams?: angular.ui.IStateParamsService, permission?: string) => boolean | angular.IPromise - ): void; - - /** - * Allows to define set of permissionNames with shared validation function on application configuration - * @method - * @throws {TypeError} - * - * @param permissionNames {Array} Set of permission names - * @param validationFunction {Function} Function used to validate if permission is valid - */ - defineManyPermissions( - permissions: string[], - validationFunction: (stateParams?: angular.ui.IStateParamsService, permission?: string) => boolean | angular.IPromise - ): void; - - clearStore(): void; - - /** - * Deletes permission - * @method - * - * @param permissionName {String} Name of defined permission - */ - removePermissionDefinition(permission: string): void; - - /** - * Checks if permission exists - * @method - * - * @param permissionName {String} Name of defined permission - * @returns {Boolean} - */ - hasPermissionDefinition(permissionName: string): boolean; - - /** - * Returns all permissions - * @method - * - * @returns {Object} Permissions collection - */ - getStore(): Permission[]; - } - - export interface RoleStore { - /** - * Allows to define role - * @method - * - * @param roleName {String} Name of defined role - * @param permissions {Array} Set of permission names - * @param [validationFunction] {Function} Function used to validate if permissions in role are valid - */ - defineRole( - role: string, - permissions: Array, - validationFunction: RoleValidationFunction - ): void; - - /** - * Allows to define role - * @method - * - * @param roleName {String} Name of defined role - * @param permissions {Array} Set of permission names - */ - defineRole(role: string, permissions: Array): void; - - /** - * Checks if role is defined in store - * @method - * - * @param roleName {String} Name of role - * @returns {Boolean} - */ - hasRoleDefinition(role: string): boolean; - - /** - * Returns role definition object by it's name - * @method - * - * @returns {permission.Role} Role definition object - */ - getRoleDefinition(roleName: string): Role; - - /** - * Removes all role definitions - * @method - */ - clearStore(): void; - - /** - * Deletes role from store - * @method - * - * @param roleName {String} Name of defined permission - */ - removeRoleDefinition(roleName: string): void; - - /** - * Returns all role definitions - * @method - * - * @returns {Object} Defined roles collection - */ - getStore(): Role[]; - } - - export interface Role { - roleName: string; - permissionNames: string[]; - validationFunction?: RoleValidationFunction; - } - - export interface Permission { - permissionName: string; - validationFunction?: PermissionValidationFunction; - } - - interface RoleValidationFunction { - (stateParams?: angular.ui.IStateParamsService, permission?: string): boolean | angular.IPromise; - } - - interface PermissionValidationFunction { - (stateParams?: angular.ui.IStateParamsService, permission?: string): boolean | angular.IPromise; - } - - export interface IPermissionState extends angular.ui.IState { - data?: any | DataWithPermissions; - } - - export interface DataWithPermissions { - permissions?: { - only?: (() => void) | Array | angular.IPromise; - except?: (() => void) | Array | angular.IPromise; - redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | {[index: string]: PermissionRedirectConfigation} - }; - } - - export interface PermissionRedirectConfigation { - state: string; - params?: {}; - options?: angular.ui.IStateOptions; - } -} diff --git a/angular-xeditable/angular-xeditable-tests.ts b/angular-xeditable/angular-xeditable-tests.ts index 57a3e53863..31add7ae56 100644 --- a/angular-xeditable/angular-xeditable-tests.ts +++ b/angular-xeditable/angular-xeditable-tests.ts @@ -1,4 +1,4 @@ -var myApp = angular.module('testModule', ['xeditable']); +var myApp = angular.module('testModule', ['xeditable']); myApp.run(["editableOptions", (editableOptions: angular.xeditable.IEditableOptions) => { diff --git a/angular/UNUSED_FILES.txt b/angular/UNUSED_FILES.txt new file mode 100644 index 0000000000..fc63be0214 --- /dev/null +++ b/angular/UNUSED_FILES.txt @@ -0,0 +1 @@ +angular-component-router.d.ts \ No newline at end of file diff --git a/angular/index.d.ts b/angular/index.d.ts index 920b616a26..3e74ed3321 100644 --- a/angular/index.d.ts +++ b/angular/index.d.ts @@ -660,6 +660,16 @@ declare namespace angular { interface IFilterFilterComparatorFunc { (actual: T, expected: T): boolean; } + + interface IFilterOrderByItem { + value: any, + type: string, + index: any + } + + interface IFilterOrderByComparatorFunc { + (left: IFilterOrderByItem, right: IFilterOrderByItem): -1 | 0 | 1; + } interface IFilterCurrency { /** @@ -743,9 +753,10 @@ declare namespace angular { * @param array The array to sort. * @param expression A predicate to be used by the comparator to determine the order of elements. * @param reverse Reverse the order of the array. - * @return Reverse the order of the array. + * @param comparator Function used to determine the relative order of value pairs. + * @return An array containing the items from the specified collection, ordered by a comparator function based on the values computed using the expression predicate. */ - (array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean): T[]; + (array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean, comparator?: IFilterOrderByComparatorFunc): T[]; } /** diff --git a/angular/legacy/angular-1.0-tests.ts b/angular/legacy/angular-1.0-tests.ts deleted file mode 100644 index b0e7ed692c..0000000000 --- a/angular/legacy/angular-1.0-tests.ts +++ /dev/null @@ -1,219 +0,0 @@ - - -// issue: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/369 -https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js -/** - * @license HTTP Auth Interceptor Module for AngularJS - * (c) 2012 Witold Szczerba - * License: MIT - */ -angular.module('http-auth-interceptor', []) - - .provider('authService', function () { - /** - * Holds all the requests which failed due to 401 response, - * so they can be re-requested in future, once login is completed. - */ - var buffer = []; - - /** - * Required by HTTP interceptor. - * Function is attached to provider to be invisible for regular users of this service. - */ - this.pushToBuffer = function (config: ng.IRequestConfig, deferred: ng.IDeferred) { - buffer.push({ - config: config, - deferred: deferred - }); - } - - this.$get = ['$rootScope', '$injector', function ($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) { - var $http: ng.IHttpService; //initialized later because of circular dependency problem - function retry(config: ng.IRequestConfig, deferred: ng.IDeferred) { - $http = $http || $injector.get('$http'); - $http(config).then(function (response) { - deferred.resolve(response); - }); - } - function retryAll() { - for (var i = 0; i < buffer.length; ++i) { - retry(buffer[i].config, buffer[i].deferred); - } - buffer = []; - } - - return { - loginConfirmed: function () { - $rootScope.$broadcast('event:auth-loginConfirmed'); - retryAll(); - } - } - }] - }) - -/** - * $http interceptor. - * On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'. - */ - .config(['$httpProvider', 'authServiceProvider', function ($httpProvider: ng.IHttpProvider, authServiceProvider) { - - var interceptor = ['$rootScope', '$q', function ($rootScope: ng.IScope, $q: ng.IQService) { - function success(response: ng.IHttpPromiseCallbackArg) { - return response; - } - - function error(response: ng.IHttpPromiseCallbackArg) { - if (response.status === 401) { - var deferred = $q.defer(); - authServiceProvider.pushToBuffer(response.config, deferred); - $rootScope.$broadcast('event:auth-loginRequired'); - return deferred.promise; - } - // otherwise - return $q.reject(response); - } - - return function (promise: ng.IHttpPromise) { - return promise.then(success, error); - } - - }]; - $httpProvider.responseInterceptors.push(interceptor); - }]); - - -namespace HttpAndRegularPromiseTests { - interface Person { - firstName: string; - lastName: string; - } - - interface ExpectedResponse extends Person { } - - interface SomeControllerScope extends ng.IScope { - person: Person; - theAnswer: number; - letters: string[]; - } - - var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => { - $http.get("http://somewhere/some/resource") - .success((data: ExpectedResponse) => { - $scope.person = data; - }); - - $http.get("http://somewhere/some/resource") - .then((response: ng.IHttpPromiseCallbackArg) => { - // typing lost, so something like - // var i: number = response.data - // would type check - $scope.person = response.data; - }); - - $http.get("http://somewhere/some/resource") - .then((response: ng.IHttpPromiseCallbackArg) => { - // typing lost, so something like - // var i: number = response.data - // would NOT type check - $scope.person = response.data; - }); - - var aPromise: ng.IPromise = $q.when({ firstName: "Jack", lastName: "Sparrow" }); - aPromise.then((person: Person) => { - $scope.person = person; - }); - - var bPromise: ng.IPromise = $q.when(42); - bPromise.then((answer: number) => { - $scope.theAnswer = answer; - }); - - var cPromise: ng.IPromise = $q.when(["a", "b", "c"]); - cPromise.then((letters: string[]) => { - $scope.letters = letters; - }); - } - - // Test that we can pass around a type-checked success/error Promise Callback - var anotherController: Function = ($scope: SomeControllerScope, $http: - ng.IHttpService, $q: ng.IQService) => { - - var buildFooData: Function = () => 42; - - var doFoo: Function = (callback: ng.IHttpPromiseCallback) => { - $http.get('/foo', buildFooData()) - .success(callback); - } - - doFoo((data) => console.log(data)); - } -} - -// Test for AngularJS Syntax - -namespace My.Namespace { - export var x; // need to export something for module to kick in -} - -// IModule Registering Test -var mod = angular.module('tests', []); -mod.controller('name', function ($scope: ng.IScope) { }) -mod.controller('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.controller(My.Namespace); -mod.directive('name', function ($scope: ng.IScope) { }) -mod.directive('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.directive(My.Namespace); -mod.factory('name', function ($scope: ng.IScope) { }) -mod.factory('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.factory(My.Namespace); -mod.filter('name', function ($scope: ng.IScope) { }) -mod.filter('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.filter(My.Namespace); -mod.provider('name', function ($scope: ng.IScope) { }) -mod.provider('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.provider(My.Namespace); -mod.service('name', function ($scope: ng.IScope) { }) -mod.service('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.service(My.Namespace); -mod.constant('name', 23); -mod.constant('name', "23"); -mod.constant(My.Namespace); -mod.value('name', 23); -mod.value('name', "23"); -mod.value(My.Namespace); - -// Promise signature tests -var foo: ng.IPromise; -foo.then((x) => { - // x is inferred to be a number - return "asdf"; -}).then((x) => { - // x is inferred to be string - x.length; - return 123; -}).then((x) => { - // x is infered to be a number - x.toFixed(); - return; -}).then((x) => { - // x is infered to be void - // Typescript will prevent you to actually use x as a local variable - // Try object: - return { a: 123 }; -}).then((x) => { - // Object is inferred here - x.a = 123; - //Try a promise - var y: ng.IPromise; - return y; -}).then((x) => { - // x is infered to be a number, which is the resolved value of a promise - x.toFixed(); -}); - - -// angular.element() tests -var element = angular.element("div.myApp"); -var scope: ng.IScope = element.scope(); - - diff --git a/angular/legacy/angular-1.0.d.ts b/angular/legacy/angular-1.0.d.ts deleted file mode 100644 index 8c3fbca20a..0000000000 --- a/angular/legacy/angular-1.0.d.ts +++ /dev/null @@ -1,760 +0,0 @@ -// Type definitions for Angular JS 1.0 -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -/// - -declare var angular: ng.IAngularStatic; - -// Support for painless dependency injection -interface Function { - $inject:string[]; -} - -/////////////////////////////////////////////////////////////////////////////// -// ng module (angular.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng { - - // All service providers extend this interface - interface IServiceProvider { - $get(): any; - } - - /////////////////////////////////////////////////////////////////////////// - // AngularStatic - // see http://docs.angularjs.org/api - /////////////////////////////////////////////////////////////////////////// - interface IAngularStatic { - bind(context: any, fn: Function, ...args: any[]): Function; - bootstrap(element: string, modules?: any[]): auto.IInjectorService; - bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService; - bootstrap(element: Element, modules?: any[]): auto.IInjectorService; - bootstrap(element: Document, modules?: any[]): auto.IInjectorService; - copy(source: any, destination?: any): any; - element: IAugmentedJQueryStatic; - equals(value1: any, value2: any): boolean; - extend(destination: any, ...sources: any[]): any; - forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any; - fromJson(json: string): any; - identity(arg?: any): any; - injector(modules?: any[]): auto.IInjectorService; - isArray(value: any): boolean; - isDate(value: any): boolean; - isDefined(value: any): boolean; - isElement(value: any): boolean; - isFunction(value: any): boolean; - isNumber(value: any): boolean; - isObject(value: any): boolean; - isString(value: any): boolean; - isUndefined(value: any): boolean; - lowercase(str: string): string; - /** construct your angular application - official docs: Interface for configuring angular modules. - see: http://docs.angularjs.org/api/angular.Module - */ - module( - /** name of your module you want to create */ - name: string, - /** name of modules yours depends on */ - requires?: string[], - configFunction?: any): IModule; - noop(...args: any[]): void; - toJson(obj: any, pretty?: boolean): string; - uppercase(str: string): string; - version: { - full: string; - major: number; - minor: number; - dot: number; - codename: string; - }; - } - - /////////////////////////////////////////////////////////////////////////// - // Module - // see http://docs.angularjs.org/api/angular.Module - /////////////////////////////////////////////////////////////////////////// - interface IModule { - animation(name: string, animationFactory: Function): IModule; - animation(name: string, inlineAnnotadedFunction: any[]): IModule; - animation(object: Object): IModule; - /** configure existing services. - Use this method to register work which needs to be performed on module loading - */ - config(configFn: Function): IModule; - /** configure existing services. - Use this method to register work which needs to be performed on module loading - */ - config(inlineAnnotadedFunction: any[]): IModule; - constant(name: string, value: any): IModule; - constant(object: Object): IModule; - controller(name: string, controllerConstructor: Function): IModule; - controller(name: string, inlineAnnotadedConstructor: any[]): IModule; - controller(object : Object): IModule; - directive(name: string, directiveFactory: (...params:any[])=> IDirective): IModule; - directive(name: string, inlineAnnotadedFunction: any[]): IModule; - directive(object: Object): IModule; - factory(name: string, serviceFactoryFunction: Function): IModule; - factory(name: string, inlineAnnotadedFunction: any[]): IModule; - factory(object: Object): IModule; - filter(name: string, filterFactoryFunction: Function): IModule; - filter(name: string, inlineAnnotadedFunction: any[]): IModule; - filter(object: Object): IModule; - provider(name: string, serviceProviderConstructor: Function): IModule; - provider(name: string, inlineAnnotadedConstructor: any[]): IModule; - provider(object: Object): IModule; - run(initializationFunction: Function): IModule; - run(inlineAnnotadedFunction: any[]): IModule; - service(name: string, serviceConstructor: Function): IModule; - service(name: string, inlineAnnotadedConstructor: any[]): IModule; - service(object: Object): IModule; - value(name: string, value: any): IModule; - value(object: Object): IModule; - - // Properties - name: string; - requires: string[]; - } - - /////////////////////////////////////////////////////////////////////////// - // Attributes - // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes - /////////////////////////////////////////////////////////////////////////// - interface IAttributes { - $set(name: string, value: any): void; - $observe(name: string, fn:(value?:any)=>any):void; - $attr: any; - } - - /////////////////////////////////////////////////////////////////////////// - // FormController - // see http://docs.angularjs.org/api/ng.directive:form.FormController - /////////////////////////////////////////////////////////////////////////// - interface IFormController { - $pristine: boolean; - $dirty: boolean; - $valid: boolean; - $invalid: boolean; - $error: any; - $setDirty(): void; - $setPristine(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // NgModelController - // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController - /////////////////////////////////////////////////////////////////////////// - interface INgModelController { - $render(): void; - $setValidity(validationErrorKey: string, isValid: boolean): void; - $setViewValue(value: string): void; - - // XXX Not sure about the types here. Documentation states it's a string, but - // I've seen it receiving other types throughout the code. - // Falling back to any for now. - $viewValue: any; - - // XXX Same as avove - $modelValue: any; - - $parsers: IModelParser[]; - $formatters: IModelFormatter[]; - $error: any; - $pristine: boolean; - $dirty: boolean; - $valid: boolean; - $invalid: boolean; - } - - interface IModelParser { - (value: any): any; - } - - interface IModelFormatter { - (value: any): any; - } - - /////////////////////////////////////////////////////////////////////////// - // Scope - // see http://docs.angularjs.org/api/ng.$rootScope.Scope - /////////////////////////////////////////////////////////////////////////// - interface IScope { - $apply(): any; - $apply(exp: string): any; - $apply(exp: (scope: IScope) => any): any; - - $broadcast(name: string, ...args: any[]): IAngularEvent; - $destroy(): void; - $digest(): void; - $emit(name: string, ...args: any[]): IAngularEvent; - - // Documentation says exp is optional, but actual implementaton counts on it - $eval(expression: string): any; - $eval(expression: (scope: IScope) => any): any; - - // Documentation says exp is optional, but actual implementaton counts on it - $evalAsync(expression: string): void; - $evalAsync(expression: (scope: IScope) => any): void; - - // Defaults to false by the implementation checking strategy - $new(isolate?: boolean): IScope; - - $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; - - $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function; - $watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function; - $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function; - $watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function; - - $watchCollection(watchExpression: string, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - $watchCollection(watchExpression: (scope: IScope) => any, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - - $parent: IScope; - - $id: number; - - // Hidden members - $$isolateBindings: any; - $$phase: any; - } - - interface IAngularEvent { - targetScope: IScope; - currentScope: IScope; - name: string; - preventDefault: Function; - defaultPrevented: boolean; - - // Available only events that were $emit-ted - stopPropagation?: Function; - } - - /////////////////////////////////////////////////////////////////////////// - // WindowService - // see http://docs.angularjs.org/api/ng.$window - /////////////////////////////////////////////////////////////////////////// - interface IWindowService extends Window {} - - /////////////////////////////////////////////////////////////////////////// - // BrowserService - // TODO undocumented, so we need to get it from the source code - /////////////////////////////////////////////////////////////////////////// - interface IBrowserService {} - - /////////////////////////////////////////////////////////////////////////// - // TimeoutService - // see http://docs.angularjs.org/api/ng.$timeout - /////////////////////////////////////////////////////////////////////////// - interface ITimeoutService { - (func: Function, delay?: number, invokeApply?: boolean): IPromise; - cancel(promise: IPromise): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // FilterService - // see http://docs.angularjs.org/api/ng.$filter - // see http://docs.angularjs.org/api/ng.$filterProvider - /////////////////////////////////////////////////////////////////////////// - interface IFilterService { - (name: string): Function; - } - - interface IFilterProvider extends IServiceProvider { - register(name: string, filterFactory: Function): IServiceProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // LocaleService - // see http://docs.angularjs.org/api/ng.$locale - /////////////////////////////////////////////////////////////////////////// - interface ILocaleService { - id: string; - - // These are not documented - // Check angular's i18n files for exemples - NUMBER_FORMATS: ILocaleNumberFormatDescriptor; - DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor; - pluralCat: (num: any) => string; - } - - interface ILocaleNumberFormatDescriptor { - DECIMAL_SEP: string; - GROUP_SEP: string; - PATTERNS: ILocaleNumberPatternDescriptor[]; - CURRENCY_SYM: string; - } - - interface ILocaleNumberPatternDescriptor { - minInt: number; - minFrac: number; - maxFrac: number; - posPre: string; - posSuf: string; - negPre: string; - negSuf: string; - gSize: number; - lgSize: number; - } - - interface ILocaleDateTimeFormatDescriptor { - MONTH: string[]; - SHORTMONTH: string[]; - DAY: string[]; - SHORTDAY: string[]; - AMPMS: string[]; - medium: string; - short: string; - fullDate: string; - longDate: string; - mediumDate: string; - shortDate: string; - mediumTime: string; - shortTime: string; - } - - /////////////////////////////////////////////////////////////////////////// - // LogService - // see http://docs.angularjs.org/api/ng.$log - /////////////////////////////////////////////////////////////////////////// - interface ILogService { - debug: ILogCall; - error: ILogCall; - info: ILogCall; - log: ILogCall; - warn: ILogCall; - } - - // We define this as separete interface so we can reopen it later for - // the ngMock module. - interface ILogCall { - (...args: any[]): void; - } - - /////////////////////////////////////////////////////////////////////////// - // ParseService - // see http://docs.angularjs.org/api/ng.$parse - /////////////////////////////////////////////////////////////////////////// - interface IParseService { - (expression: string): ICompiledExpression; - } - - interface ICompiledExpression { - (context: any, locals?: any): any; - - // If value is not provided, undefined is gonna be used since the implementation - // does not check the parameter. Let's force a value for consistency. If consumer - // whants to undefine it, pass the undefined value explicitly. - assign(context: any, value: any): any; - } - - /////////////////////////////////////////////////////////////////////////// - // LocationService - // see http://docs.angularjs.org/api/ng.$location - // see http://docs.angularjs.org/api/ng.$locationProvider - // see http://docs.angularjs.org/guide/dev_guide.services.$location - /////////////////////////////////////////////////////////////////////////// - interface ILocationService { - absUrl(): string; - hash(): string; - hash(newHash: string): ILocationService; - host(): string; - path(): string; - path(newPath: string): ILocationService; - port(): number; - protocol(): string; - replace(): ILocationService; - search(): any; - search(parametersMap: any): ILocationService; - search(parameter: string, parameterValue: any): ILocationService; - url(): string; - url(url: string): ILocationService; - } - - interface ILocationProvider extends IServiceProvider { - hashPrefix(): string; - hashPrefix(prefix: string): ILocationProvider; - html5Mode(): boolean; - - // Documentation states that parameter is string, but - // implementation tests it as boolean, which makes more sense - // since this is a toggler - html5Mode(active: boolean): ILocationProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // DocumentService - // see http://docs.angularjs.org/api/ng.$document - /////////////////////////////////////////////////////////////////////////// - interface IDocumentService extends Document {} - - /////////////////////////////////////////////////////////////////////////// - // ExceptionHandlerService - // see http://docs.angularjs.org/api/ng.$exceptionHandler - /////////////////////////////////////////////////////////////////////////// - interface IExceptionHandlerService { - (exception: Error, cause?: string): void; - } - - /////////////////////////////////////////////////////////////////////////// - // RootElementService - // see http://docs.angularjs.org/api/ng.$rootElement - /////////////////////////////////////////////////////////////////////////// - interface IRootElementService extends JQuery {} - - /////////////////////////////////////////////////////////////////////////// - // QService - // see http://docs.angularjs.org/api/ng.$q - /////////////////////////////////////////////////////////////////////////// - interface IQService { - all(promises: IPromise[]): IPromise; - defer(): IDeferred; - reject(reason?: any): IPromise; - when(value: T): IPromise; - } - - interface IPromise { - then(successCallback: (promiseValue: T) => IHttpPromise, errorCallback?: (reason: any) => any): IPromise; - then(successCallback: (promiseValue: T) => IPromise, errorCallback?: (reason: any) => any): IPromise; - then(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise; - } - - interface IDeferred { - resolve(value?: T): void; - reject(reason?: any): void; - promise: IPromise; - } - - /////////////////////////////////////////////////////////////////////////// - // AnchorScrollService - // see http://docs.angularjs.org/api/ng.$anchorScroll - /////////////////////////////////////////////////////////////////////////// - interface IAnchorScrollService { - (): void; - } - - interface IAnchorScrollProvider extends IServiceProvider { - disableAutoScrolling(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // CacheFactoryService - // see http://docs.angularjs.org/api/ng.$cacheFactory - /////////////////////////////////////////////////////////////////////////// - interface ICacheFactoryService { - // Lets not foce the optionsMap to have the capacity member. Even though - // it's the ONLY option considered by the implementation today, a consumer - // might find it useful to associate some other options to the cache object. - //(cacheId: string, optionsMap?: { capacity: number; }): CacheObject; - (cacheId: string, optionsMap?: { capacity: number; }): ICacheObject; - - // Methods bellow are not documented - info(): any; - get (cacheId: string): ICacheObject; - } - - interface ICacheObject { - info(): { - id: string; - size: number; - - // Not garanteed to have, since it's a non-mandatory option - //capacity: number; - }; - put(key: string, value?: any): void; - get (key: string): any; - remove(key: string): void; - removeAll(): void; - destroy(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // CompileService - // see http://docs.angularjs.org/api/ng.$compile - // see http://docs.angularjs.org/api/ng.$compileProvider - /////////////////////////////////////////////////////////////////////////// - interface ICompileService { - (element: string, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction; - (element: Element, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction; - (element: JQuery, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction; - } - - interface ICompileProvider extends IServiceProvider { - directive(name: string, directiveFactory: Function): ICompileProvider; - - // Undocumented, but it is there... - directive(directivesMap: any): ICompileProvider; - } - - interface ITemplateLinkingFunction { - // Let's hint but not force cloneAttachFn's signature - (scope: IScope, cloneAttachFn?: (clonedElement?: JQuery, scope?: IScope) => any): JQuery; - } - - /////////////////////////////////////////////////////////////////////////// - // ControllerService - // see http://docs.angularjs.org/api/ng.$controller - // see http://docs.angularjs.org/api/ng.$controllerProvider - /////////////////////////////////////////////////////////////////////////// - interface IControllerService { - // Although the documentation doesn't state this, locals are optional - (controllerConstructor: Function, locals?: any): any; - (controllerName: string, locals?: any): any; - } - - interface IControllerProvider extends IServiceProvider { - register(name: string, controllerConstructor: Function): void; - register(name: string, dependencyAnnotadedConstructor: any[]): void; - } - - /////////////////////////////////////////////////////////////////////////// - // HttpService - // see http://docs.angularjs.org/api/ng.$http - /////////////////////////////////////////////////////////////////////////// - interface IHttpService { - // At least moethod and url must be provided... - (config: IRequestConfig): IHttpPromise; - get (url: string, RequestConfig?: any): IHttpPromise; - delete (url: string, RequestConfig?: any): IHttpPromise; - head(url: string, RequestConfig?: any): IHttpPromise; - jsonp(url: string, RequestConfig?: any): IHttpPromise; - post(url: string, data: any, RequestConfig?: any): IHttpPromise; - put(url: string, data: any, RequestConfig?: any): IHttpPromise; - defaults: IRequestConfig; - - // For debugging, BUT it is documented as public, so... - pendingRequests: any[]; - } - - // This is just for hinting. - // Some opetions might not be available depending on the request. - // see http://docs.angularjs.org/api/ng.$http#Usage for options explanations - interface IRequestConfig { - method: string; - url: string; - params?: any; - - // XXX it has it's own structure... perhaps we should define it in the future - headers?: any; - - cache?: any; - timeout?: number; - withCredentials?: boolean; - - // These accept multiple types, so let's defile them as any - data?: any; - transformRequest?: any; - transformResponse?: any; - } - - interface IHttpPromiseCallback { - (data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): void; - } - - interface IHttpPromiseCallbackArg { - data?: T; - status?: number; - headers?: (headerName: string) => string; - config?: IRequestConfig; - } - - interface IHttpPromise extends IPromise { - success(callback: IHttpPromiseCallback): IHttpPromise; - error(callback: IHttpPromiseCallback): IHttpPromise; - then(successCallback: (response: IHttpPromiseCallbackArg) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; - then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; - } - - interface IHttpProvider extends IServiceProvider { - defaults: IRequestConfig; - interceptors: any[]; - responseInterceptors: any[]; - } - - /////////////////////////////////////////////////////////////////////////// - // HttpBackendService - // see http://docs.angularjs.org/api/ng.$httpBackend - // You should never need to use this service directly. - /////////////////////////////////////////////////////////////////////////// - interface IHttpBackendService { - // XXX Perhaps define callback signature in the future - (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; - } - - /////////////////////////////////////////////////////////////////////////// - // InterpolateService - // see http://docs.angularjs.org/api/ng.$interpolate - // see http://docs.angularjs.org/api/ng.$interpolateProvider - /////////////////////////////////////////////////////////////////////////// - interface IInterpolateService { - (text: string, mustHaveExpression?: boolean): IInterpolationFunction; - endSymbol(): string; - startSymbol(): string; - } - - interface IInterpolationFunction { - (context: any): string; - } - - interface IInterpolateProvider extends IServiceProvider { - startSymbol(): string; - startSymbol(value: string): IInterpolateProvider; - endSymbol(): string; - endSymbol(value: string): IInterpolateProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // RouteParamsService - // see http://docs.angularjs.org/api/ng.$routeParams - /////////////////////////////////////////////////////////////////////////// - interface IRouteParamsService {} - - /////////////////////////////////////////////////////////////////////////// - // TemplateCacheService - // see http://docs.angularjs.org/api/ng.$templateCache - /////////////////////////////////////////////////////////////////////////// - interface ITemplateCacheService extends ICacheObject {} - - /////////////////////////////////////////////////////////////////////////// - // RootScopeService - // see http://docs.angularjs.org/api/ng.$rootScope - /////////////////////////////////////////////////////////////////////////// - interface IRootScopeService extends IScope {} - - /////////////////////////////////////////////////////////////////////////// - // RouteService - // see http://docs.angularjs.org/api/ng.$route - // see http://docs.angularjs.org/api/ng.$routeProvider - /////////////////////////////////////////////////////////////////////////// - interface IRouteService { - reload(): void; - routes: any; - - // May not always be available. For instance, current will not be available - // to a controller that was not initialized as a result of a route maching. - current?: ICurrentRoute; - } - - // see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations - interface IRoute { - controller?: any; - name?: string; - template?: string; - templateUrl?: any; - resolve?: any; - redirectTo?: any; - reloadOnSearch?: boolean; - } - - // see http://docs.angularjs.org/api/ng.$route#current - interface ICurrentRoute extends IRoute { - locals: { - $scope: IScope; - $template: string; - }; - - params: any; - } - - interface IRouteProvider extends IServiceProvider { - otherwise(params: any): IRouteProvider; - when(path: string, route: IRoute): IRouteProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // Directive - // see http://docs.angularjs.org/api/ng.$compileProvider#directive - // and http://docs.angularjs.org/guide/directive - /////////////////////////////////////////////////////////////////////////// - - interface IDirective{ - priority?: number; - template?: any; - templateUrl?: any; - replace?: boolean; - transclude?: any; - restrict?: string; - scope?: any; - link?: Function; - compile?: Function; - controller?: any; - } - - /////////////////////////////////////////////////////////////////////////// - // angular.element - // when calling angular.element, angular returns a jQuery object, - // augmented with additional methods like e.g. scope. - // see: http://docs.angularjs.org/api/angular.element - /////////////////////////////////////////////////////////////////////////// - interface IAugmentedJQueryStatic extends JQueryStatic { - (selector: string, context?: any): IAugmentedJQuery; - (element: Element): IAugmentedJQuery; - (object: {}): IAugmentedJQuery; - (elementArray: Element[]): IAugmentedJQuery; - (object: JQuery): IAugmentedJQuery; - (func: Function): IAugmentedJQuery; - (array: any[]): IAugmentedJQuery; - (): IAugmentedJQuery; - } - - interface IAugmentedJQuery extends JQuery { - // TODO: events, how to define? - //$destroy - - find(selector: string): IAugmentedJQuery; - find(element: any): IAugmentedJQuery; - find(obj: JQuery): IAugmentedJQuery; - - controller(name: string): any; - injector(): any; - scope(): IScope; - - inheritedData(key: string, value: any): JQuery; - inheritedData(obj: { [key: string]: any; }): JQuery; - inheritedData(key?: string): any; - - - } - - - /////////////////////////////////////////////////////////////////////////// - // AUTO module (angular.js) - /////////////////////////////////////////////////////////////////////////// - export module auto { - - /////////////////////////////////////////////////////////////////////// - // InjectorService - // see http://docs.angularjs.org/api/AUTO.$injector - /////////////////////////////////////////////////////////////////////// - interface IInjectorService { - annotate(fn: Function): string[]; - annotate(inlineAnnotadedFunction: any[]): string[]; - get (name: string): any; - instantiate(typeConstructor: Function, locals?: any): any; - invoke(func: Function, context?: any, locals?: any): any; - } - - /////////////////////////////////////////////////////////////////////// - // ProvideService - // see http://docs.angularjs.org/api/AUTO.$provide - /////////////////////////////////////////////////////////////////////// - interface IProvideService { - // Documentation says it returns the registered instance, but actual - // implementation does not return anything. - // constant(name: string, value: any): any; - constant(name: string, value: any): void; - - decorator(name: string, decorator: Function): void; - decorator(name: string, decoratorInline: any[]): void; - factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider; - provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider; - provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider; - service(name: string, constructor: Function): ng.IServiceProvider; - value(name: string, value: any): ng.IServiceProvider; - } - - } - -} diff --git a/angular/legacy/angular-1.2-tests.ts b/angular/legacy/angular-1.2-tests.ts deleted file mode 100644 index d618fa8d25..0000000000 --- a/angular/legacy/angular-1.2-tests.ts +++ /dev/null @@ -1,571 +0,0 @@ - - -// issue: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/369 -// https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js -/** - * @license HTTP Auth Interceptor Module for AngularJS - * (c) 2012 Witold Szczerba - * License: MIT - */ - -class AuthService { - /** - * Holds all the requests which failed due to 401 response, - * so they can be re-requested in future, once login is completed. - */ - buffer: { config: ng.IRequestConfig; deferred: ng.IDeferred; }[] = []; - - /** - * Required by HTTP interceptor. - * Function is attached to provider to be invisible for regular users of this service. - */ - pushToBuffer = function(config: ng.IRequestConfig, deferred: ng.IDeferred) { - this.buffer.push({ - config: config, - deferred: deferred - }); - } - - $get = [ - '$rootScope', '$injector', function($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) { - var $http: ng.IHttpService; //initialized later because of circular dependency problem - function retry(config: ng.IRequestConfig, deferred: ng.IDeferred) { - $http = $http || $injector.get('$http'); - $http(config).then(function (response) { - deferred.resolve(response); - }); - } - function retryAll() { - for (var i = 0; i < this.buffer.length; ++i) { - retry(this.buffer[i].config, this.buffer[i].deferred); - } - this.buffer = []; - } - - return { - loginConfirmed: function () { - $rootScope.$broadcast('event:auth-loginConfirmed'); - retryAll(); - } - } - } - ]; -} - -angular.module('http-auth-interceptor', []) - - .provider('authService', AuthService) - -/** - * $http interceptor. - * On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'. - */ - .config(['$httpProvider', 'authServiceProvider', function ($httpProvider: ng.IHttpProvider, authServiceProvider: any) { - - var interceptor = ['$rootScope', '$q', function ($rootScope: ng.IScope, $q: ng.IQService) { - function success(response: ng.IHttpPromiseCallbackArg) { - return response; - } - - function error(response: ng.IHttpPromiseCallbackArg) { - if (response.status === 401) { - var deferred = $q.defer(); - authServiceProvider.pushToBuffer(response.config, deferred); - $rootScope.$broadcast('event:auth-loginRequired'); - return deferred.promise; - } - // otherwise - return $q.reject(response); - } - - return function (promise: ng.IHttpPromise) { - return promise.then(success, error); - } - - }]; - $httpProvider.responseInterceptors.push(interceptor); - }]); - - -namespace HttpAndRegularPromiseTests { - interface Person { - firstName: string; - lastName: string; - } - - interface ExpectedResponse extends Person { } - - interface SomeControllerScope extends ng.IScope { - person: Person; - theAnswer: number; - letters: string[]; - snack: string; - nothing?: string; - } - - var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => { - $http.get("http://somewhere/some/resource") - .success((data: ExpectedResponse) => { - $scope.person = data; - }); - - $http.get("http://somewhere/some/resource") - .then((response: ng.IHttpPromiseCallbackArg) => { - // typing lost, so something like - // var i: number = response.data - // would type check - $scope.person = response.data; - }); - - $http.get("http://somewhere/some/resource") - .then((response: ng.IHttpPromiseCallbackArg) => { - // typing lost, so something like - // var i: number = response.data - // would NOT type check - $scope.person = response.data; - }); - - var aPromise: ng.IPromise = $q.when({ firstName: "Jack", lastName: "Sparrow" }); - aPromise.then((person: Person) => { - $scope.person = person; - }); - - var bPromise: ng.IPromise = $q.when(42); - bPromise.then((answer: number) => { - $scope.theAnswer = answer; - }); - - var cPromise: ng.IPromise = $q.when(["a", "b", "c"]); - cPromise.then((letters: string[]) => { - $scope.letters = letters; - }); - - // When $q.when is passed an IPromise, it returns an IPromise - var dPromise: ng.IPromise = $q.when($q.when("ALBATROSS!")); - dPromise.then((snack: string) => { - $scope.snack = snack; - }); - - // $q.when may be called without arguments - var ePromise: ng.IPromise = $q.when(); - ePromise.then(() => { - $scope.nothing = "really nothing"; - }); - } - - // Test that we can pass around a type-checked success/error Promise Callback - var anotherController: Function = ($scope: SomeControllerScope, $http: - ng.IHttpService, $q: ng.IQService) => { - - var buildFooData: Function = () => 42; - - var doFoo: Function = (callback: ng.IHttpPromiseCallback) => { - $http.get('/foo', buildFooData()) - .success(callback); - } - - doFoo((data: any) => console.log(data)); - } -} - -// Test for AngularJS Syntax - -namespace My.Namespace { - export var x: any; // need to export something for module to kick in -} - -// IModule Registering Test -var mod = angular.module('tests', []); -mod.controller('name', function ($scope: ng.IScope) { }) -mod.controller('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.controller(My.Namespace); -mod.directive('name', function ($scope: ng.IScope) { }) -mod.directive('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.directive(My.Namespace); -mod.factory('name', function ($scope: ng.IScope) { }) -mod.factory('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.factory(My.Namespace); -mod.filter('name', function ($scope: ng.IScope) { }) -mod.filter('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.filter(My.Namespace); -mod.provider('name', function ($scope: ng.IScope) { return { $get: () => { } } }) -mod.provider('name', TestProvider); -mod.provider('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.provider(My.Namespace); -mod.service('name', function ($scope: ng.IScope) { }) -mod.service('name', ['$scope', function ($scope: ng.IScope) { }]) -mod.service(My.Namespace); -mod.constant('name', 23); -mod.constant('name', "23"); -mod.constant(My.Namespace); -mod.value('name', 23); -mod.value('name', "23"); -mod.value(My.Namespace); - -class TestProvider implements ng.IServiceProvider { - constructor(private $scope: ng.IScope) { - } - - $get() { - } -} - -// Promise signature tests -var foo: ng.IPromise; -foo.then((x) => { - // x is inferred to be a number - return "asdf"; -}).then((x) => { - // x is inferred to be string - x.length; - return 123; -}).then((x) => { - // x is infered to be a number - x.toFixed(); - return; -}).then((x) => { - // x is infered to be void - // Typescript will prevent you to actually use x as a local variable - // Try object: - return { a: 123 }; -}).then((x) => { - // Object is inferred here - x.a = 123; - //Try a promise - var y: ng.IPromise; - return y; -}).then((x) => { - // x is infered to be a number, which is the resolved value of a promise - x.toFixed(); -}); - - -var httpFoo: ng.IHttpPromise; -httpFoo.then((x) => { - // When returning a promise the generic type must be inferred. - var innerPromise : ng.IPromise; - return innerPromise; -}).then((x) => { - // must still be number. - x.toFixed(); -}); - - -function test_angular_forEach() { - var values: { [key: string]: string } = { name: 'misko', gender: 'male' }; - var log: string[] = []; - angular.forEach(values, function (value, key) { - this.push(key + ': ' + value); - }, log); - //expect(log).toEqual(['name: misko', 'gender: male']); -} - -// angular.element() tests -var element = angular.element("div.myApp"); -var scope: ng.IScope = element.scope(); -var isolateScope: ng.IScope = element.isolateScope(); - - - -function test_IAttributes(attributes: ng.IAttributes){ - return attributes; -} - -test_IAttributes({ - $addClass: function (classVal){}, - $removeClass: function(classVal){}, - $set: function(key, value){}, - $observe: function(name, fn){ - return fn; - }, - $attr: {} -}); - -class SampleDirective implements ng.IDirective { - public restrict = 'A'; - name = 'doh'; - - compile(templateElement: ng.IAugmentedJQuery) { - return { - post: this.link - }; - } - - static instance():ng.IDirective { - return new SampleDirective(); - } - - link(scope: ng.IScope) { - - } -} - -class SampleDirective2 implements ng.IDirective { - public restrict = 'EAC'; - - compile(templateElement: ng.IAugmentedJQuery) { - return { - pre: this.link - }; - } - - static instance():ng.IDirective { - return new SampleDirective2(); - } - - link(scope: ng.IScope) { - - } -} - -angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance); - -// test from https://docs.angularjs.org/guide/directive -angular.module('docsSimpleDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .directive('myCustomer', function() { - return { - template: 'Name: {{customer.name}} Address: {{customer.address}}' - }; - }); - -angular.module('docsTemplateUrlDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .directive('myCustomer', function() { - return { - templateUrl: 'my-customer.html' - }; - }); - -angular.module('docsRestrictDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - templateUrl: 'my-customer.html' - }; - }); - -angular.module('docsScopeProblemExample', []) - .controller('NaomiController', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Naomi', - address: '1600 Amphitheatre' - }; - }]) - .controller('IgorController', ['$scope', function($scope: any) { - $scope.customer = { - name: 'Igor', - address: '123 Somewhere' - }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - templateUrl: 'my-customer.html' - }; - }); - -angular.module('docsIsolateScopeDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; - $scope.igor = { name: 'Igor', address: '123 Somewhere' }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - scope: { - customerInfo: '=info' - }, - templateUrl: 'my-customer-iso.html' - }; - }); - -angular.module('docsIsolationExample', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' }; - $scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' }; - }]) - .directive('myCustomer', function() { - return { - restrict: 'E', - scope: { - customerInfo: '=info' - }, - templateUrl: 'my-customer-plus-vojta.html' - }; - }); - -angular.module('docsTimeDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.format = 'M/d/yy h:mm:ss a'; - }]) - .directive('myCurrentTime', ['$interval', 'dateFilter', function($interval: any, dateFilter: any) { - - return { - link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs:ng.IAttributes) { - var format: any, - timeoutId: any; - - function updateTime() { - element.text(dateFilter(new Date(), format)); - } - - scope.$watch(attrs['myCurrentTime'], function (value: any) { - format = value; - updateTime(); - }); - - element.on('$destroy', function () { - $interval.cancel(timeoutId); - }); - - // start the UI update process; save the timeoutId for canceling - timeoutId = $interval(function () { - updateTime(); // update DOM - }, 1000); - } - }; - }]); - -angular.module('docsTransclusionDirective', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.name = 'Tobias'; - }]) - .directive('myDialog', function() { - return { - restrict: 'E', - transclude: true, - templateUrl: 'my-dialog.html' - }; - }); - -angular.module('docsTransclusionExample', []) - .controller('Controller', ['$scope', function($scope: any) { - $scope.name = 'Tobias'; - }]) - .directive('myDialog', function() { - return { - restrict: 'E', - transclude: true, - scope: {}, - templateUrl: 'my-dialog.html', - link: function (scope: ng.IScope, element: ng.IAugmentedJQuery) { - scope['name'] = 'Jeff'; - } - }; - }); - -angular.module('docsIsoFnBindExample', []) - .controller('Controller', ['$scope', '$timeout', function($scope: any, $timeout: any) { - $scope.name = 'Tobias'; - $scope.hideDialog = function () { - $scope.dialogIsHidden = true; - $timeout(function () { - $scope.dialogIsHidden = false; - }, 2000); - }; - }]) - .directive('myDialog', function() { - return { - restrict: 'E', - transclude: true, - scope: { - 'close': '&onClose' - }, - templateUrl: 'my-dialog-close.html' - }; - }); - -angular.module('dragModule', []) - .directive('myDraggable', ['$document', function($document: any) { - return function(scope: any, element: any, attr: any) { - var startX = 0, startY = 0, x = 0, y = 0; - - element.css({ - position: 'relative', - border: '1px solid red', - backgroundColor: 'lightgrey', - cursor: 'pointer' - }); - - element.on('mousedown', function(event: any) { - // Prevent default dragging of selected content - event.preventDefault(); - startX = event.pageX - x; - startY = event.pageY - y; - $document.on('mousemove', mousemove); - $document.on('mouseup', mouseup); - }); - - function mousemove(event: any) { - y = event.pageY - startY; - x = event.pageX - startX; - element.css({ - top: y + 'px', - left: x + 'px' - }); - } - - function mouseup() { - $document.off('mousemove', mousemove); - $document.off('mouseup', mouseup); - } - }; - }]); - -angular.module('docsTabsExample', []) - .directive('myTabs', function() { - return { - restrict: 'E', - transclude: true, - scope: {}, - controller: function($scope: ng.IScope) { - var panes: any = $scope['panes'] = []; - - $scope['select'] = function(pane: any) { - angular.forEach(panes, function(pane: any) { - pane.selected = false; - }); - pane.selected = true; - }; - - this.addPane = function(pane: any) { - if (panes.length === 0) { - $scope['select'](pane); - } - panes.push(pane); - }; - }, - templateUrl: 'my-tabs.html' - }; - }) - .directive('myPane', function() { - return { - require: '^myTabs', - restrict: 'E', - transclude: true, - scope: { - title: '@' - }, - link: function(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, tabsCtrl: any) { - tabsCtrl.addPane(scope); - }, - templateUrl: 'my-pane.html' - }; - }); diff --git a/angular/legacy/angular-1.2.d.ts b/angular/legacy/angular-1.2.d.ts deleted file mode 100644 index 2c4fd8d014..0000000000 --- a/angular/legacy/angular-1.2.d.ts +++ /dev/null @@ -1,1189 +0,0 @@ -// Type definitions for Angular JS 1.2+ -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -/// - -declare var angular: ng.IAngularStatic; - -// Support for painless dependency injection -interface Function { - $inject?: string[]; -} - -/////////////////////////////////////////////////////////////////////////////// -// ng module (angular.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng { - - // not directly implemented, but ensures that constructed class implements $get - interface IServiceProviderClass { - new(...args: any[]): IServiceProvider; - } - - interface IServiceProviderFactory { - (...args: any[]): IServiceProvider; - } - - // All service providers extend this interface - interface IServiceProvider { - $get: any; - } - - /////////////////////////////////////////////////////////////////////////// - // AngularStatic - // see http://docs.angularjs.org/api - /////////////////////////////////////////////////////////////////////////// - interface IAngularStatic { - bind(context: any, fn: Function, ...args: any[]): Function; - bootstrap(element: string, modules?: any[]): auto.IInjectorService; - bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService; - bootstrap(element: Element, modules?: any[]): auto.IInjectorService; - bootstrap(element: Document, modules?: any[]): auto.IInjectorService; - copy(source: any, destination?: any): any; - element: IAugmentedJQueryStatic; - equals(value1: any, value2: any): boolean; - extend(destination: any, ...sources: any[]): any; - - /** - * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. - * - * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. - * - * @param obj Object to iterate over. - * @param iterator Iterator function. - * @param context Object to become context (this) for the iterator function. - */ - forEach(obj: T[], iterator: (value: T, key: number) => any, context?: any): any; - /** - * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. - * - * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. - * - * @param obj Object to iterate over. - * @param iterator Iterator function. - * @param context Object to become context (this) for the iterator function. - */ - forEach(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any; - /** - * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. - * - * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. - * - * @param obj Object to iterate over. - * @param iterator Iterator function. - * @param context Object to become context (this) for the iterator function. - */ - forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any; - - fromJson(json: string): any; - identity(arg?: any): any; - injector(modules?: any[]): auto.IInjectorService; - isArray(value: any): boolean; - isDate(value: any): boolean; - isDefined(value: any): boolean; - isElement(value: any): boolean; - isFunction(value: any): boolean; - isNumber(value: any): boolean; - isObject(value: any): boolean; - isString(value: any): boolean; - isUndefined(value: any): boolean; - lowercase(str: string): string; - - /** - * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. - * - * When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved. - * - * @param name The name of the module to create or retrieve. - * @param requires The names of modules this module depends on. If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. - * @param configFn Optional configuration function for the module. - */ - module( - name: string, - requires?: string[], - configFn?: Function): IModule; - - noop(...args: any[]): void; - toJson(obj: any, pretty?: boolean): string; - uppercase(str: string): string; - version: { - full: string; - major: number; - minor: number; - dot: number; - codename: string; - }; - } - - /////////////////////////////////////////////////////////////////////////// - // Module - // see http://docs.angularjs.org/api/angular.Module - /////////////////////////////////////////////////////////////////////////// - interface IModule { - animation(name: string, animationFactory: Function): IModule; - animation(name: string, inlineAnnotatedFunction: any[]): IModule; - animation(object: Object): IModule; - /** - * Use this method to register work which needs to be performed on module loading. - * - * @param configFn Execute this function on module load. Useful for service configuration. - */ - config(configFn: Function): IModule; - /** - * Use this method to register work which needs to be performed on module loading. - * - * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration. - */ - config(inlineAnnotatedFunction: any[]): IModule; - /** - * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. - * - * @param name The name of the constant. - * @param value The constant value. - */ - constant(name: string, value: any): IModule; - constant(object: Object): IModule; - /** - * The $controller service is used by Angular to create new controllers. - * - * This provider allows controller registration via the register method. - * - * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. - * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). - */ - controller(name: string, controllerConstructor: Function): IModule; - /** - * The $controller service is used by Angular to create new controllers. - * - * This provider allows controller registration via the register method. - * - * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. - * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). - */ - controller(name: string, inlineAnnotatedConstructor: any[]): IModule; - controller(object : Object): IModule; - directive(name: string, directiveFactory: IDirectiveFactory): IModule; - directive(name: string, inlineAnnotatedFunction: any[]): IModule; - directive(object: Object): IModule; - /** - * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. - * - * @param name The name of the instance. - * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). - */ - factory(name: string, $getFn: Function): IModule; - /** - * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. - * - * @param name The name of the instance. - * @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). - */ - factory(name: string, inlineAnnotatedFunction: any[]): IModule; - factory(object: Object): IModule; - filter(name: string, filterFactoryFunction: Function): IModule; - filter(name: string, inlineAnnotatedFunction: any[]): IModule; - filter(object: Object): IModule; - provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule; - provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule; - provider(name: string, inlineAnnotatedConstructor: any[]): IModule; - provider(name: string, providerObject: IServiceProvider): IModule; - provider(object: Object): IModule; - /** - * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. - */ - run(initializationFunction: Function): IModule; - /** - * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. - */ - run(inlineAnnotatedFunction: any[]): IModule; - service(name: string, serviceConstructor: Function): IModule; - service(name: string, inlineAnnotatedConstructor: any[]): IModule; - service(object: Object): IModule; - /** - * Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get property is a factory function that takes no arguments and returns the value service. - - Value services are similar to constant services, except that they cannot be injected into a module configuration function (see config) but they can be overridden by an Angular decorator. - * - * @param name The name of the instance. - * @param value The value. - */ - value(name: string, value: any): IModule; - value(object: Object): IModule; - - // Properties - name: string; - requires: string[]; - } - - /////////////////////////////////////////////////////////////////////////// - // Attributes - // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes - /////////////////////////////////////////////////////////////////////////// - interface IAttributes { - // this is necessary to be able to access the scoped attributes. it's not very elegant - // because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way - // this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 - [name: string]: any; - - // Adds the CSS class value specified by the classVal parameter to the - // element. If animations are enabled then an animation will be triggered - // for the class addition. - $addClass(classVal: string): void; - - // Removes the CSS class value specified by the classVal parameter from the - // element. If animations are enabled then an animation will be triggered for - // the class removal. - $removeClass(classVal: string): void; - - // Set DOM element attribute value. - $set(key: string, value: any): void; - - // Observes an interpolated attribute. - // The observer function will be invoked once during the next $digest - // following compilation. The observer is then invoked whenever the - // interpolated value changes. - $observe(name: string, fn:(value?:any)=>any): Function; - - // A map of DOM element attribute names to the normalized name. This is needed - // to do reverse lookup from normalized name back to actual name. - $attr: Object; - } - - /** - * form.FormController - type in module ng - * see https://docs.angularjs.org/api/ng/type/form.FormController - */ - interface IFormController { - - /** - * Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272 - */ - [name: string]: any; - - $pristine: boolean; - $dirty: boolean; - $valid: boolean; - $invalid: boolean; - $error: any; - $addControl(control: ng.INgModelController): void; - $removeControl(control: ng.INgModelController): void; - $setValidity(validationErrorKey: string, isValid: boolean, control: ng.INgModelController): void; - $setDirty(): void; - $setPristine(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // NgModelController - // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController - /////////////////////////////////////////////////////////////////////////// - interface INgModelController { - $render(): void; - $setValidity(validationErrorKey: string, isValid: boolean): void; - // Documentation states viewValue and modelValue to be a string but other - // types do work and it's common to use them. - $setViewValue(value: any): void; - $viewValue: any; - - $modelValue: any; - - $parsers: IModelParser[]; - $formatters: IModelFormatter[]; - $viewChangeListeners: IModelViewChangeListener[]; - $error: any; - $pristine: boolean; - $dirty: boolean; - $valid: boolean; - $invalid: boolean; - } - - interface IModelParser { - (value: any): any; - } - - interface IModelFormatter { - (value: any): any; - } - - interface IModelViewChangeListener { - (): void; - } - - /////////////////////////////////////////////////////////////////////////// - // Scope and RootScope - // see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and http://docs.angularjs.org/api/ng.$rootScope - /////////////////////////////////////////////////////////////////////////// - interface IRootScopeService { - $apply(): any; - $apply(exp: string): any; - $apply(exp: (scope: IScope) => any): any; - - $broadcast(name: string, ...args: any[]): IAngularEvent; - $destroy(): void; - $digest(): void; - $emit(name: string, ...args: any[]): IAngularEvent; - - // Documentation says exp is optional, but actual implementaton counts on it - $eval(expression: string, args?: Object): any; - $eval(expression: (scope: IScope) => any, args?: Object): any; - - // Documentation says exp is optional, but actual implementaton counts on it - $evalAsync(expression: string): void; - $evalAsync(expression: (scope: IScope) => any): void; - - // Defaults to false by the implementation checking strategy - $new(isolate?: boolean): IScope; - - $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; - - $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function; - $watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function; - $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function; - $watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function; - - $watchCollection(watchExpression: string, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - $watchCollection(watchExpression: (scope: IScope) => any, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - - $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - $watchGroup(watchExpressions: {(scope: IScope) : any}[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - - $parent: IScope; - - $root: IRootScopeService; - this: IRootScopeService; - - $id: string; - - // Hidden members - $$isolateBindings: any; - $$phase: any; - } - - interface IScope extends IRootScopeService { - [index: string]: any; - } - - interface IAngularEvent { - targetScope: IScope; - currentScope: IScope; - name: string; - preventDefault: Function; - defaultPrevented: boolean; - - // Available only events that were $emit-ted - stopPropagation?: Function; - } - - /////////////////////////////////////////////////////////////////////////// - // WindowService - // see http://docs.angularjs.org/api/ng.$window - /////////////////////////////////////////////////////////////////////////// - interface IWindowService extends Window { - [key: string]: any; - } - - /////////////////////////////////////////////////////////////////////////// - // BrowserService - // TODO undocumented, so we need to get it from the source code - /////////////////////////////////////////////////////////////////////////// - interface IBrowserService { - [key: string]: any; - } - - /////////////////////////////////////////////////////////////////////////// - // TimeoutService - // see http://docs.angularjs.org/api/ng.$timeout - /////////////////////////////////////////////////////////////////////////// - interface ITimeoutService { - (func: Function, delay?: number, invokeApply?: boolean): IPromise; - cancel(promise: IPromise): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // IntervalService - // see http://docs.angularjs.org/api/ng.$interval - /////////////////////////////////////////////////////////////////////////// - interface IIntervalService { - (func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise; - cancel(promise: IPromise): boolean; - } - - /** - * The animation object which contains callback functions for each event that is expected to be animated. - */ - interface IAnimateCallbackObject { - eventFn(element: Node, doneFn: () => void): Function; - } - - /////////////////////////////////////////////////////////////////////////// - // FilterService - // see http://docs.angularjs.org/api/ng.$filter - // see http://docs.angularjs.org/api/ng.$filterProvider - /////////////////////////////////////////////////////////////////////////// - interface IFilterService { - (name: string): Function; - } - - interface IFilterProvider extends IServiceProvider { - register(name: string, filterFactory: Function): IServiceProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // LocaleService - // see http://docs.angularjs.org/api/ng.$locale - /////////////////////////////////////////////////////////////////////////// - interface ILocaleService { - id: string; - - // These are not documented - // Check angular's i18n files for exemples - NUMBER_FORMATS: ILocaleNumberFormatDescriptor; - DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor; - pluralCat: (num: any) => string; - } - - interface ILocaleNumberFormatDescriptor { - DECIMAL_SEP: string; - GROUP_SEP: string; - PATTERNS: ILocaleNumberPatternDescriptor[]; - CURRENCY_SYM: string; - } - - interface ILocaleNumberPatternDescriptor { - minInt: number; - minFrac: number; - maxFrac: number; - posPre: string; - posSuf: string; - negPre: string; - negSuf: string; - gSize: number; - lgSize: number; - } - - interface ILocaleDateTimeFormatDescriptor { - MONTH: string[]; - SHORTMONTH: string[]; - DAY: string[]; - SHORTDAY: string[]; - AMPMS: string[]; - medium: string; - short: string; - fullDate: string; - longDate: string; - mediumDate: string; - shortDate: string; - mediumTime: string; - shortTime: string; - } - - /////////////////////////////////////////////////////////////////////////// - // LogService - // see http://docs.angularjs.org/api/ng.$log - // see http://docs.angularjs.org/api/ng.$logProvider - /////////////////////////////////////////////////////////////////////////// - interface ILogService { - debug: ILogCall; - error: ILogCall; - info: ILogCall; - log: ILogCall; - warn: ILogCall; - } - - interface ILogProvider { - debugEnabled(enabled: boolean): ILogProvider; - debugEnabled(): boolean; - } - - // We define this as separete interface so we can reopen it later for - // the ngMock module. - interface ILogCall { - (...args: any[]): void; - } - - /////////////////////////////////////////////////////////////////////////// - // ParseService - // see http://docs.angularjs.org/api/ng.$parse - // see http://docs.angularjs.org/api/ng.$parseProvider - /////////////////////////////////////////////////////////////////////////// - interface IParseService { - (expression: string): ICompiledExpression; - } - - interface IParseProvider { - logPromiseWarnings(): boolean; - logPromiseWarnings(value: boolean): IParseProvider; - - unwrapPromises(): boolean; - unwrapPromises(value: boolean): IParseProvider; - } - - interface ICompiledExpression { - (context: any, locals?: any): any; - - // If value is not provided, undefined is gonna be used since the implementation - // does not check the parameter. Let's force a value for consistency. If consumer - // whants to undefine it, pass the undefined value explicitly. - assign(context: any, value: any): any; - } - - /////////////////////////////////////////////////////////////////////////// - // LocationService - // see http://docs.angularjs.org/api/ng.$location - // see http://docs.angularjs.org/api/ng.$locationProvider - // see http://docs.angularjs.org/guide/dev_guide.services.$location - /////////////////////////////////////////////////////////////////////////// - interface ILocationService { - absUrl(): string; - hash(): string; - hash(newHash: string): ILocationService; - host(): string; - path(): string; - path(newPath: string): ILocationService; - port(): number; - protocol(): string; - replace(): ILocationService; - search(): any; - search(parametersMap: any): ILocationService; - search(parameter: string, parameterValue: any): ILocationService; - url(): string; - url(url: string): ILocationService; - } - - interface ILocationProvider extends IServiceProvider { - hashPrefix(): string; - hashPrefix(prefix: string): ILocationProvider; - html5Mode(): boolean; - - // Documentation states that parameter is string, but - // implementation tests it as boolean, which makes more sense - // since this is a toggler - html5Mode(active: boolean): ILocationProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // DocumentService - // see http://docs.angularjs.org/api/ng.$document - /////////////////////////////////////////////////////////////////////////// - interface IDocumentService extends IAugmentedJQuery {} - - /////////////////////////////////////////////////////////////////////////// - // ExceptionHandlerService - // see http://docs.angularjs.org/api/ng.$exceptionHandler - /////////////////////////////////////////////////////////////////////////// - interface IExceptionHandlerService { - (exception: Error, cause?: string): void; - } - - /////////////////////////////////////////////////////////////////////////// - // RootElementService - // see http://docs.angularjs.org/api/ng.$rootElement - /////////////////////////////////////////////////////////////////////////// - interface IRootElementService extends JQuery {} - - /** - * $q - service in module ng - * A promise/deferred implementation inspired by Kris Kowal's Q. - * See http://docs.angularjs.org/api/ng/service/$q - */ - interface IQService { - /** - * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. - * - * Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. - * - * @param promises An array or hash of promises. - */ - all(promises: IPromise[]): IPromise; - /** - * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. - * - * Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. - * - * @param promises An array or hash of promises. - */ - all(promises: { [id: string]: IPromise; }): IPromise<{ [id: string]: any }>; - /** - * Creates a Deferred object which represents a task which will finish in the future. - */ - defer(): IDeferred; - /** - * Creates a promise that is resolved as rejected with the specified reason. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it. - * - * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of reject as the throw keyword in JavaScript. This also means that if you "catch" an error via a promise error callback and you want to forward the error to the promise derived from the current promise, you have to "rethrow" the error by returning a rejection constructed via reject. - * - * @param reason Constant, message, exception or an object representing the rejection reason. - */ - reject(reason?: any): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - * - * @param value Value or a promise - */ - when(value: IPromise): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - * - * @param value Value or a promise - */ - when(value: T): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - * - * @param value Value or a promise - */ - when(): IPromise; - } - - interface IPromise { - then(successCallback: (promiseValue: T) => IHttpPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; - then(successCallback: (promiseValue: T) => IPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; - then(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult, notifyCallback?: (state: any) => any): IPromise; - - - catch(onRejected: (reason: any) => IHttpPromise): IPromise; - catch(onRejected: (reason: any) => IPromise): IPromise; - catch(onRejected: (reason: any) => TResult): IPromise; - - finally(finallyCallback: ()=>any):IPromise; - } - - interface IDeferred { - resolve(value?: T): void; - reject(reason?: any): void; - notify(state?:any): void; - promise: IPromise; - } - - /////////////////////////////////////////////////////////////////////////// - // AnchorScrollService - // see http://docs.angularjs.org/api/ng.$anchorScroll - /////////////////////////////////////////////////////////////////////////// - interface IAnchorScrollService { - (): void; - } - - interface IAnchorScrollProvider extends IServiceProvider { - disableAutoScrolling(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // CacheFactoryService - // see http://docs.angularjs.org/api/ng.$cacheFactory - /////////////////////////////////////////////////////////////////////////// - interface ICacheFactoryService { - // Lets not foce the optionsMap to have the capacity member. Even though - // it's the ONLY option considered by the implementation today, a consumer - // might find it useful to associate some other options to the cache object. - //(cacheId: string, optionsMap?: { capacity: number; }): CacheObject; - (cacheId: string, optionsMap?: { capacity: number; }): ICacheObject; - - // Methods bellow are not documented - info(): any; - get (cacheId: string): ICacheObject; - } - - interface ICacheObject { - info(): { - id: string; - size: number; - - // Not garanteed to have, since it's a non-mandatory option - //capacity: number; - }; - put(key: string, value?: any): void; - get (key: string): any; - remove(key: string): void; - removeAll(): void; - destroy(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // CompileService - // see http://docs.angularjs.org/api/ng.$compile - // see http://docs.angularjs.org/api/ng.$compileProvider - /////////////////////////////////////////////////////////////////////////// - interface ICompileService { - (element: string, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; - (element: Element, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; - (element: JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; - } - - interface ICompileProvider extends IServiceProvider { - directive(name: string, directiveFactory: Function): ICompileProvider; - - // Undocumented, but it is there... - directive(directivesMap: any): ICompileProvider; - - aHrefSanitizationWhitelist(): RegExp; - aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider; - - imgSrcSanitizationWhitelist(): RegExp; - imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider; - } - - interface ICloneAttachFunction { - // Let's hint but not force cloneAttachFn's signature - (clonedElement?: JQuery, scope?: IScope): any; - } - - // This corresponds to the "publicLinkFn" returned by $compile. - interface ITemplateLinkingFunction { - (scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; - } - - // This corresponds to $transclude (and also the transclude function passed to link). - interface ITranscludeFunction { - // If the scope is provided, then the cloneAttachFn must be as well. - (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery; - // If one argument is provided, then it's assumed to be the cloneAttachFn. - (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; - } - - /////////////////////////////////////////////////////////////////////////// - // ControllerService - // see http://docs.angularjs.org/api/ng.$controller - // see http://docs.angularjs.org/api/ng.$controllerProvider - /////////////////////////////////////////////////////////////////////////// - interface IControllerService { - // Although the documentation doesn't state this, locals are optional - (controllerConstructor: Function, locals?: any): any; - (controllerName: string, locals?: any): any; - } - - interface IControllerProvider extends IServiceProvider { - register(name: string, controllerConstructor: Function): void; - register(name: string, dependencyAnnotatedConstructor: any[]): void; - } - - /** - * HttpService - * see http://docs.angularjs.org/api/ng/service/$http - */ - interface IHttpService { - /** - * Object describing the request to be made and how it should be processed. - */ - (config: IRequestConfig): IHttpPromise; - - /** - * Shortcut method to perform GET request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - get(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform DELETE request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - delete(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform HEAD request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - head(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform JSONP request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - jsonp(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform POST request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param data Request content - * @param config Optional configuration object - */ - post(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform PUT request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param data Request content - * @param config Optional configuration object - */ - put(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations. - */ - defaults: IRequestConfig; - - /** - * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes. - */ - pendingRequests: any[]; - } - - /** - * Object describing the request to be made and how it should be processed. - * see http://docs.angularjs.org/api/ng/service/$http#usage - */ - interface IRequestShortcutConfig { - /** - * {Object.} - * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified. - */ - params?: any; - - /** - * Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent. - */ - headers?: any; - - /** - * Name of HTTP header to populate with the XSRF token. - */ - xsrfHeaderName?: string; - - /** - * Name of cookie containing the XSRF token. - */ - xsrfCookieName?: string; - - /** - * {boolean|Cache} - * If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching. - */ - cache?: any; - - /** - * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information. - */ - withCredentials?: boolean; - - /** - * {string|Object} - * Data to be sent as the request message data. - */ - data?: any; - - /** - * {function(data, headersGetter)|Array.} - * Transform function or an array of such functions. The transform function takes the http request body and headers and returns its transformed (typically serialized) version. - */ - transformRequest?: any; - - /** - * {function(data, headersGetter)|Array.} - * Transform function or an array of such functions. The transform function takes the http response body and headers and returns its transformed (typically deserialized) version. - */ - transformResponse?: any; - - /** - * {number|Promise} - * Timeout in milliseconds, or promise that should abort the request when resolved. - */ - timeout?: any; - - /** - * See requestType. - */ - responseType?: string; - } - - /** - * Object describing the request to be made and how it should be processed. - * see http://docs.angularjs.org/api/ng/service/$http#usage - */ - interface IRequestConfig extends IRequestShortcutConfig { - /** - * HTTP method (e.g. 'GET', 'POST', etc) - */ - method: string; - /** - * Absolute or relative URL of the resource that is being requested. - */ - url: string; - } - - interface IHttpPromiseCallback { - (data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): void; - } - - interface IHttpPromiseCallbackArg { - data?: T; - status?: number; - headers?: (headerName: string) => string; - config?: IRequestConfig; - statusText?: string; - } - - interface IHttpPromise extends IPromise { - success(callback: IHttpPromiseCallback): IHttpPromise; - error(callback: IHttpPromiseCallback): IHttpPromise; - then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; - then(successCallback: (response: IHttpPromiseCallbackArg) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; - } - - interface IHttpProvider extends IServiceProvider { - defaults: IRequestConfig; - interceptors: any[]; - responseInterceptors: any[]; - } - - /////////////////////////////////////////////////////////////////////////// - // HttpBackendService - // see http://docs.angularjs.org/api/ng.$httpBackend - // You should never need to use this service directly. - /////////////////////////////////////////////////////////////////////////// - interface IHttpBackendService { - // XXX Perhaps define callback signature in the future - (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; - } - - /////////////////////////////////////////////////////////////////////////// - // InterpolateService - // see http://docs.angularjs.org/api/ng.$interpolate - // see http://docs.angularjs.org/api/ng.$interpolateProvider - /////////////////////////////////////////////////////////////////////////// - interface IInterpolateService { - (text: string, mustHaveExpression?: boolean): IInterpolationFunction; - endSymbol(): string; - startSymbol(): string; - } - - interface IInterpolationFunction { - (context: any): string; - } - - interface IInterpolateProvider extends IServiceProvider { - startSymbol(): string; - startSymbol(value: string): IInterpolateProvider; - endSymbol(): string; - endSymbol(value: string): IInterpolateProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // TemplateCacheService - // see http://docs.angularjs.org/api/ng.$templateCache - /////////////////////////////////////////////////////////////////////////// - interface ITemplateCacheService extends ICacheObject {} - - /////////////////////////////////////////////////////////////////////////// - // SCEService - // see http://docs.angularjs.org/api/ng.$sce - /////////////////////////////////////////////////////////////////////////// - interface ISCEService { - getTrusted(type: string, mayBeTrusted: any): any; - getTrustedCss(value: any): any; - getTrustedHtml(value: any): any; - getTrustedJs(value: any): any; - getTrustedResourceUrl(value: any): any; - getTrustedUrl(value: any): any; - parse(type: string, expression: string): (context: any, locals: any) => any; - parseAsCss(expression: string): (context: any, locals: any) => any; - parseAsHtml(expression: string): (context: any, locals: any) => any; - parseAsJs(expression: string): (context: any, locals: any) => any; - parseAsResourceUrl(expression: string): (context: any, locals: any) => any; - parseAsUrl(expression: string): (context: any, locals: any) => any; - trustAs(type: string, value: any): any; - trustAsHtml(value: any): any; - trustAsJs(value: any): any; - trustAsResourceUrl(value: any): any; - trustAsUrl(value: any): any; - isEnabled(): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // SCEProvider - // see http://docs.angularjs.org/api/ng.$sceProvider - /////////////////////////////////////////////////////////////////////////// - interface ISCEProvider extends IServiceProvider { - enabled(value: boolean): void; - } - - /////////////////////////////////////////////////////////////////////////// - // SCEDelegateService - // see http://docs.angularjs.org/api/ng.$sceDelegate - /////////////////////////////////////////////////////////////////////////// - interface ISCEDelegateService { - getTrusted(type: string, mayBeTrusted: any): any; - trustAs(type: string, value: any): any; - valueOf(value: any): any; - } - - - /////////////////////////////////////////////////////////////////////////// - // SCEDelegateProvider - // see http://docs.angularjs.org/api/ng.$sceDelegateProvider - /////////////////////////////////////////////////////////////////////////// - interface ISCEDelegateProvider extends IServiceProvider { - resourceUrlBlacklist(blacklist: any[]): void; - resourceUrlWhitelist(whitelist: any[]): void; - } - - /////////////////////////////////////////////////////////////////////////// - // Directive - // see http://docs.angularjs.org/api/ng.$compileProvider#directive - // and http://docs.angularjs.org/guide/directive - /////////////////////////////////////////////////////////////////////////// - - interface IDirectiveFactory { - (...args: any[]): IDirective; - } - - interface IDirectiveLinkFn { - ( - scope: IScope, - instanceElement: IAugmentedJQuery, - instanceAttributes: IAttributes, - controller: any, - transclude: ITranscludeFunction - ): void; - } - - interface IDirectivePrePost { - pre?: IDirectiveLinkFn; - post?: IDirectiveLinkFn; - } - - interface IDirectiveCompileFn { - ( - templateElement: IAugmentedJQuery, - templateAttributes: IAttributes, - transclude: ITranscludeFunction - ): IDirectivePrePost; - } - - interface IDirective { - compile?: IDirectiveCompileFn; - controller?: any; - controllerAs?: string; - link?: IDirectiveLinkFn; - name?: string; - priority?: number; - replace?: boolean; - require?: any; - restrict?: string; - scope?: any; - template?: any; - templateUrl?: any; - terminal?: boolean; - transclude?: any; - } - - /////////////////////////////////////////////////////////////////////////// - // angular.element - // when calling angular.element, angular returns a jQuery object, - // augmented with additional methods like e.g. scope. - // see: http://docs.angularjs.org/api/angular.element - /////////////////////////////////////////////////////////////////////////// - interface IAugmentedJQueryStatic extends JQueryStatic { - (selector: string, context?: any): IAugmentedJQuery; - (element: Element): IAugmentedJQuery; - (object: {}): IAugmentedJQuery; - (elementArray: Element[]): IAugmentedJQuery; - (object: JQuery): IAugmentedJQuery; - (func: Function): IAugmentedJQuery; - (array: any[]): IAugmentedJQuery; - (): IAugmentedJQuery; - } - - interface IAugmentedJQuery extends JQuery { - // TODO: events, how to define? - //$destroy - - find(selector: string): IAugmentedJQuery; - find(element: any): IAugmentedJQuery; - find(obj: JQuery): IAugmentedJQuery; - - controller(name: string): any; - injector(): any; - scope(): IScope; - isolateScope(): IScope; - - inheritedData(key: string, value: any): JQuery; - inheritedData(obj: { [key: string]: any; }): JQuery; - inheritedData(key?: string): any; - } - - /////////////////////////////////////////////////////////////////////// - // AnimateService - // see http://docs.angularjs.org/api/ng.$animate - /////////////////////////////////////////////////////////////////////// - interface IAnimateService { - addClass(element: JQuery, className: string, done?: Function): void; - enter(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void; - leave(element: JQuery, done?: Function): void; - move(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void; - removeClass(element: JQuery, className: string, done?: Function): void; - } - - /////////////////////////////////////////////////////////////////////////// - // AUTO module (angular.js) - /////////////////////////////////////////////////////////////////////////// - export module auto { - - /////////////////////////////////////////////////////////////////////// - // InjectorService - // see http://docs.angularjs.org/api/AUTO.$injector - /////////////////////////////////////////////////////////////////////// - interface IInjectorService { - annotate(fn: Function): string[]; - annotate(inlineAnnotatedFunction: any[]): string[]; - get(name: string): any; - has(name: string): boolean; - instantiate(typeConstructor: Function, locals?: any): any; - invoke(inlineAnnotatedFunction: any[]): any; - invoke(func: Function, context?: any, locals?: any): any; - } - - /////////////////////////////////////////////////////////////////////// - // ProvideService - // see http://docs.angularjs.org/api/AUTO.$provide - /////////////////////////////////////////////////////////////////////// - interface IProvideService { - // Documentation says it returns the registered instance, but actual - // implementation does not return anything. - // constant(name: string, value: any): any; - /** - * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. - * - * @param name The name of the constant. - * @param value The constant value. - */ - constant(name: string, value: any): void; - - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * - * @param name The name of the service to decorate. - * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: - * - * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - decorator(name: string, decorator: Function): void; - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * - * @param name The name of the service to decorate. - * @param inlineAnnotatedFunction This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: - * - * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - decorator(name: string, inlineAnnotatedFunction: any[]): void; - factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider; - factory(name: string, inlineAnnotatedFunction: any[]): ng.IServiceProvider; - provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider; - provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider; - service(name: string, constructor: Function): ng.IServiceProvider; - value(name: string, value: any): ng.IServiceProvider; - } - - } -} diff --git a/angular/legacy/angular-1.4.d.ts b/angular/legacy/angular-1.4.d.ts deleted file mode 100644 index 61f4edad02..0000000000 --- a/angular/legacy/angular-1.4.d.ts +++ /dev/null @@ -1,1877 +0,0 @@ -// Type definitions for Angular JS 1.4+ -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -/// - -declare var angular: angular.IAngularStatic; - -// Support for painless dependency injection -interface Function { - $inject?: string[]; -} - -// Collapse angular into ng -import ng = angular; -// Support AMD require -declare module 'angular' { - export = angular; -} - -/////////////////////////////////////////////////////////////////////////////// -// ng module (angular.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace angular { - - // not directly implemented, but ensures that constructed class implements $get - interface IServiceProviderClass { - new (...args: any[]): IServiceProvider; - } - - interface IServiceProviderFactory { - (...args: any[]): IServiceProvider; - } - - // All service providers extend this interface - interface IServiceProvider { - $get: any; - } - - interface IAngularBootstrapConfig { - strictDi?: boolean; - debugInfoEnabled?: boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // AngularStatic - // see http://docs.angularjs.org/api - /////////////////////////////////////////////////////////////////////////// - interface IAngularStatic { - bind(context: any, fn: Function, ...args: any[]): Function; - - /** - * Use this function to manually start up angular application. - * - * @param element DOM element which is the root of angular application. - * @param modules An array of modules to load into the application. - * Each item in the array should be the name of a predefined module or a (DI annotated) - * function that will be invoked by the injector as a config block. - * @param config an object for defining configuration options for the application. The following keys are supported: - * - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. - */ - bootstrap(element: string|Element|JQuery|Document, modules?: (string|Function|any[])[], config?: IAngularBootstrapConfig): auto.IInjectorService; - - /** - * Creates a deep copy of source, which should be an object or an array. - * - * - If no destination is supplied, a copy of the object or array is created. - * - If a destination is provided, all of its elements (for array) or properties (for objects) are deleted and then all elements/properties from the source are copied to it. - * - If source is not an object or array (inc. null and undefined), source is returned. - * - If source is identical to 'destination' an exception will be thrown. - * - * @param source The source that will be used to make a copy. Can be any type, including primitives, null, and undefined. - * @param destination Destination into which the source is copied. If provided, must be of the same type as source. - */ - copy(source: T, destination?: T): T; - - /** - * Wraps a raw DOM element or HTML string as a jQuery element. - * - * If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element delegates to Angular's built-in subset of jQuery, called "jQuery lite" or "jqLite." - */ - element: IAugmentedJQueryStatic; - equals(value1: any, value2: any): boolean; - extend(destination: any, ...sources: any[]): any; - - /** - * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. - * - * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. - * - * @param obj Object to iterate over. - * @param iterator Iterator function. - * @param context Object to become context (this) for the iterator function. - */ - forEach(obj: T[], iterator: (value: T, key: number) => any, context?: any): any; - /** - * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. - * - * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. - * - * @param obj Object to iterate over. - * @param iterator Iterator function. - * @param context Object to become context (this) for the iterator function. - */ - forEach(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any; - /** - * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. - * - * It is worth noting that .forEach does not iterate over inherited properties because it filters using the hasOwnProperty method. - * - * @param obj Object to iterate over. - * @param iterator Iterator function. - * @param context Object to become context (this) for the iterator function. - */ - forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any; - - fromJson(json: string): any; - identity(arg?: T): T; - injector(modules?: any[], strictDi?: boolean): auto.IInjectorService; - isArray(value: any): boolean; - isDate(value: any): boolean; - isDefined(value: any): boolean; - isElement(value: any): boolean; - isFunction(value: any): boolean; - isNumber(value: any): boolean; - isObject(value: any): boolean; - isString(value: any): boolean; - isUndefined(value: any): boolean; - lowercase(str: string): string; - - /** - * Deeply extends the destination object dst by copying own enumerable properties from the src object(s) to dst. You can specify multiple src objects. If you want to preserve original objects, you can do so by passing an empty object as the target: var object = angular.merge({}, object1, object2). - * - * Unlike extend(), merge() recursively descends into object properties of source objects, performing a deep copy. - * - * @param dst Destination object. - * @param src Source object(s). - */ - merge(dst: any, ...src: any[]): any; - - /** - * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. - * - * When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved. - * - * @param name The name of the module to create or retrieve. - * @param requires The names of modules this module depends on. If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. - * @param configFn Optional configuration function for the module. - */ - module( - name: string, - requires?: string[], - configFn?: Function): IModule; - - noop(...args: any[]): void; - reloadWithDebugInfo(): void; - toJson(obj: any, pretty?: boolean): string; - uppercase(str: string): string; - version: { - full: string; - major: number; - minor: number; - dot: number; - codeName: string; - }; - - /** - * If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called. - * @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with. - */ - resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService; - } - - /////////////////////////////////////////////////////////////////////////// - // Module - // see http://docs.angularjs.org/api/angular.Module - /////////////////////////////////////////////////////////////////////////// - interface IModule { - animation(name: string, animationFactory: Function): IModule; - animation(name: string, inlineAnnotatedFunction: any[]): IModule; - animation(object: Object): IModule; - /** - * Use this method to register a component. - * - * @param name The name of the component. - * @param options A definition object passed into the component. - */ - component(name: string, options: IComponentOptions): IModule; - /** - * Use this method to register work which needs to be performed on module loading. - * - * @param configFn Execute this function on module load. Useful for service configuration. - */ - config(configFn: Function): IModule; - /** - * Use this method to register work which needs to be performed on module loading. - * - * @param inlineAnnotatedFunction Execute this function on module load. Useful for service configuration. - */ - config(inlineAnnotatedFunction: any[]): IModule; - config(object: Object): IModule; - /** - * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. - * - * @param name The name of the constant. - * @param value The constant value. - */ - constant(name: string, value: any): IModule; - constant(object: Object): IModule; - /** - * The $controller service is used by Angular to create new controllers. - * - * This provider allows controller registration via the register method. - * - * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. - * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). - */ - controller(name: string, controllerConstructor: Function): IModule; - /** - * The $controller service is used by Angular to create new controllers. - * - * This provider allows controller registration via the register method. - * - * @param name Controller name, or an object map of controllers where the keys are the names and the values are the constructors. - * @param controllerConstructor Controller constructor fn (optionally decorated with DI annotations in the array notation). - */ - controller(name: string, inlineAnnotatedConstructor: any[]): IModule; - controller(object: Object): IModule; - /** - * Register a new directive with the compiler. - * - * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) - * @param directiveFactory An injectable directive factory function. - */ - directive(name: string, directiveFactory: IDirectiveFactory): IModule; - /** - * Register a new directive with the compiler. - * - * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) - * @param directiveFactory An injectable directive factory function. - */ - directive(name: string, inlineAnnotatedFunction: any[]): IModule; - directive(object: Object): IModule; - /** - * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. - * - * @param name The name of the instance. - * @param $getFn The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). - */ - factory(name: string, $getFn: Function): IModule; - /** - * Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider. - * - * @param name The name of the instance. - * @param inlineAnnotatedFunction The $getFn for the instance creation. Internally this is a short hand for $provide.provider(name, {$get: $getFn}). - */ - factory(name: string, inlineAnnotatedFunction: any[]): IModule; - factory(object: Object): IModule; - filter(name: string, filterFactoryFunction: Function): IModule; - filter(name: string, inlineAnnotatedFunction: any[]): IModule; - filter(object: Object): IModule; - provider(name: string, serviceProviderFactory: IServiceProviderFactory): IModule; - provider(name: string, serviceProviderConstructor: IServiceProviderClass): IModule; - provider(name: string, inlineAnnotatedConstructor: any[]): IModule; - provider(name: string, providerObject: IServiceProvider): IModule; - provider(object: Object): IModule; - /** - * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. - */ - run(initializationFunction: Function): IModule; - /** - * Run blocks are the closest thing in Angular to the main method. A run block is the code which needs to run to kickstart the application. It is executed after all of the service have been configured and the injector has been created. Run blocks typically contain code which is hard to unit-test, and for this reason should be declared in isolated modules, so that they can be ignored in the unit-tests. - */ - run(inlineAnnotatedFunction: any[]): IModule; - service(name: string, serviceConstructor: Function): IModule; - service(name: string, inlineAnnotatedConstructor: any[]): IModule; - service(object: Object): IModule; - /** - * Register a value service with the $injector, such as a string, a number, an array, an object or a function. This is short for registering a service where its provider's $get property is a factory function that takes no arguments and returns the value service. - - Value services are similar to constant services, except that they cannot be injected into a module configuration function (see config) but they can be overridden by an Angular decorator. - * - * @param name The name of the instance. - * @param value The value. - */ - value(name: string, value: any): IModule; - value(object: Object): IModule; - - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * @param name The name of the service to decorate - * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - decorator(name:string, decoratorConstructor: Function): IModule; - decorator(name:string, inlineAnnotatedConstructor: any[]): IModule; - - // Properties - name: string; - requires: string[]; - } - - /////////////////////////////////////////////////////////////////////////// - // Attributes - // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes - /////////////////////////////////////////////////////////////////////////// - interface IAttributes { - /** - * this is necessary to be able to access the scoped attributes. it's not very elegant - * because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way - * this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 - */ - [name: string]: any; - - /** - * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with x- or data-) to its normalized, camelCase form. - * - * Also there is special case for Moz prefix starting with upper case letter. - * - * For further information check out the guide on @see https://docs.angularjs.org/guide/directive#matching-directives - */ - $normalize(name: string): string; - - /** - * Adds the CSS class value specified by the classVal parameter to the - * element. If animations are enabled then an animation will be triggered - * for the class addition. - */ - $addClass(classVal: string): void; - - /** - * Removes the CSS class value specified by the classVal parameter from the - * element. If animations are enabled then an animation will be triggered for - * the class removal. - */ - $removeClass(classVal: string): void; - - /** - * Set DOM element attribute value. - */ - $set(key: string, value: any): void; - - /** - * Observes an interpolated attribute. - * The observer function will be invoked once during the next $digest - * following compilation. The observer is then invoked whenever the - * interpolated value changes. - */ - $observe(name: string, fn: (value?: T) => any): Function; - - /** - * A map of DOM element attribute names to the normalized name. This is needed - * to do reverse lookup from normalized name back to actual name. - */ - $attr: Object; - } - - /** - * form.FormController - type in module ng - * see https://docs.angularjs.org/api/ng/type/form.FormController - */ - interface IFormController { - - /** - * Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272 - */ - [name: string]: any; - - $pristine: boolean; - $dirty: boolean; - $valid: boolean; - $invalid: boolean; - $submitted: boolean; - $error: any; - $addControl(control: INgModelController): void; - $removeControl(control: INgModelController): void; - $setValidity(validationErrorKey: string, isValid: boolean, control: INgModelController): void; - $setDirty(): void; - $setPristine(): void; - $commitViewValue(): void; - $rollbackViewValue(): void; - $setSubmitted(): void; - $setUntouched(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // NgModelController - // see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController - /////////////////////////////////////////////////////////////////////////// - interface INgModelController { - $render(): void; - $setValidity(validationErrorKey: string, isValid: boolean): void; - // Documentation states viewValue and modelValue to be a string but other - // types do work and it's common to use them. - $setViewValue(value: any, trigger?: string): void; - $setPristine(): void; - $setDirty(): void; - $validate(): void; - $setTouched(): void; - $setUntouched(): void; - $rollbackViewValue(): void; - $commitViewValue(): void; - $isEmpty(value: any): boolean; - - $viewValue: any; - - $modelValue: any; - - $parsers: IModelParser[]; - $formatters: IModelFormatter[]; - $viewChangeListeners: IModelViewChangeListener[]; - $error: any; - $name: string; - - $touched: boolean; - $untouched: boolean; - - $validators: IModelValidators; - $asyncValidators: IAsyncModelValidators; - - $pending: any; - $pristine: boolean; - $dirty: boolean; - $valid: boolean; - $invalid: boolean; - } - - interface IModelValidators { - /** - * viewValue is any because it can be an object that is called in the view like $viewValue.name:$viewValue.subName - */ - [index: string]: (modelValue: any, viewValue: any) => boolean; - } - - interface IAsyncModelValidators { - [index: string]: (modelValue: any, viewValue: any) => IPromise; - } - - interface IModelParser { - (value: any): any; - } - - interface IModelFormatter { - (value: any): any; - } - - interface IModelViewChangeListener { - (): void; - } - - /** - * $rootScope - $rootScopeProvider - service in module ng - * see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope - */ - interface IRootScopeService { - [index: string]: any; - - $apply(): any; - $apply(exp: string): any; - $apply(exp: (scope: IScope) => any): any; - - $applyAsync(): any; - $applyAsync(exp: string): any; - $applyAsync(exp: (scope: IScope) => any): any; - - /** - * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. - * - * The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled. - * - * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. - * - * @param name Event name to broadcast. - * @param args Optional one or more arguments which will be passed onto the event listeners. - */ - $broadcast(name: string, ...args: any[]): IAngularEvent; - $destroy(): void; - $digest(): void; - /** - * Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners. - * - * The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it. - * - * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. - * - * @param name Event name to emit. - * @param args Optional one or more arguments which will be passed onto the event listeners. - */ - $emit(name: string, ...args: any[]): IAngularEvent; - - $eval(): any; - $eval(expression: string, locals?: Object): any; - $eval(expression: (scope: IScope) => any, locals?: Object): any; - - $evalAsync(): void; - $evalAsync(expression: string): void; - $evalAsync(expression: (scope: IScope) => any): void; - - // Defaults to false by the implementation checking strategy - $new(isolate?: boolean, parent?: IScope): IScope; - - /** - * Listens on events of a given type. See $emit for discussion of event life cycle. - * - * The event listener function format is: function(event, args...). - * - * @param name Event name to listen on. - * @param listener Function to call when the event is emitted. - */ - $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; - - $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function; - $watch(watchExpression: string, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): Function; - $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function; - $watch(watchExpression: (scope: IScope) => T, listener?: (newValue: T, oldValue: T, scope: IScope) => any, objectEquality?: boolean): Function; - - $watchCollection(watchExpression: string, listener: (newValue: T, oldValue: T, scope: IScope) => any): Function; - $watchCollection(watchExpression: (scope: IScope) => T, listener: (newValue: T, oldValue: T, scope: IScope) => any): Function; - - $watchGroup(watchExpressions: any[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - $watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function; - - $parent: IScope; - $root: IRootScopeService; - $id: number; - - // Hidden members - $$isolateBindings: any; - $$phase: any; - } - - interface IScope extends IRootScopeService { } - - /** - * $scope for ngRepeat directive. - * see https://docs.angularjs.org/api/ng/directive/ngRepeat - */ - interface IRepeatScope extends IScope { - - /** - * iterator offset of the repeated element (0..length-1). - */ - $index: number; - - /** - * true if the repeated element is first in the iterator. - */ - $first: boolean; - - /** - * true if the repeated element is between the first and last in the iterator. - */ - $middle: boolean; - - /** - * true if the repeated element is last in the iterator. - */ - $last: boolean; - - /** - * true if the iterator position $index is even (otherwise false). - */ - $even: boolean; - - /** - * true if the iterator position $index is odd (otherwise false). - */ - $odd: boolean; - - } - - interface IAngularEvent { - /** - * the scope on which the event was $emit-ed or $broadcast-ed. - */ - targetScope: IScope; - /** - * the scope that is currently handling the event. Once the event propagates through the scope hierarchy, this property is set to null. - */ - currentScope: IScope; - /** - * name of the event. - */ - name: string; - /** - * calling stopPropagation function will cancel further event propagation (available only for events that were $emit-ed). - */ - stopPropagation?: Function; - /** - * calling preventDefault sets defaultPrevented flag to true. - */ - preventDefault: Function; - /** - * true if preventDefault was called. - */ - defaultPrevented: boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // WindowService - // see http://docs.angularjs.org/api/ng.$window - /////////////////////////////////////////////////////////////////////////// - interface IWindowService extends Window { - [key: string]: any; - } - - /////////////////////////////////////////////////////////////////////////// - // BrowserService - // TODO undocumented, so we need to get it from the source code - /////////////////////////////////////////////////////////////////////////// - interface IBrowserService { - defer: angular.ITimeoutService; - [key: string]: any; - } - - /////////////////////////////////////////////////////////////////////////// - // TimeoutService - // see http://docs.angularjs.org/api/ng.$timeout - /////////////////////////////////////////////////////////////////////////// - interface ITimeoutService { - (delay?: number, invokeApply?: boolean): IPromise; - (fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise; - cancel(promise?: IPromise): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // IntervalService - // see http://docs.angularjs.org/api/ng.$interval - /////////////////////////////////////////////////////////////////////////// - interface IIntervalService { - (func: Function, delay: number, count?: number, invokeApply?: boolean, ...args: any[]): IPromise; - cancel(promise: IPromise): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // AnimateProvider - // see http://docs.angularjs.org/api/ng/provider/$animateProvider - /////////////////////////////////////////////////////////////////////////// - interface IAnimateProvider { - /** - * Registers a new injectable animation factory function. - * - * @param name The name of the animation. - * @param factory The factory function that will be executed to return the animation object. - */ - register(name: string, factory: () => IAnimateCallbackObject): void; - - /** - * Gets and/or sets the CSS class expression that is checked when performing an animation. - * - * @param expression The className expression which will be checked against all animations. - * @returns The current CSS className expression value. If null then there is no expression value. - */ - classNameFilter(expression?: RegExp): RegExp; - } - - /** - * The animation object which contains callback functions for each event that is expected to be animated. - */ - interface IAnimateCallbackObject { - eventFn(element: Node, doneFn: () => void): Function; - } - - /** - * $filter - $filterProvider - service in module ng - * - * Filters are used for formatting data displayed to the user. - * - * see https://docs.angularjs.org/api/ng/service/$filter - */ - interface IFilterService { - (name: 'filter'): IFilterFilter; - (name: 'currency'): IFilterCurrency; - (name: 'number'): IFilterNumber; - (name: 'date'): IFilterDate; - (name: 'json'): IFilterJson; - (name: 'lowercase'): IFilterLowercase; - (name: 'uppercase'): IFilterUppercase; - (name: 'limitTo'): IFilterLimitTo; - (name: 'orderBy'): IFilterOrderBy; - /** - * Usage: - * $filter(name); - * - * @param name Name of the filter function to retrieve - */ - (name: string): T; - } - - interface IFilterFilter { - (array: T[], expression: string | IFilterFilterPatternObject | IFilterFilterPredicateFunc, comparator?: IFilterFilterComparatorFunc|boolean): T[]; - } - - interface IFilterFilterPatternObject { - [name: string]: any; - } - - interface IFilterFilterPredicateFunc { - (value: T, index: number, array: T[]): boolean; - } - - interface IFilterFilterComparatorFunc { - (actual: T, expected: T): boolean; - } - - interface IFilterCurrency { - /** - * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default symbol for current locale is used. - * @param amount Input to filter. - * @param symbol Currency symbol or identifier to be displayed. - * @param fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale - * @return Formatted number - */ - (amount: number, symbol?: string, fractionSize?: number): string; - } - - interface IFilterNumber { - /** - * Formats a number as text. - * @param number Number to format. - * @param fractionSize Number of decimal places to round the number to. If this is not provided then the fraction size is computed from the current locale's number formatting pattern. In the case of the default locale, it will be 3. - * @return Number rounded to decimalPlaces and places a “,” after each third digit. - */ - (value: number|string, fractionSize?: number|string): string; - } - - interface IFilterDate { - /** - * Formats date to a string based on the requested format. - * - * @param date Date to format either as Date object, milliseconds (string or number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is specified in the string input, the time is considered to be in the local timezone. - * @param format Formatting rules (see Description). If not specified, mediumDate is used. - * @param timezone Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, '+0430' (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used. - * @return Formatted string or the input if input is not recognized as date/millis. - */ - (date: Date | number | string, format?: string, timezone?: string): string; - } - - interface IFilterJson { - /** - * Allows you to convert a JavaScript object into JSON string. - * @param object Any JavaScript object (including arrays and primitive types) to filter. - * @param spacing The number of spaces to use per indentation, defaults to 2. - * @return JSON string. - */ - (object: any, spacing?: number): string; - } - - interface IFilterLowercase { - /** - * Converts string to lowercase. - */ - (value: string): string; - } - - interface IFilterUppercase { - /** - * Converts string to uppercase. - */ - (value: string): string; - } - - interface IFilterLimitTo { - /** - * Creates a new array containing only a specified number of elements. The elements are taken from either the beginning or the end of the source array, string or number, as specified by the value and sign (positive or negative) of limit. - * @param input Source array to be limited. - * @param limit The length of the returned array. If the limit number is positive, limit number of items from the beginning of the source array/string are copied. If the number is negative, limit number of items from the end of the source array are copied. The limit will be trimmed if it exceeds array.length. If limit is undefined, the input will be returned unchanged. - * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. - * @return A new sub-array of length limit or less if input array had less than limit elements. - */ - (input: T[], limit: string|number, begin?: string|number): T[]; - /** - * Creates a new string containing only a specified number of elements. The elements are taken from either the beginning or the end of the source string or number, as specified by the value and sign (positive or negative) of limit. If a number is used as input, it is converted to a string. - * @param input Source string or number to be limited. - * @param limit The length of the returned string. If the limit number is positive, limit number of items from the beginning of the source string are copied. If the number is negative, limit number of items from the end of the source string are copied. The limit will be trimmed if it exceeds input.length. If limit is undefined, the input will be returned unchanged. - * @param begin Index at which to begin limitation. As a negative index, begin indicates an offset from the end of input. Defaults to 0. - * @return A new substring of length limit or less if input had less than limit elements. - */ - (input: string|number, limit: string|number, begin?: string|number): string; - } - - interface IFilterOrderBy { - /** - * Orders a specified array by the expression predicate. It is ordered alphabetically for strings and numerically for numbers. Note: if you notice numbers are not being sorted as expected, make sure they are actually being saved as numbers and not strings. - * @param array The array to sort. - * @param expression A predicate to be used by the comparator to determine the order of elements. - * @param reverse Reverse the order of the array. - * @return Reverse the order of the array. - */ - (array: T[], expression: string|((value: T) => any)|(((value: T) => any)|string)[], reverse?: boolean): T[]; - } - - /** - * $filterProvider - $filter - provider in module ng - * - * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. - * - * see https://docs.angularjs.org/api/ng/provider/$filterProvider - */ - interface IFilterProvider extends IServiceProvider { - /** - * register(name); - * - * @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx). - */ - register(name: string | {}): IServiceProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // LocaleService - // see http://docs.angularjs.org/api/ng.$locale - /////////////////////////////////////////////////////////////////////////// - interface ILocaleService { - id: string; - - // These are not documented - // Check angular's i18n files for exemples - NUMBER_FORMATS: ILocaleNumberFormatDescriptor; - DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor; - pluralCat: (num: any) => string; - } - - interface ILocaleNumberFormatDescriptor { - DECIMAL_SEP: string; - GROUP_SEP: string; - PATTERNS: ILocaleNumberPatternDescriptor[]; - CURRENCY_SYM: string; - } - - interface ILocaleNumberPatternDescriptor { - minInt: number; - minFrac: number; - maxFrac: number; - posPre: string; - posSuf: string; - negPre: string; - negSuf: string; - gSize: number; - lgSize: number; - } - - interface ILocaleDateTimeFormatDescriptor { - MONTH: string[]; - SHORTMONTH: string[]; - DAY: string[]; - SHORTDAY: string[]; - AMPMS: string[]; - medium: string; - short: string; - fullDate: string; - longDate: string; - mediumDate: string; - shortDate: string; - mediumTime: string; - shortTime: string; - } - - /////////////////////////////////////////////////////////////////////////// - // LogService - // see http://docs.angularjs.org/api/ng.$log - // see http://docs.angularjs.org/api/ng.$logProvider - /////////////////////////////////////////////////////////////////////////// - interface ILogService { - debug: ILogCall; - error: ILogCall; - info: ILogCall; - log: ILogCall; - warn: ILogCall; - } - - interface ILogProvider extends IServiceProvider { - debugEnabled(): boolean; - debugEnabled(enabled: boolean): ILogProvider; - } - - // We define this as separate interface so we can reopen it later for - // the ngMock module. - interface ILogCall { - (...args: any[]): void; - } - - /////////////////////////////////////////////////////////////////////////// - // ParseService - // see http://docs.angularjs.org/api/ng.$parse - // see http://docs.angularjs.org/api/ng.$parseProvider - /////////////////////////////////////////////////////////////////////////// - interface IParseService { - (expression: string, interceptorFn?: (value: any, scope: IScope, locals: any) => any, expensiveChecks?: boolean): ICompiledExpression; - } - - interface IParseProvider { - logPromiseWarnings(): boolean; - logPromiseWarnings(value: boolean): IParseProvider; - - unwrapPromises(): boolean; - unwrapPromises(value: boolean): IParseProvider; - } - - interface ICompiledExpression { - (context: any, locals?: any): any; - - literal: boolean; - constant: boolean; - - // If value is not provided, undefined is gonna be used since the implementation - // does not check the parameter. Let's force a value for consistency. If consumer - // whants to undefine it, pass the undefined value explicitly. - assign(context: any, value: any): any; - } - - /** - * $location - $locationProvider - service in module ng - * see https://docs.angularjs.org/api/ng/service/$location - */ - interface ILocationService { - absUrl(): string; - hash(): string; - hash(newHash: string): ILocationService; - host(): string; - - /** - * Return path of current url - */ - path(): string; - - /** - * Change path when called with parameter and return $location. - * Note: Path should always begin with forward slash (/), this method will add the forward slash if it is missing. - * - * @param path New path - */ - path(path: string): ILocationService; - - port(): number; - protocol(): string; - replace(): ILocationService; - - /** - * Return search part (as object) of current url - */ - search(): any; - - /** - * Change search part when called with parameter and return $location. - * - * @param search When called with a single argument the method acts as a setter, setting the search component of $location to the specified value. - * - * If the argument is a hash object containing an array of values, these values will be encoded as duplicate search parameters in the url. - */ - search(search: any): ILocationService; - - /** - * Change search part when called with parameter and return $location. - * - * @param search New search params - * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. If paramValue is an array, it will override the property of the search component of $location specified via the first argument. If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign. - */ - search(search: string, paramValue: string|number|string[]|boolean): ILocationService; - - state(): any; - state(state: any): ILocationService; - url(): string; - url(url: string): ILocationService; - } - - interface ILocationProvider extends IServiceProvider { - hashPrefix(): string; - hashPrefix(prefix: string): ILocationProvider; - html5Mode(): boolean; - - // Documentation states that parameter is string, but - // implementation tests it as boolean, which makes more sense - // since this is a toggler - html5Mode(active: boolean): ILocationProvider; - html5Mode(mode: { enabled?: boolean; requireBase?: boolean; rewriteLinks?: boolean; }): ILocationProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // DocumentService - // see http://docs.angularjs.org/api/ng.$document - /////////////////////////////////////////////////////////////////////////// - interface IDocumentService extends IAugmentedJQuery {} - - /////////////////////////////////////////////////////////////////////////// - // ExceptionHandlerService - // see http://docs.angularjs.org/api/ng.$exceptionHandler - /////////////////////////////////////////////////////////////////////////// - interface IExceptionHandlerService { - (exception: Error, cause?: string): void; - } - - /////////////////////////////////////////////////////////////////////////// - // RootElementService - // see http://docs.angularjs.org/api/ng.$rootElement - /////////////////////////////////////////////////////////////////////////// - interface IRootElementService extends JQuery {} - - interface IQResolveReject { - (): void; - (value: T): void; - } - /** - * $q - service in module ng - * A promise/deferred implementation inspired by Kris Kowal's Q. - * See http://docs.angularjs.org/api/ng/service/$q - */ - interface IQService { - new (resolver: (resolve: IQResolveReject) => any): IPromise; - new (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; - (resolver: (resolve: IQResolveReject) => any): IPromise; - (resolver: (resolve: IQResolveReject, reject: IQResolveReject) => any): IPromise; - - /** - * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. - * - * Returns a single promise that will be resolved with an array of values, each value corresponding to the promise at the same index in the promises array. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. - * - * @param promises An array of promises. - */ - all(promises: IPromise[]): IPromise; - /** - * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. - * - * Returns a single promise that will be resolved with a hash of values, each value corresponding to the promise at the same key in the promises hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. - * - * @param promises A hash of promises. - */ - all(promises: { [id: string]: IPromise; }): IPromise<{ [id: string]: any; }>; - all(promises: { [id: string]: IPromise; }): IPromise; - /** - * Creates a Deferred object which represents a task which will finish in the future. - */ - defer(): IDeferred; - /** - * Creates a promise that is resolved as rejected with the specified reason. This api should be used to forward rejection in a chain of promises. If you are dealing with the last promise in a promise chain, you don't need to worry about it. - * - * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of reject as the throw keyword in JavaScript. This also means that if you "catch" an error via a promise error callback and you want to forward the error to the promise derived from the current promise, you have to "rethrow" the error by returning a rejection constructed via reject. - * - * @param reason Constant, message, exception or an object representing the rejection reason. - */ - reject(reason?: any): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - * - * @param value Value or a promise - */ - resolve(value: IPromise|T): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - */ - resolve(): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - * - * @param value Value or a promise - */ - when(value: IPromise|T): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - */ - when(): IPromise; - } - - interface IPromise { - /** - * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. - * The successCallBack may return IPromise for when a $q.reject() needs to be returned - * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. - */ - then(successCallback: (promiseValue: T) => IPromise|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; - - /** - * Shorthand for promise.then(null, errorCallback) - */ - catch(onRejected: (reason: any) => IPromise|TResult): IPromise; - - /** - * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information. - * - * Because finally is a reserved word in JavaScript and reserved keywords are not supported as property names by ES3, you'll need to invoke the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible. - */ - finally(finallyCallback: () => any): IPromise; - } - - interface IDeferred { - resolve(value?: T|IPromise): void; - reject(reason?: any): void; - notify(state?: any): void; - promise: IPromise; - } - - /////////////////////////////////////////////////////////////////////////// - // AnchorScrollService - // see http://docs.angularjs.org/api/ng.$anchorScroll - /////////////////////////////////////////////////////////////////////////// - interface IAnchorScrollService { - (): void; - (hash: string): void; - yOffset: any; - } - - interface IAnchorScrollProvider extends IServiceProvider { - disableAutoScrolling(): void; - } - - /** - * $cacheFactory - service in module ng - * - * Factory that constructs Cache objects and gives access to them. - * - * see https://docs.angularjs.org/api/ng/service/$cacheFactory - */ - interface ICacheFactoryService { - /** - * Factory that constructs Cache objects and gives access to them. - * - * @param cacheId Name or id of the newly created cache. - * @param optionsMap Options object that specifies the cache behavior. Properties: - * - * capacity — turns the cache into LRU cache. - */ - (cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject; - - /** - * Get information about all the caches that have been created. - * @returns key-value map of cacheId to the result of calling cache#info - */ - info(): any; - - /** - * Get access to a cache object by the cacheId used when it was created. - * - * @param cacheId Name or id of a cache to access. - */ - get(cacheId: string): ICacheObject; - } - - /** - * $cacheFactory.Cache - type in module ng - * - * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data. - * - * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache - */ - interface ICacheObject { - /** - * Retrieve information regarding a particular Cache. - */ - info(): { - /** - * the id of the cache instance - */ - id: string; - - /** - * the number of entries kept in the cache instance - */ - size: number; - - //...: any additional properties from the options object when creating the cache. - }; - - /** - * Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set. - * - * It will not insert undefined values into the cache. - * - * @param key the key under which the cached data is stored. - * @param value the value to store alongside the key. If it is undefined, the key will not be stored. - */ - put(key: string, value?: T): T; - - /** - * Retrieves named data stored in the Cache object. - * - * @param key the key of the data to be retrieved - */ - get(key: string): T; - - /** - * Removes an entry from the Cache object. - * - * @param key the key of the entry to be removed - */ - remove(key: string): void; - - /** - * Clears the cache object of any entries. - */ - removeAll(): void; - - /** - * Destroys the Cache object entirely, removing it from the $cacheFactory set. - */ - destroy(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // CompileService - // see http://docs.angularjs.org/api/ng.$compile - // see http://docs.angularjs.org/api/ng.$compileProvider - /////////////////////////////////////////////////////////////////////////// - interface ICompileService { - (element: string, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; - (element: Element, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; - (element: JQuery, transclude?: ITranscludeFunction, maxPriority?: number): ITemplateLinkingFunction; - } - - interface ICompileProvider extends IServiceProvider { - directive(name: string, directiveFactory: Function): ICompileProvider; - - // Undocumented, but it is there... - directive(directivesMap: any): ICompileProvider; - - aHrefSanitizationWhitelist(): RegExp; - aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider; - - imgSrcSanitizationWhitelist(): RegExp; - imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider; - - debugInfoEnabled(enabled?: boolean): any; - } - - interface ICloneAttachFunction { - // Let's hint but not force cloneAttachFn's signature - (clonedElement?: JQuery, scope?: IScope): any; - } - - // This corresponds to the "publicLinkFn" returned by $compile. - interface ITemplateLinkingFunction { - (scope: IScope, cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; - } - - // This corresponds to $transclude (and also the transclude function passed to link). - interface ITranscludeFunction { - // If the scope is provided, then the cloneAttachFn must be as well. - (scope: IScope, cloneAttachFn: ICloneAttachFunction): IAugmentedJQuery; - // If one argument is provided, then it's assumed to be the cloneAttachFn. - (cloneAttachFn?: ICloneAttachFunction): IAugmentedJQuery; - } - - /////////////////////////////////////////////////////////////////////////// - // ControllerService - // see http://docs.angularjs.org/api/ng.$controller - // see http://docs.angularjs.org/api/ng.$controllerProvider - /////////////////////////////////////////////////////////////////////////// - interface IControllerService { - // Although the documentation doesn't state this, locals are optional - (controllerConstructor: new (...args: any[]) => T, locals?: any, bindToController?: any): T; - (controllerConstructor: Function, locals?: any, bindToController?: any): T; - (controllerName: string, locals?: any, bindToController?: any): T; - } - - interface IControllerProvider extends IServiceProvider { - register(name: string, controllerConstructor: Function): void; - register(name: string, dependencyAnnotatedConstructor: any[]): void; - allowGlobals(): void; - } - - /** - * HttpService - * see http://docs.angularjs.org/api/ng/service/$http - */ - interface IHttpService { - /** - * Object describing the request to be made and how it should be processed. - */ - (config: IRequestConfig): IHttpPromise; - - /** - * Shortcut method to perform GET request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - get(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform DELETE request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - delete(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform HEAD request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - head(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform JSONP request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param config Optional configuration object - */ - jsonp(url: string, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform POST request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param data Request content - * @param config Optional configuration object - */ - post(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform PUT request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param data Request content - * @param config Optional configuration object - */ - put(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Shortcut method to perform PATCH request. - * - * @param url Relative or absolute URL specifying the destination of the request - * @param data Request content - * @param config Optional configuration object - */ - patch(url: string, data: any, config?: IRequestShortcutConfig): IHttpPromise; - - /** - * Runtime equivalent of the $httpProvider.defaults property. Allows configuration of default headers, withCredentials as well as request and response transformations. - */ - defaults: IHttpProviderDefaults; - - /** - * Array of config objects for currently pending requests. This is primarily meant to be used for debugging purposes. - */ - pendingRequests: IRequestConfig[]; - } - - /** - * Object describing the request to be made and how it should be processed. - * see http://docs.angularjs.org/api/ng/service/$http#usage - */ - interface IRequestShortcutConfig extends IHttpProviderDefaults { - /** - * {Object.} - * Map of strings or objects which will be turned to ?key1=value1&key2=value2 after the url. If the value is not a string, it will be JSONified. - */ - params?: any; - - /** - * {string|Object} - * Data to be sent as the request message data. - */ - data?: any; - - /** - * Timeout in milliseconds, or promise that should abort the request when resolved. - */ - timeout?: number|IPromise; - - /** - * See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype - */ - responseType?: string; - } - - /** - * Object describing the request to be made and how it should be processed. - * see http://docs.angularjs.org/api/ng/service/$http#usage - */ - interface IRequestConfig extends IRequestShortcutConfig { - /** - * HTTP method (e.g. 'GET', 'POST', etc) - */ - method: string; - /** - * Absolute or relative URL of the resource that is being requested. - */ - url: string; - } - - interface IHttpHeadersGetter { - (): { [name: string]: string; }; - (headerName: string): string; - } - - interface IHttpPromiseCallback { - (data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void; - } - - interface IHttpPromiseCallbackArg { - data?: T; - status?: number; - headers?: IHttpHeadersGetter; - config?: IRequestConfig; - statusText?: string; - } - - interface IHttpPromise extends IPromise> { - success(callback: IHttpPromiseCallback): IHttpPromise; - error(callback: IHttpPromiseCallback): IHttpPromise; - } - - // See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228 - interface IHttpRequestTransformer { - (data: any, headersGetter: IHttpHeadersGetter): any; - } - - // The definition of fields are the same as IHttpPromiseCallbackArg - interface IHttpResponseTransformer { - (data: any, headersGetter: IHttpHeadersGetter, status: number): any; - } - - interface IHttpRequestConfigHeaders { - [requestType: string]: string|(() => string); - common?: string|(() => string); - get?: string|(() => string); - post?: string|(() => string); - put?: string|(() => string); - patch?: string|(() => string); - } - - /** - * Object that controls the defaults for $http provider. Not all fields of IRequestShortcutConfig can be configured - * via defaults and the docs do not say which. The following is based on the inspection of the source code. - * https://docs.angularjs.org/api/ng/service/$http#defaults - * https://docs.angularjs.org/api/ng/service/$http#usage - * https://docs.angularjs.org/api/ng/provider/$httpProvider The properties section - */ - interface IHttpProviderDefaults { - /** - * {boolean|Cache} - * If true, a default $http cache will be used to cache the GET request, otherwise if a cache instance built with $cacheFactory, this cache will be used for caching. - */ - cache?: any; - - /** - * Transform function or an array of such functions. The transform function takes the http request body and - * headers and returns its transformed (typically serialized) version. - * @see {@link https://docs.angularjs.org/api/ng/service/$http#transforming-requests-and-responses} - */ - transformRequest?: IHttpRequestTransformer |IHttpRequestTransformer[]; - - /** - * Transform function or an array of such functions. The transform function takes the http response body and - * headers and returns its transformed (typically deserialized) version. - */ - transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[]; - - /** - * Map of strings or functions which return strings representing HTTP headers to send to the server. If the - * return value of a function is null, the header will not be sent. - * The key of the map is the request verb in lower case. The "common" key applies to all requests. - * @see {@link https://docs.angularjs.org/api/ng/service/$http#setting-http-headers} - */ - headers?: IHttpRequestConfigHeaders; - - /** Name of HTTP header to populate with the XSRF token. */ - xsrfHeaderName?: string; - - /** Name of cookie containing the XSRF token. */ - xsrfCookieName?: string; - - /** - * whether to to set the withCredentials flag on the XHR object. See [requests with credentials]https://developer.mozilla.org/en/http_access_control#section_5 for more information. - */ - withCredentials?: boolean; - - /** - * A function used to the prepare string representation of request parameters (specified as an object). If - * specified as string, it is interpreted as a function registered with the $injector. Defaults to - * $httpParamSerializer. - */ - paramSerializer?: string | ((obj: any) => string); - } - - interface IHttpInterceptor { - request?: (config: IRequestConfig) => IRequestConfig|IPromise; - requestError?: (rejection: any) => any; - response?: (response: IHttpPromiseCallbackArg) => IPromise|T; - responseError?: (rejection: any) => any; - } - - interface IHttpInterceptorFactory { - (...args: any[]): IHttpInterceptor; - } - - interface IHttpProvider extends IServiceProvider { - defaults: IHttpProviderDefaults; - - /** - * Register service factories (names or implementations) for interceptors which are called before and after - * each request. - */ - interceptors: (string|IHttpInterceptorFactory|(string|IHttpInterceptorFactory)[])[]; - useApplyAsync(): boolean; - useApplyAsync(value: boolean): IHttpProvider; - - /** - * - * @param {boolean=} value If true, `$http` will return a normal promise without the `success` and `error` methods. - * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining. - * otherwise, returns the current configured value. - */ - useLegacyPromiseExtensions(value:boolean) : boolean | IHttpProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // HttpBackendService - // see http://docs.angularjs.org/api/ng.$httpBackend - // You should never need to use this service directly. - /////////////////////////////////////////////////////////////////////////// - interface IHttpBackendService { - // XXX Perhaps define callback signature in the future - (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; - } - - /////////////////////////////////////////////////////////////////////////// - // InterpolateService - // see http://docs.angularjs.org/api/ng.$interpolate - // see http://docs.angularjs.org/api/ng.$interpolateProvider - /////////////////////////////////////////////////////////////////////////// - interface IInterpolateService { - (text: string, mustHaveExpression?: boolean, trustedContext?: string, allOrNothing?: boolean): IInterpolationFunction; - endSymbol(): string; - startSymbol(): string; - } - - interface IInterpolationFunction { - (context: any): string; - } - - interface IInterpolateProvider extends IServiceProvider { - startSymbol(): string; - startSymbol(value: string): IInterpolateProvider; - endSymbol(): string; - endSymbol(value: string): IInterpolateProvider; - } - - /////////////////////////////////////////////////////////////////////////// - // TemplateCacheService - // see http://docs.angularjs.org/api/ng.$templateCache - /////////////////////////////////////////////////////////////////////////// - interface ITemplateCacheService extends ICacheObject {} - - /////////////////////////////////////////////////////////////////////////// - // SCEService - // see http://docs.angularjs.org/api/ng.$sce - /////////////////////////////////////////////////////////////////////////// - interface ISCEService { - getTrusted(type: string, mayBeTrusted: any): any; - getTrustedCss(value: any): any; - getTrustedHtml(value: any): any; - getTrustedJs(value: any): any; - getTrustedResourceUrl(value: any): any; - getTrustedUrl(value: any): any; - parse(type: string, expression: string): (context: any, locals: any) => any; - parseAsCss(expression: string): (context: any, locals: any) => any; - parseAsHtml(expression: string): (context: any, locals: any) => any; - parseAsJs(expression: string): (context: any, locals: any) => any; - parseAsResourceUrl(expression: string): (context: any, locals: any) => any; - parseAsUrl(expression: string): (context: any, locals: any) => any; - trustAs(type: string, value: any): any; - trustAsHtml(value: any): any; - trustAsJs(value: any): any; - trustAsResourceUrl(value: any): any; - trustAsUrl(value: any): any; - isEnabled(): boolean; - } - - /////////////////////////////////////////////////////////////////////////// - // SCEProvider - // see http://docs.angularjs.org/api/ng.$sceProvider - /////////////////////////////////////////////////////////////////////////// - interface ISCEProvider extends IServiceProvider { - enabled(value: boolean): void; - } - - /////////////////////////////////////////////////////////////////////////// - // SCEDelegateService - // see http://docs.angularjs.org/api/ng.$sceDelegate - /////////////////////////////////////////////////////////////////////////// - interface ISCEDelegateService { - getTrusted(type: string, mayBeTrusted: any): any; - trustAs(type: string, value: any): any; - valueOf(value: any): any; - } - - - /////////////////////////////////////////////////////////////////////////// - // SCEDelegateProvider - // see http://docs.angularjs.org/api/ng.$sceDelegateProvider - /////////////////////////////////////////////////////////////////////////// - interface ISCEDelegateProvider extends IServiceProvider { - resourceUrlBlacklist(blacklist: any[]): void; - resourceUrlWhitelist(whitelist: any[]): void; - resourceUrlBlacklist(): any[]; - resourceUrlWhitelist(): any[]; - } - - /** - * $templateRequest service - * see http://docs.angularjs.org/api/ng/service/$templateRequest - */ - interface ITemplateRequestService { - /** - * Downloads a template using $http and, upon success, stores the - * contents inside of $templateCache. - * - * If the HTTP request fails or the response data of the HTTP request is - * empty then a $compile error will be thrown (unless - * {ignoreRequestError} is set to true). - * - * @param tpl The template URL. - * @param ignoreRequestError Whether or not to ignore the exception - * when the request fails or the template is - * empty. - * - * @return A promise whose value is the template content. - */ - (tpl: string, ignoreRequestError?: boolean): IPromise; - /** - * total amount of pending template requests being downloaded. - * @type {number} - */ - totalPendingRequests: number; - } - - /////////////////////////////////////////////////////////////////////////// - // Component - // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html - // and http://toddmotto.com/exploring-the-angular-1-5-component-method/ - /////////////////////////////////////////////////////////////////////////// - /** - * Runtime representation a type that a Component or other object is instances of. - * - * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by - * the `MyCustomComponent` constructor function. - */ - interface Type extends Function { - } - - /** - * `RouteDefinition` defines a route within a {@link RouteConfig} decorator. - * - * Supported keys: - * - `path` or `aux` (requires exactly one of these) - * - `component`, `loader`, `redirectTo` (requires exactly one of these) - * - `name` or `as` (optional) (requires exactly one of these) - * - `data` (optional) - * - * See also {@link Route}, {@link AsyncRoute}, {@link AuxRoute}, and {@link Redirect}. - */ - interface RouteDefinition { - path?: string; - aux?: string; - component?: Type | ComponentDefinition | string; - loader?: Function; - redirectTo?: any[]; - as?: string; - name?: string; - data?: any; - useAsDefault?: boolean; - } - - /** - * Represents either a component type (`type` is `component`) or a loader function - * (`type` is `loader`). - * - * See also {@link RouteDefinition}. - */ - interface ComponentDefinition { - type: string; - loader?: Function; - component?: Type; - } - - /** - * Component definition object (a simplified directive definition object) - */ - interface IComponentOptions { - /** - * Controller constructor function that should be associated with newly created scope or the name of a registered - * controller if passed as a string. Empty function by default. - */ - controller?: any; - /** - * An identifier name for a reference to the controller. If present, the controller will be published to scope under - * the controllerAs name. If not present, this will default to be the same as the component name. - */ - controllerAs?: string; - /** - * html template as a string or a function that returns an html template as a string which should be used as the - * contents of this component. Empty string by default. - * If template is a function, then it is injected with the following locals: - * $element - Current element - * $attrs - Current attributes object for the element - */ - template?: string | Function; - /** - * path or function that returns a path to an html template that should be used as the contents of this component. - * If templateUrl is a function, then it is injected with the following locals: - * $element - Current element - * $attrs - Current attributes object for the element - */ - templateUrl?: string | Function; - /** - * Define DOM attribute binding to component properties. Component properties are always bound to the component - * controller and not to the scope. - */ - bindings?: any; - /** - * Whether transclusion is enabled. Enabled by default. - */ - transclude?: boolean; - require? : Object; - $canActivate?: () => boolean; - $routeConfig?: RouteDefinition[]; - } - - interface IComponentTemplateFn { - ( $element?: IAugmentedJQuery, $attrs?: IAttributes ): string; - } - - /////////////////////////////////////////////////////////////////////////// - // Directive - // see http://docs.angularjs.org/api/ng.$compileProvider#directive - // and http://docs.angularjs.org/guide/directive - /////////////////////////////////////////////////////////////////////////// - - interface IDirectiveFactory { - (...args: any[]): IDirective; - } - - interface IDirectiveLinkFn { - ( - scope: IScope, - instanceElement: IAugmentedJQuery, - instanceAttributes: IAttributes, - controller: {}, - transclude: ITranscludeFunction - ): void; - } - - interface IDirectivePrePost { - pre?: IDirectiveLinkFn; - post?: IDirectiveLinkFn; - } - - interface IDirectiveCompileFn { - ( - templateElement: IAugmentedJQuery, - templateAttributes: IAttributes, - transclude: ITranscludeFunction - ): IDirectivePrePost; - } - - interface IDirective { - compile?: IDirectiveCompileFn; - controller?: any; - controllerAs?: string; - bindToController?: boolean|Object; - link?: IDirectiveLinkFn | IDirectivePrePost; - name?: string; - priority?: number; - replace?: boolean; - require? : any; - restrict?: string; - scope?: any; - template?: string | Function; - templateNamespace?: string; - templateUrl?: string | Function; - terminal?: boolean; - transclude?: any; - } - - /** - * angular.element - * when calling angular.element, angular returns a jQuery object, - * augmented with additional methods like e.g. scope. - * see: http://docs.angularjs.org/api/angular.element - */ - interface IAugmentedJQueryStatic extends JQueryStatic { - (selector: string, context?: any): IAugmentedJQuery; - (element: Element): IAugmentedJQuery; - (object: {}): IAugmentedJQuery; - (elementArray: Element[]): IAugmentedJQuery; - (object: JQuery): IAugmentedJQuery; - (func: Function): IAugmentedJQuery; - (array: any[]): IAugmentedJQuery; - (): IAugmentedJQuery; - } - - interface IAugmentedJQuery extends JQuery { - // TODO: events, how to define? - //$destroy - - find(selector: string): IAugmentedJQuery; - find(element: any): IAugmentedJQuery; - find(obj: JQuery): IAugmentedJQuery; - controller(): any; - controller(name: string): any; - injector(): any; - scope(): IScope; - isolateScope(): IScope; - - inheritedData(key: string, value: any): JQuery; - inheritedData(obj: { [key: string]: any; }): JQuery; - inheritedData(key?: string): any; - } - - /////////////////////////////////////////////////////////////////////////// - // AUTO module (angular.js) - /////////////////////////////////////////////////////////////////////////// - export module auto { - - /////////////////////////////////////////////////////////////////////// - // InjectorService - // see http://docs.angularjs.org/api/AUTO.$injector - /////////////////////////////////////////////////////////////////////// - interface IInjectorService { - annotate(fn: Function): string[]; - annotate(inlineAnnotatedFunction: any[]): string[]; - get(name: string, caller?: string): T; - has(name: string): boolean; - instantiate(typeConstructor: Function, locals?: any): T; - invoke(inlineAnnotatedFunction: any[]): any; - invoke(func: Function, context?: any, locals?: any): any; - } - - /////////////////////////////////////////////////////////////////////// - // ProvideService - // see http://docs.angularjs.org/api/AUTO.$provide - /////////////////////////////////////////////////////////////////////// - interface IProvideService { - // Documentation says it returns the registered instance, but actual - // implementation does not return anything. - // constant(name: string, value: any): any; - /** - * Register a constant service, such as a string, a number, an array, an object or a function, with the $injector. Unlike value it can be injected into a module configuration function (see config) and it cannot be overridden by an Angular decorator. - * - * @param name The name of the constant. - * @param value The constant value. - */ - constant(name: string, value: any): void; - - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * - * @param name The name of the service to decorate. - * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: - * - * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - decorator(name: string, decorator: Function): void; - /** - * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. - * - * @param name The name of the service to decorate. - * @param inlineAnnotatedFunction This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: - * - * $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. - */ - decorator(name: string, inlineAnnotatedFunction: any[]): void; - factory(name: string, serviceFactoryFunction: Function): IServiceProvider; - factory(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; - provider(name: string, provider: IServiceProvider): IServiceProvider; - provider(name: string, serviceProviderConstructor: Function): IServiceProvider; - service(name: string, constructor: Function): IServiceProvider; - service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider; - value(name: string, value: any): IServiceProvider; - } - - } -} diff --git a/angular/legacy/angular-animate-1.2.d.ts b/angular/legacy/angular-animate-1.2.d.ts deleted file mode 100644 index 0a74608c27..0000000000 --- a/angular/legacy/angular-animate-1.2.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -// Type definitions for Angular JS 1.2 (ngAnimate module) -// Project: http://angularjs.org -// Definitions by: Michel Salib , Adi Dahiya -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - -/////////////////////////////////////////////////////////////////////////////// -// ngAnimate module (angular-animate.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng.animate { - - /////////////////////////////////////////////////////////////////////////// - // AnimateService - // see https://code.angularjs.org/1.2.26/docs/api/ngAnimate/service/$animate - /////////////////////////////////////////////////////////////////////////// - interface IAnimateService extends ng.IAnimateService { - /** - * Globally enables / disables animations. - * - * @param value If provided then set the animation on or off. - * @param element If provided then the element will be used to represent the enable/disable operation. - * @returns current animation state - */ - enabled(value?: boolean, element?: JQuery): boolean; - - /** - * Appends the element to the parentElement element that resides in the document and then runs the enter animation. - * - * @param element the element that will be the focus of the enter animation - * @param parentElement the parent element of the element that will be the focus of the enter animation - * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation - * @param doneCallback the callback function that will be called once the animation is complete - */ - enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, doneCallback?: () => void): void; - - /** - * Runs the leave animation operation and, upon completion, removes the element from the DOM. - * - * @param element the element that will be the focus of the leave animation - * @param doneCallback the callback function that will be called once the animation is complete - */ - leave(element: JQuery, doneCallback?: () => void): void; - - /** - * Fires the move DOM operation. Just before the animation starts, the animate service will either append - * it into the parentElement container or add the element directly after the afterElement element if present. - * Then the move animation will be run. - * - * @param element the element that will be the focus of the move animation - * @param parentElement the parent element of the element that will be the focus of the move animation - * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation - * @param doneCallback the callback function that will be called once the animation is complete - */ - move(element: JQuery, parentElement: JQuery, afterElement?: JQuery, doneCallback?: () => void): void; - - /** - * Triggers a custom animation event based off the className variable and then attaches the className - * value to the element as a CSS class. - * - * @param element the element that will be animated - * @param className the CSS class that will be added to the element and then animated - * @param doneCallback the callback function that will be called once the animation is complete - */ - addClass(element: JQuery, className: string, doneCallback?: () => void): void; - - /** - * Triggers a custom animation event based off the className variable and then removes the CSS class - * provided by the className value from the element. - * - * @param element the element that will be animated - * @param className the CSS class that will be animated and then removed from the element - * @param doneCallback the callback function that will be called once the animation is complete - */ - removeClass(element: JQuery, className: string, doneCallback?: () => void): void; - - /** - * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback - * will be fired (if provided). - * - * @param element the element which will have its CSS classes changed removed from it - * @param add the CSS classes which will be added to the element - * @param remove the CSS class which will be removed from the element CSS classes have been set on the element - * @param doneCallback done the callback function (if provided) that will be fired after the CSS classes have been set on the element - */ - setClass(element: JQuery, add: string, remove: string, doneCallback?: () => void): void; - } - - /////////////////////////////////////////////////////////////////////////// - // AngularProvider - // see https://code.angularjs.org/1.2.26/docs/api/ngAnimate/provider/$animateProvider - /////////////////////////////////////////////////////////////////////////// - interface IAnimateProvider { - /** - * Registers a new injectable animation factory function. - * - * @param name The name of the animation. - * @param factory The factory function that will be executed to return the animation object. - */ - register(name: string, factory: () => ng.IAnimateCallbackObject): void; - - /** - * Gets and/or sets the CSS class expression that is checked when performing an animation. - * - * @param expression The className expression which will be checked against all animations. - * @returns The current CSS className expression value. If null then there is no expression value. - */ - classNameFilter(expression?: RegExp): RegExp; - } -} diff --git a/angular/legacy/angular-animate-1.3.d.ts b/angular/legacy/angular-animate-1.3.d.ts deleted file mode 100644 index 6f103bc83c..0000000000 --- a/angular/legacy/angular-animate-1.3.d.ts +++ /dev/null @@ -1,261 +0,0 @@ -// Type definitions for Angular JS 1.3 (ngAnimate module) -// Project: http://angularjs.org -// Definitions by: Michel Salib , Adi Dahiya , Raphael Schweizer , Cody Schaaf -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - -declare module "angular-animate" { - var _: string; - export = _; -} - -/** - * ngAnimate module (angular-animate.js) - */ -declare namespace angular.animate { - interface IAnimateFactory extends Function { - enter?: (element: ng.IAugmentedJQuery, doneFn: Function) => IAnimateCssRunner|void; - leave?: (element: ng.IAugmentedJQuery, doneFn: Function) => IAnimateCssRunner|void; - addClass?: (element: ng.IAugmentedJQuery, className: string, doneFn: Function) => IAnimateCssRunner|void; - removeClass?: (element: ng.IAugmentedJQuery, className: string, doneFn: Function) => IAnimateCssRunner|void; - setClass?: (element: ng.IAugmentedJQuery, className: string, doneFn: Function) => IAnimateCssRunner|void; - } - - /** - * AnimateService - * see http://docs.angularjs.org/api/ngAnimate/service/$animate - */ - interface IAnimateService { - /** - * Globally enables / disables animations. - * - * @param element If provided then the element will be used to represent the enable/disable operation. - * @param value If provided then set the animation on or off. - * @returns current animation state - */ - enabled(element?: JQuery, value?: boolean): boolean; - - /** - * Performs an inline animation on the element. - * - * @param element the element that will be the focus of the animation - * @param from a collection of CSS styles that will be applied to the element at the start of the animation - * @param to a collection of CSS styles that the element will animate towards - * @param className an optional CSS class that will be added to the element for the duration of the animation (the default class is 'ng-inline-animate') - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IPromise; - - /** - * Appends the element to the parentElement element that resides in the document and then runs the enter animation. - * - * @param element the element that will be the focus of the enter animation - * @param parentElement the parent element of the element that will be the focus of the enter animation - * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IPromise; - - /** - * Runs the leave animation operation and, upon completion, removes the element from the DOM. - * - * @param element the element that will be the focus of the leave animation - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - leave(element: JQuery, options?: IAnimationOptions): IPromise; - - /** - * Fires the move DOM operation. Just before the animation starts, the animate service will either append - * it into the parentElement container or add the element directly after the afterElement element if present. - * Then the move animation will be run. - * - * @param element the element that will be the focus of the move animation - * @param parentElement the parent element of the element that will be the focus of the move animation - * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation - * @returns the animation callback promise - */ - move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IPromise; - - /** - * Triggers a custom animation event based off the className variable and then attaches the className - * value to the element as a CSS class. - * - * @param element the element that will be animated - * @param className the CSS class that will be added to the element and then animated - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - addClass(element: JQuery, className: string, options?: IAnimationOptions): IPromise; - - /** - * Triggers a custom animation event based off the className variable and then removes the CSS class - * provided by the className value from the element. - * - * @param element the element that will be animated - * @param className the CSS class that will be animated and then removed from the element - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - removeClass(element: JQuery, className: string, options?: IAnimationOptions): IPromise; - - /** - * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback - * will be fired (if provided). - * - * @param element the element which will have its CSS classes changed removed from it - * @param add the CSS classes which will be added to the element - * @param remove the CSS class which will be removed from the element CSS classes have been set on the element - * @param options an optional collection of styles that will be picked up by the CSS transition/animation - * @returns the animation callback promise - */ - setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IPromise; - - /** - * Cancels the provided animation. - */ - cancel(animationPromise: IPromise): void; - } - - /** - * AnimateProvider - * see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider - */ - interface IAnimateProvider { - /** - * Registers a new injectable animation factory function. - * - * @param name The name of the animation. - * @param factory The factory function that will be executed to return the animation object. - */ - register(name: string, factory: () => IAnimateCallbackObject): void; - - /** - * Gets and/or sets the CSS class expression that is checked when performing an animation. - * - * @param expression The className expression which will be checked against all animations. - * @returns The current CSS className expression value. If null then there is no expression value. - */ - classNameFilter(expression?: RegExp): RegExp; - } - - /** - * Angular Animation Options - * see https://docs.angularjs.org/api/ngAnimate/#applying-directive-specific-styles-to-an-animation - */ - interface IAnimationOptions { - /** - * The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. - */ - to?: Object; - - /** - * The starting CSS styles (a key/value object) that will be applied at the start of the animation. - */ - from?: Object; - - /** - * The DOM event (e.g. enter, leave, move). When used, a generated CSS class of ng-EVENT and - * ng-EVENT-active will be applied to the element during the animation. Multiple events can be provided when - * spaces are used as a separator. (Note that this will not perform any DOM operation.) - */ - event?: string; - - /** - * The CSS easing value that will be applied to the transition or keyframe animation (or both). - */ - easing?: string; - - /** - * The raw CSS transition style that will be used (e.g. 1s linear all). - */ - transition?: string; - - /** - * The raw CSS keyframe animation style that will be used (e.g. 1s my_animation linear). - */ - keyframe?: string; - - /** - * A space separated list of CSS classes that will be added to the element and spread across the animation. - */ - addClass?: string; - - /** - * A space separated list of CSS classes that will be removed from the element and spread across - * the animation. - */ - removeClass?: string; - - /** - * A number value representing the total duration of the transition and/or keyframe (note that a value - * of 1 is 1000ms). If a value of 0 is provided then the animation will be skipped entirely. - */ - duration?: number; - - /** - * A number value representing the total delay of the transition and/or keyframe (note that a value of - * 1 is 1000ms). If a value of true is used then whatever delay value is detected from the CSS classes will be - * mirrored on the elements styles (e.g. by setting delay true then the style value of the element will be - * transition-delay: DETECTED_VALUE). Using true is useful when you want the CSS classes and inline styles to - * all share the same CSS delay value. - */ - delay?: number; - - /** - * A numeric time value representing the delay between successively animated elements (Click here to - * learn how CSS-based staggering works in ngAnimate.) - */ - stagger?: number; - - /** - * The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item - * in the stagger; therefore when a stagger option value of 0.1 is used then there will be a stagger delay of 600ms) - * applyClassesEarly - Whether or not the classes being added or removed will be used when detecting the animation. - * This is set by $animate when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. - * (Note that this will prevent any transitions from occuring on the classes being added and removed.) - */ - staggerIndex?: number; - } - - interface IAnimateCssRunner { - /** - * Starts the animation - * - * @returns The animation runner with a done function for supplying a callback. - */ - start(): IAnimateCssRunnerStart; - - /** - * Ends (aborts) the animation - */ - end(): void; - } - - interface IAnimateCssRunnerStart extends IPromise { - /** - * Allows you to add done callbacks to the running animation - * - * @param callbackFn: the callback function to be run - */ - done(callbackFn: (animationFinished: boolean) => void): void; - } - - /** - * AnimateCssService - * see http://docs.angularjs.org/api/ngAnimate/service/$animateCss - */ - interface IAnimateCssService { - (element: JQuery, animateCssOptions: IAnimationOptions): IAnimateCssRunner; - } - -} - -declare namespace angular { - interface IModule { - animate(cssSelector: string, animateFactory: angular.animate.IAnimateFactory): IModule; - } -} diff --git a/angular/legacy/angular-cookies-1.0.d.ts b/angular/legacy/angular-cookies-1.0.d.ts deleted file mode 100644 index 78c8bd4229..0000000000 --- a/angular/legacy/angular-cookies-1.0.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Type definitions for Angular JS 1.0 (ngCookies module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - -/////////////////////////////////////////////////////////////////////////////// -// ngCookies module (angular-cookies.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng.cookies { - - /////////////////////////////////////////////////////////////////////////// - // CookieService - // see http://docs.angularjs.org/api/ngCookies.$cookies - /////////////////////////////////////////////////////////////////////////// - interface ICookiesService {} - - /////////////////////////////////////////////////////////////////////////// - // CookieStoreService - // see http://docs.angularjs.org/api/ngCookies.$cookieStore - /////////////////////////////////////////////////////////////////////////// - interface ICookieStoreService { - get(key: string): any; - put(key: string, value: any): void; - remove(key: string): void; - } - -} diff --git a/angular/legacy/angular-cookies-1.2.d.ts b/angular/legacy/angular-cookies-1.2.d.ts deleted file mode 100644 index 662bf11662..0000000000 --- a/angular/legacy/angular-cookies-1.2.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Type definitions for Angular JS 1.2 (ngCookies module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - -/////////////////////////////////////////////////////////////////////////////// -// ngCookies module (angular-cookies.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng.cookies { - - /////////////////////////////////////////////////////////////////////////// - // CookieService - // see https://code.angularjs.org/1.2.26/docs/api/ngCookies/service/$cookies - /////////////////////////////////////////////////////////////////////////// - interface ICookiesService {} - - /////////////////////////////////////////////////////////////////////////// - // CookieStoreService - // see https://code.angularjs.org/1.2.26/docs/api/ngCookies/service/$cookieStore - /////////////////////////////////////////////////////////////////////////// - interface ICookieStoreService { - /** - * Returns the value of given cookie key - * @param key Id to use for lookup - */ - get(key: string): any; - /** - * Sets a value for given cookie key - * @param key Id for the value - * @param value Value to be stored - */ - put(key: string, value: any): void; - /** - * Remove given cookie - * @param key Id of the key-value pair to delete - */ - remove(key: string): void; - } - -} diff --git a/angular/legacy/angular-mocks-1.0.d.ts b/angular/legacy/angular-mocks-1.0.d.ts deleted file mode 100644 index 7ffa97f0ee..0000000000 --- a/angular/legacy/angular-mocks-1.0.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -// Type definitions for Angular JS 1.0 (ngMock, ngMockE2E module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - -/////////////////////////////////////////////////////////////////////////////// -// functions attached to global object (window) -/////////////////////////////////////////////////////////////////////////////// -declare var module: (...modules: any[]) => any; -declare var inject: (...fns: Function[]) => any; - -/////////////////////////////////////////////////////////////////////////////// -// ngMock module (angular-mocks.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng { - - /////////////////////////////////////////////////////////////////////////// - // AngularStatic - // We reopen it to add the MockStatic definition - /////////////////////////////////////////////////////////////////////////// - interface IAngularStatic { - mock: IMockStatic; - } - - interface IMockStatic { - // see http://docs.angularjs.org/api/angular.mock.debug - debug(obj: any): string; - - // see http://docs.angularjs.org/api/angular.mock.inject - inject(...fns: Function[]): any; - - // see http://docs.angularjs.org/api/angular.mock.module - module(...modules: any[]): any; - - // see http://docs.angularjs.org/api/angular.mock.TzDate - TzDate(offset: number, timestamp: number): Date; - TzDate(offset: number, timestamp: string): Date; - } - - /////////////////////////////////////////////////////////////////////////// - // ExceptionHandlerService - // see http://docs.angularjs.org/api/ngMock.$exceptionHandler - // see http://docs.angularjs.org/api/ngMock.$exceptionHandlerProvider - /////////////////////////////////////////////////////////////////////////// - interface IExceptionHandlerProvider extends IServiceProvider { - mode(mode: string): void; - } - - /////////////////////////////////////////////////////////////////////////// - // TimeoutService - // see http://docs.angularjs.org/api/ngMock.$timeout - // Augments the original service - /////////////////////////////////////////////////////////////////////////// - interface ITimeoutService { - flush(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // LogService - // see http://docs.angularjs.org/api/ngMock.$log - // Augments the original service - /////////////////////////////////////////////////////////////////////////// - interface ILogService { - assertEmpty(): void; - reset(): void; - } - - interface LogCall { - logs: string[]; - } - - /////////////////////////////////////////////////////////////////////////// - // HttpBackendService - // see http://docs.angularjs.org/api/ngMock.$httpBackend - /////////////////////////////////////////////////////////////////////////// - interface IHttpBackendService { - flush(count?: number): void; - resetExpectations(): void; - verifyNoOutstandingExpectation(): void; - verifyNoOutstandingRequest(): void; - - expect(method: string, url: string, data?: any, headers?: any): mock.IRequestHandler; - expect(method: string, url: RegExp, data?: any, headers?: any): mock.IRequestHandler; - expect(method: RegExp, url: string, data?: any, headers?: any): mock.IRequestHandler; - expect(method: RegExp, url: RegExp, data?: any, headers?: any): mock.IRequestHandler; - - when(method: string, url: string, data?: string, headers?: any): mock.IRequestHandler; - when(method: string, url: RegExp, data?: string, headers?: any): mock.IRequestHandler; - when(method: string, url: string, data?: RegExp, headers?: any): mock.IRequestHandler; - when(method: string, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; - when(method: RegExp, url: string, data?: string, headers?: any): mock.IRequestHandler; - when(method: RegExp, url: RegExp, data?: string, headers?: any): mock.IRequestHandler; - when(method: RegExp, url: string, data?: RegExp, headers?: any): mock.IRequestHandler; - when(method: RegExp, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; - - expectDELETE(url: string, headers?: any): mock.IRequestHandler; - expectDELETE(url: RegExp, headers?: any): mock.IRequestHandler; - expectGET(url: string, headers?: any): mock.IRequestHandler; - expectGET(url: RegExp, headers?: any): mock.IRequestHandler; - expectHEAD(url: string, headers?: any): mock.IRequestHandler; - expectHEAD(url: RegExp, headers?: any): mock.IRequestHandler; - expectJSONP(url: string): mock.IRequestHandler; - expectJSONP(url: RegExp): mock.IRequestHandler; - expectPATCH(url: string, data?: any, headers?: any): mock.IRequestHandler; - expectPATCH(url: RegExp, data?: any, headers?: any): mock.IRequestHandler; - expectPOST(url: string, data?: any, headers?: any): mock.IRequestHandler; - expectPOST(url: RegExp, data?: any, headers?: any): mock.IRequestHandler; - expectPUT(url: string, data?: any, headers?: any): mock.IRequestHandler; - expectPUT(url: RegExp, data?: any, headers?: any): mock.IRequestHandler; - - whenDELETE(url: string, headers?: any): mock.IRequestHandler; - whenDELETE(url: RegExp, headers?: any): mock.IRequestHandler; - whenGET(url: string, headers?: any): mock.IRequestHandler; - whenGET(url: RegExp, headers?: any): mock.IRequestHandler; - whenHEAD(url: string, headers?: any): mock.IRequestHandler; - whenHEAD(url: RegExp, headers?: any): mock.IRequestHandler; - whenJSONP(url: string): mock.IRequestHandler; - whenJSONP(url: RegExp): mock.IRequestHandler; - whenPATCH(url: string, data?: string, headers?: any): mock.IRequestHandler; - whenPATCH(url: RegExp, data?: string, headers?: any): mock.IRequestHandler; - whenPATCH(url: string, data?: RegExp, headers?: any): mock.IRequestHandler; - whenPATCH(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; - whenPOST(url: string, data?: string, headers?: any): mock.IRequestHandler; - whenPOST(url: RegExp, data?: string, headers?: any): mock.IRequestHandler; - whenPOST(url: string, data?: RegExp, headers?: any): mock.IRequestHandler; - whenPOST(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; - whenPUT(url: string, data?: string, headers?: any): mock.IRequestHandler; - whenPUT(url: RegExp, data?: string, headers?: any): mock.IRequestHandler; - whenPUT(url: string, data?: RegExp, headers?: any): mock.IRequestHandler; - whenPUT(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler; - } - - export module mock { - - // returned interface by the the mocked HttpBackendService expect/when methods - interface IRequestHandler { - respond(func: Function): void; - respond(status: number, data?: any, headers?: any): void; - respond(data: any, headers?: any): void; - - // Available wehn ngMockE2E is loaded - passThrough(): void; - } - - } - -} diff --git a/angular/legacy/angular-mocks-1.2-tests.ts b/angular/legacy/angular-mocks-1.2-tests.ts deleted file mode 100644 index 34e29addc0..0000000000 --- a/angular/legacy/angular-mocks-1.2-tests.ts +++ /dev/null @@ -1,305 +0,0 @@ - - -/////////////////////////////////////// -// IAngularStatic -/////////////////////////////////////// -var angular: ng.IAngularStatic; -var mock: ng.IMockStatic; - -mock = angular.mock; - - -/////////////////////////////////////// -// IMockStatic -/////////////////////////////////////// -var date: Date; - -mock.dump({ key: 'value' }); - -mock.inject( - function () { return 1; }, - function () { return 2; } - ); - -mock.inject( - ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }]); - -// This overload is not documented on the website, but flows from -// how the injector works. -mock.inject( - ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }], - ['$rootScope', function ($rootScope: ng.IRootScopeService) { return 2; }]); - -mock.module('module1', 'module2'); -mock.module( - function () { return 1; }, - function () { return 2; } - ); -mock.module({ module1: function () { return 1; } }); - -date = mock.TzDate(-7, '2013-1-1T15:00:00Z'); -date = mock.TzDate(-8, 12345678); - - -/////////////////////////////////////// -// IExceptionHandlerProvider -/////////////////////////////////////// -var exceptionHandlerProvider: ng.IExceptionHandlerProvider; - -exceptionHandlerProvider.mode('log'); - - -/////////////////////////////////////// -// ITimeoutService -/////////////////////////////////////// -var timeoutService: ng.ITimeoutService; - -timeoutService.flush(); -timeoutService.flush(1234); -timeoutService.flushNext(); -timeoutService.flushNext(1234); -timeoutService.verifyNoPendingTasks(); - -//////////////////////////////////////// -// IIntervalService -//////////////////////////////////////// -var intervalService: ng.IIntervalService; -var intervalServiceTimeActuallyAdvanced: number; - -intervalServiceTimeActuallyAdvanced = intervalService.flush(); -intervalServiceTimeActuallyAdvanced = intervalService.flush(1234); - -/////////////////////////////////////// -// ILogService, ILogCall -/////////////////////////////////////// -var logService: ng.ILogService; -var logCall: ng.ILogCall; -var logs: string[]; - -logService.assertEmpty(); -logService.reset(); - -logCall = logService.debug; -logCall = logService.error; -logCall = logService.info; -logCall = logService.log; -logCall = logService.warn; - -logs = logCall.logs; - - -/////////////////////////////////////// -// IHttpBackendService -/////////////////////////////////////// -var httpBackendService: ng.IHttpBackendService; -var requestHandler: ng.mock.IRequestHandler; - -httpBackendService.flush(); -httpBackendService.flush(1234); -httpBackendService.resetExpectations(); -httpBackendService.verifyNoOutstandingExpectation(); -httpBackendService.verifyNoOutstandingRequest(); - -requestHandler = httpBackendService.expect('GET', 'http://test.local'); -requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data'); -requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/); -requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local/); -requestHandler = httpBackendService.expect('GET', /test.local/, 'response data'); -requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local/, /response data/); -requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; }); - -requestHandler = httpBackendService.expectDELETE('http://test.local'); -requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' }); -requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' }); -requestHandler = httpBackendService.expectGET('http://test.local'); -requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' }); -requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' }); -requestHandler = httpBackendService.expectHEAD('http://test.local'); -requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' }); -requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' }); -requestHandler = httpBackendService.expectJSONP('http://test.local'); -requestHandler = httpBackendService.expectJSONP(/test.local/); - -requestHandler = httpBackendService.expectPATCH('http://test.local'); -requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data'); -requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/); -requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local/); -requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data'); -requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/); -requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }); -requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' }); - -requestHandler = httpBackendService.expectPOST('http://test.local'); -requestHandler = httpBackendService.expectPOST('http://test.local', 'response data'); -requestHandler = httpBackendService.expectPOST('http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPOST('http://test.local', /response data/); -requestHandler = httpBackendService.expectPOST('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expectPOST(/test.local/); -requestHandler = httpBackendService.expectPOST(/test.local/, 'response data'); -requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPOST(/test.local/, /response data/); -requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }); -requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' }); - -requestHandler = httpBackendService.expectPUT('http://test.local'); -requestHandler = httpBackendService.expectPUT('http://test.local', 'response data'); -requestHandler = httpBackendService.expectPUT('http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPUT('http://test.local', /response data/); -requestHandler = httpBackendService.expectPUT('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.expectPUT(/test.local/); -requestHandler = httpBackendService.expectPUT(/test.local/, 'response data'); -requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.expectPUT(/test.local/, /response data/); -requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }); -requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' }); - -requestHandler = httpBackendService.when('GET', 'http://test.local'); -requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data'); -requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/); -requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local/); -requestHandler = httpBackendService.when('GET', /test.local/, 'response data'); -requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local/, /response data/); -requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; }); -requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; }); - -requestHandler = httpBackendService.whenDELETE('http://test.local'); -requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' }); -requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' }); -requestHandler = httpBackendService.whenGET('http://test.local'); -requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' }); -requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' }); -requestHandler = httpBackendService.whenHEAD('http://test.local'); -requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' }); -requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' }); -requestHandler = httpBackendService.whenJSONP('http://test.local'); -requestHandler = httpBackendService.whenJSONP(/test.local/); - -requestHandler = httpBackendService.whenPATCH('http://test.local'); -requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data'); -requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/); -requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH(/test.local/); -requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data'); -requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/); -requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }); -requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' }); - -requestHandler = httpBackendService.whenPOST('http://test.local'); -requestHandler = httpBackendService.whenPOST('http://test.local', 'response data'); -requestHandler = httpBackendService.whenPOST('http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPOST('http://test.local', /response data/); -requestHandler = httpBackendService.whenPOST('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.whenPOST(/test.local/); -requestHandler = httpBackendService.whenPOST(/test.local/, 'response data'); -requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPOST(/test.local/, /response data/); -requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }); -requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' }); - -requestHandler = httpBackendService.whenPUT('http://test.local'); -requestHandler = httpBackendService.whenPUT('http://test.local', 'response data'); -requestHandler = httpBackendService.whenPUT('http://test.local', 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPUT('http://test.local', /response data/); -requestHandler = httpBackendService.whenPUT('http://test.local', /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }); -requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }, { header: 'value' }); -requestHandler = httpBackendService.whenPUT(/test.local/); -requestHandler = httpBackendService.whenPUT(/test.local/, 'response data'); -requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' }); -requestHandler = httpBackendService.whenPUT(/test.local/, /response data/); -requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' }); -requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }); -requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' }); -requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }); -requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' }); - - -/////////////////////////////////////// -// IRequestHandler -/////////////////////////////////////// -requestHandler.passThrough(); -requestHandler.respond(function () { }); -requestHandler.respond({ key: 'value' }); -requestHandler.respond({ key: 'value' }, { header: 'value' }); -requestHandler.respond(404); -requestHandler.respond(404, { key: 'value' }); -requestHandler.respond(404, { key: 'value' }, { header: 'value' }); diff --git a/angular/legacy/angular-mocks-1.2.d.ts b/angular/legacy/angular-mocks-1.2.d.ts deleted file mode 100644 index 3b4f7e0405..0000000000 --- a/angular/legacy/angular-mocks-1.2.d.ts +++ /dev/null @@ -1,226 +0,0 @@ -// Type definitions for Angular JS 1.2 (ngMock, ngMockE2E module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - -/////////////////////////////////////////////////////////////////////////////// -// functions attached to global object (window) -/////////////////////////////////////////////////////////////////////////////// -declare var module: (...modules: any[]) => any; -declare var inject: (...fns: Function[]) => any; - -/////////////////////////////////////////////////////////////////////////////// -// ngMock module (angular-mocks.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng { - - /////////////////////////////////////////////////////////////////////////// - // AngularStatic - // We reopen it to add the MockStatic definition - /////////////////////////////////////////////////////////////////////////// - interface IAngularStatic { - mock: IMockStatic; - } - - interface IMockStatic { - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/function/angular.mock.dump - dump(obj: any): string; - - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/function/angular.mock.inject - inject(...fns: Function[]): any; - inject(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works - - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/function/angular.mock.module - module(...modules: any[]): any; - - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/type/angular.mock.TzDate - TzDate(offset: number, timestamp: number): Date; - TzDate(offset: number, timestamp: string): Date; - } - - /////////////////////////////////////////////////////////////////////////// - // ExceptionHandlerService - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$exceptionHandler - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/provider/$exceptionHandlerProvider - /////////////////////////////////////////////////////////////////////////// - interface IExceptionHandlerProvider extends IServiceProvider { - mode(mode: string): void; - } - - /////////////////////////////////////////////////////////////////////////// - // TimeoutService - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$timeout - // Augments the original service - /////////////////////////////////////////////////////////////////////////// - interface ITimeoutService { - flush(delay?: number): void; - flushNext(expectedDelay?: number): void; - verifyNoPendingTasks(): void; - } - - /////////////////////////////////////////////////////////////////////////// - // IntervalService - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$interval - // Augments the original service - /////////////////////////////////////////////////////////////////////////// - interface IIntervalService { - flush(millis?: number): number; - } - - /////////////////////////////////////////////////////////////////////////// - // LogService - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$log - // Augments the original service - /////////////////////////////////////////////////////////////////////////// - interface ILogService { - assertEmpty(): void; - reset(): void; - } - - interface ILogCall { - logs: string[]; - } - - /////////////////////////////////////////////////////////////////////////// - // HttpBackendService - // see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$httpBackend - /////////////////////////////////////////////////////////////////////////// - interface IHttpBackendService { - flush(count?: number): void; - resetExpectations(): void; - verifyNoOutstandingExpectation(): void; - verifyNoOutstandingRequest(): void; - - expect(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler; - expect(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler; - expect(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; - expect(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; - expect(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - expect(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler; - expect(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler; - expect(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler; - expect(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; - expect(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler; - expect(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; - expect(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; - expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler; - expect(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; - expect(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler; - - expectDELETE(url: string, headers?: Object): mock.IRequestHandler; - expectDELETE(url: RegExp, headers?: Object): mock.IRequestHandler; - expectGET(url: string, headers?: Object): mock.IRequestHandler; - expectGET(url: RegExp, headers?: Object): mock.IRequestHandler; - expectHEAD(url: string, headers?: Object): mock.IRequestHandler; - expectHEAD(url: RegExp, headers?: Object): mock.IRequestHandler; - expectJSONP(url: string): mock.IRequestHandler; - expectJSONP(url: RegExp): mock.IRequestHandler; - - expectPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler; - expectPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; - expectPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - expectPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler; - expectPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; - expectPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; - expectPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - expectPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; - - expectPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler; - expectPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; - expectPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - expectPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler; - expectPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; - expectPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; - expectPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - expectPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; - - expectPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler; - expectPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; - expectPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - expectPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler; - expectPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; - expectPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; - expectPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - expectPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; - - when(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler; - when(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler; - when(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; - when(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; - when(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - when(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler; - when(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler; - when(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler; - when(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; - when(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler; - when(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; - when(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; - when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler; - when(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; - when(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler; - - whenDELETE(url: string, headers?: Object): mock.IRequestHandler; - whenDELETE(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler; - whenDELETE(url: RegExp, headers?: Object): mock.IRequestHandler; - whenDELETE(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; - - whenGET(url: string, headers?: Object): mock.IRequestHandler; - whenGET(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler; - whenGET(url: RegExp, headers?: Object): mock.IRequestHandler; - whenGET(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; - - whenHEAD(url: string, headers?: Object): mock.IRequestHandler; - whenHEAD(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler; - whenHEAD(url: RegExp, headers?: Object): mock.IRequestHandler; - whenHEAD(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler; - - whenJSONP(url: string): mock.IRequestHandler; - whenJSONP(url: RegExp): mock.IRequestHandler; - - whenPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler; - whenPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; - whenPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - whenPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler; - whenPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; - whenPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; - whenPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - whenPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; - - whenPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler; - whenPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; - whenPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - whenPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler; - whenPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; - whenPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; - whenPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - whenPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; - - whenPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler; - whenPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler; - whenPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - whenPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler; - whenPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler; - whenPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler; - whenPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler; - whenPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler; - } - - export module mock { - - // returned interface by the the mocked HttpBackendService expect/when methods - interface IRequestHandler { - respond(func: Function): void; - respond(status: number, data?: any, headers?: any): void; - respond(data: any, headers?: any): void; - - // Available wehn ngMockE2E is loaded - passThrough(): void; - } - - } - -} diff --git a/angular/legacy/angular-resource-1.0.d.ts b/angular/legacy/angular-resource-1.0.d.ts deleted file mode 100644 index 88ea0adcd8..0000000000 --- a/angular/legacy/angular-resource-1.0.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -// Type definitions for Angular JS 1.0 (ngResource module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - -/////////////////////////////////////////////////////////////////////////////// -// ngResource module (angular-resource.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng.resource { - - /////////////////////////////////////////////////////////////////////////// - // ResourceService - // see http://docs.angularjs.org/api/ngResource.$resource - // Most part of the following definitions were achieved by analyzing the - // actual implementation, since the documentation doesn't seem to cover - // that deeply. - /////////////////////////////////////////////////////////////////////////// - interface IResourceService { - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actionDescriptors?: any): IResourceClass; - } - - // Just a reference to facilitate describing new actions - interface IActionDescriptor { - method: string; - isArray?: boolean; - params?: any; - headers?: any; - } - - // Baseclass for everyresource with default actions. - // If you define your new actions for the resource, you will need - // to extend this interface and typecast the ResourceClass to it. - interface IResourceClass { - get: IActionCall; - save: IActionCall; - query: IActionCall; - remove: IActionCall; - delete: IActionCall; - } - - // In case of passing the first argument as anything but a function, - // it's gonna be considered data if the action method is POST, PUT or - // PATCH (in other words, methods with body). Otherwise, it's going - // to be considered as parameters to the request. - interface IActionCall { - (): IResource; - (dataOrParams: any): IResource; - (dataOrParams: any, success: Function): IResource; - (success: Function, error?: Function): IResource; - (params: any, data: any, success?: Function, error?: Function): IResource; - } - - interface IResource { - $save: IActionCall; - $remove: IActionCall; - $delete: IActionCall; - - // No documented, but they are there, just as any custom action will be - $query: IActionCall; - $get: IActionCall; - } - - /** when creating a resource factory via IModule.factory */ - interface IResourceServiceFactoryFunction { - ($resource: ng.resource.IResourceService): ng.resource.IResourceClass; - } -} - -/** extensions to base ng based on using angular-resource */ -declare namespace ng { - - interface IModule { - /** creating a resource service factory */ - factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule; - } -} diff --git a/angular/legacy/angular-resource-1.2-tests.ts b/angular/legacy/angular-resource-1.2-tests.ts deleted file mode 100644 index f79b4752d3..0000000000 --- a/angular/legacy/angular-resource-1.2-tests.ts +++ /dev/null @@ -1,138 +0,0 @@ - - -interface IMyResource extends ng.resource.IResource { }; -interface IMyResourceClass extends ng.resource.IResourceClass { }; - -/////////////////////////////////////// -// IActionDescriptor -/////////////////////////////////////// -var actionDescriptor: ng.resource.IActionDescriptor; - -actionDescriptor.headers = { header: 'value' }; -actionDescriptor.isArray = true; -actionDescriptor.method = 'method action'; -actionDescriptor.params = { key: 'value' }; - - -/////////////////////////////////////// -// IResourceClass -/////////////////////////////////////// -var resourceClass: IMyResourceClass; -var resource: IMyResource; -var resourceArray: ng.resource.IResourceArray; - -resource = resourceClass.delete(); -resource = resourceClass.delete({ key: 'value' }); -resource = resourceClass.delete({ key: 'value' }, function () { }); -resource = resourceClass.delete(function () { }); -resource = resourceClass.delete(function () { }, function () { }); -resource = resourceClass.delete({ key: 'value' }, { key: 'value' }); -resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { }); -resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { }, function () { }); -resource.$promise.then(function(data: IMyResource) {}); - -resource = resourceClass.get(); -resource = resourceClass.get({ key: 'value' }); -resource = resourceClass.get({ key: 'value' }, function () { }); -resource = resourceClass.get(function () { }); -resource = resourceClass.get(function () { }, function () { }); -resource = resourceClass.get({ key: 'value' }, { key: 'value' }); -resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { }); -resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { }, function () { }); - -resourceArray = resourceClass.query(); -resourceArray = resourceClass.query({ key: 'value' }); -resourceArray = resourceClass.query({ key: 'value' }, function () { }); -resourceArray = resourceClass.query(function () { }); -resourceArray = resourceClass.query(function () { }, function () { }); -resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }); -resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { }); -resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { }, function () { }); -resourceArray.push(resource); -resourceArray.$promise.then(function(data: ng.resource.IResourceArray) {}); - -resource = resourceClass.remove(); -resource = resourceClass.remove({ key: 'value' }); -resource = resourceClass.remove({ key: 'value' }, function () { }); -resource = resourceClass.remove(function () { }); -resource = resourceClass.remove(function () { }, function () { }); -resource = resourceClass.remove({ key: 'value' }, { key: 'value' }); -resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { }); -resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { }, function () { }); - -resource = resourceClass.save(); -resource = resourceClass.save({ key: 'value' }); -resource = resourceClass.save({ key: 'value' }, function () { }); -resource = resourceClass.save(function () { }); -resource = resourceClass.save(function () { }, function () { }); -resource = resourceClass.save({ key: 'value' }, { key: 'value' }); -resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }); -resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }, function () { }); - -/////////////////////////////////////// -// IResource -/////////////////////////////////////// - -var promise : ng.IPromise; -var arrayPromise : ng.IPromise; - -promise = resource.$delete(); -promise = resource.$delete({ key: 'value' }); -promise = resource.$delete({ key: 'value' }, function () { }); -promise = resource.$delete(function () { }); -promise = resource.$delete(function () { }, function () { }); -promise = resource.$delete({ key: 'value' }, function () { }, function () { }); -promise.then(function(data: IMyResource) {}); - -promise = resource.$get(); -promise = resource.$get({ key: 'value' }); -promise = resource.$get({ key: 'value' }, function () { }); -promise = resource.$get(function () { }); -promise = resource.$get(function () { }, function () { }); -promise = resource.$get({ key: 'value' }, function () { }, function () { }); - -arrayPromise = resourceArray[0].$query(); -arrayPromise = resourceArray[0].$query({ key: 'value' }); -arrayPromise = resourceArray[0].$query({ key: 'value' }, function () { }); -arrayPromise = resourceArray[0].$query(function () { }); -arrayPromise = resourceArray[0].$query(function () { }, function () { }); -arrayPromise = resourceArray[0].$query({ key: 'value' }, function () { }, function () { }); -arrayPromise.then(function(data: ng.resource.IResourceArray) {}); - -promise = resource.$remove(); -promise = resource.$remove({ key: 'value' }); -promise = resource.$remove({ key: 'value' }, function () { }); -promise = resource.$remove(function () { }); -promise = resource.$remove(function () { }, function () { }); -promise = resource.$remove({ key: 'value' }, function () { }, function () { }); - -promise = resource.$save(); -promise = resource.$save({ key: 'value' }); -promise = resource.$save({ key: 'value' }, function () { }); -promise = resource.$save(function () { }); -promise = resource.$save(function () { }, function () { }); -promise = resource.$save({ key: 'value' }, function () { }, function () { }); - -/////////////////////////////////////// -// IResourceService -/////////////////////////////////////// -var resourceService: ng.resource.IResourceService; -resourceClass = resourceService('test'); -resourceClass = resourceService('test'); -resourceClass = resourceService('test'); - -/////////////////////////////////////// -// IModule -/////////////////////////////////////// -var mod: ng.IModule; -var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction; -var resourceService: ng.resource.IResourceService; - -resourceClass = resourceServiceFactoryFunction(resourceService); - -resourceServiceFactoryFunction = function (resourceService: ng.resource.IResourceService) { return resourceClass; }; -mod = mod.factory('factory name', resourceServiceFactoryFunction); - -/////////////////////////////////////// -// IResource -/////////////////////////////////////// \ No newline at end of file diff --git a/angular/legacy/angular-resource-1.2.d.ts b/angular/legacy/angular-resource-1.2.d.ts deleted file mode 100644 index 5270037426..0000000000 --- a/angular/legacy/angular-resource-1.2.d.ts +++ /dev/null @@ -1,152 +0,0 @@ -// Type definitions for Angular JS 1.2 (ngResource module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar , Michael Jess -// Definitions: https://github.com/daptiv/DefinitelyTyped - - - - -/////////////////////////////////////////////////////////////////////////////// -// ngResource module (angular-resource.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng.resource { - - /////////////////////////////////////////////////////////////////////////// - // ResourceService - // see https://code.angularjs.org/1.2.26/docs/api/ngResource/service/$resource - // Most of the following definitions were achieved by analyzing the - // actual implementation, since the documentation doesn't seem to cover - // that deeply. - /////////////////////////////////////////////////////////////////////////// - interface IResourceService { - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actionDescriptors?: any): IResourceClass>; - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actionDescriptors?: any): U; - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actionDescriptors?: any): IResourceClass; - } - - // Just a reference to facilitate describing new actions - interface IActionDescriptor { - method: string; - isArray?: boolean; - params?: any; - headers?: any; - } - - // Baseclass for everyresource with default actions. - // If you define your new actions for the resource, you will need - // to extend this interface and typecast the ResourceClass to it. - // - // In case of passing the first argument as anything but a function, - // it's gonna be considered data if the action method is POST, PUT or - // PATCH (in other words, methods with body). Otherwise, it's going - // to be considered as parameters to the request. - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465 - // - // Only those methods with an HTTP body do have 'data' as first parameter: - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463 - // More specifically, those methods are POST, PUT and PATCH: - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432 - // - // Also, static calls always return the IResource (or IResourceArray) retrieved - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549 - interface IResourceClass { - new(dataOrParams? : any) : T; - get(): T; - get(params: Object): T; - get(success: Function, error?: Function): T; - get(params: Object, success: Function, error?: Function): T; - get(params: Object, data: Object, success?: Function, error?: Function): T; - - query(): IResourceArray; - query(params: Object): IResourceArray; - query(success: Function, error?: Function): IResourceArray; - query(params: Object, success: Function, error?: Function): IResourceArray; - query(params: Object, data: Object, success?: Function, error?: Function): IResourceArray; - - save(): T; - save(data: Object): T; - save(success: Function, error?: Function): T; - save(data: Object, success: Function, error?: Function): T; - save(params: Object, data: Object, success?: Function, error?: Function): T; - - remove(): T; - remove(params: Object): T; - remove(success: Function, error?: Function): T; - remove(params: Object, success: Function, error?: Function): T; - remove(params: Object, data: Object, success?: Function, error?: Function): T; - - delete(): T; - delete(params: Object): T; - delete(success: Function, error?: Function): T; - delete(params: Object, success: Function, error?: Function): T; - delete(params: Object, data: Object, success?: Function, error?: Function): T; - } - - // Instance calls always return the the promise of the request which retrieved the object - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546 - interface IResource { - $get(): ng.IPromise; - $get(params?: Object, success?: Function, error?: Function): ng.IPromise; - $get(success: Function, error?: Function): ng.IPromise; - - $query(): ng.IPromise>; - $query(params?: Object, success?: Function, error?: Function): ng.IPromise>; - $query(success: Function, error?: Function): ng.IPromise>; - - $save(): ng.IPromise; - $save(params?: Object, success?: Function, error?: Function): ng.IPromise; - $save(success: Function, error?: Function): ng.IPromise; - - $remove(): ng.IPromise; - $remove(params?: Object, success?: Function, error?: Function): ng.IPromise; - $remove(success: Function, error?: Function): ng.IPromise; - - $delete(): ng.IPromise; - $delete(params?: Object, success?: Function, error?: Function): ng.IPromise; - $delete(success: Function, error?: Function): ng.IPromise; - - /** the promise of the original server interaction that created this instance. **/ - $promise : ng.IPromise; - $resolved : boolean; - } - - /** - * Really just a regular Array object with $promise and $resolve attached to it - */ - interface IResourceArray extends Array { - /** the promise of the original server interaction that created this collection. **/ - $promise : ng.IPromise>; - $resolved : boolean; - } - - /** when creating a resource factory via IModule.factory */ - interface IResourceServiceFactoryFunction { - ($resource: ng.resource.IResourceService): IResourceClass; - >($resource: ng.resource.IResourceService): U; - } -} - -/** extensions to base ng based on using angular-resource */ -declare namespace ng { - - interface IModule { - /** creating a resource service factory */ - factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule; - } -} - -interface Array -{ - /** the promise of the original server interaction that created this collection. **/ - $promise : ng.IPromise>; - $resolved : boolean; -} diff --git a/angular/legacy/angular-resource-1.3.d.ts b/angular/legacy/angular-resource-1.3.d.ts deleted file mode 100644 index 7390570991..0000000000 --- a/angular/legacy/angular-resource-1.3.d.ts +++ /dev/null @@ -1,185 +0,0 @@ -// Type definitions for Angular JS 1.3 (ngResource module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar , Michael Jess -// Definitions: https://github.com/daptiv/DefinitelyTyped - - - -declare module 'angular-resource' { - var _: string; - export = _; -} - -/////////////////////////////////////////////////////////////////////////////// -// ngResource module (angular-resource.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace angular.resource { - - /** - * Currently supported options for the $resource factory options argument. - */ - interface IResourceOptions { - /** - * If true then the trailing slashes from any calculated URL will be stripped (defaults to true) - */ - stripTrailingSlashes?: boolean; - } - - - /////////////////////////////////////////////////////////////////////////// - // ResourceService - // see http://docs.angularjs.org/api/ngResource.$resource - // Most part of the following definitions were achieved by analyzing the - // actual implementation, since the documentation doesn't seem to cover - // that deeply. - /////////////////////////////////////////////////////////////////////////// - interface IResourceService { - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actions?: any, options?: IResourceOptions): IResourceClass>; - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actions?: any, options?: IResourceOptions): U; - (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actions?: any, options?: IResourceOptions): IResourceClass; - } - - // Just a reference to facilitate describing new actions - interface IActionDescriptor { - method: string; - params?: any; - url?: string; - isArray?: boolean; - transformRequest?: angular.IHttpRequestTransformer | angular.IHttpRequestTransformer[]; - transformResponse?: angular.IHttpResponseTransformer | angular.IHttpResponseTransformer[]; - headers?: any; - cache?: boolean | angular.ICacheObject; - timeout?: number | angular.IPromise; - withCredentials?: boolean; - responseType?: string; - interceptor?: any; - } - - // Baseclass for everyresource with default actions. - // If you define your new actions for the resource, you will need - // to extend this interface and typecast the ResourceClass to it. - // - // In case of passing the first argument as anything but a function, - // it's gonna be considered data if the action method is POST, PUT or - // PATCH (in other words, methods with body). Otherwise, it's going - // to be considered as parameters to the request. - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465 - // - // Only those methods with an HTTP body do have 'data' as first parameter: - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463 - // More specifically, those methods are POST, PUT and PATCH: - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432 - // - // Also, static calls always return the IResource (or IResourceArray) retrieved - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549 - interface IResourceClass { - new(dataOrParams? : any) : T; - get(): T; - get(params: Object): T; - get(success: Function, error?: Function): T; - get(params: Object, success: Function, error?: Function): T; - get(params: Object, data: Object, success?: Function, error?: Function): T; - - query(): IResourceArray; - query(params: Object): IResourceArray; - query(success: Function, error?: Function): IResourceArray; - query(params: Object, success: Function, error?: Function): IResourceArray; - query(params: Object, data: Object, success?: Function, error?: Function): IResourceArray; - - save(): T; - save(data: Object): T; - save(success: Function, error?: Function): T; - save(data: Object, success: Function, error?: Function): T; - save(params: Object, data: Object, success?: Function, error?: Function): T; - - remove(): T; - remove(params: Object): T; - remove(success: Function, error?: Function): T; - remove(params: Object, success: Function, error?: Function): T; - remove(params: Object, data: Object, success?: Function, error?: Function): T; - - delete(): T; - delete(params: Object): T; - delete(success: Function, error?: Function): T; - delete(params: Object, success: Function, error?: Function): T; - delete(params: Object, data: Object, success?: Function, error?: Function): T; - } - - // Instance calls always return the the promise of the request which retrieved the object - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546 - interface IResource { - $get(): angular.IPromise; - $get(params?: Object, success?: Function, error?: Function): angular.IPromise; - $get(success: Function, error?: Function): angular.IPromise; - - $query(): angular.IPromise>; - $query(params?: Object, success?: Function, error?: Function): angular.IPromise>; - $query(success: Function, error?: Function): angular.IPromise>; - - $save(): angular.IPromise; - $save(params?: Object, success?: Function, error?: Function): angular.IPromise; - $save(success: Function, error?: Function): angular.IPromise; - - $remove(): angular.IPromise; - $remove(params?: Object, success?: Function, error?: Function): angular.IPromise; - $remove(success: Function, error?: Function): angular.IPromise; - - $delete(): angular.IPromise; - $delete(params?: Object, success?: Function, error?: Function): angular.IPromise; - $delete(success: Function, error?: Function): angular.IPromise; - - /** the promise of the original server interaction that created this instance. **/ - $promise : angular.IPromise; - $resolved : boolean; - toJSON: () => { - [index: string]: any; - } - } - - /** - * Really just a regular Array object with $promise and $resolve attached to it - */ - interface IResourceArray extends Array> { - /** the promise of the original server interaction that created this collection. **/ - $promise : angular.IPromise>; - $resolved : boolean; - } - - /** when creating a resource factory via IModule.factory */ - interface IResourceServiceFactoryFunction { - ($resource: angular.resource.IResourceService): IResourceClass; - >($resource: angular.resource.IResourceService): U; - } - - // IResourceServiceProvider used to configure global settings - interface IResourceServiceProvider extends angular.IServiceProvider { - - defaults: IResourceOptions; - } - -} - -/** extensions to base ng based on using angular-resource */ -declare namespace angular { - - interface IModule { - /** creating a resource service factory */ - factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction): IModule; - } -} - -interface Array -{ - /** the promise of the original server interaction that created this collection. **/ - $promise : angular.IPromise>; - $resolved : boolean; -} diff --git a/angular/legacy/angular-route-1.2-tests.ts b/angular/legacy/angular-route-1.2-tests.ts deleted file mode 100644 index d076c148c2..0000000000 --- a/angular/legacy/angular-route-1.2-tests.ts +++ /dev/null @@ -1,17 +0,0 @@ - - -/** - * @license HTTP Auth Interceptor Module for AngularJS - * (c) 2013 Jonathan Park @ Daptiv Solutions Inc - * License: MIT - */ - -declare var $routeProvider: ng.route.IRouteProvider; -$routeProvider - .when('/projects/:projectId/dashboard',{ - controller: '', - templateUrl: '', - caseInsensitiveMatch: true, - reloadOnSearch: false - }) - .otherwise({redirectTo: '/'}); diff --git a/angular/legacy/angular-route-1.2.d.ts b/angular/legacy/angular-route-1.2.d.ts deleted file mode 100644 index 29b57a39b4..0000000000 --- a/angular/legacy/angular-route-1.2.d.ts +++ /dev/null @@ -1,145 +0,0 @@ -// Type definitions for Angular JS 1.2 (ngRoute module) -// Project: http://angularjs.org -// Definitions by: Jonathan Park -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - -/////////////////////////////////////////////////////////////////////////////// -// ngRoute module (angular-route.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng.route { - - /////////////////////////////////////////////////////////////////////////// - // RouteParamsService - // see https://code.angularjs.org/1.2.26/docs/api/ngRoute/service/$routeParams - /////////////////////////////////////////////////////////////////////////// - interface IRouteParamsService { - [key: string]: any; - } - - /////////////////////////////////////////////////////////////////////////// - // RouteService - // see https://code.angularjs.org/1.2.26/docs/api/ngRoute/service/$route - // see https://code.angularjs.org/1.2.26/docs/api/ngRoute/provider/$routeProvider - /////////////////////////////////////////////////////////////////////////// - interface IRouteService { - /** - * Causes $route service to reload the current route even if $location hasn't changed. - * As a result of that, ngView creates new scope, reinstantiates the controller. - */ - reload(): void; - - /** - * Object with all route configuration Objects as its properties. - */ - routes: any; - - // May not always be available. For instance, current will not be available - // to a controller that was not initialized as a result of a route maching. - current?: ICurrentRoute; - } - - - /** - * see https://code.angularjs.org/1.2.26/docs/api/ngRoute/provider/$routeProvider#when for API documentation - */ - interface IRoute { - /** - * {(string|function()=} - * Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string. - */ - controller?: any; - /** - * A controller alias name. If present the controller will be published to scope under the controllerAs name. - */ - controllerAs?: string; - /** - * Undocumented? - */ - name?: string; - /** - * {string=|function()=} - * Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl. - * - * If template is a function, it will be called with the following parameters: - * - * {Array.} - route parameters extracted from the current $location.path() by applying the current route - */ - template?: string; - /** - * {string=|function()=} - * Path or function that returns a path to an html template that should be used by ngView. - * - * If templateUrl is a function, it will be called with the following parameters: - * - * {Array.} - route parameters extracted from the current $location.path() by applying the current route - */ - templateUrl?: any; - /** - * {Object.=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is: - * - * - key - {string}: a name of a dependency to be injected into the controller. - * - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead. - */ - resolve?: {[key: string]: any}; - /** - * {(string|function())=} - * Value to update $location path with and trigger route redirection. - * - * If redirectTo is a function, it will be called with the following parameters: - * - * - {Object.} - route parameters extracted from the current $location.path() by applying the current route templateUrl. - * - {string} - current $location.path() - * - {Object} - current $location.search() - * - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search(). - */ - redirectTo?: any; - /** - * Reload route when only $location.search() or $location.hash() changes. - * - * This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope. - */ - reloadOnSearch?: boolean; - /** - * Match routes without being case sensitive - * - * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive - */ - caseInsensitiveMatch?: boolean; - } - - // see https://code.angularjs.org/1.2.26/docs/api/ngRoute/service/$route#current - interface ICurrentRoute extends IRoute { - locals: { - $scope: IScope; - $template: string; - }; - - params: any; - } - - interface IRouteProvider extends IServiceProvider { - /** - * Sets route definition that will be used on route change when no other route definition is matched. - * - * @params Mapping information to be assigned to $route.current. - */ - otherwise(params: IRoute): IRouteProvider; - /** - * Adds a new route definition to the $route service. - * - * @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition. - * - * - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches. - * - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches. - * - path can contain optional named groups with a question mark: e.g.:name?. - * - * For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes. - * - * @param route Mapping information to be assigned to $route.current on route match. - */ - when(path: string, route: IRoute): IRouteProvider; - } -} diff --git a/angular/legacy/angular-sanitize-1.0.d.ts b/angular/legacy/angular-sanitize-1.0.d.ts deleted file mode 100644 index e883621105..0000000000 --- a/angular/legacy/angular-sanitize-1.0.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Type definitions for Angular JS 1.0 (ngSanitize module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - -/////////////////////////////////////////////////////////////////////////////// -// ngSanitize module (angular-sanitize.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng.sanitize { - - /////////////////////////////////////////////////////////////////////////// - // SanitizeService - // see http://docs.angularjs.org/api/ngSanitize.$sanitize - /////////////////////////////////////////////////////////////////////////// - interface ISanitizeService { - (html: string): string; - } - -} diff --git a/angular/legacy/angular-sanitize-1.2-tests.ts b/angular/legacy/angular-sanitize-1.2-tests.ts deleted file mode 100644 index 644d40b364..0000000000 --- a/angular/legacy/angular-sanitize-1.2-tests.ts +++ /dev/null @@ -1,32 +0,0 @@ - - -/////////////////////////////////////////////////////////////////////////////// -// Variables -/////////////////////////////////////////////////////////////////////////////// -let shouldBeString: string; -let testInputText: string = 'TEST'; - -/////////////////////////////////////////////////////////////////////////////// -// Test sanitize service -/////////////////////////////////////////////////////////////////////////////// -declare let $sanitizeService: ng.sanitize.ISanitizeService; -shouldBeString = $sanitizeService(testInputText); - -/////////////////////////////////////////////////////////////////////////////// -// Test `linky` filter -/////////////////////////////////////////////////////////////////////////////// -declare let $linky: ng.sanitize.filter.ILinky; - -// Should be string for simple text and target parameters -shouldBeString = $linky(testInputText, testInputText); - -// Should be string for simple text, target and attributes parameters -let attributesAsFunction = () => { -}; -shouldBeString = $linky(shouldBeString, testInputText, { - "attributeKey1": "attributeValue1", - "attributeKey2": "attributeValue2" -}); -shouldBeString = $linky(shouldBeString, testInputText, (url: string) => { - return {"attributeKey1": "attributeValue1"} -}); \ No newline at end of file diff --git a/angular/legacy/angular-sanitize-1.2.d.ts b/angular/legacy/angular-sanitize-1.2.d.ts deleted file mode 100644 index 88c3eec39e..0000000000 --- a/angular/legacy/angular-sanitize-1.2.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Type definitions for Angular JS 1.2 (ngSanitize module) -// Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - - -/////////////////////////////////////////////////////////////////////////////// -// ngSanitize module (angular-sanitize.js) -/////////////////////////////////////////////////////////////////////////////// -declare namespace ng.sanitize { - - /////////////////////////////////////////////////////////////////////////// - // SanitizeService - // see https://code.angularjs.org/1.2.26/docs/api/ngSanitize/service/$sanitize - /////////////////////////////////////////////////////////////////////////// - interface ISanitizeService { - (html: string): string; - } - - /////////////////////////////////////////////////////////////////////////// - // Filters included with the ngSanitize - // see https://code.angularjs.org/1.2.26/docs/api/ngSanitize/filter - /////////////////////////////////////////////////////////////////////////// - export module filter { - - // Finds links in text input and turns them into html links. - // Supports http/https/ftp/mailto and plain email address links. - // see https://code.angularjs.org/1.2.26/docs/api/ngSanitize/filter/linky - interface ILinky { - (text: string, target?: string): string; - } - } -} diff --git a/angular/legacy/angular-scenario-1.0.d.ts b/angular/legacy/angular-scenario-1.0.d.ts deleted file mode 100644 index ff0c87075f..0000000000 --- a/angular/legacy/angular-scenario-1.0.d.ts +++ /dev/null @@ -1,155 +0,0 @@ -// Type definitions for Angular Scenario Testing 1.0 (ngScenario module) -// Project: http://angularjs.org -// Definitions by: RomanoLindano -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace angularScenario { - export interface AngularModel { - scenario: any; - } - - export interface RunFunction { - (functionToRun: any): any; - } - export interface RunFunctionWithDescription { - (description: string, functionToRun: any): any; - } - - export interface PauseFunction { - (): any; - } - - export interface SleepFunction { - (seconds: number): any; - } - - export interface Future { - } - - export interface testWindow { - href(): Future; - path(): Future; - search(): Future; - hash(): Future; - } - - export interface testLocation { - url(): Future; - path(): Future; - search(): Future; - hash(): Future; - } - - export interface Browser { - navigateTo(url: string): void; - navigateTo(urlDescription: string, urlFunction: () => string): void; - reload(): void; - window(): testWindow; - location(): testLocation; - } - - export interface Matchers { - toEqual(value: any): void; - toBe(value: any): void; - toBeDefined(): void; - toBeTruthy(): void; - toBeFalsy(): void; - toMatch(regularExpression: any): void; - toBeNull(): void; - toContain(value: any): void; - toBeLessThan(value: any): void; - toBeGreaterThan(value: any): void; - } - - export interface CustomMatchers extends Matchers{ - } - - export interface Expect extends CustomMatchers { - not(): angularScenario.CustomMatchers; - } - - export interface UsingFunction { - (selector: string, selectorDescription?: string): void; - } - - export interface BindingFunction { - (bracketBindingExpression: string): Future; - } - - export interface Input { - enter(value: any); - check(): any; - select(radioButtonValue: any): any; - val(): Future; - } - - export interface Repeater { - count(): Future; - row(index: number): Future; - column(ngBindingExpression: string): Future; - } - - export interface Select { - option(value: any): any; - option(...listOfValues: any[]): any; - } - - export interface Element { - count(): Future; - click(): any; - query(callback: (selectedDOMElements: any[], callbackWhenDone: (objNull: any, futureValue: any) => any) =>any): any; - val(): Future; - text(): Future; - html(): Future; - height(): Future; - innerHeight(): Future; - outerHeight(): Future; - width(): Future; - innerWidth(): Future; - outerWidth(): Future; - position(): Future; - scrollLeft(): Future; - scrollTop(): Future; - offset(): Future; - - val(value: any): void; - text(value: any): void; - html(value: any): void; - height(value: any): void; - innerHeight(value: any): void; - outerHeight(value: any): void; - width(value: any): void; - innerWidth(value: any): void; - outerWidth(value: any): void; - position(value: any): void; - scrollLeft(value: any): void; - scrollTop(value: any): void; - offset(value: any): void; - - attr(key: any): Future; - prop(key: any): Future; - css(key: any): Future; - - attr(key: any, value: any): void; - prop(key: any, value: any): void; - css(key: any, value: any): void; - } -} - -declare var describe: angularScenario.RunFunctionWithDescription; -declare var xdescribe: angularScenario.RunFunctionWithDescription; -declare var beforeEach: angularScenario.RunFunction; -declare var afterEach: angularScenario.RunFunction; -declare var it: angularScenario.RunFunctionWithDescription; -declare var xit: angularScenario.RunFunctionWithDescription; -declare var pause: angularScenario.PauseFunction; -declare var sleep: angularScenario.SleepFunction; -declare function browser(): angularScenario.Browser; -declare function expect(expectation: angularScenario.Future): angularScenario.Expect; -declare var using: angularScenario.UsingFunction; -declare var binding: angularScenario.BindingFunction; -declare function input(ngModelBinding: string): angularScenario.Input; -declare function repeater(selector: string, repeaterDescription?: string): angularScenario.Repeater; -declare function select(ngModelBinding: string): angularScenario.Select; -declare function element(selector: string, elementDescription?: string): angularScenario.Element; -declare var angular: angularScenario.AngularModel; diff --git a/angular/legacy/angular-scenario-1.2.d.ts b/angular/legacy/angular-scenario-1.2.d.ts deleted file mode 100644 index 5dfa36fc5f..0000000000 --- a/angular/legacy/angular-scenario-1.2.d.ts +++ /dev/null @@ -1,166 +0,0 @@ -// Type definitions for Angular Scenario Testing 1.2 (ngScenario module) -// Project: http://angularjs.org -// Definitions by: RomanoLindano -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -declare namespace ng { - export interface IAngularStatic { - scenario: any; - } -} - -declare namespace angularScenario { - - export interface RunFunction { - (functionToRun: any): any; - } - export interface RunFunctionWithDescription { - (description: string, functionToRun: any): any; - } - - export interface PauseFunction { - (): any; - } - - export interface SleepFunction { - (seconds: number): any; - } - - export interface Future { - } - - export interface testWindow { - href(): Future; - path(): Future; - search(): Future; - hash(): Future; - } - - export interface testLocation { - url(): Future; - path(): Future; - search(): Future; - hash(): Future; - } - - export interface Browser { - navigateTo(url: string): void; - navigateTo(urlDescription: string, urlFunction: () => string): void; - reload(): void; - window(): testWindow; - location(): testLocation; - } - - export interface Matchers { - toEqual(value: any): void; - toBe(value: any): void; - toBeDefined(): void; - toBeTruthy(): void; - toBeFalsy(): void; - toMatch(regularExpression: any): void; - toBeNull(): void; - toContain(value: any): void; - toBeLessThan(value: any): void; - toBeGreaterThan(value: any): void; - } - - export interface CustomMatchers extends Matchers { - } - - export interface Expect extends CustomMatchers { - not(): angularScenario.CustomMatchers; - } - - export interface UsingFunction { - (selector: string, selectorDescription?: string): void; - } - - export interface BindingFunction { - (bracketBindingExpression: string): Future; - } - - export interface Input { - enter(value: any): any; - check(): any; - select(radioButtonValue: any): any; - val(): Future; - } - - export interface Repeater { - count(): Future; - row(index: number): Future; - column(ngBindingExpression: string): Future; - } - - export interface Select { - option(value: any): any; - option(...listOfValues: any[]): any; - } - - export interface Element { - count(): Future; - click(): any; - dblclick(): any; - mouseover(): any; - mousedown(): any; - mouseup(): any; - query(callback: (selectedDOMElements: JQuery, callbackWhenDone: (objNull: any, futureValue: any) => any) => any): any; - val(): Future; - text(): Future; - html(): Future; - height(): Future; - innerHeight(): Future; - outerHeight(): Future; - width(): Future; - innerWidth(): Future; - outerWidth(): Future; - position(): Future; - scrollLeft(): Future; - scrollTop(): Future; - offset(): Future; - - val(value: any): void; - text(value: any): void; - html(value: any): void; - height(value: any): void; - innerHeight(value: any): void; - outerHeight(value: any): void; - width(value: any): void; - innerWidth(value: any): void; - outerWidth(value: any): void; - position(value: any): void; - scrollLeft(value: any): void; - scrollTop(value: any): void; - offset(value: any): void; - - attr(key: any): Future; - prop(key: any): Future; - css(key: any): Future; - - attr(key: any, value: any): void; - prop(key: any, value: any): void; - css(key: any, value: any): void; - } -} - -declare var describe: angularScenario.RunFunctionWithDescription; -declare var ddescribe: angularScenario.RunFunctionWithDescription; -declare var xdescribe: angularScenario.RunFunctionWithDescription; -declare var beforeEach: angularScenario.RunFunction; -declare var afterEach: angularScenario.RunFunction; -declare var it: angularScenario.RunFunctionWithDescription; -declare var iit: angularScenario.RunFunctionWithDescription; -declare var xit: angularScenario.RunFunctionWithDescription; -declare var pause: angularScenario.PauseFunction; -declare var sleep: angularScenario.SleepFunction; -declare function browser(): angularScenario.Browser; -declare function expect(expectation: angularScenario.Future): angularScenario.Expect; -declare var using: angularScenario.UsingFunction; -declare var binding: angularScenario.BindingFunction; -declare function input(ngModelBinding: string): angularScenario.Input; -declare function repeater(selector: string, repeaterDescription?: string): angularScenario.Repeater; -declare function select(ngModelBinding: string): angularScenario.Select; -declare function element(selector: string, elementDescription?: string): angularScenario.Element; -declare var angular: ng.IAngularStatic; diff --git a/angular/tsconfig.json b/angular/tsconfig.json index ef071ac6ee..8cd61f15fb 100644 --- a/angular/tsconfig.json +++ b/angular/tsconfig.json @@ -6,7 +6,7 @@ "compilerOptions": { "module": "commonjs", "target": "es6", - "noImplicitAny": true, + "noImplicitAny": false, "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", diff --git a/apex.js/apex.js-tests.ts b/apex.js/apex.js-tests.ts new file mode 100644 index 0000000000..0595ef43ea --- /dev/null +++ b/apex.js/apex.js-tests.ts @@ -0,0 +1,8 @@ +import * as λ from "apex.js"; + +const handler = λ((event, context) => { + console.log("Event: " + JSON.stringify(event)); + console.log("Context: " + JSON.stringify(context)); + + return {event, context}; +}); diff --git a/apex.js/index.d.ts b/apex.js/index.d.ts new file mode 100644 index 0000000000..20178369dc --- /dev/null +++ b/apex.js/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for apex.js 2.0 +// Project: https://github.com/apex/node-apex +// Definitions by: Yoriki Yamaguchi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare function λ(fn: (event: any, context: AWSLambda.Context) => any): (event: any, context: AWSLambda.Context, callback: AWSLambda.Callback) => void; +declare namespace λ {} +export = λ; diff --git a/apex.js/tsconfig.json b/apex.js/tsconfig.json new file mode 100644 index 0000000000..835b16d90b --- /dev/null +++ b/apex.js/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "apex.js-tests.ts" + ] +} diff --git a/apex.js/tslint.json b/apex.js/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/apex.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/argon2/argon2-tests.ts b/argon2/argon2-tests.ts deleted file mode 100644 index 566292b4fa..0000000000 --- a/argon2/argon2-tests.ts +++ /dev/null @@ -1,35 +0,0 @@ - -import { defaults, limits, hash, verify, generateSalt } from 'argon2'; - -main(); - -async function main() { - - const defaultTimeCost: number = defaults.timeCost; - const defaultMemoryCost: number = defaults.memoryCost; - const defaultParallelism: number = defaults.parallelism; - const defaultArgon2d: boolean = defaults.argon2d; - - const minMemoryCost: number = limits.memoryCost.min; - const maxMemoryCost: number = limits.memoryCost.max; - const minTimeCost: number = limits.timeCost.min; - const maxTimeCost: number = limits.timeCost.max; - const minParallelism: number = limits.parallelism.min; - const maxParallelism: number = limits.parallelism.max; - - const options = { - timeCost: 4, - memoryCost: 13, - parallelism: 2, - argon2d: true, - }; - - const hash1: string = await hash('secret', new Buffer(''), options); - const hash2: string = await hash('secret', new Buffer(''), {}); - const hash3: string = await hash('secret', new Buffer('')); - - const verified: boolean = await verify('long-hash', 'secret'); - - const salt1: Buffer = await generateSalt(); - const salt2: Buffer = await generateSalt(32); -} diff --git a/argon2/index.d.ts b/argon2/index.d.ts deleted file mode 100644 index 1cbf1a5156..0000000000 --- a/argon2/index.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Type definitions for argon2 0.14 -// Project: https://github.com/ranisalt/node-argon2#readme -// Definitions by: Peter Safranek -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -export var defaults: { - timeCost: number; - memoryCost: number; - parallelism: number; - argon2d: boolean; -}; - -export var limits: { - memoryCost: { - min: number; - max: number; - }; - timeCost: { - min: number; - max: number; - }; - parallelism: { - min: number; - max: number; - }; -}; - -export function hash(plain: string, salt: Buffer, options?: { - timeCost?: number; - memoryCost?: number; - parallelism?: number; - argon2d?: boolean; -}): Promise; - -export function verify(hash: string, plain: string): Promise; - -export function generateSalt(length?: number): Promise; diff --git a/assert-plus/assert-plus-tests.ts b/assert-plus/assert-plus-tests.ts index 9042bbbb69..ec1036e56f 100644 --- a/assert-plus/assert-plus-tests.ts +++ b/assert-plus/assert-plus-tests.ts @@ -1,5 +1,5 @@ -import * as lib from 'assert-plus'; +import * as assert from 'assert-plus'; let arr = ['one', 'two']; -lib.array(arr, ''); +assert.array(arr, ''); diff --git a/assert-plus/index.d.ts b/assert-plus/index.d.ts index 2bdcae3250..e2bafe4eae 100644 --- a/assert-plus/index.d.ts +++ b/assert-plus/index.d.ts @@ -3,65 +3,505 @@ // Definitions by: Костя Третяк // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function array(options: any[], message ?: string): void; -export function bool(options: boolean, message ?: string): void; -export function buffer(options: any, message ?: string): void; -export function func(options: any, message ?: string): void; -export function number(options: number, message ?: string): void; -export function finite(options: any, message ?: string): void; -export function object(options: any, message ?: string): void; -export function string(options: string, message ?: string): void; -export function stream(options: any, message ?: string): void; -export function date(options: string | number, message ?: string): void; -export function regexp(options: any, message ?: string): void; -export function uuid(options: string, message ?: string): void; -export function arrayOfArray(options: any[], message ?: string): void; -export function arrayOfBool(options: boolean[], message ?: string): void; -export function arrayOfBuffer(options: any[], message ?: string): void; -export function arrayOfFunc(options: any[], message ?: string): void; -export function arrayOfNumber(options: number[], message ?: string): void; -export function arrayOfFinite(options: any[], message ?: string): void; -export function arrayOfObject(options: any[], message ?: string): void; -export function arrayOfString(options: string[], message ?: string): void; -export function arrayOfStream(options: any[], message ?: string): void; -export function arrayOfDate(options: Array, message ?: string): void; -export function arrayOfRegexp(options: any[], message ?: string): void; -export function arrayOfUuid(options: string[], message ?: string): void; -export function optionalArray(options: any, message ?: string): void; -export function optionalBool(options: any, message ?: string): void; -export function optionalBuffer(options: any, message ?: string): void; +/// + +import {Stream} from 'stream'; + +/** + * + */ +export function array(arr: any[], message ?: string): void; + +/** + * + */ +export function bool(bool: boolean, message ?: string): void; + +/** + * + */ +export function buffer(buffer: Buffer, message ?: string): void; + +/** + * + */ +export function func(func: any, message ?: string): void; + +/** + * + */ +export function number(number: number, message ?: string): void; + +/** + * + */ +export function finite(finite: number, message ?: string): void; + +/** + * + */ +export function object(obj: any, message ?: string): void; + +/** + * + */ +export function string(str: string, message ?: string): void; + +/** + * + */ +export function stream(stream: Stream, message ?: string): void; + +/** + * + */ +export function date(date: Date, message ?: string): void; + +/** + * + */ +export function regexp(regexp: RegExp, message ?: string): void; + +/** + * + */ +export function uuid(uuid: string, message ?: string): void; + +/** + * + */ +export function arrayOfArray(arr: any[][], message ?: string): void; + +/** + * + */ +export function arrayOfBool(arr: boolean[], message ?: string): void; + +/** + * + */ +export function arrayOfBuffer(arr: Buffer[], message ?: string): void; + +/** + * + */ +export function arrayOfFunc(arr: any[], message ?: string): void; + +/** + * + */ +export function arrayOfNumber(arr: number[], message ?: string): void; + +/** + * + */ +export function arrayOfFinite(arr: number[], message ?: string): void; + +/** + * + */ +export function arrayOfObject(arr: any[], message ?: string): void; + +/** + * + */ +export function arrayOfString(arr: string[], message ?: string): void; + +/** + * + */ +export function arrayOfStream(arr: Stream[], message ?: string): void; + +/** + * + */ +export function arrayOfDate(arr: Date[], message ?: string): void; + +/** + * + */ +export function arrayOfRegexp(arr: RegExp[], message ?: string): void; + +/** + * + */ +export function arrayOfUuid(arr: string[], message ?: string): void; + +/** + * + */ +export function optionalArray(arr: any[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalBool(bool: boolean | undefined, message ?: string): void; + +/** + * + */ +export function optionalBuffer(buffer: Buffer | undefined, message ?: string): void; + +/** + * + */ export function optionalFunc(options: any, message ?: string): void; -export function optionalNumber(options: any, message ?: string): void; -export function optionalFinite(options: any, message ?: string): void; + +/** + * + */ +export function optionalNumber(options: number | undefined, message ?: string): void; + +/** + * + */ +export function optionalFinite(options: number | undefined, message ?: string): void; + +/** + * + */ export function optionalObject(options: any, message ?: string): void; -export function optionalString(options: any, message ?: string): void; -export function optionalStream(options: any, message ?: string): void; -export function optionalDate(options: any, message ?: string): void; -export function optionalRegexp(options: any, message ?: string): void; -export function optionalUuid(options: any, message ?: string): void; -export function optionalArrayOfArray(options: any, message ?: string): void; -export function optionalArrayOfBool(options: any, message ?: string): void; -export function optionalArrayOfBuffer(options: any, message ?: string): void; -export function optionalArrayOfFunc(options: any, message ?: string): void; -export function optionalArrayOfNumber(options: any, message ?: string): void; -export function optionalArrayOfFinite(options: any, message ?: string): void; -export function optionalArrayOfObject(options: any, message ?: string): void; -export function optionalArrayOfString(options: any, message ?: string): void; -export function optionalArrayOfStream(options: any, message ?: string): void; -export function optionalArrayOfDate(options: any, message ?: string): void; -export function optionalArrayOfRegexp(options: any, message ?: string): void; -export function optionalArrayOfUuid(options: any, message ?: string): void; + +/** + * + */ +export function optionalString(options: string | undefined, message ?: string): void; + +/** + * + */ +export function optionalStream(options: Stream | undefined, message ?: string): void; + +/** + * + */ +export function optionalDate(options: Date | undefined, message ?: string): void; + +/** + * + */ +export function optionalRegexp(options: RegExp | undefined, message ?: string): void; + +/** + * + */ +export function optionalUuid(options: string | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfArray(arr: any[][] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfBool(arr: boolean[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfBuffer(arr: Buffer[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfFunc(arr: any[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfNumber(arr: number[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfFinite(arr: number[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfObject(arr: any[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfString(arr: string[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfStream(arr: Stream[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfDate(arr: Date[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfRegexp(arr: RegExp[] | undefined, message ?: string): void; + +/** + * + */ +export function optionalArrayOfUuid(arr: string[] | undefined, message ?: string): void; + +/** + * + */ export function AssertionError(options: any, message ?: string): void; + +/** + * Throws an `AssertionError`. If `message` is falsy, the error message is set + * as the values of `actual` and `expected` separated by the provided `operator`. + * Otherwise, the error message is the value of `message`. + * + * ```js + * const assert = require('assert'); + * + * assert.fail(1, 2, undefined, '>'); + * // AssertionError: 1 > 2 + * + * assert.fail(1, 2, 'whoops', '>'); + * // AssertionError: whoops + * ``` + */ export function fail(actual: any, expected: any, message: any, operator: any): void; + + +/** + * Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`. + * + * If `value` is not truthy, an `AssertionError` is thrown with a `message` property + * set equal to the value of the `message` parameter. + * If the `message` parameter is `undefined`, a default error message is assigned. + * + * ```js + * const assert = require('assert'); + * + * assert.ok(true); + * // OK + * assert.ok(1); + * // OK + * assert.ok(false); + * // throws "AssertionError: false == true" + * assert.ok(0); + * // throws "AssertionError: 0 == true" + * assert.ok(false, 'it\'s false'); + * // throws "AssertionError: it's false" + * ``` + */ export function ok(options: any, message ?: string): void; + +/** + * Tests shallow, coercive equality between the actual and expected parameters + * using the equal comparison operator ( `==` ). + * + * ```js + * const assert = require('assert'); + * + * assert.equal(1, 1); + * // OK, 1 == 1 + * assert.equal(1, '1'); + * // OK, 1 == '1' + * + * assert.equal(1, 2); + * // AssertionError: 1 == 2 + * assert.equal({a: {b: 1}}, {a: {b: 1}}); + * //AssertionError: { a: { b: 1 } } == { a: { b: 1 } } + * ``` + * + * If the values are not equal, an `AssertionError` is thrown with + * a `message` property set equal to the value of the `message` parameter. + * If the `message` parameter is undefined, a default error message is assigned. + */ export function equal(actual: any, expected: any, message ?: string): void; + +/** + * Tests shallow, coercive inequality with the not equal comparison operator ( `!=` ). + * + * ```js + * const assert = require('assert'); + * + * assert.notEqual(1, 2); + * // OK + * + * assert.notEqual(1, 1); + * // AssertionError: 1 != 1 + * + * assert.notEqual(1, '1'); + * // AssertionError: 1 != '1' + * ``` + * + * If the values are equal, an `AssertionError` is thrown with + * a `message` property set equal to the value of the `message` parameter. + * If the `message` parameter is undefined, a default error message is assigned. + */ export function notEqual(actual: any, expected: any, message ?: string): void; -export function deepEqual(actual: any, expected: any, message ?: string): void; + +/** + * Tests for deep equality between the `actual` and `expected` parameters. + * Primitive values are compared with the equal comparison operator ( `==` ). + * + * Only enumerable "own" properties are considered. + * The `deepEqual()` implementation does not test object prototypes, attached symbols, + * or non-enumerable properties. This can lead to some potentially surprising results. + * For example, the following example does not throw an `AssertionError` because + * the properties on the Error object are non-enumerable: + * + * ```js + * // WARNING: This does not throw an AssertionError! + * assert.deepEqual(Error('a'), Error('b')); + * ``` + * + * "Deep" equality means that the enumerable "own" properties of child objects are evaluated also. + * + * If the values are not equal, an `AssertionError` is thrown with a `message` property + * set equal to the value of the `message` parameter. If the `message` parameter is undefined, + * a default error message is assigned. + */ +export function deepEqual(actual: T, expected: T, message ?: string): void; + +/** + * Tests for any deep inequality. Opposite of `assert.deepEqual()`. + * + * ```js + * const assert = require('assert'); + * + * const obj1 = { a : { b : 1 } }; + * const obj2 = { a : { b : 2 } }; + * const obj3 = { a : { b : 1 } }; + * const obj4 = Object.create(obj1); + * + * assert.notDeepEqual(obj1, obj1); + * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } + * + * assert.notDeepEqual(obj1, obj2); + * // OK, obj1 and obj2 are not deeply equal + * + * assert.notDeepEqual(obj1, obj3); + * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } + * + * assert.notDeepEqual(obj1, obj4); + * // OK, obj1 and obj2 are not deeply equal + * ``` + * + * If the values are deeply equal, an `AssertionError` is thrown with + * a `message` property set equal to the value of the `message` parameter. + * If the `message` parameter is undefined, a default error message is assigned. + */ export function notDeepEqual(actual: any, expected: any, message ?: string): void; -export function strictEqual(actual: any, expected: any, message ?: string): void; + +/** + * Tests strict equality as determined by the strict equality operator ( `===` ). + * + * ```js + * const assert = require('assert'); + * + * assert.strictEqual(1, 2); + * // AssertionError: 1 === 2 + * + * assert.strictEqual(1, 1); + * // OK + * + * assert.strictEqual(1, '1'); + * // AssertionError: 1 === '1' + * ``` + * + * If the values are not strictly equal, an `AssertionError` is thrown with + * a `message` property set equal to the value of the `message` parameter. + * If the `message` parameter is undefined, a default error message is assigned. + */ +export function strictEqual(actual: T, expected: T, message ?: string): void; + +/** + * Tests strict inequality as determined by the strict not equal operator ( `!==` ). + * + * ```js + * const assert = require('assert'); + * + * assert.notStrictEqual(1, 2); + * // OK + * + * assert.notStrictEqual(1, 1); + * // AssertionError: 1 !== 1 + * + * assert.notStrictEqual(1, '1'); + * // OK + * ``` + * + * If the values are strictly equal, an `AssertionError` is thrown with a `message` property + * set equal to the value of the `message` parameter. If the `message` parameter is undefined, + * a default error message is assigned. + */ export function notStrictEqual(actual: any, expected: any, message ?: string): void; + +/** + * + */ export function throws(block: any, error ?: any, message ?: string): void; + +/** + * Asserts that the function `block` does not throw an error. See `assert.throws()` for more details. + * + * When `assert.doesNotThrow()` is called, it will immediately call the `block` function. + * + * If an error is thrown and it is the same type as that specified by the `error` parameter, + * then an `AssertionError` is thrown. If the error is of a different type, + * or if the `error` parameter is undefined, the error is propagated back to the caller. + * + * The following, for instance, will throw the TypeError because there is no matching error type in the assertion: + * ```js + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * SyntaxError + * ); + * ``` + * + * However, the following will result in an `AssertionError` with the message 'Got unwanted exception (TypeError)..': + * ```js + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * TypeError + * ); + * ``` + * + * If an `AssertionError` is thrown and a value is provided for the `message` parameter, + * the value of `message` will be appended to the `AssertionError` message: + * ```js + * assert.doesNotThrow( + * () => { + * throw new TypeError('Wrong value'); + * }, + * TypeError, + * 'Whoops' + * ); + * // Throws: AssertionError: Got unwanted exception (TypeError). Whoops + * ``` + */ export function doesNotThrow(block: any, error ?: any, message ?: string): void; + +/** + * Throws `value` if `value` is truthy. This is useful when testing the `error` argument in callbacks. + * ```js + * const assert = require('assert'); + * + * assert.ifError(0); + * // OK + * assert.ifError(1); + * // Throws 1 + * assert.ifError('error'); + * // Throws 'error' + * assert.ifError(new Error()); + * // Throws Error + * ``` + */ export function ifError(value: any): void; + export as namespace AssertPlus; diff --git a/async/asyncamd-tests.ts b/async/asyncamd-tests.ts deleted file mode 100644 index 4bf6c2789d..0000000000 --- a/async/asyncamd-tests.ts +++ /dev/null @@ -1,5 +0,0 @@ - - -import async = require("async"); - -async.map(["a", "b", "c"], (item, cb) => cb(null, [item.toUpperCase()]), (err, results) => { }); diff --git a/async/tsconfig.json b/async/tsconfig.json index d62fccf232..412f9b97c6 100644 --- a/async/tsconfig.json +++ b/async/tsconfig.json @@ -4,7 +4,7 @@ "target": "es6", "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, + "strictNullChecks": false, "baseUrl": "../", "typeRoots": [ "../" @@ -15,6 +15,7 @@ }, "files": [ "index.d.ts", - "async-tests.ts" + "async-tests.ts", + "async-explicit-tests.ts" ] } \ No newline at end of file diff --git a/atom/tsconfig.json b/atom/tsconfig.json index a2678c3d56..cbb243e6bb 100644 --- a/atom/tsconfig.json +++ b/atom/tsconfig.json @@ -15,6 +15,7 @@ }, "files": [ "index.d.ts", + "api-docs.d.ts", "atom-tests.ts" ] } \ No newline at end of file diff --git a/auth0-angular/auth0-angular-tests.ts b/auth0-angular/auth0-angular-tests.ts index f9700c1410..e35b0a7627 100644 --- a/auth0-angular/auth0-angular-tests.ts +++ b/auth0-angular/auth0-angular-tests.ts @@ -1,4 +1,4 @@ - + var authProvider: auth0.angular.IAuth0ServiceProvider; diff --git a/auth0-lock/auth0.lock-tests.ts b/auth0-lock/auth0.lock-tests.ts index bba2fc8228..cd51950c6a 100644 --- a/auth0-lock/auth0.lock-tests.ts +++ b/auth0-lock/auth0.lock-tests.ts @@ -26,6 +26,18 @@ lock.on("authenticated", function(authResult : any) { }); }); +lock.on("authenticated", function(authResult : any) { + lock.getUserInfo(authResult.accessToken, function(error, profile) { + if (error) { + // Handle error + return; + } + + localStorage.setItem("idToken", authResult.idToken); + localStorage.setItem("profile", JSON.stringify(profile)); + }); +}); + // test theme diff --git a/auth0-lock/index.d.ts b/auth0-lock/index.d.ts index 1a05d3f913..e2964d287c 100644 --- a/auth0-lock/index.d.ts +++ b/auth0-lock/index.d.ts @@ -107,6 +107,8 @@ interface Auth0LockStatic { new (clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic; getProfile(token: string, callback: (error: Auth0Error, profile: Auth0UserProfile) => void) : void; + getUserInfo(token: string, callback: (error: Auth0Error, profile: Auth0UserProfile) => void) : void; + show(): void; hide(): void; logout(query: any): void; diff --git a/aws4/aws4-tests.ts b/aws4/aws4-tests.ts index b611951e45..d5915994c7 100644 --- a/aws4/aws4-tests.ts +++ b/aws4/aws4-tests.ts @@ -1,6 +1,4 @@ -/// - -import * as aws4 from "."; +import * as aws4 from "aws4"; let requestSigner = new aws4.RequestSigner({}, {}); requestSigner.matchHost(""); diff --git a/azure/azure-tests.ts b/azure/azure-tests.ts index 2d60803d3b..e763346d84 100644 --- a/azure/azure-tests.ts +++ b/azure/azure-tests.ts @@ -1,4 +1,4 @@ -import Azure = require("azure"); +import Azure = require("azure"); var ts = new Azure.TableService(); diff --git a/backbone.radio/backbone.radio-tests.ts b/backbone.radio/backbone.radio-tests.ts index 1c0685780f..e0adecb925 100644 --- a/backbone.radio/backbone.radio-tests.ts +++ b/backbone.radio/backbone.radio-tests.ts @@ -1,4 +1,4 @@ - + /// import * as Backbone from 'backbone'; diff --git a/backbone/backbone-with-lodash-tests.ts b/backbone/backbone-with-lodash-tests.ts index 27da75d5f9..b44b2be988 100644 --- a/backbone/backbone-with-lodash-tests.ts +++ b/backbone/backbone-with-lodash-tests.ts @@ -1,6 +1,5 @@ -/// -/// -/// +import * as Backbone from "backbone"; +import * as _ from "lodash"; function test_events() { diff --git a/backbone/tsconfig.json b/backbone/tsconfig.json index b4a63b9ef0..43a64b9e25 100644 --- a/backbone/tsconfig.json +++ b/backbone/tsconfig.json @@ -15,6 +15,7 @@ }, "files": [ "index.d.ts", - "backbone-tests.ts" + "backbone-tests.ts", + "backbone-with-lodash-tests.ts" ] } \ No newline at end of file diff --git a/base64url/base64url-test.ts b/base64url/base64url-tests.ts similarity index 100% rename from base64url/base64url-test.ts rename to base64url/base64url-tests.ts diff --git a/base64url/tsconfig.json b/base64url/tsconfig.json index e5f6b4b0a6..a62c495fb3 100644 --- a/base64url/tsconfig.json +++ b/base64url/tsconfig.json @@ -15,6 +15,6 @@ }, "files": [ "index.d.ts", - "base64url-test.ts" + "base64url-tests.ts" ] } \ No newline at end of file diff --git a/bcryptjs/bcryptjs-tests.ts b/bcryptjs/bcryptjs-tests.ts index 83b67c17cc..cd91eb4896 100644 --- a/bcryptjs/bcryptjs-tests.ts +++ b/bcryptjs/bcryptjs-tests.ts @@ -3,6 +3,7 @@ import bcryptjs = require("bcryptjs"); let str: string; let num: number; let bool: boolean; +let error: Error; str = bcryptjs.genSaltSync(); str = bcryptjs.genSaltSync(10); @@ -13,6 +14,12 @@ bcryptjs.genSalt((err: Error, salt: string) => { bcryptjs.genSalt(10, (err: Error, salt: string) => { str = salt; }); +bcryptjs.genSalt() + .then(salt => str = salt) + .catch(err => error = err); +bcryptjs.genSalt(10) + .then(salt => str = salt) + .catch(err => error = err); str = bcryptjs.hashSync("string"); str = bcryptjs.hashSync("string", 10); @@ -26,6 +33,9 @@ bcryptjs.hash("string", 10, (err: Error, hash: string) => { }, (percent: number) => { num = percent; }); +bcryptjs.hash("string", 10) + .then(salt => str = salt) + .catch(err => error = err); bcryptjs.hash("string", "salt", (err: Error, hash: string) => { str = hash; @@ -46,6 +56,9 @@ bcryptjs.compare("string1", "string2", (err: Error, success: boolean) => { }, (percent: number) => { num = percent; }); +bcryptjs.compare("string1", "string2") + .then(success => bool = success) + .catch(err => error = err); num = bcryptjs.getRounds("string"); diff --git a/bcryptjs/index.d.ts b/bcryptjs/index.d.ts index fd1c0d7903..c081ed33fd 100644 --- a/bcryptjs/index.d.ts +++ b/bcryptjs/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for bcryptjs v2.3.0 +// Type definitions for bcryptjs v2.4.0 // Project: https://github.com/dcodeIO/bcrypt.js -// Definitions by: Joshua Filby +// Definitions by: Joshua Filby , Rafael Kraut // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -16,9 +16,17 @@ export declare function setRandomFallback(random: (random: number) => number[]): * Synchronously generates a salt. * @param rounds Number of rounds to use, defaults to 10 if omitted * @return Resulting salt + * @throws If a random fallback is required but not set */ export declare function genSaltSync(rounds?: number): string; +/** + * Asynchronously generates a salt. + * @param rounds Number of rounds to use, defaults to 10 if omitted + * @return Promise with resulting salt, if callback has been omitted + */ +export declare function genSalt(rounds?: number): Promise; + /** * Asynchronously generates a salt. * @param callback Callback receiving the error, if any, and the resulting salt @@ -40,6 +48,14 @@ export declare function genSalt(rounds: number, callback: (err: Error, salt: str */ export declare function hashSync(s: string, salt?: number | string): string; +/** + * Asynchronously generates a hash for the given string. + * @param s String to hash + * @param salt Salt length to generate or salt to use + * @return Promise with resulting hash, if callback has been omitted + */ +export declare function hash(s: string, salt: number | string): Promise; + /** * Asynchronously generates a hash for the given string. * @param s String to hash @@ -47,7 +63,7 @@ export declare function hashSync(s: string, salt?: number | string): string; * @param callback Callback receiving the error, if any, and the resulting hash * @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms. */ -export declare function hash(s: string, salt: number | string, callback: (err: Error, hash: string) => void, progressCallback?: (percent: number) => void): void; +export declare function hash(s: string, salt: number | string, callback?: (err: Error, hash: string) => void, progressCallback?: (percent: number) => void): void; /** * Synchronously tests a string against a hash. @@ -57,6 +73,14 @@ export declare function hash(s: string, salt: number | string, callback: (err: E */ export declare function compareSync(s: string, hash: string): boolean; +/** + * Asynchronously compares the given data against the given hash. + * @param s Data to compare + * @param hash Data to be compared to + * @return Promise, if callback has been omitted + */ +export declare function compare(s: string, hash: string): Promise; + /** * Asynchronously compares the given data against the given hash. * @param s Data to compare @@ -64,7 +88,7 @@ export declare function compareSync(s: string, hash: string): boolean; * @param callback Callback receiving the error, if any, otherwise the result * @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms. */ -export declare function compare(s: string, hash: string, callback: (err: Error, success: boolean) => void, progressCallback?: (percent: number) => void): void; +export declare function compare(s: string, hash: string, callback?: (err: Error, success: boolean) => void, progressCallback?: (percent: number) => void): void; /** * Gets the number of rounds used to encrypt the specified hash. diff --git a/bingmaps/Microsoft.Maps.AdvancedShapes.d.ts b/bingmaps/Microsoft.Maps.AdvancedShapes.d.ts index 32ac20a874..e261e1d0ce 100644 --- a/bingmaps/Microsoft.Maps.AdvancedShapes.d.ts +++ b/bingmaps/Microsoft.Maps.AdvancedShapes.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft.Maps.AdvancedShapes 7.0 +// Type definitions for Microsoft.Maps.AdvancedShapes 7.0 // Project: http://msdn.microsoft.com/en-us/library/hh921952.aspx // Definitions by: Eric Todd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bingmaps/Microsoft.Maps.Directions.d.ts b/bingmaps/Microsoft.Maps.Directions.d.ts index e9f2fa9cf1..710efd7b02 100644 --- a/bingmaps/Microsoft.Maps.Directions.d.ts +++ b/bingmaps/Microsoft.Maps.Directions.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft.Maps.Directions 7.0 +// Type definitions for Microsoft.Maps.Directions 7.0 // Project: http://msdn.microsoft.com/en-us/library/hh312813.aspx // Definitions by: Eric Todd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bingmaps/Microsoft.Maps.Search.d.ts b/bingmaps/Microsoft.Maps.Search.d.ts index 21011ab1cd..d5fcb3e255 100644 --- a/bingmaps/Microsoft.Maps.Search.d.ts +++ b/bingmaps/Microsoft.Maps.Search.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft.Maps.Search 7.0 +// Type definitions for Microsoft.Maps.Search 7.0 // Project: http://msdn.microsoft.com/en-us/library/hh868061.aspx // Definitions by: Eric Todd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bingmaps/Microsoft.Maps.Themes.BingTheme.d.ts b/bingmaps/Microsoft.Maps.Themes.BingTheme.d.ts index e13be2603b..43faf0bd71 100644 --- a/bingmaps/Microsoft.Maps.Themes.BingTheme.d.ts +++ b/bingmaps/Microsoft.Maps.Themes.BingTheme.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft.Maps.Themes 7.0 +// Type definitions for Microsoft.Maps.Themes 7.0 // Project: http://msdn.microsoft.com/en-us/library/hh868061.aspx // Definitions by: Eric Todd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bingmaps/Microsoft.Maps.Traffic.d.ts b/bingmaps/Microsoft.Maps.Traffic.d.ts index 353ec39b7c..003f874cd1 100644 --- a/bingmaps/Microsoft.Maps.Traffic.d.ts +++ b/bingmaps/Microsoft.Maps.Traffic.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft.Maps.Traffic 7.0 +// Type definitions for Microsoft.Maps.Traffic 7.0 // Project: http://msdn.microsoft.com/en-us/library/hh312840.aspx // Definitions by: Eric Todd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bingmaps/Microsoft.Maps.VenueMaps.d.ts b/bingmaps/Microsoft.Maps.VenueMaps.d.ts index 51b41815f5..79076d30ea 100644 --- a/bingmaps/Microsoft.Maps.VenueMaps.d.ts +++ b/bingmaps/Microsoft.Maps.VenueMaps.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Microsoft.Maps.VenueMaps 7.0 +// Type definitions for Microsoft.Maps.VenueMaps 7.0 // Project: http://msdn.microsoft.com/en-us/library/hh312797.aspx // Definitions by: Eric Todd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bingmaps/UNUSED_FILES.txt b/bingmaps/UNUSED_FILES.txt new file mode 100644 index 0000000000..edf324bfcc --- /dev/null +++ b/bingmaps/UNUSED_FILES.txt @@ -0,0 +1,6 @@ +Microsoft.Maps.AdvancedShapes.d.ts +Microsoft.Maps.Directions.d.ts +Microsoft.Maps.Search.d.ts +Microsoft.Maps.Themes.BingTheme.d.ts +Microsoft.Maps.Traffic.d.ts +Microsoft.Maps.VenueMaps.d.ts \ No newline at end of file diff --git a/bingmaps/bingmaps-tests.ts b/bingmaps/bingmaps-tests.ts index d50efb0e62..239e33094a 100644 --- a/bingmaps/bingmaps-tests.ts +++ b/bingmaps/bingmaps-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// /// /// diff --git a/blazy/index.d.ts b/blazy/index.d.ts index dedeff4160..8a7183366d 100644 --- a/blazy/index.d.ts +++ b/blazy/index.d.ts @@ -67,6 +67,6 @@ interface Breakpoint { src: string; } -declare module 'Blazy' { +declare module 'blazy' { export = Blazy; } diff --git a/bluebird/bluebird-1.0-tests.ts b/bluebird/v1/bluebird-tests.ts similarity index 100% rename from bluebird/bluebird-1.0-tests.ts rename to bluebird/v1/bluebird-tests.ts diff --git a/bluebird/bluebird-1.0.d.ts b/bluebird/v1/index.d.ts similarity index 100% rename from bluebird/bluebird-1.0.d.ts rename to bluebird/v1/index.d.ts diff --git a/bluebird/v1/tsconfig.json b/bluebird/v1/tsconfig.json new file mode 100644 index 0000000000..9207bdd01d --- /dev/null +++ b/bluebird/v1/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "bluebird": ["bluebird/v1"] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bluebird-tests.ts" + ] +} \ No newline at end of file diff --git a/bluebird/bluebird-2.0-tests.ts b/bluebird/v2/bluebird-tests.ts similarity index 99% rename from bluebird/bluebird-2.0-tests.ts rename to bluebird/v2/bluebird-tests.ts index 3a8ddaa383..8acdcb44bd 100644 --- a/bluebird/bluebird-2.0-tests.ts +++ b/bluebird/v2/bluebird-tests.ts @@ -1,5 +1,3 @@ -/// - // Tests by: Bart van der Schoor // Note: replicate changes to all overloads in both definition and test file diff --git a/bluebird/bluebird-2.0.d.ts b/bluebird/v2/index.d.ts similarity index 100% rename from bluebird/bluebird-2.0.d.ts rename to bluebird/v2/index.d.ts diff --git a/bluebird/v2/tsconfig.json b/bluebird/v2/tsconfig.json new file mode 100644 index 0000000000..8c7fd4c71f --- /dev/null +++ b/bluebird/v2/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "bluebird": ["bluebird/v2"] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bluebird-tests.ts" + ] +} \ No newline at end of file diff --git a/bootstrap-datepicker/bootstrap-datepicker-tests.ts b/bootstrap-datepicker/bootstrap-datepicker-tests.ts index 8175b32738..cedc28c93c 100644 --- a/bootstrap-datepicker/bootstrap-datepicker-tests.ts +++ b/bootstrap-datepicker/bootstrap-datepicker-tests.ts @@ -1,4 +1,4 @@ -/// +/// function tests_simple() { $('#datepicker').datepicker(); $('#datepicker').datepicker({ diff --git a/bootstrap-datepicker/index.d.ts b/bootstrap-datepicker/index.d.ts index a692b663bb..5a6e80f72e 100644 --- a/bootstrap-datepicker/index.d.ts +++ b/bootstrap-datepicker/index.d.ts @@ -42,6 +42,7 @@ interface DatepickerOptions { showOnFocus?: boolean; immediateUpdates?: boolean; title?: string; + container?: string; } interface DatepickerCustomFormatOptions { diff --git a/bootstrap-touchspin/bootstrap-touchspin-tests.ts b/bootstrap-touchspin/bootstrap-touchspin-tests.ts index d3c37d87d7..c8a6a713f9 100644 --- a/bootstrap-touchspin/bootstrap-touchspin-tests.ts +++ b/bootstrap-touchspin/bootstrap-touchspin-tests.ts @@ -1,4 +1,4 @@ -/// +/// $(function () { diff --git a/bootstrap-validator/bootstrap-validator-tests.ts b/bootstrap-validator/bootstrap-validator-tests.ts new file mode 100644 index 0000000000..07d4753ed1 --- /dev/null +++ b/bootstrap-validator/bootstrap-validator-tests.ts @@ -0,0 +1,14 @@ +/// + +$('#myForm').validator(); +$('#myForm').validator('update'); +$('#myForm').validator('validate'); +$('#myForm').validator('destroy'); +$('#myForm').validator({ + delay: 500, + html: false, + disable: false, + focus: true, + feedback: {}, + custom: {} +}); diff --git a/bootstrap-validator/index.d.ts b/bootstrap-validator/index.d.ts new file mode 100644 index 0000000000..92dee2c310 --- /dev/null +++ b/bootstrap-validator/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for bootstrap-validator 0.11 +// Project: https://github.com/1000hz/bootstrap-validator +// Definitions by: Brady Liles +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +interface ValidatorOptions { + delay?: number; + html?: boolean; + disable?: boolean; + focus?: boolean; + feedback?: any; + custom?: any; +} + +interface JQuery { + validator(options?: ValidatorOptions): JQuery; + validator(command: string): JQuery; +} diff --git a/bootstrap-validator/tsconfig.json b/bootstrap-validator/tsconfig.json new file mode 100644 index 0000000000..d5bde637e0 --- /dev/null +++ b/bootstrap-validator/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bootstrap-validator-tests.ts" + ] +} diff --git a/argon2/tslint.json b/bootstrap-validator/tslint.json similarity index 100% rename from argon2/tslint.json rename to bootstrap-validator/tslint.json diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-3.0.0.d.ts b/bootstrap.v3.datetimepicker/v3/index.d.ts similarity index 98% rename from bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-3.0.0.d.ts rename to bootstrap.v3.datetimepicker/v3/index.d.ts index a0d8a9bbd6..2c69607cb9 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-3.0.0.d.ts +++ b/bootstrap.v3.datetimepicker/v3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Bootstrap datetimepicker v3 +// Type definitions for Bootstrap datetimepicker v3 3.x // Project: http://eonasdan.github.io/bootstrap-datetimepicker // Definitions by: Jesica N. Fera // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/bootstrap.v3.datetimepicker/v3/tsconfig.json b/bootstrap.v3.datetimepicker/v3/tsconfig.json new file mode 100644 index 0000000000..e368705f30 --- /dev/null +++ b/bootstrap.v3.datetimepicker/v3/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "bootstrap.v3.datetimepicker": ["bootstrap.v3.datetimepicker/v3"] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/bowser/bowser-tests-global.ts b/bowser/bowser-global-tests.ts similarity index 100% rename from bowser/bowser-tests-global.ts rename to bowser/bowser-global-tests.ts diff --git a/bowser/bowser-tests-module.ts b/bowser/bowser-module-tests.ts similarity index 100% rename from bowser/bowser-tests-module.ts rename to bowser/bowser-module-tests.ts diff --git a/bowser/tsconfig.json b/bowser/tsconfig.json index 51ffd1dd85..60a6d8803f 100644 --- a/bowser/tsconfig.json +++ b/bowser/tsconfig.json @@ -15,7 +15,7 @@ }, "files": [ "index.d.ts", - "bowser-tests-module.ts", - "bowser-tests-global.ts" + "bowser-module-tests.ts", + "bowser-global-tests.ts" ] } \ No newline at end of file diff --git a/browser-bunyan/browser-bunyan-tests.ts b/browser-bunyan/browser-bunyan-tests.ts new file mode 100644 index 0000000000..656a8eb002 --- /dev/null +++ b/browser-bunyan/browser-bunyan-tests.ts @@ -0,0 +1,8 @@ +import * as bunyan from "browser-bunyan"; + +var log = bunyan.createLogger({ + name: 'play', + serializers: bunyan.stdSerializers +}); +log.debug({foo: 'bar'}, 'hi at debug') +log.trace('hi at trace') diff --git a/browser-bunyan/index.d.ts b/browser-bunyan/index.d.ts new file mode 100644 index 0000000000..df5116f1c4 --- /dev/null +++ b/browser-bunyan/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for browser-bunyan 0.4 +// Project: https://github.com/philmander/browser-bunyan +// Definitions by: Paul Lockwood +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export * from "bunyan"; + +export function ConsoleFormattedStream(): void; diff --git a/webaudioapi/tsconfig.json b/browser-bunyan/tsconfig.json similarity index 91% rename from webaudioapi/tsconfig.json rename to browser-bunyan/tsconfig.json index 6bd7ac4c89..695ae41ca5 100644 --- a/webaudioapi/tsconfig.json +++ b/browser-bunyan/tsconfig.json @@ -15,6 +15,6 @@ }, "files": [ "index.d.ts", - "waa-tests.ts" + "browser-bunyan-tests.ts" ] -} \ No newline at end of file +} diff --git a/browser-bunyan/tslint.json b/browser-bunyan/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/browser-bunyan/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/business-rules-engine/business-rules-engine-tests.ts b/business-rules-engine/business-rules-engine-tests.ts index 84f6d243ec..3ffbe2948c 100644 --- a/business-rules-engine/business-rules-engine-tests.ts +++ b/business-rules-engine/business-rules-engine-tests.ts @@ -1,5 +1,5 @@ /// -import * as Validators from './node-validators'; +import * as Validators from 'business-rules-engine/node-validators'; import Validation = require("business-rules-engine"); export interface IPerson{ diff --git a/business-rules-engine/tsconfig.json b/business-rules-engine/tsconfig.json index bc9aaa2d87..290905450c 100644 --- a/business-rules-engine/tsconfig.json +++ b/business-rules-engine/tsconfig.json @@ -1,8 +1,4 @@ { - "files": [ - "index.d.ts", - "business-rules-engine-tests.ts" - ], "compilerOptions": { "module": "commonjs", "target": "es6", @@ -16,5 +12,12 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true - } + }, + "files": [ + "index.d.ts", + "node-validators.d.ts", + "Utils.d.ts", + "Validation.d.ts", + "business-rules-engine-tests.ts" + ] } \ No newline at end of file diff --git a/bytes/bytes-tests.ts b/bytes/bytes-tests.ts index 482b54afd2..9c7f7abd5d 100644 --- a/bytes/bytes-tests.ts +++ b/bytes/bytes-tests.ts @@ -1,4 +1,4 @@ -import bytes = require('bytes'); +import bytes = require('bytes'); // 1024*1024 = 1048576 console.log(bytes(104857)); diff --git a/cal-heatmap/cal-heatmap-tests.ts b/cal-heatmap/cal-heatmap-tests.ts index f19a88c3c1..47020b811c 100644 --- a/cal-heatmap/cal-heatmap-tests.ts +++ b/cal-heatmap/cal-heatmap-tests.ts @@ -1,4 +1,4 @@ - + /// /// diff --git a/canvasjs/canvasjs-tests.ts b/canvasjs/canvasjs-tests.ts index cfc67ab128..e9120ec9c3 100644 --- a/canvasjs/canvasjs-tests.ts +++ b/canvasjs/canvasjs-tests.ts @@ -1,4 +1,4 @@ - + namespace CanvasJS.Tests { // Column Chart diff --git a/chai-json-schema/index.d.ts b/chai-json-schema/index.d.ts index e3e4934c76..e66e2c96af 100644 --- a/chai-json-schema/index.d.ts +++ b/chai-json-schema/index.d.ts @@ -6,19 +6,19 @@ // // -declare namespace Chai { - export interface Assert { - jsonSchema(value: any, schema: any, msg?: string): void; - notJsonSchema(value: any, schema: any, msg?: string): void; - } +declare global { + namespace Chai { + export interface Assert { + jsonSchema(value: any, schema: any, msg?: string): void; + notJsonSchema(value: any, schema: any, msg?: string): void; + } - export interface LanguageChains { - jsonSchema(schema: any, msg?: string): void; + export interface LanguageChains { + jsonSchema(schema: any, msg?: string): void; + } } } -declare module "chai-json-schema" { - function chaiJsonSchema(chai: any, utils: any): void; - namespace chaiJsonSchema {} - export = chaiJsonSchema; -} +declare function chaiJsonSchema(chai: any, utils: any): void; +declare namespace chaiJsonSchema { } +export = chaiJsonSchema; diff --git a/chai-json-schema/tslint.json b/chai-json-schema/tslint.json index 83a03ce890..377cc837d4 100644 --- a/chai-json-schema/tslint.json +++ b/chai-json-schema/tslint.json @@ -1,5 +1 @@ -{ "extends": "../tslint.json", - "rules": { - "no-single-declare-module": false - } -} +{ "extends": "../tslint.json" } diff --git a/chai-subset/chai-subset-tests.ts b/chai-subset/chai-subset-tests.ts index d4c7ca3f2b..ded911ed19 100644 --- a/chai-subset/chai-subset-tests.ts +++ b/chai-subset/chai-subset-tests.ts @@ -29,6 +29,8 @@ function test_containSubset() { }); obj.should.containSubset({ a: 'b' }); + + assert.containSubset(obj, { a: 'b' }); } function test_notContainSubset() { @@ -52,6 +54,7 @@ function test_arrayContainSubset() { expect(list).to.containSubset([{a:'a', b: 'b'}]); list.should.containSubset([{a:'a', b: 'b'}]); + assert.containSubset(list, [{a:'a', b: 'b'}]); } function test_arrayNotContainSubset() { diff --git a/chai-subset/index.d.ts b/chai-subset/index.d.ts index 89ee553945..3e0818aa2b 100644 --- a/chai-subset/index.d.ts +++ b/chai-subset/index.d.ts @@ -1,17 +1,20 @@ -// Type definitions for chai-subset 1.0.0 +// Type definitions for chai-subset 1.3 // Project: https://github.com/e-conomic/chai-subset // Definitions by: Sam Noedel , Andrew Brown // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare namespace Chai { - interface Assertion { - containSubset(obj: Object): Assertion; +declare global { + namespace Chai { + interface Assertion { + containSubset(expected: any): Assertion; + } + interface Assert { + containSubset(val: any, exp: any, msg?: string): void; + } } } -declare module "chai-subset" { - function chaiSubset(chai: any, utils: any): void; - export = chaiSubset; -} +declare function chaiSubset(chai: any, utils: any): void; +export = chaiSubset; diff --git a/chai-subset/tslint.json b/chai-subset/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/chai-subset/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/chai/chai-3.2.0-tests.ts b/chai/chai-3.2.0-tests.ts deleted file mode 100644 index 0a69e52cae..0000000000 --- a/chai/chai-3.2.0-tests.ts +++ /dev/null @@ -1,1966 +0,0 @@ - -import chai = require('chai'); - -// ReSharper disable WrongExpressionStatement - -var expect = chai.expect; -var assert = chai.assert; -var should = chai.should(); -declare var err: Function; - -function chaiVersion() { - expect(chai).to.have.property('version'); - (<{}>chai).should.have.property('version'); -} - -function assertion() { - expect('test').to.be.a('string'); - 'test'.should.be.a('string'); - expect('foo').to.equal('foo'); - 'foo'.should.equal('foo'); - should.equal('foo', 'foo'); -} - -function fail() { - err(() => { - should.fail('foo', 'bar'); - }, 'expected fail to throw an AssertionError'); - err(() => { - should.fail('foo', 'bar', 'should fail'); - }, 'expected fail to throw an AssertionError'); - err(() => { - should.fail('foo', 'bar', 'should fail', 'equal'); - }, 'expected fail to throw an AssertionError'); - - err(() => { - expect.fail('foo', 'bar'); - }, 'expected fail to throw an AssertionError'); - err(() => { - expect.fail('foo', 'bar', 'should fail'); - }, 'expected fail to throw an AssertionError'); - err(() => { - expect.fail('foo', 'bar', 'should fail', 'equal'); - }, 'expected fail to throw an AssertionError'); -} - -// ReSharper disable once InconsistentNaming -function _true() { - expect(true).to.be.true; - true.should.be.true; - expect(false).to.not.be.true; - false.should.not.be.true; - expect(1).to.not.be.true; - (1).should.not.be.true; - - err(() => { - expect('test').to.be.true; - 'test'.should.be.true; - }, 'expected \'test\' to be true'); -} - -function ok() { - expect(true).to.be.ok; - true.should.be.ok; - expect(false).to.not.be.ok; - false.should.not.be.ok; - expect(1).to.be.ok; - (1).should.be.ok; - expect(0).to.not.be.ok; - (0).should.not.be.ok; - - err(() => { - expect('').to.be.ok; - ''.should.be.ok; - }, 'expected \'\' to be truthy'); - - err(() => { - expect('test').to.not.be.ok; - 'test'.should.not.be.ok; - }, 'expected \'test\' to be falsy'); -} - -function _false() { - expect(false).to.be.false; - false.should.be.false; - expect(true).to.not.be.false; - true.should.not.be.false; - expect(0).to.not.be.false; - (0).should.not.be.false; - - err(() => { - expect('').to.be.false; - ''.should.be.false; - }, 'expected \'\' to be false'); -} - -function _null() { - expect(null).to.be.null; - should.equal(null, null); - expect(false).to.not.be.null; - false.should.not.be.null; - - err(() => { - expect('').to.be.null; - ''.should.be.null; - }, 'expected \'\' to be null'); -} - -function _undefined() { - expect(undefined).to.be.undefined; - should.equal(undefined, undefined); - expect(null).to.not.be.undefined; - should.not.equal(null, undefined); - - err(() => { - expect('').to.be.undefined; - ''.should.be.undefined; - }, 'expected \'\' to be undefined'); -} - -function _NaN() { - expect(NaN).to.be.NaN; - expect(12).to.be.not.NaN; - expect("NaN").to.be.not.NaN; - (NaN).should.be.NaN; - (12).should.be.not.NaN; - ("NaN").should.be.not.NaN; -} - -function exist() { - var foo = 'bar'; - expect(foo).to.exist; - should.exist(foo); - expect(void (0)).to.not.exist; - should.not.exist(void (0)); -} - -function argumentsTest() { - var args = arguments; - expect(args).to.be.arguments; - args.should.be.arguments; - expect([]).to.not.be.arguments; - [].should.not.be.arguments; - expect(args).to.be.an('arguments').and.be.arguments; - args.should.be.an('arguments').and.be.arguments; - expect([]).to.be.an('array').and.not.be.Arguments; - [].should.be.an('array').and.not.be.Arguments; -} - -function equal() { - expect(undefined).to.equal(void (0)); - should.equal(undefined, void (0)); -} - -function _typeof() { - expect('test').to.be.a('string'); - 'test'.should.be.a('string'); - - err(() => { - expect('test').to.not.be.a('string'); - 'test'.should.not.be.a('string'); - }, 'expected \'test\' not to be a string'); - - expect(arguments).to.be.an('arguments'); - arguments.should.be.an('arguments'); - - expect(5).to.be.a('number'); - (5).should.be.a('number'); - - expect(new Number(1)).to.be.a('number'); - (new Number(1)).should.be.a('number'); - expect(Number(1)).to.be.a('number'); - Number(1).should.be.a('number'); - expect(true).to.be.a('boolean'); - true.should.be.a('boolean'); - expect(new Array()).to.be.a('array'); - (new Array()).should.be.a('array'); - expect(new Object()).to.be.a('object'); - (new Object()).should.be.a('object'); - expect({}).to.be.a('object'); - ({}).should.be.a('object'); - expect([]).to.be.a('array'); - [].should.be.a('array'); - expect(() => { }).to.be.a('function'); - (() => { }).should.be.a('function'); - expect(null).to.be.a('null'); - // N.B. previous line has no should equivalent - - err(() => { - expect(5).to.not.be.a('number', 'blah'); - (5).should.not.be.a('number', 'blah'); - }, 'blah: expected 5 not to be a number'); -} - -class Foo { } -function _instanceof() { - expect(new Foo()).to.be.an.instanceof(Foo); - (new Foo()).should.be.an.instanceof(Foo); - - err(() => { - expect(3).to.an.instanceof(Foo, 'blah'); - (3).should.an.instanceof(Foo, 'blah'); - }, 'blah: expected 3 to be an instance of Foo'); -} - -function within() { - expect(5).to.be.within(5, 10); - (5).should.be.within(5, 10); - expect(5).to.be.within(3, 6); - (5).should.be.within(3, 6); - expect(5).to.be.within(3, 5); - (5).should.be.within(3, 5); - expect(5).to.not.be.within(1, 3); - (5).should.not.be.within(1, 3); - expect('foo').to.have.length.within(2, 4); - 'foo'.should.have.length.within(2, 4); - expect([1, 2, 3]).to.have.length.within(2, 4); - [1, 2, 3].should.have.length.within(2, 4); - - err(() => { - expect(5).to.not.be.within(4, 6, 'blah'); - (5).should.not.be.within(4, 6, 'blah'); - }, 'blah: expected 5 to not be within 4..6', 'blah'); - - err(() => { - expect(10).to.be.within(50, 100, 'blah'); - (10).should.be.within(50, 100, 'blah'); - }, 'blah: expected 10 to be within 50..100'); - - err(() => { - expect('foo').to.have.length.within(5, 7, 'blah'); - 'foo'.should.have.length.within(5, 7, 'blah'); - }, 'blah: expected \'foo\' to have a length within 5..7'); - - err(() => { - expect([1, 2, 3]).to.have.length.within(5, 7, 'blah'); - [1, 2, 3].should.have.length.within(5, 7, 'blah'); - }, 'blah: expected [ 1, 2, 3 ] to have a length within 5..7'); -} - -function above() { - expect(5).to.be.above(2); - (5).should.be.above(2); - expect(5).to.be.greaterThan(2); - (5).should.be.greaterThan(2); - expect(5).to.not.be.above(5); - (5).should.not.be.above(5); - expect(5).to.not.be.above(6); - (5).should.not.be.above(6); - expect('foo').to.have.length.above(2); - 'foo'.should.have.length.above(2); - expect([1, 2, 3]).to.have.length.above(2); - [1, 2, 3].should.have.length.above(2); - - err(() => { - expect(5).to.be.above(6, 'blah'); - (5).should.be.above(6, 'blah'); - }, 'blah: expected 5 to be above 6', 'blah'); - - err(() => { - expect(10).to.not.be.above(6, 'blah'); - (10).should.not.be.above(6, 'blah'); - }, 'blah: expected 10 to be at most 6'); - - err(() => { - expect('foo').to.have.length.above(4, 'blah'); - 'foo'.should.have.length.above(4, 'blah'); - }, 'blah: expected \'foo\' to have a length above 4 but got 3'); - - err(() => { - expect([1, 2, 3]).to.have.length.above(4, 'blah'); - [1, 2, 3].should.have.length.above(4, 'blah'); - }, 'blah: expected [ 1, 2, 3 ] to have a length above 4 but got 3'); -} - -function least() { - expect(5).to.be.at.least(2); - (5).should.be.at.least(2); - expect(5).to.be.at.least(5); - (5).should.be.at.least(5); - expect(5).to.not.be.at.least(6); - (5).should.not.be.at.least(6); - expect('foo').to.have.length.of.at.least(2); - 'foo'.should.have.length.of.at.least(2); - expect([1, 2, 3]).to.have.length.of.at.least(2); - [1, 2, 3].should.have.length.of.at.least(2); - - err(() => { - expect(5).to.be.at.least(6, 'blah'); - (5).should.be.at.least(6, 'blah'); - }, 'blah: expected 5 to be at least 6', 'blah'); - - err(() => { - expect(10).to.not.be.at.least(6, 'blah'); - (10).should.not.be.at.least(6, 'blah'); - }, 'blah: expected 10 to be below 6'); - - err(() => { - expect('foo').to.have.length.of.at.least(4, 'blah'); - 'foo'.should.have.length.of.at.least(4, 'blah'); - }, 'blah: expected \'foo\' to have a length at least 4 but got 3'); - - err(() => { - expect([1, 2, 3]).to.have.length.of.at.least(4, 'blah'); - [1, 2, 3].should.have.length.of.at.least(4, 'blah'); - }, 'blah: expected [ 1, 2, 3 ] to have a length at least 4 but got 3'); - - err(() => { - expect([1, 2, 3, 4]).to.not.have.length.of.at.least(4, 'blah'); - [1, 2, 3, 4].should.not.have.length.of.at.least(4, 'blah'); - }, 'blah: expected [ 1, 2, 3, 4 ] to have a length below 4'); -} - -function below() { - expect(2).to.be.below(5); - (2).should.be.below(5); - expect(2).to.be.lessThan(5); - (2).should.be.lessThan(5); - expect(2).to.not.be.below(2); - (2).should.not.be.below(2); - expect(2).to.not.be.below(1); - (2).should.not.be.below(1); - expect('foo').to.have.length.below(4); - 'foo'.should.have.length.below(4); - expect([1, 2, 3]).to.have.length.below(4); - [1, 2, 3].should.have.length.below(4); - - err(() => { - expect(6).to.be.below(5, 'blah'); - (6).should.be.below(5, 'blah'); - }, 'blah: expected 6 to be below 5'); - - err(() => { - expect(6).to.not.be.below(10, 'blah'); - (6).should.not.be.below(10, 'blah'); - }, 'blah: expected 6 to be at least 10'); - - err(() => { - expect('foo').to.have.length.below(2, 'blah'); - 'foo'.should.have.length.below(2, 'blah'); - }, 'blah: expected \'foo\' to have a length below 2 but got 3'); - - err(() => { - expect([1, 2, 3]).to.have.length.below(2, 'blah'); - [1, 2, 3].should.have.length.below(2, 'blah'); - }, 'blah: expected [ 1, 2, 3 ] to have a length below 2 but got 3'); -} - -function most() { - expect(2).to.be.at.most(5); - (2).should.be.at.most(5); - expect(2).to.be.at.most(2); - (2).should.be.at.most(2); - expect(2).to.not.be.at.most(1); - (2).should.not.be.at.most(1); - expect(2).to.not.be.at.most(1); - (2).should.not.be.at.most(1); - expect('foo').to.have.length.of.at.most(4); - 'foo'.should.have.length.of.at.most(4); - expect([1, 2, 3]).to.have.length.of.at.most(4); - [1, 2, 3].should.have.length.of.at.most(4); - - err(() => { - expect(6).to.be.at.most(5, 'blah'); - (6).should.be.at.most(5, 'blah'); - }, 'blah: expected 6 to be at most 5'); - - err(() => { - expect(6).to.not.be.at.most(10, 'blah'); - (6).should.not.be.at.most(10, 'blah'); - }, 'blah: expected 6 to be above 10'); - - err(() => { - expect('foo').to.have.length.of.at.most(2, 'blah'); - 'foo'.should.have.length.of.at.most(2, 'blah'); - }, 'blah: expected \'foo\' to have a length at most 2 but got 3'); - - err(() => { - expect([1, 2, 3]).to.have.length.of.at.most(2, 'blah'); - [1, 2, 3].should.have.length.of.at.most(2, 'blah'); - }, 'blah: expected [ 1, 2, 3 ] to have a length at most 2 but got 3'); - - err(() => { - expect([1, 2]).to.not.have.length.of.at.most(2, 'blah'); - [1, 2].should.not.have.length.of.at.most(2, 'blah'); - }, 'blah: expected [ 1, 2 ] to have a length above 2'); -} - -function match() { - expect('foobar').to.match(/^foo/); - 'foobar'.should.match(/^foo/); - expect('foobar').to.not.match(/^bar/); - 'foobar'.should.not.match(/^bar/); - - expect('foobar').matches(/^foo/); - 'foobar'.should.not.matches(/^bar/); - - err(() => { - expect('foobar').to.match(/^bar/i, 'blah'); - 'foobar'.should.match(/^bar/i, 'blah'); - }, 'blah: expected \'foobar\' to match /^bar/i'); - - err(() => { - expect('foobar').to.not.match(/^foo/i, 'blah'); - 'foobar'.should.not.match(/^foo/i, 'blah'); - }, 'blah: expected \'foobar\' not to match /^foo/i'); -} - -function length2() { - expect('test').to.have.length(4); - 'test'.should.have.length(4); - expect('test').to.not.have.length(3); - 'test'.should.not.have.length(3); - expect([1, 2, 3]).to.have.length(3); - [1, 2, 3].should.have.length(3); - - err(() => { - expect(4).to.have.length(3, 'blah'); - (4).should.have.length(3, 'blah'); - }, 'blah: expected 4 to have a property \'length\''); - - err(() => { - expect('asd').to.not.have.length(3, 'blah'); - 'asd'.should.not.have.length(3, 'blah'); - }, 'blah: expected \'asd\' to not have a length of 3'); -} - -function eql() { - expect('test').to.eql('test'); - 'test'.should.eql('test'); - expect({ foo: 'bar' }).to.eql({ foo: 'bar' }); - ({ foo: 'bar' }).should.eql({ foo: 'bar' }); - expect(1).to.eql(1); - (1).should.eql(1); - expect('4').to.not.eql(4); - '4'.should.not.eql(4); - - err(() => { - expect(4).to.eql(3, 'blah'); - (4).should.eql(3, 'blah'); - }, 'blah: expected 4 to deeply equal 3'); -} - -class Buffer { - constructor(arr: number[]) { - } -} -function buffer() { - expect(new Buffer([1])).to.eql(new Buffer([1])); - (new Buffer([1])).should.eql(new Buffer([1])); - - err(() => { - expect(new Buffer([0])).to.eql(new Buffer([1])); - (new Buffer([0])).should.eql(new Buffer([1])); - }, 'expected to deeply equal '); -} - -function equal2() { - expect('test').to.equal('test'); - 'test'.should.equal('test'); - should.equal('test', 'test'); - expect(1).to.equal(1); - (1).should.equal(1); - should.equal(1, 1); - - err(() => { - expect(4).to.equal(3, 'blah'); - (4).should.equal(3, 'blah'); - should.equal(4, 3, 'blah'); - }, 'blah: expected 4 to equal 3'); - - err(() => { - expect('4').to.equal(4, 'blah'); - '4'.should.equal(4, 'blah'); - should.equal(4, 4, 'blah'); - }, 'blah: expected \'4\' to equal 4'); -} - -function deepEqual() { - expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' }); - ({ foo: 'bar' }).should.deep.equal({ foo: 'bar' }); - expect({ foo: 'bar' }).not.to.deep.equal({ foo: 'baz' }); -} - -function deepEqual2() { - expect(/a/).to.deep.equal(/a/); - /a/.should.deep.equal(/a/); - expect(/a/).not.to.deep.equal(/b/); - expect(/a/).not.to.deep.equal({}); - expect(/a/g).to.deep.equal(/a/g); - /a/g.should.deep.equal(/a/g); - expect(/a/g).not.to.deep.equal(/b/g); - expect(/a/i).to.deep.equal(/a/i); - /a/i.should.deep.equal(/a/i); - expect(/a/i).not.to.deep.equal(/b/i); - expect(/a/m).to.deep.equal(/a/m); - /a/m.should.deep.equal(/a/m); - expect(/a/m).not.to.deep.equal(/b/m); -} - -// ReSharper disable once InconsistentNaming -function deepEqual3() { - var a = new Date(1, 2, 3); - var b = new Date(4, 5, 6); - expect(a).to.deep.equal(a); - a.should.deep.equal(a); - expect(a).not.to.deep.equal(b); - a.should.not.deep.equal(b); - expect(a).not.to.deep.equal({}); - a.should.not.deep.equal({}); -} - -function deepInclude() { - expect(['foo', 'bar']).to.deep.include(['bar', 'foo']); - ['foo', 'bar'].should.deep.include(['bar', 'foo']); - expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz']); - ['foo', 'bar'].should.not.deep.equal(['foo', 'baz']); -} - -class FakeArgs { - length: number; -} - -function empty() { - FakeArgs.prototype.length = 0; - - expect('').to.be.empty; - - ''.should.be.empty; - expect('foo').not.to.be.empty; - 'foo'.should.not.be.empty; - expect([]).to.be.empty; - [].should.be.empty; - expect(['foo']).not.to.be.empty; - ['foo'].should.not.be.empty; - expect(new FakeArgs).to.be.empty; - (new FakeArgs).should.be.empty; - expect({ arguments: 0 }).not.to.be.empty; - ({ arguments: 0 }).should.not.be.empty; - expect({}).to.be.empty; - ({}).should.be.empty; - expect({ foo: 'bar' }).not.to.be.empty; - ({ foo: 'bar' }).should.not.be.empty; - - err(() => { - expect('').not.to.be.empty; - ''.should.not.be.empty; - }, 'expected \'\' not to be empty'); - - err(() => { - expect('foo').to.be.empty; - 'foo'.should.be.empty; - 'foo'.should.be.empty; - }, 'expected \'foo\' to be empty'); - - err(() => { - expect([]).not.to.be.empty; - [].should.not.be.empty; - }, 'expected [] not to be empty'); - - err(() => { - expect(['foo']).to.be.empty; - ['foo'].should.be.empty; - }, 'expected [ \'foo\' ] to be empty'); - - err(() => { - expect(new FakeArgs).not.to.be.empty; - (new FakeArgs).should.not.be.empty; - }, 'expected { length: 0 } not to be empty'); - - err(() => { - expect({ arguments: 0 }).to.be.empty; - ({ arguments: 0 }).should.be.empty; - }, 'expected { arguments: 0 } to be empty'); - - err(() => { - expect({}).not.to.be.empty; - ({}).should.not.be.empty; - }, 'expected {} not to be empty'); - - err(() => { - expect({ foo: 'bar' }).to.be.empty; - ({ foo: 'bar' }).should.be.empty; - }, 'expected { foo: \'bar\' } to be empty'); -} - -function property() { - expect('test').to.have.property('length'); - 'test'.should.have.property('length'); - expect(4).to.not.have.property('length'); - (4).should.not.have.property('length'); - - expect({ 'foo.bar': 'baz' }) - .to.have.property('foo.bar'); - ({ 'foo.bar': 'baz' }).should.have.property('foo.bar'); - expect({ foo: { bar: 'baz' } }) - .to.not.have.property('foo.bar'); - ({ foo: { bar: 'baz' } }).should.not.have.property('foo.bar'); - - err(() => { - expect('asd').to.have.property('foo'); - 'asd'.should.have.property('foo'); - }, 'expected \'asd\' to have a property \'foo\''); - err(() => { - expect({ foo: { bar: 'baz' } }) - .to.have.property('foo.bar'); - ({ foo: { bar: 'baz' } }).should.have.property('foo.bar'); - }, 'expected { foo: { bar: \'baz\' } } to have a property \'foo.bar\''); -} - -function deepProperty() { - expect({ 'foo.bar': 'baz' }) - .to.not.have.deep.property('foo.bar'); - ({ 'foo.bar': 'baz' }).should - .not.have.deep.property('foo.bar'); - expect({ foo: { bar: 'baz' } }) - .to.have.deep.property('foo.bar'); - ({ foo: { bar: 'baz' } }).should - .have.deep.property('foo.bar'); - - err(() => { - expect({ 'foo.bar': 'baz' }) - .to.have.deep.property('foo.bar'); - ({ 'foo.bar': 'baz' }).should - .have.deep.property('foo.bar'); - }, 'expected { \'foo.bar\': \'baz\' } to have a deep property \'foo.bar\''); -} - -function property2() { - expect('test').to.have.property('length', 4); - 'test'.should.have.property('length', 4); - expect('asd').to.have.property('constructor', String); - 'asd'.should.have.property('constructor', String); - - err(() => { - expect('asd').to.have.property('length', 4, 'blah'); - 'asd'.should.have.property('length', 4, 'blah'); - }, 'blah: expected \'asd\' to have a property \'length\' of 4, but got 3'); - - err(() => { - expect('asd').to.not.have.property('length', 3, 'blah'); - 'asd'.should.not.have.property('length', 3, 'blah'); - }, 'blah: expected \'asd\' to not have a property \'length\' of 3'); - - err(() => { - expect('asd').to.not.have.property('foo', 3, 'blah'); - 'asd'.should.not.have.property('foo', 3, 'blah'); - }, 'blah: \'asd\' has no property \'foo\''); - - err(() => { - expect('asd').to.have.property('constructor', Number, 'blah'); - 'asd'.should.have.property('constructor', Number, 'blah'); - }, 'blah: expected \'asd\' to have a property \'constructor\' of [Function: Number], but got [Function: String]'); -} - -function deepProperty2() { - expect({ foo: { bar: 'baz' } }) - .to.have.deep.property('foo.bar', 'baz'); - ({ foo: { bar: 'baz' } }).should - .have.deep.property('foo.bar', 'baz'); - - err(() => { - expect({ foo: { bar: 'baz' } }) - .to.have.deep.property('foo.bar', 'quux', 'blah'); - ({ foo: { bar: 'baz' } }).should - .have.deep.property('foo.bar', 'quux', 'blah'); - }, 'blah: expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'quux\', but got \'baz\''); - err(() => { - expect({ foo: { bar: 'baz' } }) - .to.not.have.deep.property('foo.bar', 'baz', 'blah'); - ({ foo: { bar: 'baz' } }).should - .not.have.deep.property('foo.bar', 'baz', 'blah'); - }, 'blah: expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); - err(() => { - expect({ foo: 5 }) - .to.not.have.deep.property('foo.bar', 'baz', 'blah'); - ({ foo: 5 }).should - .not.have.deep.property('foo.bar', 'baz', 'blah'); - }, 'blah: { foo: 5 } has no deep property \'foo.bar\''); -} - -function ownProperty() { - expect('test').to.have.ownProperty('length'); - 'test'.should.have.ownProperty('length'); - expect('test').to.haveOwnProperty('length'); - 'test'.should.haveOwnProperty('length'); - expect({ length: 12 }).to.have.ownProperty('length'); - ({ length: 12 }).should.have.ownProperty('length'); - - err(() => { - expect({ length: 12 }).to.not.have.ownProperty('length', 'blah'); - ({ length: 12 }).should.not.have.ownProperty('length', 'blah'); - }, 'blah: expected { length: 12 } to not have own property \'length\''); -} - -function ownPropertyDescriptor() { - expect('test').to.have.ownPropertyDescriptor('length'); - expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); - expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); - expect('test').to.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false); - expect('test').to.haveOwnPropertyDescriptor('length').to.contain.keys('value'); - - 'test'.should.have.ownPropertyDescriptor('length'); - 'test'.should.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); - 'test'.should.not.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); - 'test'.should.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false); - 'test'.should.haveOwnPropertyDescriptor('length').to.contain.keys('value'); -} - -function string() { - expect('foobar').to.have.string('bar'); - 'foobar'.should.have.string('bar'); - expect('foobar').to.have.string('foo'); - 'foobar'.should.have.string('foo'); - expect('foobar').to.not.have.string('baz'); - 'foobar'.should.not.have.string('baz'); - - err(() => { - expect(3).to.have.string('baz'); - (3).should.have.string('baz'); - }, 'expected 3 to be a string'); - - err(() => { - expect('foobar').to.have.string('baz', 'blah'); - 'foobar'.should.have.string('baz', 'blah'); - }, 'blah: expected \'foobar\' to contain \'baz\''); - - err(() => { - expect('foobar').to.not.have.string('bar', 'blah'); - 'foobar'.should.not.have.string('bar', 'blah'); - }, 'blah: expected \'foobar\' to not contain \'bar\''); -} - -function include() { - expect(['foo', 'bar']).to.include('foo'); - ['foo', 'bar'].should.include('foo'); - expect(['foo', 'bar']).to.include('foo'); - ['foo', 'bar'].should.include('foo'); - expect(['foo', 'bar']).to.include('bar'); - ['foo', 'bar'].should.include('bar'); - expect([1, 2]).to.include(1); - [1, 2].should.include(1); - expect(['foo', 'bar']).to.not.include('baz'); - ['foo', 'bar'].should.not.include('baz'); - expect(['foo', 'bar']).to.not.include(1); - ['foo', 'bar'].should.not.include(1); - // alias - - expect(['foo', 'bar']).includes('foo'); - ['foo', 'bar'].should.includes('foo'); - - err(() => { - expect(['foo']).to.include('bar', 'blah'); - ['foo'].should.include('bar', 'blah'); - }, 'blah: expected [ \'foo\' ] to include \'bar\''); - - err(() => { - expect(['bar', 'foo']).to.not.include('foo', 'blah'); - ['bar', 'foo'].should.not.include('foo', 'blah'); - }, 'blah: expected [ \'bar\', \'foo\' ] to not include \'foo\''); -} - -function keys() { - expect({ foo: 1 }).to.have.keys(['foo']); - ({ foo: 1 }).should.have.keys(['foo']); - expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']); - ({ foo: 1, bar: 2 }).should.have.keys(['foo', 'bar']); - expect({ foo: 1, bar: 2 }).to.have.keys('foo', 'bar'); - ({ foo: 1, bar: 2 }).should.have.keys('foo', 'bar'); - expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar'); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('foo', 'bar'); - expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('bar', 'foo'); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('bar', 'foo'); - expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('baz'); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('baz'); - // alias - - expect({ foo: 1, bar: 2, baz: 3 }).contains.keys('baz'); - - expect({ foo: 1, bar: 2 }).to.have.all.keys(['foo', 'bar']); - expect({ foo: 1, bar: 2 }).to.have.any.keys(['foo', 'bar']); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.all.keys('baz'); - ({ foo: 1, bar: 2, baz: 3 }).should.contain.any.keys('baz'); - - expect({ foo: 1, bar: 2 }).to.contain.keys('foo'); - ({ foo: 1, bar: 2 }).should.contain.keys('foo'); - expect({ foo: 1, bar: 2 }).to.contain.keys('bar', 'foo'); - ({ foo: 1, bar: 2 }).should.contain.keys('bar', 'foo'); - expect({ foo: 1, bar: 2 }).to.contain.keys(['foo']); - ({ foo: 1, bar: 2 }).should.contain.keys(['foo']); - expect({ foo: 1, bar: 2 }).to.contain.keys(['bar']); - ({ foo: 1, bar: 2 }).should.contain.keys(['bar']); - expect({ foo: 1, bar: 2 }).to.contain.keys(['bar', 'foo']); - ({ foo: 1, bar: 2 }).should.contain.keys(['bar', 'foo']); - - expect({ foo: 1, bar: 2 }).to.not.have.keys('baz'); - ({ foo: 1, bar: 2 }).should.not.have.keys('baz'); - expect({ foo: 1, bar: 2 }).to.not.have.keys('foo', 'baz'); - ({ foo: 1, bar: 2 }).should.not.have.keys('foo', 'baz'); - expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz'); - ({ foo: 1, bar: 2 }).should.not.contain.keys('baz'); - expect({ foo: 1, bar: 2 }).to.not.contain.keys('foo', 'baz'); - ({ foo: 1, bar: 2 }).should.not.contain.keys('foo', 'baz'); - expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz', 'foo'); - ({ foo: 1, bar: 2 }).should.not.contain.keys('baz', 'foo'); - - err(() => { - expect({ foo: 1 }).to.have.keys(); - ({ foo: 1 }).should.have.keys(); - }, 'keys required'); - - err(() => { - expect({ foo: 1 }).to.have.keys([]); - ({ foo: 1 }).should.have.keys([]); - }, 'keys required'); - - err(() => { - expect({ foo: 1 }).to.not.have.keys([]); - ({ foo: 1 }).should.not.have.keys([]); - }, 'keys required'); - - err(() => { - expect({ foo: 1 }).to.contain.keys([]); - ({ foo: 1 }).should.contain.keys([]); - }, 'keys required'); - - err(() => { - expect({ foo: 1 }).to.have.keys(['bar']); - ({ foo: 1 }).should.have.keys(['bar']); - }, 'expected { foo: 1 } to have key \'bar\''); - - err(() => { - expect({ foo: 1 }).to.have.keys(['bar', 'baz']); - ({ foo: 1 }).should.have.keys(['bar', 'baz']); - }, 'expected { foo: 1 } to have keys \'bar\', and \'baz\''); - - err(() => { - expect({ foo: 1 }).to.have.keys(['foo', 'bar', 'baz']); - ({ foo: 1 }).should.have.keys(['foo', 'bar', 'baz']); - }, 'expected { foo: 1 } to have keys \'foo\', \'bar\', and \'baz\''); - - err(() => { - expect({ foo: 1 }).to.not.have.keys(['foo']); - ({ foo: 1 }).should.not.have.keys(['foo']); - }, 'expected { foo: 1 } to not have key \'foo\''); - - err(() => { - expect({ foo: 1 }).to.not.have.keys(['foo']); - ({ foo: 1 }).should.not.have.keys(['foo']); - }, 'expected { foo: 1 } to not have key \'foo\''); - - err(() => { - expect({ foo: 1, bar: 2 }).to.not.have.keys(['foo', 'bar']); - ({ foo: 1, bar: 2 }).should.not.have.keys(['foo', 'bar']); - }, 'expected { foo: 1, bar: 2 } to not have keys \'foo\', and \'bar\''); - - err(() => { - expect({ foo: 1 }).to.not.contain.keys(['foo']); - ({ foo: 1 }).should.not.contain.keys(['foo']); - }, 'expected { foo: 1 } to not contain key \'foo\''); - - err(() => { - expect({ foo: 1 }).to.contain.keys('foo', 'bar'); - ({ foo: 1 }).should.contain.keys('foo', 'bar'); - }, 'expected { foo: 1 } to contain keys \'foo\', and \'bar\''); -} - -function chaining() { - var tea = { name: 'chai', extras: ['milk', 'sugar', 'smile'] }; - expect(tea).to.have.property('extras').with.lengthOf(3); - tea.should.have.property('extras').with.lengthOf(3); - - err(() => { - expect(tea).to.have.property('extras').with.lengthOf(4); - tea.should.have.property('extras').with.lengthOf(4); - }, 'expected [ \'milk\', \'sugar\', \'smile\' ] to have a length of 4 but got 3'); - - expect(tea).to.be.a('object').and.have.property('name', 'chai'); - tea.should.be.a('object').and.have.property('name', 'chai'); -} - -function exxtensible() { - expect({}).to.be.extensible; - expect(Object.preventExtensions({})).to.be.not.extensible; - ({}).should.be.extensible; - Object.preventExtensions({}).should.not.be.extensible; -} -function sealed() { - expect({}).to.be.not.sealed; - expect(Object.seal({})).to.be.sealed; - ({}).should.be.not.sealed; - Object.seal({}).should.be.sealed; -} - -function frozen() { - expect({}).to.be.not.frozen; - expect(Object.freeze({})).to.be.frozen; - ({}).should.be.not.frozen; - Object.freeze({}).should.be.frozen; -} - - -class PoorlyConstructedError { } -function _throw() { - // See GH-45: some poorly-constructed custom errors don't have useful names - // on either their constructor or their constructor prototype, but instead - // only set the name inside the constructor itself. - PoorlyConstructedError.prototype = Object.create(Error.prototype); - - var specificError = new RangeError('boo'); - - var goodFn = () => { } - , badFn = () => { throw new Error('testing'); } - , refErrFn = () => { throw new ReferenceError('hello'); } - , ickyErrFn = () => { throw new PoorlyConstructedError(); } - , specificErrFn = () => { throw specificError; }; - - expect(goodFn).to.not.throw(); - goodFn.should.not.throw(); - should.not.throw(goodFn); - expect(goodFn).to.not.throw(Error); - goodFn.should.not.throw(Error); - should.not.throw(goodFn, Error); - expect(goodFn).to.not.throw(specificError); - goodFn.should.not.throw(specificError); - should.not.throw(goodFn, specificError); - - expect(badFn).to.throw(); - badFn.should.throw(); - should.throw(badFn); - expect(badFn).to.throw(Error); - badFn.should.throw(Error); - should.throw(badFn, Error); - expect(badFn).to.not.throw(ReferenceError); - badFn.should.not.throw(ReferenceError); - should.not.throw(badFn, ReferenceError); - expect(badFn).to.not.throw(specificError); - badFn.should.not.throw(specificError); - should.not.throw(badFn, specificError); - - expect(refErrFn).to.throw(); - refErrFn.should.throw(); - should.throw(refErrFn); - expect(refErrFn).to.throw(ReferenceError); - refErrFn.should.throw(ReferenceError); - should.throw(refErrFn, ReferenceError); - expect(refErrFn).to.throw(Error); - refErrFn.should.throw(Error); - should.throw(refErrFn, Error); - expect(refErrFn).to.not.throw(TypeError); - refErrFn.should.not.throw(TypeError); - should.not.throw(refErrFn, TypeError); - expect(refErrFn).to.not.throw(specificError); - refErrFn.should.not.throw(specificError); - should.not.throw(refErrFn, specificError); - - expect(ickyErrFn).to.throw(); - ickyErrFn.should.throw(); - should.throw(ickyErrFn); - expect(ickyErrFn).to.throw(PoorlyConstructedError); - ickyErrFn.should.throw(PoorlyConstructedError); - should.throw(ickyErrFn, PoorlyConstructedError); - expect(ickyErrFn).to.throw(Error); - ickyErrFn.should.throw(Error); - should.throw(ickyErrFn, Error); - expect(ickyErrFn).to.not.throw(specificError); - ickyErrFn.should.not.throw(specificError); - should.not.throw(ickyErrFn, specificError); - expect(specificErrFn).to.throw(specificError); - specificErrFn.should.throw(specificError); - should.throw(ickyErrFn, specificError); - - expect(badFn).to.throw(/testing/); - badFn.should.throw(/testing/); - should.throw(badFn, /testing/); - expect(badFn).to.not.throw(/hello/); - badFn.should.not.throw(/hello/); - should.not.throw(badFn, /hello/); - expect(badFn).to.throw('testing'); - badFn.should.throw('testing'); - should.throw(badFn, 'testing'); - expect(badFn).to.not.throw('hello'); - badFn.should.not.throw('hello'); - should.not.throw(badFn, 'hello'); - - expect(badFn).to.throw(Error, /testing/); - badFn.should.throw(Error, /testing/); - should.throw(badFn, Error, /testing/); - expect(badFn).to.throw(Error, 'testing'); - badFn.should.throw(Error, 'testing'); - should.throw(badFn, Error, 'testing'); - - err(() => { - expect(goodFn).to.throw(); - goodFn.should.throw(); - should.throw(goodFn); - }, 'expected [Function] to throw an error'); - - err(() => { - expect(goodFn).to.throw(ReferenceError); - goodFn.should.throw(ReferenceError); - should.throw(goodFn, ReferenceError); - }, 'expected [Function] to throw ReferenceError'); - - err(() => { - expect(goodFn).to.throw(specificError); - goodFn.should.throw(specificError); - should.throw(goodFn, specificError); - }, 'expected [Function] to throw [RangeError: boo]'); - - err(() => { - expect(badFn).to.not.throw(); - badFn.should.not.throw(); - should.not.throw(badFn); - }, 'expected [Function] to not throw an error but [Error: testing] was thrown'); - - err(() => { - expect(badFn).to.throw(ReferenceError); - badFn.should.throw(ReferenceError); - should.throw(badFn, ReferenceError); - }, 'expected [Function] to throw \'ReferenceError\' but [Error: testing] was thrown'); - - err(() => { - expect(badFn).to.throw(specificError); - badFn.should.throw(specificError); - should.throw(badFn, specificError); - }, 'expected [Function] to throw [RangeError: boo] but [Error: testing] was thrown'); - - err(() => { - expect(badFn).to.not.throw(Error); - badFn.should.not.throw(Error); - should.not.throw(badFn, Error); - }, 'expected [Function] to not throw \'Error\' but [Error: testing] was thrown'); - - err(() => { - expect(refErrFn).to.not.throw(ReferenceError); - refErrFn.should.not.throw(ReferenceError); - should.not.throw(refErrFn, ReferenceError); - }, 'expected [Function] to not throw \'ReferenceError\' but [ReferenceError: hello] was thrown'); - - err(() => { - expect(badFn).to.throw(PoorlyConstructedError); - badFn.should.throw(PoorlyConstructedError); - should.throw(badFn, PoorlyConstructedError); - }, 'expected [Function] to throw \'PoorlyConstructedError\' but [Error: testing] was thrown'); - - err(() => { - expect(ickyErrFn).to.not.throw(PoorlyConstructedError); - ickyErrFn.should.not.throw(PoorlyConstructedError); - should.not.throw(ickyErrFn, PoorlyConstructedError); - }, /^(expected \[Function\] to not throw 'PoorlyConstructedError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); - - err(() => { - expect(ickyErrFn).to.throw(ReferenceError); - ickyErrFn.should.throw(ReferenceError); - should.throw(ickyErrFn, ReferenceError); - }, /^(expected \[Function\] to throw 'ReferenceError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); - - err(() => { - expect(specificErrFn).to.throw(new ReferenceError('eek')); - specificErrFn.should.throw(new ReferenceError('eek')); - should.throw(specificErrFn, new ReferenceError('eek')); - }, 'expected [Function] to throw [ReferenceError: eek] but [RangeError: boo] was thrown'); - - err(() => { - expect(specificErrFn).to.not.throw(specificError); - specificErrFn.should.not.throw(specificError); - should.not.throw(specificErrFn, specificError); - }, 'expected [Function] to not throw [RangeError: boo]'); - - err(() => { - expect(badFn).to.not.throw(/testing/); - badFn.should.not.throw(/testing/); - should.not.throw(badFn, /testing/); - }, 'expected [Function] to throw error not matching /testing/'); - - err(() => { - expect(badFn).to.throw(/hello/); - badFn.should.throw(/hello/); - should.throw(badFn, /hello/); - }, 'expected [Function] to throw error matching /hello/ but got \'testing\''); - - err(() => { - expect(badFn).to.throw(Error, /hello/, 'blah'); - badFn.should.throw(Error, /hello/, 'blah'); - should.throw(badFn, Error, /hello/, 'blah'); - }, 'blah: expected [Function] to throw error matching /hello/ but got \'testing\''); - - err(() => { - expect(badFn).to.throw(Error, 'hello', 'blah'); - badFn.should.throw(Error, 'hello', 'blah'); - should.throw(badFn, Error, 'hello', 'blah'); - }, 'blah: expected [Function] to throw error including \'hello\' but got \'testing\''); -} - -function use() { - // ReSharper disable once InconsistentNaming - chai.use((_chai) => { - _chai.can.use.any(); - }); -} - -class Klass { - val: number; - constructor() { this.val = 0; } - bar() { } - - static baz() { } -} - -function respondTo() { - var obj = new Klass(); - - expect(Klass).to.respondTo('bar'); - expect(obj).respondsTo('bar'); - Klass.should.respondTo('bar'); - Klass.should.respondsTo('bar'); - expect(Klass).to.not.respondTo('foo'); - Klass.should.not.respondTo('foo'); - expect(Klass).itself.to.respondTo('func'); - expect(Klass).itself.not.to.respondTo('bar'); - - expect(obj).not.to.respondTo('foo'); - obj.should.not.respondTo('foo'); - - err(() => { - expect(Klass).to.respondTo('baz', 'constructor'); - Klass.should.respondTo('baz', 'constructor'); - }, /^(constructor: expected)(.*)(\[Function: Klass\])(.*)(to respond to \'baz\')$/); - - err(() => { - expect(obj).to.respondTo('baz', 'object'); - obj.should.respondTo('baz', 'object'); - }, /^(object: expected)(.*)(\{ foo: \[Function\] \}|\{ Object \()(.*)(to respond to \'baz\')$/); -} - -function satisfy() { - function matcher(num: number) { - return num === 1; - } - - expect(1).to.satisfy(matcher); - (1).should.satisfy(matcher); - - err(() => { - expect(2).to.satisfy(matcher, 'blah'); - (2).should.satisfy(matcher, 'blah'); - }, 'blah: expected 2 to satisfy [Function: matcher]'); -} - -function closeTo() { - expect(1.5).to.be.closeTo(1.0, 0.5); - (1.5).should.be.closeTo(1.0, 0.5); - expect(10).to.be.closeTo(20, 20); - (10).should.be.closeTo(20, 20); - expect(-10).to.be.closeTo(20, 30); - (-10).should.be.closeTo(20, 30); - - err(() => { - expect(2).to.be.closeTo(1.0, 0.5, 'blah'); - (2).should.be.closeTo(1.0, 0.5, 'blah'); - }, 'blah: expected 2 to be close to 1 +/- 0.5'); - - err(() => { - expect(-10).to.be.closeTo(20, 29, 'blah'); - (-10).should.be.closeTo(20, 29, 'blah'); - }, 'blah: expected -10 to be close to 20 +/- 29'); -} - -function includeMembers() { - expect([1, 2, 3]).to.include.members([]); - [1, 2, 3].should.include.members([]); - - expect([1, 2, 3]).to.include.members([3, 2]); - - [1, 2, 3].should.include.members([3, 2]); - - expect([1, 2, 3]).to.not.include.members([8, 4]); - - [1, 2, 3].should.not.include.members([8, 4]); - - expect([1, 2, 3]).to.not.include.members([1, 2, 3, 4]); - - [1, 2, 3].should.not.include.members([1, 2, 3, 4]); -} - -function sameMembers() { - expect([5, 4]).to.have.same.members([4, 5]); - [5, 4].should.have.same.members([4, 5]); - expect([5, 4]).to.have.same.members([5, 4]); - [5, 4].should.have.same.members([5, 4]); - - expect([5, 4]).to.not.have.same.members([]); - [5, 4].should.not.have.same.members([]); - expect([5, 4]).to.not.have.same.members([6, 3]); - [5, 4].should.not.have.same.members([6, 3]); - expect([5, 4]).to.not.have.same.members([5, 4, 2]); - [5, 4].should.not.have.same.members([5, 4, 2]); - - assert.sameMembers([5, 4], [4, 5]); -} -function sameDeepMembers() { - expect([{ id: 5 }, { id: 4 }]).to.have.same.deep.members([{ id: 4 }, { id: 5 }]); - [{ id: 5 }, { id: 4 }].should.have.same.deep.members([{ id: 4 }, { id: 5 }]); - expect([{ id: 5 }, { id: 4 }]).to.have.same.members([{ id: 5 }, { id: 4 }]); - [{ id: 5 }, { id: 4 }].should.have.same.members([{ id: 5 }, { id: 4 }]); - - expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([]); - [{ id: 5 }, { id: 4 }].should.not.have.same.members([]); - expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 6 }, { id: 3 }]); - [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 6 }, { id: 3 }]); - expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); - [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); - - assert.sameDeepMembers([{ id: 5 }, { id: 4 }], [{ id: 4 }, { id: 5 }]); -} - -function members() { - expect([5, 4]).members([4, 5]); - expect([5, 4]).members([5, 4]); - - expect([5, 4]).not.members([]); - expect([5, 4]).not.members([6, 3]); - expect([5, 4]).not.members([5, 4, 2]); -} - -function increaseDecreaseChange() { - var obj = { val: 10 }; - var inc = () => { obj.val++; }; - var dec = () => { obj.val--; }; - var same = () => { }; - - expect(inc).to.increase(obj, "val"); - expect(inc).increases(obj, "val"); - expect(inc).to.change(obj, "val"); - - expect(dec).to.decrease(obj, "val"); - expect(dec).decreases(obj, "val"); - expect(dec).to.change(obj, "val"); - expect(dec).changes(obj, "val"); - - expect(inc).to.not.decrease(obj, "val"); - expect(dec).to.not.increase(obj, "val"); - expect(same).to.not.increase(obj, "val"); - expect(same).to.not.decrease(obj, "val"); - expect(same).to.not.change(obj, "val"); - - inc.should.increase(obj, "val"); - inc.should.change(obj, "val"); - - dec.should.decrease(obj, "val"); - dec.should.change(obj, "val"); - - inc.should.not.decrease(obj, "val"); - dec.should.not.increase(obj, "val"); - same.should.not.change(obj, "val"); -} - -//tdd -declare function suite(description: string, action: Function): void; -declare function test(description: string, action: Function): void; - -interface FieldObj { - field: any; -} - -class CrashyObject { - inspect(): void { - throw new Error('Arg\'s inspect() called even though the test passed'); - } -} - -suite('assert', () => { - - test('assert', () => { - var foo = 'bar'; - assert(foo === 'bar', 'expected foo to equal `bar`'); - - err(() => { - assert(foo === 'baz', 'expected foo to equal `bar`'); - }, 'expected foo to equal `bar`'); - }); - - test('isTrue', () => { - assert.isTrue(true); - - err(() => { - assert.isTrue(false); - }, 'expected false to be true'); - - err(() => { - assert.isTrue(1); - }, 'expected 1 to be true'); - - err(() => { - assert.isTrue('test'); - }, 'expected \'test\' to be true'); - }); - - test('ok', () => { - assert.ok(true); - assert.ok(1); - assert.ok('test'); - assert.isOk(true); - assert.isOk(1); - assert.isOk('test'); - - err(() => { - assert.ok(false); - }, 'expected false to be truthy'); - - err(() => { - assert.ok(0); - }, 'expected 0 to be truthy'); - - err(() => { - assert.ok(''); - }, 'expected \'\' to be truthy'); - }); - - test('notOk', () => { - assert.notOk(false); - assert.notOk(0); - assert.notOk(''); - assert.isNotOk(false); - assert.isNotOk(0); - assert.isNotOk(''); - - err(() => { - assert.notOk(true); - }, 'expected true to be falsy'); - - err(() => { - assert.notOk(1); - }, 'expected 1 to be falsy'); - - err(() => { - assert.notOk('test'); - }, 'expected \'test\' to be falsy'); - }); - - test('isFalse', () => { - assert.isFalse(false); - - err(() => { - assert.isFalse(true); - }, 'expected true to be false'); - - err(() => { - assert.isFalse(0); - }, 'expected 0 to be false'); - }); - - test('equal', () => { - assert.equal(void (0), undefined); - }); - - test('typeof / notTypeOf', () => { - assert.typeOf('test', 'string'); - assert.typeOf(true, 'boolean'); - assert.typeOf(5, 'number'); - - err(() => { - assert.typeOf(5, 'string'); - }, 'expected 5 to be a string'); - - }); - - test('notTypeOf', () => { - assert.notTypeOf('test', 'number'); - - err(() => { - assert.notTypeOf(5, 'number'); - }, 'expected 5 not to be a number'); - }); - - test('instanceOf', () => { - assert.instanceOf(new Foo(), Foo); - - err(() => { - assert.instanceOf(5, Foo); - }, 'expected 5 to be an instance of Foo'); - assert.instanceOf(new CrashyObject(), CrashyObject); - }); - - test('notInstanceOf', () => { - assert.notInstanceOf(new Foo(), String); - - err(() => { - assert.notInstanceOf(new Foo(), Foo); - }, 'expected {} to not be an instance of Foo'); - }); - - test('isObject', () => { - assert.isObject({}); - assert.isObject(new Foo()); - - err(() => { - assert.isObject(true); - }, 'expected true to be an object'); - - err(() => { - assert.isObject(Foo); - }, 'expected [Function: Foo] to be an object'); - - err(() => { - assert.isObject('foo'); - }, 'expected \'foo\' to be an object'); - }); - - test('isNotObject', () => { - assert.isNotObject(5); - - err(() => { - assert.isNotObject({}); - }, 'expected {} not to be an object'); - }); - - test('notEqual', () => { - assert.notEqual(3, 4); - - err(() => { - assert.notEqual(5, 5); - }, 'expected 5 to not equal 5'); - }); - - test('strictEqual', () => { - assert.strictEqual('foo', 'foo'); - - err(() => { - assert.strictEqual('5', 5); - }, 'expected \'5\' to equal 5'); - }); - - test('notStrictEqual', () => { - assert.notStrictEqual(5, '5'); - - err(() => { - assert.notStrictEqual(5, 5); - }, 'expected 5 to not equal 5'); - }); - - test('deepEqual', () => { - assert.deepEqual({ tea: 'chai' }, { tea: 'chai' }); - - err(() => { - assert.deepEqual({ tea: 'chai' }, { tea: 'black' }); - }, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }'); - - var obja = Object.create({ tea: 'chai' }) - , objb = Object.create({ tea: 'chai' }); - - assert.deepEqual(obja, objb); - - var obj1 = Object.create({ tea: 'chai' }) - , obj2 = Object.create({ tea: 'black' }); - - err(() => { - assert.deepEqual(obj1, obj2); - }, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }'); - }); - - test('deepEqual (ordering)', () => { - var a = { a: 'b', c: 'd' } - , b = { c: 'd', a: 'b' }; - assert.deepEqual(a, b); - }); - - test('deepEqual (circular)', () => { - var circularObject: any = {} - , secondCircularObject: any = {}; - circularObject.field = circularObject; - secondCircularObject.field = secondCircularObject; - - assert.deepEqual(circularObject, secondCircularObject); - - err(() => { - secondCircularObject.field2 = secondCircularObject; - assert.deepEqual(circularObject, secondCircularObject); - }, 'expected { field: [Circular] } to deeply equal { Object (field, field2) }'); - }); - - test('notDeepEqual', () => { - assert.notDeepEqual({ tea: 'jasmine' }, { tea: 'chai' }); - err(() => { - assert.notDeepEqual({ tea: 'chai' }, { tea: 'chai' }); - }, 'expected { tea: \'chai\' } to not deeply equal { tea: \'chai\' }'); - }); - - test('notDeepEqual (circular)', () => { - var circularObject: any = {} - , secondCircularObject: any = { tea: 'jasmine' }; - circularObject.field = circularObject; - secondCircularObject.field = secondCircularObject; - - assert.notDeepEqual(circularObject, secondCircularObject); - - err(() => { - delete secondCircularObject.tea; - assert.notDeepEqual(circularObject, secondCircularObject); - }, 'expected { field: [Circular] } to not deeply equal { field: [Circular] }'); - }); - - test('isNull', () => { - assert.isNull(null); - - err(() => { - assert.isNull(undefined); - }, 'expected undefined to equal null'); - }); - - test('isNotNull', () => { - assert.isNotNull(undefined); - - err(() => { - assert.isNotNull(null); - }, 'expected null to not equal null'); - }); - - test('isUndefined', () => { - assert.isUndefined(undefined); - - err(() => { - assert.isUndefined(null); - }, 'expected null to equal undefined'); - }); - - test('isDefined', () => { - assert.isDefined(null); - - err(() => { - assert.isDefined(undefined); - }, 'expected undefined to not equal undefined'); - }); - - test('isNaN', () => { - assert.isNaN(NaN); - - err(() => { - assert.isNaN(12); - }, 'expected 12 to be NaN'); - }); - - test('isNotNaN', () => { - assert.isNotNaN(12); - - err(() => { - assert.isNotNaN(NaN); - }, 'expected NaN to not NaN'); - }); - - test('isFunction', () => { - var func = () => { - }; - assert.isFunction(func); - - err(() => { - assert.isFunction({}); - }, 'expected {} to be a function'); - }); - - test('isNotFunction', () => { - assert.isNotFunction(5); - - err(() => { - assert.isNotFunction(() => { - }); - }, 'expected [Function] not to be a function'); - }); - - test('isArray', () => { - assert.isArray([]); - assert.isArray(new Array()); - - err(() => { - assert.isArray({}); - }, 'expected {} to be an array'); - }); - - test('isNotArray', () => { - assert.isNotArray(3); - - err(() => { - assert.isNotArray([]); - }, 'expected [] not to be an array'); - - err(() => { - assert.isNotArray(new Array()); - }, 'expected [] not to be an array'); - }); - - test('isString', () => { - assert.isString('Foo'); - assert.isString(new String('foo')); - - err(() => { - assert.isString(1); - }, 'expected 1 to be a string'); - }); - - test('isNotString', () => { - assert.isNotString(3); - assert.isNotString(['hello']); - - err(() => { - assert.isNotString('hello'); - }, 'expected \'hello\' not to be a string'); - }); - - test('isNumber', () => { - assert.isNumber(1); - assert.isNumber(Number('3')); - - err(() => { - assert.isNumber('1'); - }, 'expected \'1\' to be a number'); - }); - - test('isNotNumber', () => { - assert.isNotNumber('hello'); - assert.isNotNumber([5]); - - err(() => { - assert.isNotNumber(4); - }, 'expected 4 not to be a number'); - }); - - test('isBoolean', () => { - assert.isBoolean(true); - assert.isBoolean(false); - - err(() => { - assert.isBoolean('1'); - }, 'expected \'1\' to be a boolean'); - }); - - test('isNotBoolean', () => { - assert.isNotBoolean('true'); - - err(() => { - assert.isNotBoolean(true); - }, 'expected true not to be a boolean'); - - err(() => { - assert.isNotBoolean(false); - }, 'expected false not to be a boolean'); - }); - - test('include', () => { - assert.include('foobar', 'bar'); - assert.include([1, 2, 3], 3); - - err(() => { - assert.include('foobar', 'baz'); - }, 'expected \'foobar\' to contain \'baz\''); - - err(() => { - assert.include(undefined, 'bar'); - }, 'expected an array or string'); - }); - - test('notInclude', () => { - assert.notInclude('foobar', 'baz'); - assert.notInclude([1, 2, 3], 4); - - err(() => { - assert.notInclude('foobar', 'bar'); - }, 'expected \'foobar\' to not contain \'bar\''); - - err(() => { - assert.notInclude(undefined, 'bar'); - }, 'expected an array or string'); - }); - - test('lengthOf', () => { - assert.lengthOf([1, 2, 3], 3); - assert.lengthOf('foobar', 6); - - err(() => { - assert.lengthOf('foobar', 5); - }, 'expected \'foobar\' to have a length of 5 but got 6'); - - err(() => { - assert.lengthOf(1, 5); - }, 'expected 1 to have a property \'length\''); - }); - - test('match', () => { - assert.match('foobar', /^foo/); - assert.notMatch('foobar', /^bar/); - - err(() => { - assert.match('foobar', /^bar/i); - }, 'expected \'foobar\' to match /^bar/i'); - - err(() => { - assert.notMatch('foobar', /^foo/i); - }, 'expected \'foobar\' not to match /^foo/i'); - }); - - test('property', () => { - var obj = { foo: { bar: 'baz' } }; - var simpleObj = { foo: 'bar' }; - assert.property(obj, 'foo'); - assert.deepProperty(obj, 'foo.bar'); - assert.notProperty(obj, 'baz'); - assert.notProperty(obj, 'foo.bar'); - assert.notDeepProperty(obj, 'foo.baz'); - assert.deepPropertyVal(obj, 'foo.bar', 'baz'); - assert.deepPropertyNotVal(obj, 'foo.bar', 'flow'); - - err(() => { - assert.property(obj, 'baz'); - }, 'expected { foo: { bar: \'baz\' } } to have a property \'baz\''); - - err(() => { - assert.deepProperty(obj, 'foo.baz'); - }, 'expected { foo: { bar: \'baz\' } } to have a deep property \'foo.baz\''); - - err(() => { - assert.notProperty(obj, 'foo'); - }, 'expected { foo: { bar: \'baz\' } } to not have property \'foo\''); - - err(() => { - assert.notDeepProperty(obj, 'foo.bar'); - }, 'expected { foo: { bar: \'baz\' } } to not have deep property \'foo.bar\''); - - err(() => { - assert.propertyVal(simpleObj, 'foo', 'ball'); - }, 'expected { foo: \'bar\' } to have a property \'foo\' of \'ball\', but got \'bar\''); - - err(() => { - assert.deepPropertyVal(obj, 'foo.bar', 'ball'); - }, 'expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'ball\', but got \'baz\''); - - err(() => { - assert.propertyNotVal(simpleObj, 'foo', 'bar'); - }, 'expected { foo: \'bar\' } to not have a property \'foo\' of \'bar\''); - - err(() => { - assert.deepPropertyNotVal(obj, 'foo.bar', 'baz'); - }, 'expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); - }); - - test('throws', () => { - assert.throws(() => { - throw new Error('foo'); - }); - assert.throws(() => { - throw new Error('bar'); - }, 'bar'); - assert.throws(() => { - throw new Error('bar'); - }, /bar/); - assert.throws(() => { - throw new Error('bar'); - }, Error); - assert.throws(() => { - throw new Error('bar'); - }, Error, 'bar'); - - err(() => { - assert.throws(() => { - throw new Error('foo'); - }, TypeError); - }, 'expected [Function] to throw \'TypeError\' but [Error: foo] was thrown'); - - err(() => { - assert.throws(() => { - throw new Error('foo'); - }, 'bar'); - }, 'expected [Function] to throw error including \'bar\' but got \'foo\''); - - err(() => { - assert.throws(() => { - throw new Error('foo'); - }, Error, 'bar'); - }, 'expected [Function] to throw error including \'bar\' but got \'foo\''); - - err(() => { - assert.throws(() => { - throw new Error('foo'); - }, TypeError, 'bar'); - }, 'expected [Function] to throw \'TypeError\' but [Error: foo] was thrown'); - - err(() => { - assert.throws(() => { - }); - }, 'expected [Function] to throw an error'); - - err(() => { - assert.throws(() => { - throw new Error(''); - }, 'bar'); - }, 'expected [Function] to throw error including \'bar\' but got \'\''); - - err(() => { - assert.throws(() => { - throw new Error(''); - }, /bar/); - }, 'expected [Function] to throw error matching /bar/ but got \'\''); - }); - - test('doesNotThrow', () => { - assert.doesNotThrow(() => { - }); - assert.doesNotThrow(() => { - }, 'foo'); - - err(() => { - assert.doesNotThrow(() => { - throw new Error('foo'); - }); - }, 'expected [Function] to not throw an error but [Error: foo] was thrown'); - }); - - test('ifError', () => { - assert.ifError(false); - assert.ifError(null); - assert.ifError(undefined); - - err(() => { - assert.ifError('foo'); - }, 'expected \'foo\' to be falsy'); - }); - - test('operator', () => { - assert.operator(1, '<', 2); - assert.operator(2, '>', 1); - assert.operator(1, '==', 1); - assert.operator(1, '<=', 1); - assert.operator(1, '>=', 1); - assert.operator(1, '!=', 2); - assert.operator(1, '!==', 2); - - err(() => { - assert.operator(1, '=', 2); - }, 'Invalid operator "="'); - - err(() => { - assert.operator(2, '<', 1); - }, 'expected 2 to be < 1'); - - err(() => { - assert.operator(1, '>', 2); - }, 'expected 1 to be > 2'); - - err(() => { - assert.operator(1, '==', 2); - }, 'expected 1 to be == 2'); - - err(() => { - assert.operator(2, '<=', 1); - }, 'expected 2 to be <= 1'); - - err(() => { - assert.operator(1, '>=', 2); - }, 'expected 1 to be >= 2'); - - err(() => { - assert.operator(1, '!=', 1); - }, 'expected 1 to be != 1'); - - err(() => { - assert.operator(1, '!==', '1'); - }, 'expected 1 to be !== \'1\''); - }); - - test('closeTo', () => { - assert.closeTo(1.5, 1.0, 0.5); - assert.closeTo(10, 20, 20); - assert.closeTo(-10, 20, 30); - - err(() => { - assert.closeTo(2, 1.0, 0.5); - }, 'expected 2 to be close to 1 +/- 0.5'); - - err(() => { - assert.closeTo(-10, 20, 29); - }, 'expected -10 to be close to 20 +/- 29'); - }); - - test('members', () => { - assert.includeMembers([1, 2, 3], [2, 3]); - assert.includeMembers([1, 2, 3], []); - assert.includeMembers([1, 2, 3], [3]); - - err(() => { - assert.includeMembers([5, 6], [7, 8]); - }, 'expected [ 5, 6 ] to be a superset of [ 7, 8 ]'); - - err(() => { - assert.includeMembers([5, 6], [5, 6, 0]); - }, 'expected [ 5, 6 ] to be a superset of [ 5, 6, 0 ]'); - }); - - test('memberEquals', () => { - assert.sameMembers([], []); - assert.sameMembers([1, 2, 3], [3, 2, 1]); - assert.sameMembers([4, 2], [4, 2]); - - err(() => { - assert.sameMembers([], [1, 2]); - }, 'expected [] to have the same members as [ 1, 2 ]'); - - err(() => { - assert.sameMembers([1, 54], [6, 1, 54]); - }, 'expected [ 1, 54 ] to have the same members as [ 6, 1, 54 ]'); - }); - - - test('isAbove', () => { - assert.isAbove(10, 5); - - err(() => { - assert.isAbove(1, 5); - }, 'expected 1 to be above 5'); - err(() => { - assert.isAbove(5, 5); - }, 'expected 5 to be above 5'); - }); - - test('isBelow', () => { - assert.isBelow(5, 10); - - err(() => { - assert.isBelow(5, 1); - }, 'expected 5 to be above 1'); - err(() => { - assert.isBelow(5, 5); - }, 'expected 5 to be below 5'); - }); - - test('isAtLeast', () => { - assert.isAtLeast(5, 3); - assert.isAtLeast(5, 5); - - err(() => { - assert.isAtLeast(3, 5); - }, 'expected 3 to be greater than or equal to 5'); - }); - - test('isAtMost', () => { - assert.isAtMost(3, 5); - assert.isAtMost(5, 5); - - err(() => { - assert.isAtMost(5, 3); - }, 'expected 5 to be less than or equal to 3'); - }); - - test('extensible', () => { assert.extensible({}); }); - test('isExtensible', () => { assert.isExtensible({}); }); - test('notExtensible', () => { assert.notExtensible(Object.preventExtensions({})); }); - test('isNotExtensible', () => { assert.isNotExtensible(Object.preventExtensions({})); }); - - test('sealed', () => { assert.sealed(Object.seal({})); }); - test('isSealed', () => { assert.isSealed(Object.seal({})); }); - test('notSealed', () => { assert.notSealed({}); }); - test('isNotSealed', () => { assert.isNotSealed({}); }); - - test('frozen', () => { assert.frozen(Object.freeze({})); }); - test('isFrozen', () => { assert.isFrozen(Object.freeze({})); }); - test('notFrozen', () => { assert.notFrozen({}); }); - test('isNotFrozen', () => { assert.isNotFrozen({}); }); - -}); diff --git a/chai/chai-3.2.0.d.ts b/chai/chai-3.2.0.d.ts deleted file mode 100644 index 7e4e1a1ff4..0000000000 --- a/chai/chai-3.2.0.d.ts +++ /dev/null @@ -1,391 +0,0 @@ -// Type definitions for chai 3.2.0 -// Project: http://chaijs.com/ -// Definitions by: Jed Mao , -// Bart van der Schoor , -// Andrew Brown , -// Olivier Chevet -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -// - -declare namespace Chai { - - interface ChaiStatic { - expect: ExpectStatic; - should(): Should; - /** - * Provides a way to extend the internals of Chai - */ - use(fn: (chai: any, utils: any) => void): any; - assert: AssertStatic; - config: Config; - AssertionError: typeof AssertionError; - } - - export interface ExpectStatic extends AssertionStatic { - fail(actual?: any, expected?: any, message?: string, operator?: string): void; - } - - export interface AssertStatic extends Assert { - } - - export interface AssertionStatic { - (target: any, message?: string): Assertion; - } - - interface ShouldAssertion { - equal(value1: any, value2: any, message?: string): void; - Throw: ShouldThrow; - throw: ShouldThrow; - exist(value: any, message?: string): void; - } - - interface Should extends ShouldAssertion { - not: ShouldAssertion; - fail(actual: any, expected: any, message?: string, operator?: string): void; - } - - interface ShouldThrow { - (actual: Function): void; - (actual: Function, expected: string|RegExp, message?: string): void; - (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; - } - - interface Assertion extends LanguageChains, NumericComparison, TypeComparison { - not: Assertion; - deep: Deep; - any: KeyFilter; - all: KeyFilter; - a: TypeComparison; - an: TypeComparison; - include: Include; - includes: Include; - contain: Include; - contains: Include; - ok: Assertion; - true: Assertion; - false: Assertion; - null: Assertion; - undefined: Assertion; - NaN: Assertion; - exist: Assertion; - empty: Assertion; - arguments: Assertion; - Arguments: Assertion; - equal: Equal; - equals: Equal; - eq: Equal; - eql: Equal; - eqls: Equal; - property: Property; - ownProperty: OwnProperty; - haveOwnProperty: OwnProperty; - ownPropertyDescriptor: OwnPropertyDescriptor; - haveOwnPropertyDescriptor: OwnPropertyDescriptor; - length: Length; - lengthOf: Length; - match: Match; - matches: Match; - string(string: string, message?: string): Assertion; - keys: Keys; - key(string: string): Assertion; - throw: Throw; - throws: Throw; - Throw: Throw; - respondTo: RespondTo; - respondsTo: RespondTo; - itself: Assertion; - satisfy: Satisfy; - satisfies: Satisfy; - closeTo(expected: number, delta: number, message?: string): Assertion; - members: Members; - increase: PropertyChange; - increases: PropertyChange; - decrease: PropertyChange; - decreases: PropertyChange; - change: PropertyChange; - changes: PropertyChange; - extensible: Assertion; - sealed: Assertion; - frozen: Assertion; - - } - - interface LanguageChains { - to: Assertion; - be: Assertion; - been: Assertion; - is: Assertion; - that: Assertion; - which: Assertion; - and: Assertion; - has: Assertion; - have: Assertion; - with: Assertion; - at: Assertion; - of: Assertion; - same: Assertion; - } - - interface NumericComparison { - above: NumberComparer; - gt: NumberComparer; - greaterThan: NumberComparer; - least: NumberComparer; - gte: NumberComparer; - below: NumberComparer; - lt: NumberComparer; - lessThan: NumberComparer; - most: NumberComparer; - lte: NumberComparer; - within(start: number, finish: number, message?: string): Assertion; - } - - interface NumberComparer { - (value: number, message?: string): Assertion; - } - - interface TypeComparison { - (type: string, message?: string): Assertion; - instanceof: InstanceOf; - instanceOf: InstanceOf; - } - - interface InstanceOf { - (constructor: Object, message?: string): Assertion; - } - - interface Deep { - equal: Equal; - include: Include; - property: Property; - members: Members; - } - - interface KeyFilter { - keys: Keys; - } - - interface Equal { - (value: any, message?: string): Assertion; - } - - interface Property { - (name: string, value?: any, message?: string): Assertion; - } - - interface OwnProperty { - (name: string, message?: string): Assertion; - } - - interface OwnPropertyDescriptor { - (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; - (name: string, message?: string): Assertion; - } - - interface Length extends LanguageChains, NumericComparison { - (length: number, message?: string): Assertion; - } - - interface Include { - (value: Object, message?: string): Assertion; - (value: string, message?: string): Assertion; - (value: number, message?: string): Assertion; - keys: Keys; - members: Members; - any: KeyFilter; - all: KeyFilter; - } - - interface Match { - (regexp: RegExp|string, message?: string): Assertion; - } - - interface Keys { - (...keys: string[]): Assertion; - (keys: any[]): Assertion; - (keys: Object): Assertion; - } - - interface Throw { - (): Assertion; - (expected: string, message?: string): Assertion; - (expected: RegExp, message?: string): Assertion; - (constructor: Error, expected?: string, message?: string): Assertion; - (constructor: Error, expected?: RegExp, message?: string): Assertion; - (constructor: Function, expected?: string, message?: string): Assertion; - (constructor: Function, expected?: RegExp, message?: string): Assertion; - } - - interface RespondTo { - (method: string, message?: string): Assertion; - } - - interface Satisfy { - (matcher: Function, message?: string): Assertion; - } - - interface Members { - (set: any[], message?: string): Assertion; - } - - interface PropertyChange { - (object: Object, prop: string, msg?: string): Assertion; - } - - export interface Assert { - /** - * @param expression Expression to test for truthiness. - * @param message Message to display on error. - */ - (expression: any, message?: string): void; - - fail(actual?: any, expected?: any, msg?: string, operator?: string): void; - - ok(val: any, msg?: string): void; - isOk(val: any, msg?: string): void; - notOk(val: any, msg?: string): void; - isNotOk(val: any, msg?: string): void; - - equal(act: any, exp: any, msg?: string): void; - notEqual(act: any, exp: any, msg?: string): void; - - strictEqual(act: any, exp: any, msg?: string): void; - notStrictEqual(act: any, exp: any, msg?: string): void; - - deepEqual(act: any, exp: any, msg?: string): void; - notDeepEqual(act: any, exp: any, msg?: string): void; - - isTrue(val: any, msg?: string): void; - isFalse(val: any, msg?: string): void; - - isNull(val: any, msg?: string): void; - isNotNull(val: any, msg?: string): void; - - isUndefined(val: any, msg?: string): void; - isDefined(val: any, msg?: string): void; - - isNaN(val: any, msg?: string): void; - isNotNaN(val: any, msg?: string): void; - - isAbove(val: number, abv: number, msg?: string): void; - isBelow(val: number, blw: number, msg?: string): void; - - isAtMost(val: number, atmst: number, msg?: string): void; - isAtLeast(val: number, atlst: number, msg?: string): void; - - isFunction(val: any, msg?: string): void; - isNotFunction(val: any, msg?: string): void; - - isObject(val: any, msg?: string): void; - isNotObject(val: any, msg?: string): void; - - isArray(val: any, msg?: string): void; - isNotArray(val: any, msg?: string): void; - - isString(val: any, msg?: string): void; - isNotString(val: any, msg?: string): void; - - isNumber(val: any, msg?: string): void; - isNotNumber(val: any, msg?: string): void; - - isBoolean(val: any, msg?: string): void; - isNotBoolean(val: any, msg?: string): void; - - typeOf(val: any, type: string, msg?: string): void; - notTypeOf(val: any, type: string, msg?: string): void; - - instanceOf(val: any, type: Function, msg?: string): void; - notInstanceOf(val: any, type: Function, msg?: string): void; - - include(exp: string, inc: any, msg?: string): void; - include(exp: any[], inc: any, msg?: string): void; - - notInclude(exp: string, inc: any, msg?: string): void; - notInclude(exp: any[], inc: any, msg?: string): void; - - match(exp: any, re: RegExp, msg?: string): void; - notMatch(exp: any, re: RegExp, msg?: string): void; - - property(obj: Object, prop: string, msg?: string): void; - notProperty(obj: Object, prop: string, msg?: string): void; - deepProperty(obj: Object, prop: string, msg?: string): void; - notDeepProperty(obj: Object, prop: string, msg?: string): void; - - propertyVal(obj: Object, prop: string, val: any, msg?: string): void; - propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - - deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; - deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - - lengthOf(exp: any, len: number, msg?: string): void; - //alias frenzy - throw(fn: Function, msg?: string): void; - throw(fn: Function, regExp: RegExp): void; - throw(fn: Function, errType: Function, msg?: string): void; - throw(fn: Function, errType: Function, regExp: RegExp): void; - - throws(fn: Function, msg?: string): void; - throws(fn: Function, regExp: RegExp): void; - throws(fn: Function, errType: Function, msg?: string): void; - throws(fn: Function, errType: Function, regExp: RegExp): void; - - Throw(fn: Function, msg?: string): void; - Throw(fn: Function, regExp: RegExp): void; - Throw(fn: Function, errType: Function, msg?: string): void; - Throw(fn: Function, errType: Function, regExp: RegExp): void; - - doesNotThrow(fn: Function, msg?: string): void; - doesNotThrow(fn: Function, regExp: RegExp): void; - doesNotThrow(fn: Function, errType: Function, msg?: string): void; - doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; - - operator(val: any, operator: string, val2: any, msg?: string): void; - closeTo(act: number, exp: number, delta: number, msg?: string): void; - - sameMembers(set1: any[], set2: any[], msg?: string): void; - sameDeepMembers(set1: any[], set2: any[], msg?: string): void; - includeMembers(superset: any[], subset: any[], msg?: string): void; - - ifError(val: any, msg?: string): void; - - isExtensible(obj: {}, msg?: string): void; - extensible(obj: {}, msg?: string): void; - isNotExtensible(obj: {}, msg?: string): void; - notExtensible(obj: {}, msg?: string): void; - - isSealed(obj: {}, msg?: string): void; - sealed(obj: {}, msg?: string): void; - isNotSealed(obj: {}, msg?: string): void; - notSealed(obj: {}, msg?: string): void; - - isFrozen(obj: Object, msg?: string): void; - frozen(obj: Object, msg?: string): void; - isNotFrozen(obj: Object, msg?: string): void; - notFrozen(obj: Object, msg?: string): void; - - - } - - export interface Config { - includeStack: boolean; - } - - export class AssertionError { - constructor(message: string, _props?: any, ssf?: Function); - name: string; - message: string; - showDiff: boolean; - stack: string; - } -} - -declare var chai: Chai.ChaiStatic; - -declare module "chai" { - export = chai; -} - -interface Object { - should: Chai.Assertion; -} diff --git a/chai/chai-2.0.0.d.ts b/chai/v2/index.d.ts similarity index 100% rename from chai/chai-2.0.0.d.ts rename to chai/v2/index.d.ts diff --git a/chai/v2/tsconfig.json b/chai/v2/tsconfig.json new file mode 100644 index 0000000000..4eb64088fc --- /dev/null +++ b/chai/v2/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "chai": ["chai/v2"] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/charm/charm-tests.ts b/charm/charm-tests.ts new file mode 100644 index 0000000000..0cdbdc8055 --- /dev/null +++ b/charm/charm-tests.ts @@ -0,0 +1,25 @@ +import getCharm = require("charm"); +const charm = getCharm(); +charm.pipe(process.stdout); +charm.reset(); + +var colors: getCharm.CharmColor[] = [ 'red', 'cyan', 'yellow', 'green', 'blue' ]; +var text = 'Always after me lucky charms.'; + +var offset = 0; +var iv = setInterval(function () { + var y = 0, dy = 1; + for (var i = 0; i < 40; i++) { + var color = colors[(i + offset) % colors.length]; + var c = text[(i + offset) % text.length]; + charm + .move(1, dy) + .foreground(color) + .write(c) + ; + y += dy; + if (y <= 0 || y >= 5) dy *= -1; + } + charm.position(0, 1); + offset ++; +}, 150); diff --git a/charm/index.d.ts b/charm/index.d.ts new file mode 100644 index 0000000000..2ce1b9e13a --- /dev/null +++ b/charm/index.d.ts @@ -0,0 +1,154 @@ +// Type definitions for Charm 1.0 +// Project: https://github.com/substack/node-charm/ +// Definitions by: Jad Sarout +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace charm { + type CharmColorName = "red" | "yellow" | "green" | "blue" | "cyan" | "magenta" | "black" | "white"; + type CharmColorHex = number; + type CharmColor = CharmColorName | CharmColorHex; + type CharmAnyStream = NodeJS.WritableStream|NodeJS.ReadableStream|NodeJS.Process; + + interface CharmInstance extends NodeJS.WritableStream { + /** Reset the entire screen, like the /usr/bin/reset command. */ + reset(): void; + + /** Emit an "end" event downstream. */ + destroy(): void; + + /** Emit an "end" event downstream. */ + end(): void; + + /** + * Pass along `msg` to the output stream. + * @param cb Unused by charm, only there to comply to the WritableStream interface + */ + write(msg: string | Buffer, cb?: Function): boolean; + write(msgs: string | Buffer, encoding?: string, cb?: Function): boolean; + + /** Set the cursor position to the absolute coordinates `x`, `y`. */ + position(x: number, y: number): void; + + /** + * Query the absolute cursor position from the input stream through the output stream + * (the shell does this automatically) and get the response back as `cb(x, y)`. + */ + position(callback: (x: number, y: number) => void): void; + + /** Move the cursor position by the relative coordinates `x`, `y`. */ + move(x: number, y: number): this; + + /** Move the cursor up by `y` rows. */ + up(y: number): this; + + /** Move the cursor down by `y` rows. */ + down(y: number): this; + + /** Move the cursor left by `x` columns. */ + left(x: number): this; + + /** Move the cursor right by `x` columns. */ + right(x: number): this; + + /** Push the cursor state and optionally the attribute state. */ + push(withAttributes?: boolean): this; + + /** Pop the cursor state and optionally the attribute state. */ + pop(withAttributes?: boolean): this; + + /** + * Erase a region defined by the string `s`. + * + * `s` can be: + * + * - end - erase from the cursor to the end of the line + * - start - erase from the cursor to the start of the line + * - line - erase the current line + * - down - erase everything below the current line + * - up - erase everything above the current line + * - screen - erase the entire screen + */ + erase(s: "end"|"start"|"line"|"down"|"up"|"screen"): this; + + /** + * Delete `'line'` or `'char'`s. delete differs from erase because it does not write over + * the deleted characters with whitesapce, but instead removes the deleted space. + * + * mode can be `'line'` or `'char'`. `n` is the number of items to be deleted. + * `n` must be a positive integer. + * + * The cursor position is not updated. + */ + delete(mode: "line"|"char", n?: number): this; + + /** + * Insert space into the terminal. `insert` is the opposite of `delete`, + * + * mode can be `'line'` or `'char'`. `n` is the number of items to be deleted. + * `n` must be a positive integer. + */ + insert(mode: "line"|"char", n: number): this; + /** + * Set the display mode with the string `attr.` + * + * `attr` can be: + * + * - reset + * - bright + * - dim + * - underscore + * - blink + * - reverse + * - hidden + */ + display(attr: "reset" | "bright" | "dim" | "underscore" | "blink" | "reverse" | "hidden"): this; + + /** + * Set the foreground color with the string `color`, which can be: + * + * - red + * - yellow + * - green + * - blue + * - cyan + * - magenta + * - black + * - white + * - or `color` can be an integer from 0 to 255, inclusive. + */ + foreground(color: CharmColor): this; + /** + * Set the background color with the string `color`, which can be: + * + * - red + * - yellow + * - green + * - blue + * - cyan + * - magenta + * - black + * - white + * - or `color` can be an integer from 0 to 255, inclusive. + */ + background(color: CharmColor): this; + + /** Set the cursor visibility with a boolean `visible`. */ + cursor(visible: boolean): any; + + /** Pipes the output of Charm to a writeable stream `stream` */ + pipe(stream: NodeJS.WritableStream): void; + } +} + +/** + * Create a new readable/writable charm stream. + * + * You can pass in readable or writable streams as parameters + * and they will be piped to or from accordingly. + * You can also pass `process` in which case + * `process.stdin` and `process.stdout` will be used. + */ +declare function charm(param?: charm.CharmAnyStream): charm.CharmInstance; +export = charm; diff --git a/charm/tsconfig.json b/charm/tsconfig.json new file mode 100644 index 0000000000..931b421062 --- /dev/null +++ b/charm/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "charm-tests.ts" + ] +} diff --git a/charm/tslint.json b/charm/tslint.json new file mode 100644 index 0000000000..f05741c59b --- /dev/null +++ b/charm/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "../tslint.json", + "rules": { + "forbidden-types": false + } +} diff --git a/chart.js/chart.js-tests.ts b/chart.js/chart.js-tests.ts new file mode 100644 index 0000000000..2b38efaa25 --- /dev/null +++ b/chart.js/chart.js-tests.ts @@ -0,0 +1,26 @@ +import { Chart, LinearChartData } from 'chart.js'; + +//alternative: +//import chartjs = require('chart.js'); +// => chartjs.Chart + +var chart = new Chart(new CanvasRenderingContext2D(), { + type: 'bar', + data: { + labels: ['group 1'], + datasets: [ + { + label: 'test', + data: [1] + } + ] + }, + options: { + scales: { + xAxes: [{ + gridLines: { display: false } + }] + } + } +}); +chart.update(); diff --git a/chart.js/index.d.ts b/chart.js/index.d.ts index bf23a1cc52..3ef5919acf 100644 --- a/chart.js/index.d.ts +++ b/chart.js/index.d.ts @@ -3,398 +3,11 @@ // Definitions by: Alberto Nuti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare enum ChartType { - line, bar, radar, doughnut, polarArea, bubble -} -declare enum TimeUnit { - millisecond, second, minute, - hour, day, week, - month, quarter, year -} -interface ChartLegendItem { - text?: string; - fillStyle?: string; - hidden?: boolean; - lineCap?: string; - lineDash?: number[]; - lineDashOffset?: number; - lineJoin?: string; - lineWidth?: number; - strokeStyle?: string; -} -interface ChartTooltipItem { - xLabel?: string; - yLabel?: string; - datasetIndex?: number; - index?: number; -} -interface ChartTooltipCallback { - beforeTitle?: (item?: ChartTooltipItem[], data?: any) => void; - title?: (item?: ChartTooltipItem[], data?: any) => void; - afterTitle?: (item?: ChartTooltipItem[], data?: any) => void; - beforeBody?: (item?: ChartTooltipItem[], data?: any) => void; - beforeLabel?: (tooltipItem?: ChartTooltipItem, data?: any) => void; - label?: (tooltipItem?: ChartTooltipItem, data?: any) => void; - afterLabel?: (tooltipItem?: ChartTooltipItem, data?: any) => void; - afterBody?: (item?: ChartTooltipItem[], data?: any) => void; - beforeFooter?: (item?: ChartTooltipItem[], data?: any) => void; - footer?: (item?: ChartTooltipItem[], data?: any) => void; - afterfooter?: (item?: ChartTooltipItem[], data?: any) => void; -} -interface ChartAnimationParameter { - chartInstance?: any; - animationObject?: any; -} -interface ChartPoint { - x?: number; - y?: number; -} - -interface ChartConfiguration { - type?: string; - data?: ChartData; - options?: ChartOptions; -} - -interface ChartData { - -} - -interface LinearChartData extends ChartData { - labels?: string[]; - datasets?: ChartDataSets[]; -} - -interface ChartOptions { - responsive?: boolean; - responsiveAnimationDuration?: number; - maintainAspectRatio?: boolean; - events?: string[]; - onClick?: (any?: any) => any; - title?: ChartTitleOptions; - legend?: ChartLegendOptions; - tooltips?: ChartTooltipOptions; - hover?: ChartHoverOptions; - animation?: ChartAnimationOptions; - elements?: ChartElementsOptions; - scales?: ChartScales; -} - -interface ChartFontOptions { - defaultFontColor?: ChartColor; - defaultFontFamily?: string; - defaultFontSize?: number; - defaultFontStyle?: string; -} - -interface ChartTitleOptions { - display?: boolean; - position?: string; - fullWdith?: boolean; - fontSize?: number; - fontFamily?: string; - fontColor?: ChartColor; - fontStyle?: string; - padding?: number; - text?: string; -} - -interface ChartLegendOptions { - display?: boolean; - position?: string; - fullWidth?: boolean; - onClick?: (event: any, legendItem: any) => void; - labels?: ChartLegendLabelOptions; -} - -interface ChartLegendLabelOptions { - boxWidth?: number; - fontSize?: number; - fontStyle?: number; - fontColor?: ChartColor; - fontFamily?: string; - padding?: number; - generateLabels?: (chart: any) => any; -} - -interface ChartTooltipOptions { - enabled?: boolean; - custom?: (a: any) => void; - mode?: string; - backgroundColor?: ChartColor; - titleFontFamily?: string; - titleFontSize?: number; - titleFontStyle?: string; - titleFontColor?: ChartColor; - titleSpacing?: number; - titleMarginBottom?: number; - bodyFontFamily?: string; - bodyFontSize?: number; - bodyFontStyle?: string; - bodyFontColor?: ChartColor; - bodySpacing?: number; - footerFontFamily?: string; - footerFontSize?: number; - footerFontStyle?: string; - footerFontColor?: ChartColor; - footerSpacing?: number; - footerMarginTop?: number; - xPadding?: number; - yPadding?: number; - caretSize?: number; - cornerRadius?: number; - multiKeyBackground?: string; - callbacks?: ChartTooltipCallback; -} - -interface ChartHoverOptions { - mode?: string; - animationDuration?: number; - onHover?: (active: any) => void; -} - -interface ChartAnimationObject { - currentStep?: number; - numSteps?: number; - easing?: string; - render?: (arg: any) => void; - onAnimationProgress?: (arg: any) => void; - onAnimationComplete?: (arg: any) => void; -} - -interface ChartAnimationOptions { - duration?: number; - easing?: string; - onProgress?: (chart: any) => void; - onComplete?: (chart: any) => void; -} - -interface ChartElementsOptions { - point?: ChartPointOptions; - line?: ChartLineOptions; - arc?: ChartArcOptions; - rectangle?: ChartRectangleOptions; -} - -interface ChartArcOptions { - backgroundColor?: ChartColor; - borderColor?: ChartColor; - borderWidth?: number; -} - -interface ChartLineOptions { - tension?: number; - backgroundColor?: ChartColor; - borderWidth?: number; - borderColor?: ChartColor; - borderCapStyle?: string; - borderDash?: any[]; - borderDashOffset?: number; - borderJoinStyle?: string; -} - -interface ChartPointOptions { - radius?: number; - pointStyle?: string; - backgroundColor?: ChartColor; - borderWidth?: number; - borderColor?: ChartColor; - hitRadius?: number; - hoverRadius?: number; - hoverBorderWidth?: number; -} - -interface ChartRectangleOptions { - backgroundColor?: ChartColor; - borderWidth?: number; - borderColor?: ChartColor; - borderSkipped?: string; -} -interface GridLineOptions { - display?: boolean; - color?: ChartColor; - lineWidth?: number; - drawBorder?: boolean; - drawOnChartArea?: boolean; - drawticks?: boolean; - tickMarkLength?: number; - zeroLineWidth?: number; - zeroLineColor?: ChartColor; - offsetGridLines?: boolean; -} - -interface ScaleTitleOptions { - display?: boolean; - labelString?: string; - fontColor?: ChartColor; - fontFamily?: string; - fontSize?: number; - fontStyle?: string; -} - -interface TickOptions { - autoSkip?: boolean; - callback?: (value: any, index: any, values: any) => string; - display?: boolean; - fontColor?: ChartColor; - fontFamily?: string; - fontSize?: number; - fontStyle?: string; - labelOffset?: number; - maxRotation?: number; - minRotation?: number; - mirror?: boolean; - padding?: number; - reverse?: boolean; - min?: any; - max?: any; -} -interface AngleLineOptions { - display?: boolean; - color?: ChartColor; - lineWidth?: number; -} - -interface PointLabelOptions { - callback?: (arg: any) => any; - fontColor?: ChartColor; - fontFamily?: string; - fontSize?: number; - fontStyle?: string; -} - -interface TickOptions { - backdropColor?: ChartColor; - backdropPaddingX?: number; - backdropPaddingY?: number; - maxTicksLimit?: number; - showLabelBackdrop?: boolean; -} -interface LinearTickOptions extends TickOptions { - beginAtZero?: boolean; - min?: number; - max?: number; - maxTicksLimit?: number; - stepSize?: number; - suggestedMin?: number; - suggestedMax?: number; -} - -interface LogarithmicTickOptions extends TickOptions { - min?: number; - max?: number; -} - -type ChartColor = string | CanvasGradient | CanvasPattern; - -interface ChartDataSets { - backgroundColor?: ChartColor; - borderWidth?: number; - borderColor?: ChartColor; - borderCapStyle?: string; - borderDash?: number[]; - borderDashOffset?: number; - borderJoinStyle?: string; - data?: number[] | ChartPoint[]; - fill?: boolean; - label?: string; - lineTension?: number; - pointBorderColor?: ChartColor | ChartColor[]; - pointBackgroundColor?: ChartColor | ChartColor[]; - pointBorderWidth?: number | number[]; - pointRadius?: number | number[]; - pointHoverRadius?: number | number[]; - pointHitRadius?: number | number[]; - pointHoverBackgroundColor?: ChartColor | ChartColor[]; - pointHoverBorderColor?: ChartColor | ChartColor[]; - pointHoverBorderWidth?: number | number[]; - pointStyle?: string | string[] | HTMLImageElement | HTMLImageElement[]; - xAxisID?: string; - yAxisID?: string; -} - -interface ChartScales { - type?: string; - display?: boolean; - position?: string; - beforeUpdate?: (scale?: any) => void; - beforeSetDimension?: (scale?: any) => void; - beforeDataLimits?: (scale?: any) => void; - beforeBuildTicks?: (scale?: any) => void; - beforeTickToLabelConversion?: (scale?: any) => void; - beforeCalculateTickRotation?: (scale?: any) => void; - beforeFit?: (scale?: any) => void; - afterUpdate?: (scale?: any) => void; - afterSetDimension?: (scale?: any) => void; - afterDataLimits?: (scale?: any) => void; - afterBuildTicks?: (scale?: any) => void; - afterTickToLabelConversion?: (scale?: any) => void; - afterCalculateTickRotation?: (scale?: any) => void; - afterFit?: (scale?: any) => void; - gridLines?: GridLineOptions; - scaleLabel?: ScaleTitleOptions; - ticks?: TickOptions; - xAxes?: ChartXAxe[]; - yAxes?: ChartYAxe[]; -} - -interface ChartXAxe { - type?: string; - display?: boolean; - id?: string; - stacked?: boolean; - categoryPercentage?: number; - barPercentage?: number; - barThickness?: number; - gridLines?: GridLineOptions; - position?: string; - ticks?: TickOptions; - time?: TimeScale; - scaleLabel?: ScaleTitleOptions; -} - -interface ChartYAxe { - type?: string; - display?: boolean; - id?: string; - stacked?: boolean; - position?: string; - ticks?: TickOptions; - scaleLabel?: ScaleTitleOptions; -} - -interface LinearScale extends ChartScales { - ticks?: LinearTickOptions; -} - -interface LogarithmicScale extends ChartScales { - ticks?: LogarithmicTickOptions; -} - -interface TimeScale extends ChartScales { - format?: string; - displayFormats?: string; - isoWeekday?: boolean; - max?: string; - min?: string; - parser?: string | ((arg: any) => any); - round?: string; - tooltipFormat?: string; - unit?: string | TimeUnit; - unitStepSize?: number; -} - -interface RadialLinearScale { - lineArc?: boolean; - angleLines?: AngleLineOptions; - pointLabels?: PointLabelOptions; - ticks?: TickOptions; -} - declare class Chart { - constructor (context: CanvasRenderingContext2D | HTMLCanvasElement, options: ChartConfiguration); - config: ChartConfiguration; - data: ChartData; + static readonly Chart: typeof Chart; + constructor(context: CanvasRenderingContext2D | HTMLCanvasElement, options: Chart.ChartConfiguration); + config: Chart.ChartConfiguration; + data: Chart.ChartData; destroy: () => {}; update: (duration?: any, lazy?: any) => {}; render: (duration?: any, lazy?: any) => {}; @@ -408,6 +21,413 @@ declare class Chart { getDatasetAtEvent: (e: any) => {}[]; defaults: { - global: ChartOptions; + global: Chart.ChartOptions; } } + +declare namespace Chart { + export type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble'; + + export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; + + export type ScaleType = 'category' | 'linear' | 'logarithmic' | 'time' | 'radialLinear'; + + export interface ChartLegendItem { + text?: string; + fillStyle?: string; + hidden?: boolean; + lineCap?: string; + lineDash?: number[]; + lineDashOffset?: number; + lineJoin?: string; + lineWidth?: number; + strokeStyle?: string; + } + + export interface ChartTooltipItem { + xLabel?: string; + yLabel?: string; + datasetIndex?: number; + index?: number; + } + + export interface ChartTooltipCallback { + beforeTitle?: (item?: ChartTooltipItem[], data?: any) => void; + title?: (item?: ChartTooltipItem[], data?: any) => void; + afterTitle?: (item?: ChartTooltipItem[], data?: any) => void; + beforeBody?: (item?: ChartTooltipItem[], data?: any) => void; + beforeLabel?: (tooltipItem?: ChartTooltipItem, data?: any) => void; + label?: (tooltipItem?: ChartTooltipItem, data?: any) => void; + afterLabel?: (tooltipItem?: ChartTooltipItem, data?: any) => void; + afterBody?: (item?: ChartTooltipItem[], data?: any) => void; + beforeFooter?: (item?: ChartTooltipItem[], data?: any) => void; + footer?: (item?: ChartTooltipItem[], data?: any) => void; + afterfooter?: (item?: ChartTooltipItem[], data?: any) => void; + } + + export interface ChartAnimationParameter { + chartInstance?: any; + animationObject?: any; + } + + export interface ChartPoint { + x?: number; + y?: number; + } + + export interface ChartConfiguration { + type?: ChartType | string; + data?: ChartData; + options?: ChartOptions; + } + + export interface ChartData { + + } + + export interface LinearChartData extends ChartData { + labels?: string[]; + datasets?: ChartDataSets[]; + } + + export interface ChartOptions { + responsive?: boolean; + responsiveAnimationDuration?: number; + maintainAspectRatio?: boolean; + events?: string[]; + onClick?: (any?: any) => any; + title?: ChartTitleOptions; + legend?: ChartLegendOptions; + tooltips?: ChartTooltipOptions; + hover?: ChartHoverOptions; + animation?: ChartAnimationOptions; + elements?: ChartElementsOptions; + scales?: ChartScales; + } + + export interface ChartFontOptions { + defaultFontColor?: ChartColor; + defaultFontFamily?: string; + defaultFontSize?: number; + defaultFontStyle?: string; + } + + export interface ChartTitleOptions { + display?: boolean; + position?: string; + fullWdith?: boolean; + fontSize?: number; + fontFamily?: string; + fontColor?: ChartColor; + fontStyle?: string; + padding?: number; + text?: string; + } + + export interface ChartLegendOptions { + display?: boolean; + position?: string; + fullWidth?: boolean; + onClick?: (event: any, legendItem: any) => void; + labels?: ChartLegendLabelOptions; + } + + export interface ChartLegendLabelOptions { + boxWidth?: number; + fontSize?: number; + fontStyle?: number; + fontColor?: ChartColor; + fontFamily?: string; + padding?: number; + generateLabels?: (chart: any) => any; + } + + export interface ChartTooltipOptions { + enabled?: boolean; + custom?: (a: any) => void; + mode?: string; + backgroundColor?: ChartColor; + titleFontFamily?: string; + titleFontSize?: number; + titleFontStyle?: string; + titleFontColor?: ChartColor; + titleSpacing?: number; + titleMarginBottom?: number; + bodyFontFamily?: string; + bodyFontSize?: number; + bodyFontStyle?: string; + bodyFontColor?: ChartColor; + bodySpacing?: number; + footerFontFamily?: string; + footerFontSize?: number; + footerFontStyle?: string; + footerFontColor?: ChartColor; + footerSpacing?: number; + footerMarginTop?: number; + xPadding?: number; + yPadding?: number; + caretSize?: number; + cornerRadius?: number; + multiKeyBackground?: string; + callbacks?: ChartTooltipCallback; + } + + export interface ChartHoverOptions { + mode?: string; + animationDuration?: number; + onHover?: (active: any) => void; + } + + export interface ChartAnimationObject { + currentStep?: number; + numSteps?: number; + easing?: string; + render?: (arg: any) => void; + onAnimationProgress?: (arg: any) => void; + onAnimationComplete?: (arg: any) => void; + } + + export interface ChartAnimationOptions { + duration?: number; + easing?: string; + onProgress?: (chart: any) => void; + onComplete?: (chart: any) => void; + } + + export interface ChartElementsOptions { + point?: ChartPointOptions; + line?: ChartLineOptions; + arc?: ChartArcOptions; + rectangle?: ChartRectangleOptions; + } + + export interface ChartArcOptions { + backgroundColor?: ChartColor; + borderColor?: ChartColor; + borderWidth?: number; + } + + export interface ChartLineOptions { + tension?: number; + backgroundColor?: ChartColor; + borderWidth?: number; + borderColor?: ChartColor; + borderCapStyle?: string; + borderDash?: any[]; + borderDashOffset?: number; + borderJoinStyle?: string; + } + + export interface ChartPointOptions { + radius?: number; + pointStyle?: string; + backgroundColor?: ChartColor; + borderWidth?: number; + borderColor?: ChartColor; + hitRadius?: number; + hoverRadius?: number; + hoverBorderWidth?: number; + } + + export interface ChartRectangleOptions { + backgroundColor?: ChartColor; + borderWidth?: number; + borderColor?: ChartColor; + borderSkipped?: string; + } + export interface GridLineOptions { + display?: boolean; + color?: ChartColor; + lineWidth?: number; + drawBorder?: boolean; + drawOnChartArea?: boolean; + drawticks?: boolean; + tickMarkLength?: number; + zeroLineWidth?: number; + zeroLineColor?: ChartColor; + offsetGridLines?: boolean; + } + + export interface ScaleTitleOptions { + display?: boolean; + labelString?: string; + fontColor?: ChartColor; + fontFamily?: string; + fontSize?: number; + fontStyle?: string; + } + + export interface TickOptions { + autoSkip?: boolean; + callback?: (value: any, index: any, values: any) => string; + display?: boolean; + fontColor?: ChartColor; + fontFamily?: string; + fontSize?: number; + fontStyle?: string; + labelOffset?: number; + maxRotation?: number; + minRotation?: number; + mirror?: boolean; + padding?: number; + reverse?: boolean; + min?: any; + max?: any; + } + export interface AngleLineOptions { + display?: boolean; + color?: ChartColor; + lineWidth?: number; + } + + export interface PointLabelOptions { + callback?: (arg: any) => any; + fontColor?: ChartColor; + fontFamily?: string; + fontSize?: number; + fontStyle?: string; + } + + export interface TickOptions { + backdropColor?: ChartColor; + backdropPaddingX?: number; + backdropPaddingY?: number; + maxTicksLimit?: number; + showLabelBackdrop?: boolean; + } + export interface LinearTickOptions extends TickOptions { + beginAtZero?: boolean; + min?: number; + max?: number; + maxTicksLimit?: number; + stepSize?: number; + suggestedMin?: number; + suggestedMax?: number; + } + + export interface LogarithmicTickOptions extends TickOptions { + min?: number; + max?: number; + } + + type ChartColor = string | CanvasGradient | CanvasPattern; + + export interface ChartDataSets { + backgroundColor?: ChartColor; + borderWidth?: number; + borderColor?: ChartColor; + borderCapStyle?: string; + borderDash?: number[]; + borderDashOffset?: number; + borderJoinStyle?: string; + data?: number[] | ChartPoint[]; + fill?: boolean; + label?: string; + lineTension?: number; + pointBorderColor?: ChartColor | ChartColor[]; + pointBackgroundColor?: ChartColor | ChartColor[]; + pointBorderWidth?: number | number[]; + pointRadius?: number | number[]; + pointHoverRadius?: number | number[]; + pointHitRadius?: number | number[]; + pointHoverBackgroundColor?: ChartColor | ChartColor[]; + pointHoverBorderColor?: ChartColor | ChartColor[]; + pointHoverBorderWidth?: number | number[]; + pointStyle?: string | string[] | HTMLImageElement | HTMLImageElement[]; + xAxisID?: string; + yAxisID?: string; + } + + export interface ChartScales { + type?: ScaleType | string; + display?: boolean; + position?: string; + beforeUpdate?: (scale?: any) => void; + beforeSetDimension?: (scale?: any) => void; + beforeDataLimits?: (scale?: any) => void; + beforeBuildTicks?: (scale?: any) => void; + beforeTickToLabelConversion?: (scale?: any) => void; + beforeCalculateTickRotation?: (scale?: any) => void; + beforeFit?: (scale?: any) => void; + afterUpdate?: (scale?: any) => void; + afterSetDimension?: (scale?: any) => void; + afterDataLimits?: (scale?: any) => void; + afterBuildTicks?: (scale?: any) => void; + afterTickToLabelConversion?: (scale?: any) => void; + afterCalculateTickRotation?: (scale?: any) => void; + afterFit?: (scale?: any) => void; + gridLines?: GridLineOptions; + scaleLabel?: ScaleTitleOptions; + ticks?: TickOptions; + xAxes?: ChartXAxe[]; + yAxes?: ChartYAxe[]; + } + + export interface ChartXAxe { + type?: ScaleType | string; + display?: boolean; + id?: string; + stacked?: boolean; + categoryPercentage?: number; + barPercentage?: number; + barThickness?: number; + gridLines?: GridLineOptions; + position?: string; + ticks?: TickOptions; + time?: TimeScale; + scaleLabel?: ScaleTitleOptions; + } + + export interface ChartYAxe { + type?: ScaleType | string; + display?: boolean; + id?: string; + stacked?: boolean; + position?: string; + ticks?: TickOptions; + scaleLabel?: ScaleTitleOptions; + } + + export interface LinearScale extends ChartScales { + ticks?: LinearTickOptions; + } + + export interface LogarithmicScale extends ChartScales { + ticks?: LogarithmicTickOptions; + } + + export interface TimeDisplayFormat { + millisecond?: string; + second?: string; + minute?: string; + hour?: string; + day?: string; + week?: string; + month?: string; + quarter?: string; + year?: string; + } + + export interface TimeScale extends ChartScales { + format?: string; + displayFormats?: TimeDisplayFormat; + isoWeekday?: boolean; + max?: string; + min?: string; + parser?: string | ((arg: any) => any); + round?: string; + tooltipFormat?: string; + unit?: TimeUnit; + unitStepSize?: number; + } + + export interface RadialLinearScale { + lineArc?: boolean; + angleLines?: AngleLineOptions; + pointLabels?: PointLabelOptions; + ticks?: TickOptions; + } +} + +export = Chart; +export as namespace Chart; \ No newline at end of file diff --git a/chart.js/tsconfig.json b/chart.js/tsconfig.json index cdcaca971c..e55a6fd51b 100644 --- a/chart.js/tsconfig.json +++ b/chart.js/tsconfig.json @@ -14,6 +14,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "chart.js-tests.ts" ] } \ No newline at end of file diff --git a/chroma-js/chroma-js-0.5.6-tests.ts b/chroma-js/v0/chroma-js-tests.ts similarity index 98% rename from chroma-js/chroma-js-0.5.6-tests.ts rename to chroma-js/v0/chroma-js-tests.ts index cb8b593d26..88a917dff9 100644 --- a/chroma-js/chroma-js-0.5.6-tests.ts +++ b/chroma-js/v0/chroma-js-tests.ts @@ -1,5 +1,3 @@ -/// - function test_chroma() { chroma("red"); chroma("#ff0000"); diff --git a/chroma-js/chroma-js-0.5.6.d.ts b/chroma-js/v0/index.d.ts similarity index 100% rename from chroma-js/chroma-js-0.5.6.d.ts rename to chroma-js/v0/index.d.ts diff --git a/chroma-js/v0/tsconfig.json b/chroma-js/v0/tsconfig.json new file mode 100644 index 0000000000..f4be951841 --- /dev/null +++ b/chroma-js/v0/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "chroma-js": ["chroma-js/v0"] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "chroma-js-tests.ts" + ] +} \ No newline at end of file diff --git a/chrome/chrome-app-tests.ts b/chrome/chrome-app-tests.ts index 31695c8efc..6dbd06d9e2 100644 --- a/chrome/chrome-app-tests.ts +++ b/chrome/chrome-app-tests.ts @@ -1,4 +1,4 @@ - + import runtime = chrome.app.runtime; import cwindow = chrome.app.window; diff --git a/chrome/index.d.ts b/chrome/index.d.ts index 942c5ef5eb..2822dd421e 100644 --- a/chrome/index.d.ts +++ b/chrome/index.d.ts @@ -22,89 +22,89 @@ interface Window { * Important: This API works only on Chrome OS. */ declare namespace chrome.accessibilityFeatures { - interface AccessibilityFeaturesGetArg { - /** Optional. Whether to return the value that applies to the incognito session (default false). */ - incognito?: boolean; - } + interface AccessibilityFeaturesGetArg { + /** Optional. Whether to return the value that applies to the incognito session (default false). */ + incognito?: boolean; + } - interface AccessibilityFeaturesCallbackArg { - /** The value of the setting. */ - value: any; - /** - * One of - * • not_controllable: cannot be controlled by any extension - * • controlled_by_other_extensions: controlled by extensions with higher precedence - * • controllable_by_this_extension: can be controlled by this extension - * • controlled_by_this_extension: controlled by this extension - */ - levelOfControl: string; - /** Optional. Whether the effective value is specific to the incognito session. This property will only be present if the incognito property in the details parameter of get() was true. */ - incognitoSpecific?: boolean; - } + interface AccessibilityFeaturesCallbackArg { + /** The value of the setting. */ + value: any; + /** + * One of + * • not_controllable: cannot be controlled by any extension + * • controlled_by_other_extensions: controlled by extensions with higher precedence + * • controllable_by_this_extension: can be controlled by this extension + * • controlled_by_this_extension: controlled by this extension + */ + levelOfControl: string; + /** Optional. Whether the effective value is specific to the incognito session. This property will only be present if the incognito property in the details parameter of get() was true. */ + incognitoSpecific?: boolean; + } - interface AccessibilityFeaturesSetArg { - /** - * The value of the setting. - * Note that every setting has a specific value type, which is described together with the setting. An extension should not set a value of a different type. - */ - value: any; - /** - * Optional. - * The scope of the ChromeSetting. One of - * • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere), - * • regular_only: setting for the regular profile only (not inherited by the incognito profile), - * • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences), - * • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences). - */ - scope?: string; - } + interface AccessibilityFeaturesSetArg { + /** + * The value of the setting. + * Note that every setting has a specific value type, which is described together with the setting. An extension should not set a value of a different type. + */ + value: any; + /** + * Optional. + * The scope of the ChromeSetting. One of + * • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere), + * • regular_only: setting for the regular profile only (not inherited by the incognito profile), + * • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences), + * • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences). + */ + scope?: string; + } - interface AccessibilityFeaturesClearArg { - /** - * Optional. - * The scope of the ChromeSetting. One of - * • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere), - * • regular_only: setting for the regular profile only (not inherited by the incognito profile), - * • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences), - * • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences). - */ - scope?: string; - } + interface AccessibilityFeaturesClearArg { + /** + * Optional. + * The scope of the ChromeSetting. One of + * • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere), + * • regular_only: setting for the regular profile only (not inherited by the incognito profile), + * • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences), + * • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences). + */ + scope?: string; + } - interface AccessibilityFeaturesSetting { - /** - * Gets the value of a setting. - * @param details Which setting to consider. - * @param callback The callback parameter should be a function that looks like this: - * function(object details) {...}; - */ - get(details: AccessibilityFeaturesGetArg, callback: (details: AccessibilityFeaturesCallbackArg) => void): void; - /** - * Sets the value of a setting. - * @param details Which setting to change. - * @param callback Called at the completion of the set operation. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - set(details: AccessibilityFeaturesSetArg, callback?: () => void): void; - /** - * Clears the setting, restoring any default value. - * @param details Which setting to clear. - * @param callback Called at the completion of the clear operation. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - clear(details: AccessibilityFeaturesClearArg, callback?: () => void): void; - } + interface AccessibilityFeaturesSetting { + /** + * Gets the value of a setting. + * @param details Which setting to consider. + * @param callback The callback parameter should be a function that looks like this: + * function(object details) {...}; + */ + get(details: AccessibilityFeaturesGetArg, callback: (details: AccessibilityFeaturesCallbackArg) => void): void; + /** + * Sets the value of a setting. + * @param details Which setting to change. + * @param callback Called at the completion of the set operation. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + set(details: AccessibilityFeaturesSetArg, callback?: () => void): void; + /** + * Clears the setting, restoring any default value. + * @param details Which setting to clear. + * @param callback Called at the completion of the clear operation. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + clear(details: AccessibilityFeaturesClearArg, callback?: () => void): void; + } - var spokenFeedback: AccessibilityFeaturesSetting; - var largeCursor: AccessibilityFeaturesSetting; - var stickyKeys: AccessibilityFeaturesSetting; - var highContrast: AccessibilityFeaturesSetting; - var screenMagnifier: AccessibilityFeaturesSetting; - var autoclick: AccessibilityFeaturesSetting; - var virtualKeyboard: AccessibilityFeaturesSetting; - var animationPolicy: AccessibilityFeaturesSetting; + var spokenFeedback: AccessibilityFeaturesSetting; + var largeCursor: AccessibilityFeaturesSetting; + var stickyKeys: AccessibilityFeaturesSetting; + var highContrast: AccessibilityFeaturesSetting; + var screenMagnifier: AccessibilityFeaturesSetting; + var autoclick: AccessibilityFeaturesSetting; + var virtualKeyboard: AccessibilityFeaturesSetting; + var animationPolicy: AccessibilityFeaturesSetting; } //////////////////// @@ -117,80 +117,80 @@ declare namespace chrome.accessibilityFeatures { */ declare namespace chrome.alarms { interface AlarmCreateInfo { - /** Optional. Length of time in minutes after which the onAlarm event should fire. */ + /** Optional. Length of time in minutes after which the onAlarm event should fire. */ delayInMinutes?: number; - /** Optional. If set, the onAlarm event should fire every periodInMinutes minutes after the initial event specified by when or delayInMinutes. If not set, the alarm will only fire once. */ + /** Optional. If set, the onAlarm event should fire every periodInMinutes minutes after the initial event specified by when or delayInMinutes. If not set, the alarm will only fire once. */ periodInMinutes?: number; - /** Optional. Time at which the alarm should fire, in milliseconds past the epoch (e.g. Date.now() + n). */ + /** Optional. Time at which the alarm should fire, in milliseconds past the epoch (e.g. Date.now() + n). */ when?: number; } interface Alarm { - /** Optional. If not null, the alarm is a repeating alarm and will fire again in periodInMinutes minutes. */ + /** Optional. If not null, the alarm is a repeating alarm and will fire again in periodInMinutes minutes. */ periodInMinutes?: number; - /** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. Date.now() + n). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */ + /** Time at which this alarm was scheduled to fire, in milliseconds past the epoch (e.g. Date.now() + n). For performance reasons, the alarm may have been delayed an arbitrary amount beyond this. */ scheduledTime: number; - /** Name of this alarm. */ + /** Name of this alarm. */ name: string; } interface AlarmEvent extends chrome.events.Event<(alarm: Alarm) => void> {} - /** - * Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm. - * In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more. That is, setting delayInMinutes or periodInMinutes to less than 1 will not be honored and will cause a warning. when can be set to less than 1 minute after "now" without warning but won't actually cause the alarm to fire for at least 1 minute. - * To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire. - * @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes. - */ + /** + * Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm. + * In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more. That is, setting delayInMinutes or periodInMinutes to less than 1 will not be honored and will cause a warning. when can be set to less than 1 minute after "now" without warning but won't actually cause the alarm to fire for at least 1 minute. + * To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire. + * @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes. + */ export function create(alarmInfo: AlarmCreateInfo): void; - /** - * Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm. - * In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more. That is, setting delayInMinutes or periodInMinutes to less than 1 will not be honored and will cause a warning. when can be set to less than 1 minute after "now" without warning but won't actually cause the alarm to fire for at least 1 minute. - * To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire. - * @param name Optional name to identify this alarm. Defaults to the empty string. - * @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes. - */ + /** + * Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm. + * In order to reduce the load on the user's machine, Chrome limits alarms to at most once every 1 minute but may delay them an arbitrary amount more. That is, setting delayInMinutes or periodInMinutes to less than 1 will not be honored and will cause a warning. when can be set to less than 1 minute after "now" without warning but won't actually cause the alarm to fire for at least 1 minute. + * To help you debug your app or extension, when you've loaded it unpacked, there's no limit to how often the alarm can fire. + * @param name Optional name to identify this alarm. Defaults to the empty string. + * @param alarmInfo Describes when the alarm should fire. The initial time must be specified by either when or delayInMinutes (but not both). If periodInMinutes is set, the alarm will repeat every periodInMinutes minutes after the initial event. If neither when or delayInMinutes is set for a repeating alarm, periodInMinutes is used as the default for delayInMinutes. + */ export function create(name: string, alarmInfo: AlarmCreateInfo): void; - /** - * Gets an array of all the alarms. - * @param callback The callback parameter should be a function that looks like this: - * function(array of Alarm alarms) {...}; - */ + /** + * Gets an array of all the alarms. + * @param callback The callback parameter should be a function that looks like this: + * function(array of Alarm alarms) {...}; + */ export function getAll(callback: (alarms: Alarm[]) => void): void; - /** - * Clears all alarms. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(boolean wasCleared) {...}; - */ + /** + * Clears all alarms. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(boolean wasCleared) {...}; + */ export function clearAll(callback?: (wasCleared: boolean) => void): void; - /** - * Clears the alarm with the given name. - * @param name The name of the alarm to clear. Defaults to the empty string. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(boolean wasCleared) {...}; - */ + /** + * Clears the alarm with the given name. + * @param name The name of the alarm to clear. Defaults to the empty string. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(boolean wasCleared) {...}; + */ export function clear(name?: string, callback?: (wasCleared: boolean) => void): void; - /** - * Clears the alarm without a name. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(boolean wasCleared) {...}; - */ + /** + * Clears the alarm without a name. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(boolean wasCleared) {...}; + */ export function clear(callback: (wasCleared: boolean) => void): void; - /** - * Retrieves details about the specified alarm. - * @param callback The callback parameter should be a function that looks like this: - * function( Alarm alarm) {...}; - */ + /** + * Retrieves details about the specified alarm. + * @param callback The callback parameter should be a function that looks like this: + * function( Alarm alarm) {...}; + */ export function get(callback: (alarm: Alarm) => void): void; - /** - * Retrieves details about the specified alarm. - * @param name The name of the alarm to get. Defaults to the empty string. - * @param callback The callback parameter should be a function that looks like this: - * function( Alarm alarm) {...}; - */ + /** + * Retrieves details about the specified alarm. + * @param name The name of the alarm to get. Defaults to the empty string. + * @param callback The callback parameter should be a function that looks like this: + * function( Alarm alarm) {...}; + */ export function get(name: string, callback: (alarm: Alarm) => void): void; - /** Fired when an alarm has elapsed. Useful for event pages. */ + /** Fired when an alarm has elapsed. Useful for event pages. */ var onAlarm: AlarmEvent; } @@ -214,12 +214,12 @@ declare namespace chrome.browser { */ export function openTab(options: Options, callback: () => void): void; - /** - * Opens a new tab in a browser window associated with the current application - * and Chrome profile. If no browser window for the Chrome profile is opened, - * a new one is opened prior to creating the new tab. Since Chrome 42 only. - * @param options Configures how the tab should be opened. - */ + /** + * Opens a new tab in a browser window associated with the current application + * and Chrome profile. If no browser window for the Chrome profile is opened, + * a new one is opened prior to creating the new tab. Since Chrome 42 only. + * @param options Configures how the tab should be opened. + */ export function openTab(options: Options): void; } @@ -232,30 +232,30 @@ declare namespace chrome.browser { * Permissions: "bookmarks" */ declare namespace chrome.bookmarks { - /** A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder. */ + /** A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder. */ interface BookmarkTreeNode { - /** Optional. The 0-based position of this node within its parent folder. */ + /** Optional. The 0-based position of this node within its parent folder. */ index?: number; - /** Optional. When this node was created, in milliseconds since the epoch (new Date(dateAdded)). */ + /** Optional. When this node was created, in milliseconds since the epoch (new Date(dateAdded)). */ dateAdded?: number; - /** The text displayed for the node. */ + /** The text displayed for the node. */ title: string; - /** Optional. The URL navigated to when a user clicks the bookmark. Omitted for folders. */ + /** Optional. The URL navigated to when a user clicks the bookmark. Omitted for folders. */ url?: string; - /** Optional. When the contents of this folder last changed, in milliseconds since the epoch. */ + /** Optional. When the contents of this folder last changed, in milliseconds since the epoch. */ dateGroupModified?: number; - /** The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted. */ + /** The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted. */ id: string; - /** Optional. The id of the parent folder. Omitted for the root node. */ + /** Optional. The id of the parent folder. Omitted for the root node. */ parentId?: string; - /** Optional. An ordered list of children of this node. */ + /** Optional. An ordered list of children of this node. */ children?: BookmarkTreeNode[]; - /** - * Optional. - * Since Chrome 37. - * Indicates the reason why this node is unmodifiable. The managed value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default). - */ - unmodifiable?: any; + /** + * Optional. + * Since Chrome 37. + * Indicates the reason why this node is unmodifiable. The managed value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default). + */ + unmodifiable?: any; } interface BookmarkRemoveInfo { @@ -293,134 +293,134 @@ declare namespace chrome.bookmarks { interface BookmarkChildrenReordered extends chrome.events.Event<(id: string, reorderInfo: BookmarkReorderInfo) => void> {} - interface BookmarkSearchQuery { - query?: string; - url?: string; - title?: string; - } + interface BookmarkSearchQuery { + query?: string; + url?: string; + title?: string; + } - interface BookmarkCreateArg { - /** Optional. Defaults to the Other Bookmarks folder. */ - parentId?: string; - index?: number; - title?: string; - url?: string; - } + interface BookmarkCreateArg { + /** Optional. Defaults to the Other Bookmarks folder. */ + parentId?: string; + index?: number; + title?: string; + url?: string; + } - interface BookmarkDestinationArg { - parentId?: string; - index?: number; - } + interface BookmarkDestinationArg { + parentId?: string; + index?: number; + } - interface BookmarkChangesArg { - title?: string; - url?: string; - } + interface BookmarkChangesArg { + title?: string; + url?: string; + } - /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */ + /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */ var MAX_WRITE_OPERATIONS_PER_HOUR: number; - /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */ + /** @deprecated since Chrome 38. Bookmark write operations are no longer limited by Chrome. */ var MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; - /** - * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties. - * @param query A string of words and quoted phrases that are matched against bookmark URLs and titles. - * @param callback The callback parameter should be a function that looks like this: - * function(array of BookmarkTreeNode results) {...}; - */ + /** + * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties. + * @param query A string of words and quoted phrases that are matched against bookmark URLs and titles. + * @param callback The callback parameter should be a function that looks like this: + * function(array of BookmarkTreeNode results) {...}; + */ export function search(query: string, callback: (results: BookmarkTreeNode[]) => void): void; - /** - * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties. - * @param query An object with one or more of the properties query, url, and title specified. Bookmarks matching all specified properties will be produced. - * @param callback The callback parameter should be a function that looks like this: - * function(array of BookmarkTreeNode results) {...}; - */ - export function search(query: BookmarkSearchQuery, callback: (results: BookmarkTreeNode[]) => void): void; - /** - * Retrieves the entire Bookmarks hierarchy. - * @param callback The callback parameter should be a function that looks like this: - * function(array of BookmarkTreeNode results) {...}; - */ + /** + * Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties. + * @param query An object with one or more of the properties query, url, and title specified. Bookmarks matching all specified properties will be produced. + * @param callback The callback parameter should be a function that looks like this: + * function(array of BookmarkTreeNode results) {...}; + */ + export function search(query: BookmarkSearchQuery, callback: (results: BookmarkTreeNode[]) => void): void; + /** + * Retrieves the entire Bookmarks hierarchy. + * @param callback The callback parameter should be a function that looks like this: + * function(array of BookmarkTreeNode results) {...}; + */ export function getTree(callback: (results: BookmarkTreeNode[]) => void): void; - /** - * Retrieves the recently added bookmarks. - * @param numberOfItems The maximum number of items to return. - * @param callback The callback parameter should be a function that looks like this: - * function(array of BookmarkTreeNode results) {...}; - */ + /** + * Retrieves the recently added bookmarks. + * @param numberOfItems The maximum number of items to return. + * @param callback The callback parameter should be a function that looks like this: + * function(array of BookmarkTreeNode results) {...}; + */ export function getRecent(numberOfItems: number, callback: (results: BookmarkTreeNode[]) => void): void; - /** - * Retrieves the specified BookmarkTreeNode. - * @param id A single string-valued id - * @param callback The callback parameter should be a function that looks like this: - * function(array of BookmarkTreeNode results) {...}; - */ + /** + * Retrieves the specified BookmarkTreeNode. + * @param id A single string-valued id + * @param callback The callback parameter should be a function that looks like this: + * function(array of BookmarkTreeNode results) {...}; + */ export function get(id: string, callback: (results: BookmarkTreeNode[]) => void): void; - /** - * Retrieves the specified BookmarkTreeNode. - * @param idList An array of string-valued ids - * @param callback The callback parameter should be a function that looks like this: - * function(array of BookmarkTreeNode results) {...}; - */ + /** + * Retrieves the specified BookmarkTreeNode. + * @param idList An array of string-valued ids + * @param callback The callback parameter should be a function that looks like this: + * function(array of BookmarkTreeNode results) {...}; + */ export function get(idList: string[], callback: (results: BookmarkTreeNode[]) => void): void; - /** - * Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function( BookmarkTreeNode result) {...}; - */ + /** + * Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function( BookmarkTreeNode result) {...}; + */ export function create(bookmark: BookmarkCreateArg, callback?: (result: BookmarkTreeNode) => void): void; - /** - * Moves the specified BookmarkTreeNode to the provided location. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function( BookmarkTreeNode result) {...}; - */ + /** + * Moves the specified BookmarkTreeNode to the provided location. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function( BookmarkTreeNode result) {...}; + */ export function move(id: string, destination: BookmarkDestinationArg, callback?: (result: BookmarkTreeNode) => void): void; - /** - * Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. Note: Currently, only 'title' and 'url' are supported. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function( BookmarkTreeNode result) {...}; - */ + /** + * Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. Note: Currently, only 'title' and 'url' are supported. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function( BookmarkTreeNode result) {...}; + */ export function update(id: string, changes: BookmarkChangesArg, callback?: (result: BookmarkTreeNode) => void): void; - /** - * Removes a bookmark or an empty bookmark folder. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Removes a bookmark or an empty bookmark folder. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function remove(id: string, callback?: Function): void; - /** - * Retrieves the children of the specified BookmarkTreeNode id. - * @param callback The callback parameter should be a function that looks like this: - * function(array of BookmarkTreeNode results) {...}; - */ + /** + * Retrieves the children of the specified BookmarkTreeNode id. + * @param callback The callback parameter should be a function that looks like this: + * function(array of BookmarkTreeNode results) {...}; + */ export function getChildren(id: string, callback: (results: BookmarkTreeNode[]) => void): void; - /** - * Since Chrome 14. - * Retrieves part of the Bookmarks hierarchy, starting at the specified node. - * @param id The ID of the root of the subtree to retrieve. - * @param callback The callback parameter should be a function that looks like this: - * function(array of BookmarkTreeNode results) {...}; - */ + /** + * Since Chrome 14. + * Retrieves part of the Bookmarks hierarchy, starting at the specified node. + * @param id The ID of the root of the subtree to retrieve. + * @param callback The callback parameter should be a function that looks like this: + * function(array of BookmarkTreeNode results) {...}; + */ export function getSubTree(id: string, callback: (results: BookmarkTreeNode[]) => void): void; - /** - * Recursively removes a bookmark folder. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Recursively removes a bookmark folder. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeTree(id: string, callback?: Function): void; - /** Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents. */ + /** Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents. */ var onRemoved: BookmarkRemovedEvent; - /** Fired when a bookmark import session is ended. */ + /** Fired when a bookmark import session is ended. */ var onImportEnded: BookmarkImportEndedEvent; - /** Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately. */ + /** Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately. */ var onImportBegan: BookmarkImportBeganEvent; - /** Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this. */ + /** Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this. */ var onChanged: BookmarkChangedEvent; - /** Fired when a bookmark or folder is moved to a different parent folder. */ + /** Fired when a bookmark or folder is moved to a different parent folder. */ var onMoved: BookmarkMovedEvent; - /** Fired when a bookmark or folder is created. */ + /** Fired when a bookmark or folder is created. */ var onCreated: BookmarkCreatedEvent; - /** Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move(). */ + /** Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move(). */ var onChildrenReordered: BookmarkChildrenReordered; } @@ -434,105 +434,105 @@ declare namespace chrome.bookmarks { */ declare namespace chrome.browserAction { interface BadgeBackgroundColorDetails { - /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. */ + /** An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is [255, 0, 0, 255]. Can also be a string with a CSS value, with opaque red being #FF0000 or #F00. */ color: any; - /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ + /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ tabId?: number; } interface BadgeTextDetails { - /** Any number of characters can be passed, but only about four can fit in the space. */ + /** Any number of characters can be passed, but only about four can fit in the space. */ text: string; - /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ + /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ tabId?: number; } interface TitleDetails { - /** The string the browser action should display when moused over. */ + /** The string the browser action should display when moused over. */ title: string; - /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ + /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ tabId?: number; } interface TabDetails { - /** Optional. Specify the tab to get the information. If no tab is specified, the non-tab-specific information is returned. */ + /** Optional. Specify the tab to get the information. If no tab is specified, the non-tab-specific information is returned. */ tabId?: number; } interface TabIconDetails { - /** Optional. Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */ + /** Optional. Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */ path?: any; - /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ + /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ tabId?: number; - /** Optional. Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' */ + /** Optional. Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' */ imageData?: ImageData; } interface PopupDetails { - /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ + /** Optional. Limits the change to when a particular tab is selected. Automatically resets when the tab is closed. */ tabId?: number; - /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */ + /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */ popup: string; } interface BrowserClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {} - /** - * Since Chrome 22. - * Enables the browser action for a tab. By default, browser actions are enabled. - * @param tabId The id of the tab for which you want to modify the browser action. - */ + /** + * Since Chrome 22. + * Enables the browser action for a tab. By default, browser actions are enabled. + * @param tabId The id of the tab for which you want to modify the browser action. + */ export function enable(tabId?: number): void; - /** Sets the background color for the badge. */ + /** Sets the background color for the badge. */ export function setBadgeBackgroundColor(details: BadgeBackgroundColorDetails): void; - /** Sets the badge text for the browser action. The badge is displayed on top of the icon. */ + /** Sets the badge text for the browser action. The badge is displayed on top of the icon. */ export function setBadgeText(details: BadgeTextDetails): void; - /** Sets the title of the browser action. This shows up in the tooltip. */ + /** Sets the title of the browser action. This shows up in the tooltip. */ export function setTitle(details: TitleDetails): void; - /** - * Since Chrome 19. - * Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned. - * @param callback The callback parameter should be a function that looks like this: - * function(string result) {...}; - */ + /** + * Since Chrome 19. + * Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned. + * @param callback The callback parameter should be a function that looks like this: + * function(string result) {...}; + */ export function getBadgeText(details: TabDetails, callback: (result: string) => void): void; - /** Sets the html document to be opened as a popup when the user clicks on the browser action's icon. */ + /** Sets the html document to be opened as a popup when the user clicks on the browser action's icon. */ export function setPopup(details: PopupDetails): void; - /** - * Since Chrome 22. - * Disables the browser action for a tab. - * @param tabId The id of the tab for which you want to modify the browser action. - */ + /** + * Since Chrome 22. + * Disables the browser action for a tab. + * @param tabId The id of the tab for which you want to modify the browser action. + */ export function disable(tabId?: number): void; - /** - * Since Chrome 19. - * Gets the title of the browser action. - * @param callback The callback parameter should be a function that looks like this: - * function(string result) {...}; - */ + /** + * Since Chrome 19. + * Gets the title of the browser action. + * @param callback The callback parameter should be a function that looks like this: + * function(string result) {...}; + */ export function getTitle(details: TabDetails, callback: (result: string) => void): void; - /** - * Since Chrome 19. - * Gets the background color of the browser action. - * @param callback The callback parameter should be a function that looks like this: - * function( ColorArray result) {...}; - */ + /** + * Since Chrome 19. + * Gets the background color of the browser action. + * @param callback The callback parameter should be a function that looks like this: + * function( ColorArray result) {...}; + */ export function getBadgeBackgroundColor(details: TabDetails, callback: (result: number[]) => void): void; - /** - * Since Chrome 19. - * Gets the html document set as the popup for this browser action. - * @param callback The callback parameter should be a function that looks like this: - * function(string result) {...}; - */ + /** + * Since Chrome 19. + * Gets the html document set as the popup for this browser action. + * @param callback The callback parameter should be a function that looks like this: + * function(string result) {...}; + */ export function getPopup(details: TabDetails, callback: (result: string) => void): void; - /** - * Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Sets the icon for the browser action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function setIcon(details: TabIconDetails, callback?: Function): void; - /** Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup. */ + /** Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup. */ var onClicked: BrowserClickedEvent; } @@ -546,171 +546,171 @@ declare namespace chrome.browserAction { */ declare namespace chrome.browsingData { interface OriginTypes { - /** Optional. Websites that have been installed as hosted applications (be careful!). */ + /** Optional. Websites that have been installed as hosted applications (be careful!). */ protectedWeb?: boolean; - /** Optional. Extensions and packaged applications a user has installed (be _really_ careful!). */ + /** Optional. Extensions and packaged applications a user has installed (be _really_ careful!). */ extension?: boolean; - /** Optional. Normal websites. */ + /** Optional. Normal websites. */ unprotectedWeb?: boolean; } - /** Options that determine exactly what data will be removed. */ + /** Options that determine exactly what data will be removed. */ interface RemovalOptions { - /** - * Optional. - * Since Chrome 21. - * An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only "unprotected" origins. Please ensure that you really want to remove application data before adding 'protectedWeb' or 'extensions'. - */ + /** + * Optional. + * Since Chrome 21. + * An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only "unprotected" origins. Please ensure that you really want to remove application data before adding 'protectedWeb' or 'extensions'. + */ originTypes?: OriginTypes; - /** Optional. Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the getTime method of the JavaScript Date object). If absent, defaults to 0 (which would remove all browsing data). */ + /** Optional. Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the getTime method of the JavaScript Date object). If absent, defaults to 0 (which would remove all browsing data). */ since?: number; } - /** - * Since Chrome 27. - * A set of data types. Missing data types are interpreted as false. - */ + /** + * Since Chrome 27. + * A set of data types. Missing data types are interpreted as false. + */ interface DataTypeSet { - /** Optional. Websites' WebSQL data. */ + /** Optional. Websites' WebSQL data. */ webSQL?: boolean; - /** Optional. Websites' IndexedDB data. */ + /** Optional. Websites' IndexedDB data. */ indexedDB?: boolean; - /** Optional. The browser's cookies. */ + /** Optional. The browser's cookies. */ cookies?: boolean; - /** Optional. Stored passwords. */ + /** Optional. Stored passwords. */ passwords?: boolean; - /** Optional. Server-bound certificates. */ + /** Optional. Server-bound certificates. */ serverBoundCertificates?: boolean; - /** Optional. The browser's download list. */ + /** Optional. The browser's download list. */ downloads?: boolean; - /** Optional. The browser's cache. Note: when removing data, this clears the entire cache: it is not limited to the range you specify. */ + /** Optional. The browser's cache. Note: when removing data, this clears the entire cache: it is not limited to the range you specify. */ cache?: boolean; - /** Optional. Websites' appcaches. */ + /** Optional. Websites' appcaches. */ appcache?: boolean; - /** Optional. Websites' file systems. */ + /** Optional. Websites' file systems. */ fileSystems?: boolean; - /** Optional. Plugins' data. */ + /** Optional. Plugins' data. */ pluginData?: boolean; - /** Optional. Websites' local storage data. */ + /** Optional. Websites' local storage data. */ localStorage?: boolean; - /** Optional. The browser's stored form data. */ + /** Optional. The browser's stored form data. */ formData?: boolean; - /** Optional. The browser's history. */ + /** Optional. The browser's history. */ history?: boolean; - /** - * Optional. - * Since Chrome 39. - * Service Workers. - */ - serviceWorkers?: boolean; + /** + * Optional. + * Since Chrome 39. + * Service Workers. + */ + serviceWorkers?: boolean; } - interface SettingsCallback { - options: RemovalOptions; - /** All of the types will be present in the result, with values of true if they are both selected to be removed and permitted to be removed, otherwise false. */ - dataToRemove: DataTypeSet; - /** All of the types will be present in the result, with values of true if they are permitted to be removed (e.g., by enterprise policy) and false if not. */ - dataRemovalPermitted: DataTypeSet; - } + interface SettingsCallback { + options: RemovalOptions; + /** All of the types will be present in the result, with values of true if they are both selected to be removed and permitted to be removed, otherwise false. */ + dataToRemove: DataTypeSet; + /** All of the types will be present in the result, with values of true if they are permitted to be removed (e.g., by enterprise policy) and false if not. */ + dataRemovalPermitted: DataTypeSet; + } - /** - * Since Chrome 26. - * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here. - * @param callback The callback parameter should be a function that looks like this: - * function(object result) {...}; - */ - export function settings(callback: (result: SettingsCallback) => void): void; - /** - * Clears plugins' data. - * @param callback Called when plugins' data has been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Since Chrome 26. + * Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here. + * @param callback The callback parameter should be a function that looks like this: + * function(object result) {...}; + */ + export function settings(callback: (result: SettingsCallback) => void): void; + /** + * Clears plugins' data. + * @param callback Called when plugins' data has been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removePluginData(options: RemovalOptions, callback?: () => void): void; - /** - * Clears the browser's stored form data (autofill). - * @param callback Called when the browser's form data has been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the browser's stored form data (autofill). + * @param callback Called when the browser's form data has been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeFormData(options: RemovalOptions, callback?: () => void): void; - /** - * Clears websites' file system data. - * @param callback Called when websites' file systems have been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears websites' file system data. + * @param callback Called when websites' file systems have been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeFileSystems(options: RemovalOptions, callback?: () => void): void; - /** - * Clears various types of browsing data stored in a user's profile. - * @param dataToRemove The set of data types to remove. - * @param callback Called when deletion has completed. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears various types of browsing data stored in a user's profile. + * @param dataToRemove The set of data types to remove. + * @param callback Called when deletion has completed. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function remove(options: RemovalOptions, dataToRemove: DataTypeSet, callback?: () => void): void; - /** - * Clears the browser's stored passwords. - * @param callback Called when the browser's passwords have been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the browser's stored passwords. + * @param callback Called when the browser's passwords have been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removePasswords(options: RemovalOptions, callback?: () => void): void; - /** - * Clears the browser's cookies and server-bound certificates modified within a particular timeframe. - * @param callback Called when the browser's cookies and server-bound certificates have been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the browser's cookies and server-bound certificates modified within a particular timeframe. + * @param callback Called when the browser's cookies and server-bound certificates have been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeCookies(options: RemovalOptions, callback?: () => void): void; - /** - * Clears websites' WebSQL data. - * @param callback Called when websites' WebSQL databases have been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears websites' WebSQL data. + * @param callback Called when websites' WebSQL databases have been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeWebSQL(options: RemovalOptions, callback?: () => void): void; - /** - * Clears websites' appcache data. - * @param callback Called when websites' appcache data has been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears websites' appcache data. + * @param callback Called when websites' appcache data has been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeAppcache(options: RemovalOptions, callback?: () => void): void; - /** - * Clears the browser's list of downloaded files (not the downloaded files themselves). - * @param callback Called when the browser's list of downloaded files has been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the browser's list of downloaded files (not the downloaded files themselves). + * @param callback Called when the browser's list of downloaded files has been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeDownloads(options: RemovalOptions, callback?: () => void): void; - /** - * Clears websites' local storage data. - * @param callback Called when websites' local storage has been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears websites' local storage data. + * @param callback Called when websites' local storage has been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeLocalStorage(options: RemovalOptions, callback?: () => void): void; - /** - * Clears the browser's cache. - * @param callback Called when the browser's cache has been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the browser's cache. + * @param callback Called when the browser's cache has been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeCache(options: RemovalOptions, callback?: () => void): void; - /** - * Clears the browser's history. - * @param callback Called when the browser's history has cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the browser's history. + * @param callback Called when the browser's history has cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeHistory(options: RemovalOptions, callback?: () => void): void; - /** - * Clears websites' IndexedDB data. - * @param callback Called when websites' IndexedDB data has been cleared. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears websites' IndexedDB data. + * @param callback Called when websites' IndexedDB data has been cleared. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeIndexedDB(options: RemovalOptions, callback?: () => void): void; } @@ -723,26 +723,26 @@ declare namespace chrome.browsingData { * Manifest: "commands": {...} */ declare namespace chrome.commands { - interface Command { - /** Optional. The name of the Extension Command */ - name?: string; - /** Optional. The Extension Command description */ - description?: string; - /** Optional. The shortcut active for this command, or blank if not active. */ - shortcut?: string; - } + interface Command { + /** Optional. The name of the Extension Command */ + name?: string; + /** Optional. The Extension Command description */ + description?: string; + /** Optional. The shortcut active for this command, or blank if not active. */ + shortcut?: string; + } interface CommandEvent extends chrome.events.Event<(command: string) => void> {} - /** - * Returns all the registered extension commands for this extension and their shortcut (if active). - * @param callback Called to return the registered commands. - * If you specify the callback parameter, it should be a function that looks like this: - * function(array of Command commands) {...}; - */ - export function getAll(callback: (commands: Command[]) => void): void; + /** + * Returns all the registered extension commands for this extension and their shortcut (if active). + * @param callback Called to return the registered commands. + * If you specify the callback parameter, it should be a function that looks like this: + * function(array of Command commands) {...}; + */ + export function getAll(callback: (commands: Command[]) => void): void; - /** Fired when a registered command is activated using a keyboard shortcut. */ + /** Fired when a registered command is activated using a keyboard shortcut. */ var onCommand: CommandEvent; } @@ -756,180 +756,180 @@ declare namespace chrome.commands { */ declare namespace chrome.contentSettings { interface ClearDetails { - /** - * Optional. - * Where to clear the setting (default: regular). - * The scope of the ContentSetting. One of - * * regular: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere), - * * incognito_session_only: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings). - */ + /** + * Optional. + * Where to clear the setting (default: regular). + * The scope of the ContentSetting. One of + * * regular: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere), + * * incognito_session_only: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings). + */ scope?: string; } interface SetDetails { - /** Optional. The resource identifier for the content type. */ + /** Optional. The resource identifier for the content type. */ resourceIdentifier?: ResourceIdentifier; - /** The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values. */ + /** The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values. */ setting: any; - /** Optional. The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see Content Setting Patterns. */ + /** Optional. The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see Content Setting Patterns. */ secondaryPattern?: string; - /** Optional. Where to set the setting (default: regular). */ + /** Optional. Where to set the setting (default: regular). */ scope?: string; - /** The pattern for the primary URL. For details on the format of a pattern, see Content Setting Patterns. */ + /** The pattern for the primary URL. For details on the format of a pattern, see Content Setting Patterns. */ primaryPattern: string; } interface GetDetails { - /** Optional. The secondary URL for which the content setting should be retrieved. Defaults to the primary URL. Note that the meaning of a secondary URL depends on the content type, and not all content types use secondary URLs. */ + /** Optional. The secondary URL for which the content setting should be retrieved. Defaults to the primary URL. Note that the meaning of a secondary URL depends on the content type, and not all content types use secondary URLs. */ secondaryUrl?: string; - /** Optional. A more specific identifier of the type of content for which the settings should be retrieved. */ + /** Optional. A more specific identifier of the type of content for which the settings should be retrieved. */ resourceIdentifier?: ResourceIdentifier; - /** Optional. Whether to check the content settings for an incognito session. (default false) */ + /** Optional. Whether to check the content settings for an incognito session. (default false) */ incognito?: boolean; - /** The primary URL for which the content setting should be retrieved. Note that the meaning of a primary URL depends on the content type. */ + /** The primary URL for which the content setting should be retrieved. Note that the meaning of a primary URL depends on the content type. */ primaryUrl: string; } interface ReturnedDetails { - /** The content setting. See the description of the individual ContentSetting objects for the possible values. */ + /** The content setting. See the description of the individual ContentSetting objects for the possible values. */ setting: any; } interface ContentSetting { - /** - * Clear all content setting rules set by this extension. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clear all content setting rules set by this extension. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ clear(details: ClearDetails, callback?: () => void): void; - /** - * Applies a new content setting rule. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Applies a new content setting rule. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ set(details: SetDetails, callback?: () => void): void; - /** - * @param callback The callback parameter should be a function that looks like this: - * function(array of ResourceIdentifier resourceIdentifiers) {...}; - * Parameter resourceIdentifiers: A list of resource identifiers for this content type, or undefined if this content type does not use resource identifiers. - */ + /** + * @param callback The callback parameter should be a function that looks like this: + * function(array of ResourceIdentifier resourceIdentifiers) {...}; + * Parameter resourceIdentifiers: A list of resource identifiers for this content type, or undefined if this content type does not use resource identifiers. + */ getResourceIdentifiers(callback: (resourceIdentifiers?: ResourceIdentifier[]) => void): void; - /** - * Gets the current content setting for a given pair of URLs. - * @param callback The callback parameter should be a function that looks like this: - * function(object details) {...}; - */ + /** + * Gets the current content setting for a given pair of URLs. + * @param callback The callback parameter should be a function that looks like this: + * function(object details) {...}; + */ get(details: GetDetails, callback: (details: ReturnedDetails) => void): void; } - /** The only content type using resource identifiers is contentSettings.plugins. For more information, see Resource Identifiers. */ + /** The only content type using resource identifiers is contentSettings.plugins. For more information, see Resource Identifiers. */ interface ResourceIdentifier { - /** The resource identifier for the given content type. */ + /** The resource identifier for the given content type. */ id: string; - /** Optional. A human readable description of the resource. */ + /** Optional. A human readable description of the resource. */ description?: string; } - /** - * Whether to allow cookies and other local data to be set by websites. One of - * allow: Accept cookies, - * block: Block cookies, - * session_only: Accept cookies only for the current session. - * Default is allow. - * The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame. - */ + /** + * Whether to allow cookies and other local data to be set by websites. One of + * allow: Accept cookies, + * block: Block cookies, + * session_only: Accept cookies only for the current session. + * Default is allow. + * The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame. + */ var cookies: ContentSetting; - /** - * Whether to allow sites to show pop-ups. One of - * allow: Allow sites to show pop-ups, - * block: Don't allow sites to show pop-ups. - * Default is block. - * The primary URL is the URL of the top-level frame. The secondary URL is not used. - */ + /** + * Whether to allow sites to show pop-ups. One of + * allow: Allow sites to show pop-ups, + * block: Don't allow sites to show pop-ups. + * Default is block. + * The primary URL is the URL of the top-level frame. The secondary URL is not used. + */ var popups: ContentSetting; - /** - * Whether to run JavaScript. One of - * allow: Run JavaScript, - * block: Don't run JavaScript. - * Default is allow. - * The primary URL is the URL of the top-level frame. The secondary URL is not used. - */ + /** + * Whether to run JavaScript. One of + * allow: Run JavaScript, + * block: Don't run JavaScript. + * Default is allow. + * The primary URL is the URL of the top-level frame. The secondary URL is not used. + */ var javascript: ContentSetting; - /** - * Whether to allow sites to show desktop notifications. One of - * allow: Allow sites to show desktop notifications, - * block: Don't allow sites to show desktop notifications, - * ask: Ask when a site wants to show desktop notifications. - * Default is ask. - * The primary URL is the URL of the document which wants to show the notification. The secondary URL is not used. - */ + /** + * Whether to allow sites to show desktop notifications. One of + * allow: Allow sites to show desktop notifications, + * block: Don't allow sites to show desktop notifications, + * ask: Ask when a site wants to show desktop notifications. + * Default is ask. + * The primary URL is the URL of the document which wants to show the notification. The secondary URL is not used. + */ var notifications: ContentSetting; - /** - * Whether to run plugins. One of - * allow: Run plugins automatically, - * block: Don't run plugins automatically, - * detect_important_content: Only run automatically those plugins that are detected as the website's main content. - * Default is allow. - * The primary URL is the URL of the top-level frame. The secondary URL is not used. - */ + /** + * Whether to run plugins. One of + * allow: Run plugins automatically, + * block: Don't run plugins automatically, + * detect_important_content: Only run automatically those plugins that are detected as the website's main content. + * Default is allow. + * The primary URL is the URL of the top-level frame. The secondary URL is not used. + */ var plugins: ContentSetting; - /** - * Whether to show images. One of - * allow: Show images, - * block: Don't show images. - * Default is allow. - * The primary URL is the URL of the top-level frame. The secondary URL is the URL of the image. - */ + /** + * Whether to show images. One of + * allow: Show images, + * block: Don't show images. + * Default is allow. + * The primary URL is the URL of the top-level frame. The secondary URL is the URL of the image. + */ var images: ContentSetting; - /** - * Since Chrome 42. - * Whether to allow Geolocation. One of - * allow: Allow sites to track your physical location, - * block: Don't allow sites to track your physical location, - * ask: Ask before allowing sites to track your physical location. - * Default is ask. - * The primary URL is the URL of the document which requested location data. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL). - */ - var location: ContentSetting; - /** - * Since Chrome 42. - * Whether to allow sites to toggle the fullscreen mode. One of - * allow: Allow sites to toggle the fullscreen mode, - * ask: Ask when a site wants to toggle the fullscreen mode. - * Default is ask. - * The primary URL is the URL of the document which requested to toggle the fullscreen mode. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL). - */ - var fullscreen: ContentSetting; - /** - * Since Chrome 42. - * Whether to allow sites to disable the mouse cursor. One of - * allow: Allow sites to disable the mouse cursor, - * block: Don't allow sites to disable the mouse cursor, - * ask: Ask when a site wants to disable the mouse cursor. - * Default is ask. - * The primary URL is the URL of the top-level frame. The secondary URL is not used. - */ - var mouselock: ContentSetting; - /** - * Since Chrome 42. - * Whether to allow sites to run plugins unsandboxed. One of - * allow: Allow sites to run plugins unsandboxed, - * block: Don't allow sites to run plugins unsandboxed, - * ask: Ask when a site wants to run a plugin unsandboxed. - * Default is ask. - * The primary URL is the URL of the top-level frame. The secondary URL is not used. - */ - var unsandboxedPlugins: ContentSetting; - /** - * Since Chrome 42. - * Whether to allow sites to download multiple files automatically. One of - * allow: Allow sites to download multiple files automatically, - * block: Don't allow sites to download multiple files automatically, - * ask: Ask when a site wants to download files automatically after the first file. - * Default is ask. - * The primary URL is the URL of the top-level frame. The secondary URL is not used. - */ - var automaticDownloads: ContentSetting; + /** + * Since Chrome 42. + * Whether to allow Geolocation. One of + * allow: Allow sites to track your physical location, + * block: Don't allow sites to track your physical location, + * ask: Ask before allowing sites to track your physical location. + * Default is ask. + * The primary URL is the URL of the document which requested location data. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL). + */ + var location: ContentSetting; + /** + * Since Chrome 42. + * Whether to allow sites to toggle the fullscreen mode. One of + * allow: Allow sites to toggle the fullscreen mode, + * ask: Ask when a site wants to toggle the fullscreen mode. + * Default is ask. + * The primary URL is the URL of the document which requested to toggle the fullscreen mode. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL). + */ + var fullscreen: ContentSetting; + /** + * Since Chrome 42. + * Whether to allow sites to disable the mouse cursor. One of + * allow: Allow sites to disable the mouse cursor, + * block: Don't allow sites to disable the mouse cursor, + * ask: Ask when a site wants to disable the mouse cursor. + * Default is ask. + * The primary URL is the URL of the top-level frame. The secondary URL is not used. + */ + var mouselock: ContentSetting; + /** + * Since Chrome 42. + * Whether to allow sites to run plugins unsandboxed. One of + * allow: Allow sites to run plugins unsandboxed, + * block: Don't allow sites to run plugins unsandboxed, + * ask: Ask when a site wants to run a plugin unsandboxed. + * Default is ask. + * The primary URL is the URL of the top-level frame. The secondary URL is not used. + */ + var unsandboxedPlugins: ContentSetting; + /** + * Since Chrome 42. + * Whether to allow sites to download multiple files automatically. One of + * allow: Allow sites to download multiple files automatically, + * block: Don't allow sites to download multiple files automatically, + * ask: Ask when a site wants to download files automatically after the first file. + * Default is ask. + * The primary URL is the URL of the top-level frame. The secondary URL is not used. + */ + var automaticDownloads: ContentSetting; } //////////////////// @@ -942,104 +942,104 @@ declare namespace chrome.contentSettings { */ declare namespace chrome.contextMenus { interface OnClickData { - /** - * Optional. - * Since Chrome 35. - * The text for the context selection, if any. - */ + /** + * Optional. + * Since Chrome 35. + * The text for the context selection, if any. + */ selectionText?: string; - /** - * Optional. - * Since Chrome 35. - * A flag indicating the state of a checkbox or radio item after it is clicked. - */ + /** + * Optional. + * Since Chrome 35. + * A flag indicating the state of a checkbox or radio item after it is clicked. + */ checked?: boolean; - /** - * Since Chrome 35. - * The ID of the menu item that was clicked. - */ + /** + * Since Chrome 35. + * The ID of the menu item that was clicked. + */ menuItemId: any; - /** - * Optional. - * Since Chrome 35. - * The URL of the frame of the element where the context menu was clicked, if it was in a frame. - */ + /** + * Optional. + * Since Chrome 35. + * The URL of the frame of the element where the context menu was clicked, if it was in a frame. + */ frameUrl?: string; - /** - * Since Chrome 35. - * A flag indicating whether the element is editable (text input, textarea, etc.). - */ + /** + * Since Chrome 35. + * A flag indicating whether the element is editable (text input, textarea, etc.). + */ editable: boolean; - /** - * Optional. - * Since Chrome 35. - * One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements. - */ + /** + * Optional. + * Since Chrome 35. + * One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements. + */ mediaType?: string; - /** - * Optional. - * Since Chrome 35. - * A flag indicating the state of a checkbox or radio item before it was clicked. - */ + /** + * Optional. + * Since Chrome 35. + * A flag indicating the state of a checkbox or radio item before it was clicked. + */ wasChecked?: boolean; - /** - * Since Chrome 35. - * The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where there is no current page, such as in a launcher context menu. - */ + /** + * Since Chrome 35. + * The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where there is no current page, such as in a launcher context menu. + */ pageUrl: string; - /** - * Optional. - * Since Chrome 35. - * If the element is a link, the URL it points to. - */ + /** + * Optional. + * Since Chrome 35. + * If the element is a link, the URL it points to. + */ linkUrl?: string; - /** - * Optional. - * Since Chrome 35. - * The parent ID, if any, for the item clicked. - */ + /** + * Optional. + * Since Chrome 35. + * The parent ID, if any, for the item clicked. + */ parentMenuItemId?: any; - /** - * Optional. - * Since Chrome 35. - * Will be present for elements with a 'src' URL. - */ + /** + * Optional. + * Since Chrome 35. + * Will be present for elements with a 'src' URL. + */ srcUrl?: string; } interface CreateProperties { - /** Optional. Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see Match Patterns. */ + /** Optional. Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see Match Patterns. */ documentUrlPatterns?: string[]; - /** Optional. The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items. */ + /** Optional. The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items. */ checked?: boolean; - /** Optional. The text to be displayed in the item; this is required unless type is 'separator'. When the context is 'selection', you can use %s within the string to show the selected text. For example, if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", the context menu item for the selection is "Translate 'cool' to Pig Latin". */ + /** Optional. The text to be displayed in the item; this is required unless type is 'separator'. When the context is 'selection', you can use %s within the string to show the selected text. For example, if this parameter's value is "Translate '%s' to Pig Latin" and the user selects the word "cool", the context menu item for the selection is "Translate 'cool' to Pig Latin". */ title?: string; - /** Optional. List of contexts this menu item will appear in. Defaults to ['page'] if not specified. */ + /** Optional. List of contexts this menu item will appear in. Defaults to ['page'] if not specified. */ contexts?: string[]; - /** - * Optional. - * Since Chrome 20. - * Whether this context menu item is enabled or disabled. Defaults to true. - */ + /** + * Optional. + * Since Chrome 20. + * Whether this context menu item is enabled or disabled. Defaults to true. + */ enabled?: boolean; - /** Optional. Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags. */ + /** Optional. Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags. */ targetUrlPatterns?: string[]; - /** - * Optional. - * A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for chrome.contextMenus.onClicked. - * @param info Information sent when a context menu item is clicked. - * @param tab The details of the tab where the click took place. Note: this parameter only present for extensions. - */ + /** + * Optional. + * A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for chrome.contextMenus.onClicked. + * @param info Information sent when a context menu item is clicked. + * @param tab The details of the tab where the click took place. Note: this parameter only present for extensions. + */ onclick?: (info: OnClickData, tab: chrome.tabs.Tab) => void; - /** Optional. The ID of a parent menu item; this makes the item a child of a previously added item. */ + /** Optional. The ID of a parent menu item; this makes the item a child of a previously added item. */ parentId?: any; - /** Optional. The type of menu item. Defaults to 'normal' if not specified. */ + /** Optional. The type of menu item. Defaults to 'normal' if not specified. */ type?: string; - /** - * Optional. - * Since Chrome 21. - * The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension. - */ + /** + * Optional. + * Since Chrome 21. + * The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension. + */ id?: string; } @@ -1048,76 +1048,76 @@ declare namespace chrome.contextMenus { checked?: boolean; title?: string; contexts?: string[]; - /** Optional. Since Chrome 20. */ + /** Optional. Since Chrome 20. */ enabled?: boolean; targetUrlPatterns?: string[]; onclick?: Function; - /** Optional. Note: You cannot change an item to be a child of one of its own descendants. */ + /** Optional. Note: You cannot change an item to be a child of one of its own descendants. */ parentId?: any; type?: string; } interface MenuClickedEvent extends chrome.events.Event<(info: OnClickData, tab?: chrome.tabs.Tab) => void> {} - /** - * Since Chrome 38. - * The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored. - */ - var ACTION_MENU_TOP_LEVEL_LIMIT: number; + /** + * Since Chrome 38. + * The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored. + */ + var ACTION_MENU_TOP_LEVEL_LIMIT: number; /** - * Removes all context menu items added by this extension. - * @param callback Called when removal is complete. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + * Removes all context menu items added by this extension. + * @param callback Called when removal is complete. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeAll(callback?: () => void): void; - /** - * Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.runtime.lastError). - * @param callback Called when the item has been created in the browser. If there were any problems creating the item, details will be available in chrome.runtime.lastError. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.runtime.lastError). + * @param callback Called when the item has been created in the browser. If there were any problems creating the item, details will be available in chrome.runtime.lastError. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function create(createProperties: CreateProperties, callback?: () => void): void; - /** - * Updates a previously created context menu item. - * @param id The ID of the item to update. - * @param updateProperties The properties to update. Accepts the same values as the create function. - * @param callback Called when the context menu has been updated. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Updates a previously created context menu item. + * @param id The ID of the item to update. + * @param updateProperties The properties to update. Accepts the same values as the create function. + * @param callback Called when the context menu has been updated. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function update(id: string, updateProperties: UpdateProperties, callback?: () => void): void; - /** - * Updates a previously created context menu item. - * @param id The ID of the item to update. - * @param updateProperties The properties to update. Accepts the same values as the create function. - * @param callback Called when the context menu has been updated. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function update(id: number, updateProperties: UpdateProperties, callback?: () => void): void; - /** - * Removes a context menu item. - * @param menuItemId The ID of the context menu item to remove. - * @param callback Called when the context menu has been removed. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function remove(menuItemId: string, callback?: () => void): void; - /** - * Removes a context menu item. - * @param menuItemId The ID of the context menu item to remove. - * @param callback Called when the context menu has been removed. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function remove(menuItemId: number, callback?: () => void): void; + /** + * Updates a previously created context menu item. + * @param id The ID of the item to update. + * @param updateProperties The properties to update. Accepts the same values as the create function. + * @param callback Called when the context menu has been updated. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function update(id: number, updateProperties: UpdateProperties, callback?: () => void): void; + /** + * Removes a context menu item. + * @param menuItemId The ID of the context menu item to remove. + * @param callback Called when the context menu has been removed. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function remove(menuItemId: string, callback?: () => void): void; + /** + * Removes a context menu item. + * @param menuItemId The ID of the context menu item to remove. + * @param callback Called when the context menu has been removed. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function remove(menuItemId: number, callback?: () => void): void; - /** - * Since Chrome 21. - * Fired when a context menu item is clicked. - */ + /** + * Since Chrome 21. + * Fired when a context menu item is clicked. + */ var onClicked: MenuClickedEvent; } @@ -1130,73 +1130,73 @@ declare namespace chrome.contextMenus { * Permissions: "cookies", host permissions */ declare namespace chrome.cookies { - /** Represents information about an HTTP cookie. */ + /** Represents information about an HTTP cookie. */ interface Cookie { - /** The domain of the cookie (e.g. "www.google.com", "example.com"). */ + /** The domain of the cookie (e.g. "www.google.com", "example.com"). */ domain: string; - /** The name of the cookie. */ + /** The name of the cookie. */ name: string; - /** The ID of the cookie store containing this cookie, as provided in getAllCookieStores(). */ + /** The ID of the cookie store containing this cookie, as provided in getAllCookieStores(). */ storeId: string; - /** The value of the cookie. */ + /** The value of the cookie. */ value: string; - /** True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date. */ + /** True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date. */ session: boolean; - /** True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie). */ + /** True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie). */ hostOnly: boolean; - /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. */ + /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies. */ expirationDate?: number; - /** The path of the cookie. */ + /** The path of the cookie. */ path: string; - /** True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts). */ + /** True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts). */ httpOnly: boolean; - /** True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS). */ + /** True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS). */ secure: boolean; } - /** Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window. */ + /** Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window. */ interface CookieStore { - /** The unique identifier for the cookie store. */ + /** The unique identifier for the cookie store. */ id: string; - /** Identifiers of all the browser tabs that share this cookie store. */ + /** Identifiers of all the browser tabs that share this cookie store. */ tabIds: number[]; } interface GetAllDetails { - /** Optional. Restricts the retrieved cookies to those whose domains match or are subdomains of this one. */ + /** Optional. Restricts the retrieved cookies to those whose domains match or are subdomains of this one. */ domain?: string; - /** Optional. Filters the cookies by name. */ + /** Optional. Filters the cookies by name. */ name?: string; - /** Optional. Restricts the retrieved cookies to those that would match the given URL. */ + /** Optional. Restricts the retrieved cookies to those that would match the given URL. */ url?: string; - /** Optional. The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used. */ + /** Optional. The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used. */ storeId?: string; - /** Optional. Filters out session vs. persistent cookies. */ + /** Optional. Filters out session vs. persistent cookies. */ session?: boolean; - /** Optional. Restricts the retrieved cookies to those whose path exactly matches this string. */ + /** Optional. Restricts the retrieved cookies to those whose path exactly matches this string. */ path?: string; - /** Optional. Filters the cookies by their Secure property. */ + /** Optional. Filters the cookies by their Secure property. */ secure?: boolean; } interface SetDetails { - /** Optional. The domain of the cookie. If omitted, the cookie becomes a host-only cookie. */ + /** Optional. The domain of the cookie. If omitted, the cookie becomes a host-only cookie. */ domain?: string; - /** Optional. The name of the cookie. Empty by default if omitted. */ + /** Optional. The name of the cookie. Empty by default if omitted. */ name?: string; - /** The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail. */ + /** The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail. */ url: string; - /** Optional. The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store. */ + /** Optional. The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store. */ storeId?: string; - /** Optional. The value of the cookie. Empty by default if omitted. */ + /** Optional. The value of the cookie. Empty by default if omitted. */ value?: string; - /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie. */ + /** Optional. The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie. */ expirationDate?: number; - /** Optional. The path of the cookie. Defaults to the path portion of the url parameter. */ + /** Optional. The path of the cookie. Defaults to the path portion of the url parameter. */ path?: string; - /** Optional. Whether the cookie should be marked as HttpOnly. Defaults to false. */ + /** Optional. Whether the cookie should be marked as HttpOnly. Defaults to false. */ httpOnly?: boolean; - /** Optional. Whether the cookie should be marked as Secure. Defaults to false. */ + /** Optional. Whether the cookie should be marked as Secure. Defaults to false. */ secure?: boolean; } @@ -1207,59 +1207,59 @@ declare namespace chrome.cookies { } interface CookieChangeInfo { - /** Information about the cookie that was set or removed. */ + /** Information about the cookie that was set or removed. */ cookie: Cookie; - /** True if a cookie was removed. */ + /** True if a cookie was removed. */ removed: boolean; - /** - * Since Chrome 12. - * The underlying reason behind the cookie's change. - */ + /** + * Since Chrome 12. + * The underlying reason behind the cookie's change. + */ cause: string; } interface CookieChangedEvent extends chrome.events.Event<(changeInfo: CookieChangeInfo) => void> {} - /** - * Lists all existing cookie stores. - * @param callback The callback parameter should be a function that looks like this: - * function(array of CookieStore cookieStores) {...}; - * Parameter cookieStores: All the existing cookie stores. - */ + /** + * Lists all existing cookie stores. + * @param callback The callback parameter should be a function that looks like this: + * function(array of CookieStore cookieStores) {...}; + * Parameter cookieStores: All the existing cookie stores. + */ export function getAllCookieStores(callback: (cookieStores: CookieStore[]) => void): void; - /** - * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first. - * @param details Information to filter the cookies being retrieved. - * @param callback The callback parameter should be a function that looks like this: - * function(array of Cookie cookies) {...}; - * Parameter cookies: All the existing, unexpired cookies that match the given cookie info. - */ + /** + * Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first. + * @param details Information to filter the cookies being retrieved. + * @param callback The callback parameter should be a function that looks like this: + * function(array of Cookie cookies) {...}; + * Parameter cookies: All the existing, unexpired cookies that match the given cookie info. + */ export function getAll(details: GetAllDetails, callback: (cookies: Cookie[]) => void): void; - /** - * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. - * @param details Details about the cookie being set. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function( Cookie cookie) {...}; - * Optional parameter cookie: Contains details about the cookie that's been set. If setting failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set. - */ + /** + * Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. + * @param details Details about the cookie being set. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function( Cookie cookie) {...}; + * Optional parameter cookie: Contains details about the cookie that's been set. If setting failed for any reason, this will be "null", and "chrome.runtime.lastError" will be set. + */ export function set(details: SetDetails, callback?: (cookie: Cookie | null) => void): void; - /** - * Deletes a cookie by name. - * @param details Information to identify the cookie to remove. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(object details) {...}; - */ + /** + * Deletes a cookie by name. + * @param details Information to identify the cookie to remove. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(object details) {...}; + */ export function remove(details: Details, callback?: (details: Details) => void): void; - /** - * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned. - * @param details Details to identify the cookie being retrieved. - * @param callback The callback parameter should be a function that looks like this: - * function( Cookie cookie) {...}; - * Parameter cookie: Contains details about the cookie. This parameter is null if no such cookie was found. - */ + /** + * Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned. + * @param details Details to identify the cookie being retrieved. + * @param callback The callback parameter should be a function that looks like this: + * function( Cookie cookie) {...}; + * Parameter cookie: Contains details about the cookie. This parameter is null if no such cookie was found. + */ export function get(details: Details, callback: (cookie: Cookie | null) => void): void; - /** Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with "cause" "explicit". */ + /** Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with "cause" of "overwrite" . Afterwards, a new cookie is written with the updated values, generating a second notification with "cause" "explicit". */ var onChanged: CookieChangedEvent; } @@ -1273,99 +1273,99 @@ declare namespace chrome.cookies { */ // TODO: Uncomment when Microsoft/TypeScript#8312 is merged in // declare module chrome.debugger { -// /** Debuggee identifier. Either tabId or extensionId must be specified */ +// /** Debuggee identifier. Either tabId or extensionId must be specified */ // interface Debuggee { -// /** Optional. The id of the tab which you intend to debug. */ -// tabId?: number; -// /** -// * Optional. -// * Since Chrome 27. -// * The id of the extension which you intend to debug. Attaching to an extension background page is only possible when 'silent-debugger-extension-api' flag is enabled on the target browser. -// */ -// extensionId?: string; -// /** -// * Optional. -// * Since Chrome 28. -// * The opaque id of the debug target. -// */ -// targetId?: string; +// /** Optional. The id of the tab which you intend to debug. */ +// tabId?: number; +// /** +// * Optional. +// * Since Chrome 27. +// * The id of the extension which you intend to debug. Attaching to an extension background page is only possible when 'silent-debugger-extension-api' flag is enabled on the target browser. +// */ +// extensionId?: string; +// /** +// * Optional. +// * Since Chrome 28. +// * The opaque id of the debug target. +// */ +// targetId?: string; // } // -// /** -// * Since Chrome 28. -// * Debug target information -// */ -// interface TargetInfo { -// /** Target type. */ -// type: string; -// /** Target id. */ -// id: string; -// /** -// * Optional. -// * Since Chrome 30. -// * The tab id, defined if type == 'page'. -// */ -// tabId?: number; -// /** -// * Optional. -// * Since Chrome 30. -// * The extension id, defined if type = 'background_page'. -// */ -// extensionId?: string; -// /** True if debugger is already attached. */ -// attached: boolean; -// /** Target page title. */ -// title: string; -// /** Target URL. */ -// url: string; -// /** Optional. Target favicon URL. */ -// faviconUrl?: string; +// /** +// * Since Chrome 28. +// * Debug target information +// */ +// interface TargetInfo { +// /** Target type. */ +// type: string; +// /** Target id. */ +// id: string; +// /** +// * Optional. +// * Since Chrome 30. +// * The tab id, defined if type == 'page'. +// */ +// tabId?: number; +// /** +// * Optional. +// * Since Chrome 30. +// * The extension id, defined if type = 'background_page'. +// */ +// extensionId?: string; +// /** True if debugger is already attached. */ +// attached: boolean; +// /** Target page title. */ +// title: string; +// /** Target URL. */ +// url: string; +// /** Optional. Target favicon URL. */ +// faviconUrl?: string; // } // // interface DebuggerDetachedEvent extends chrome.events.Event<(source: Debuggee, reason: string) => void> {} // // interface DebuggerEventEvent extends chrome.events.Event<(source: Debuggee, method: string, params?: Object) => void> {} // -// /** -// * Attaches debugger to the given target. -// * @param target Debugging target to which you want to attach. -// * @param requiredVersion Required debugging protocol version ("0.1"). One can only attach to the debuggee with matching major version and greater or equal minor version. List of the protocol versions can be obtained in the documentation pages. -// * @param callback Called once the attach operation succeeds or fails. Callback receives no arguments. If the attach fails, runtime.lastError will be set to the error message. -// * If you specify the callback parameter, it should be a function that looks like this: -// * function() {...}; -// */ +// /** +// * Attaches debugger to the given target. +// * @param target Debugging target to which you want to attach. +// * @param requiredVersion Required debugging protocol version ("0.1"). One can only attach to the debuggee with matching major version and greater or equal minor version. List of the protocol versions can be obtained in the documentation pages. +// * @param callback Called once the attach operation succeeds or fails. Callback receives no arguments. If the attach fails, runtime.lastError will be set to the error message. +// * If you specify the callback parameter, it should be a function that looks like this: +// * function() {...}; +// */ // export function attach(target: Debuggee, requiredVersion: string, callback?: () => void): void; -// /** -// * Detaches debugger from the given target. -// * @param target Debugging target from which you want to detach. -// * @param callback Called once the detach operation succeeds or fails. Callback receives no arguments. If the detach fails, runtime.lastError will be set to the error message. -// * If you specify the callback parameter, it should be a function that looks like this: -// * function() {...}; -// */ +// /** +// * Detaches debugger from the given target. +// * @param target Debugging target from which you want to detach. +// * @param callback Called once the detach operation succeeds or fails. Callback receives no arguments. If the detach fails, runtime.lastError will be set to the error message. +// * If you specify the callback parameter, it should be a function that looks like this: +// * function() {...}; +// */ // export function detach(target: Debuggee, callback?: () => void): void; -// /** -// * Sends given command to the debugging target. -// * @param target Debugging target to which you want to send the command. -// * @param method Method name. Should be one of the methods defined by the remote debugging protocol. -// * @param commandParams Since Chrome 22. -// * JSON object with request parameters. This object must conform to the remote debugging params scheme for given method. -// * @param callback Response body. If an error occurs while posting the message, the callback will be called with no arguments and runtime.lastError will be set to the error message. -// * If you specify the callback parameter, it should be a function that looks like this: -// * function(object result) {...}; -// */ +// /** +// * Sends given command to the debugging target. +// * @param target Debugging target to which you want to send the command. +// * @param method Method name. Should be one of the methods defined by the remote debugging protocol. +// * @param commandParams Since Chrome 22. +// * JSON object with request parameters. This object must conform to the remote debugging params scheme for given method. +// * @param callback Response body. If an error occurs while posting the message, the callback will be called with no arguments and runtime.lastError will be set to the error message. +// * If you specify the callback parameter, it should be a function that looks like this: +// * function(object result) {...}; +// */ // export function sendCommand(target: Debuggee, method: string, commandParams?: Object, callback?: (result?: Object) => void): void; -// /** -// * Since Chrome 28. -// * Returns the list of available debug targets. -// * @param callback The callback parameter should be a function that looks like this: -// * function(array of TargetInfo result) {...}; -// * Parameter result: Array of TargetInfo objects corresponding to the available debug targets. -// */ -// export function getTargets(callback: (result: TargetInfo[]) => void): void; +// /** +// * Since Chrome 28. +// * Returns the list of available debug targets. +// * @param callback The callback parameter should be a function that looks like this: +// * function(array of TargetInfo result) {...}; +// * Parameter result: Array of TargetInfo objects corresponding to the available debug targets. +// */ +// export function getTargets(callback: (result: TargetInfo[]) => void): void; // -// /** Fired when browser terminates debugging session for the tab. This happens when either the tab is being closed or Chrome DevTools is being invoked for the attached tab. */ +// /** Fired when browser terminates debugging session for the tab. This happens when either the tab is being closed or Chrome DevTools is being invoked for the attached tab. */ // var onDetach: DebuggerDetachedEvent; -// /** Fired whenever debugging target issues instrumentation event. */ +// /** Fired whenever debugging target issues instrumentation event. */ // var onEvent: DebuggerEventEvent; // } @@ -1378,62 +1378,62 @@ declare namespace chrome.cookies { * Permissions: "declarativeContent" */ declare namespace chrome.declarativeContent { - interface PageStateUrlDetails { - /** Optional. Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name. */ - hostContains?: string; - /** Optional. Matches if the host name of the URL is equal to a specified string. */ - hostEquals?: string; - /** Optional. Matches if the host name of the URL starts with a specified string. */ - hostPrefix?: string; - /** Optional. Matches if the host name of the URL ends with a specified string. */ - hostSuffix?: string; - /** Optional. Matches if the path segment of the URL contains a specified string. */ - pathContains?: string; - /** Optional. Matches if the path segment of the URL is equal to a specified string. */ - pathEquals?: string; - /** Optional. Matches if the path segment of the URL starts with a specified string. */ - pathPrefix?: string; - /** Optional. Matches if the path segment of the URL ends with a specified string. */ - pathSuffix?: string; - /** Optional. Matches if the query segment of the URL contains a specified string. */ - queryContains?: string; - /** Optional. Matches if the query segment of the URL is equal to a specified string. */ - queryEquals?: string; - /** Optional. Matches if the query segment of the URL starts with a specified string. */ - queryPrefix?: string; - /** Optional. Matches if the query segment of the URL ends with a specified string. */ - querySuffix?: string; - /** Optional. Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number. */ - urlContains?: string; - /** Optional. Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number. */ - urlEquals?: string; - /** Optional. Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */ - urlMatches?: string; - /** Optional. Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */ - originAndPathMatches?: string; - /** Optional. Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number. */ - urlPrefix?: string; - /** Optional. Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number. */ - urlSuffix?: string; - /** Optional. Matches if the scheme of the URL is equal to any of the schemes specified in the array. */ - schemes?: string[]; - /** Optional. Matches if the port of the URL is contained in any of the specified port lists. For example [80, 443, [1000, 1200]] matches all requests on port 80, 443 and in the range 1000-1200. */ - ports?: (number | number[])[]; - } + interface PageStateUrlDetails { + /** Optional. Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name. */ + hostContains?: string; + /** Optional. Matches if the host name of the URL is equal to a specified string. */ + hostEquals?: string; + /** Optional. Matches if the host name of the URL starts with a specified string. */ + hostPrefix?: string; + /** Optional. Matches if the host name of the URL ends with a specified string. */ + hostSuffix?: string; + /** Optional. Matches if the path segment of the URL contains a specified string. */ + pathContains?: string; + /** Optional. Matches if the path segment of the URL is equal to a specified string. */ + pathEquals?: string; + /** Optional. Matches if the path segment of the URL starts with a specified string. */ + pathPrefix?: string; + /** Optional. Matches if the path segment of the URL ends with a specified string. */ + pathSuffix?: string; + /** Optional. Matches if the query segment of the URL contains a specified string. */ + queryContains?: string; + /** Optional. Matches if the query segment of the URL is equal to a specified string. */ + queryEquals?: string; + /** Optional. Matches if the query segment of the URL starts with a specified string. */ + queryPrefix?: string; + /** Optional. Matches if the query segment of the URL ends with a specified string. */ + querySuffix?: string; + /** Optional. Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number. */ + urlContains?: string; + /** Optional. Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number. */ + urlEquals?: string; + /** Optional. Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */ + urlMatches?: string; + /** Optional. Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. */ + originAndPathMatches?: string; + /** Optional. Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number. */ + urlPrefix?: string; + /** Optional. Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number. */ + urlSuffix?: string; + /** Optional. Matches if the scheme of the URL is equal to any of the schemes specified in the array. */ + schemes?: string[]; + /** Optional. Matches if the port of the URL is contained in any of the specified port lists. For example [80, 443, [1000, 1200]] matches all requests on port 80, 443 and in the range 1000-1200. */ + ports?: (number | number[])[]; + } - /** Matches the state of a web page by various criteria. */ - interface PageStateMatcher { - /** Optional. Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */ - pageUrl?: PageStateUrlDetails; - /** Optional. Matches if all of the CSS selectors in the array match displayed elements in a frame with the same origin as the page's main frame. All selectors in this array must be compound selectors to speed up matching. Note that listing hundreds of CSS selectors or CSS selectors that match hundreds of times per page can still slow down web sites. */ - css?: string[]; - /** - * Optional. - * Since Chrome 45. Warning: this is the current Beta channel. More information available on the API documentation pages. - * Matches if the bookmarked state of the page is equal to the specified value. Requres the bookmarks permission. - */ - isBookmarked?: boolean; - } + /** Matches the state of a web page by various criteria. */ + interface PageStateMatcher { + /** Optional. Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */ + pageUrl?: PageStateUrlDetails; + /** Optional. Matches if all of the CSS selectors in the array match displayed elements in a frame with the same origin as the page's main frame. All selectors in this array must be compound selectors to speed up matching. Note that listing hundreds of CSS selectors or CSS selectors that match hundreds of times per page can still slow down web sites. */ + css?: string[]; + /** + * Optional. + * Since Chrome 45. Warning: this is the current Beta channel. More information available on the API documentation pages. + * Matches if the bookmarked state of the page is equal to the specified value. Requres the bookmarks permission. + */ + isBookmarked?: boolean; + } } //////////////////// @@ -1554,27 +1554,27 @@ declare namespace chrome.declarativeWebRequest { * Permissions: "desktopCapture" */ declare namespace chrome.desktopCapture { - /** - * Shows desktop media picker UI with the specified set of sources. - * @param sources Set of sources that should be shown to the user. - * @param callback The callback parameter should be a function that looks like this: - * function(string streamId) {...}; - * Parameter streamId: An opaque string that can be passed to getUserMedia() API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty streamId. The created streamId can be used only once and expires after a few seconds when it is not used. - */ + /** + * Shows desktop media picker UI with the specified set of sources. + * @param sources Set of sources that should be shown to the user. + * @param callback The callback parameter should be a function that looks like this: + * function(string streamId) {...}; + * Parameter streamId: An opaque string that can be passed to getUserMedia() API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty streamId. The created streamId can be used only once and expires after a few seconds when it is not used. + */ export function chooseDesktopMedia(sources: string[], callback: (streamId: string) => void): number; - /** - * Shows desktop media picker UI with the specified set of sources. - * @param sources Set of sources that should be shown to the user. - * @param targetTab Optional tab for which the stream is created. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches tab.url. - * @param callback The callback parameter should be a function that looks like this: - * function(string streamId) {...}; - * Parameter streamId: An opaque string that can be passed to getUserMedia() API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty streamId. The created streamId can be used only once and expires after a few seconds when it is not used. - */ + /** + * Shows desktop media picker UI with the specified set of sources. + * @param sources Set of sources that should be shown to the user. + * @param targetTab Optional tab for which the stream is created. If not specified then the resulting stream can be used only by the calling extension. The stream can only be used by frames in the given tab whose security origin matches tab.url. + * @param callback The callback parameter should be a function that looks like this: + * function(string streamId) {...}; + * Parameter streamId: An opaque string that can be passed to getUserMedia() API to generate media stream that corresponds to the source selected by the user. If user didn't select any source (i.e. canceled the prompt) then the callback is called with an empty streamId. The created streamId can be used only once and expires after a few seconds when it is not used. + */ export function chooseDesktopMedia(sources: string[], targetTab: chrome.tabs.Tab, callback: (streamId: string) => void): number; - /** - * Hides desktop media picker dialog shown by chooseDesktopMedia(). - * @param desktopMediaRequestId Id returned by chooseDesktopMedia() - */ + /** + * Hides desktop media picker dialog shown by chooseDesktopMedia(). + * @param desktopMediaRequestId Id returned by chooseDesktopMedia() + */ export function cancelChooseDesktopMedia(desktopMediaRequestId: number): void; } @@ -1586,91 +1586,91 @@ declare namespace chrome.desktopCapture { * Availability: Since Chrome 18. */ declare namespace chrome.devtools.inspectedWindow { - /** A resource within the inspected page, such as a document, a script, or an image. */ + /** A resource within the inspected page, such as a document, a script, or an image. */ interface Resource { - /** The URL of the resource. */ + /** The URL of the resource. */ url: string; - /** - * Gets the content of the resource. - * @param callback A function that receives resource content when the request completes. - * The callback parameter should be a function that looks like this: - * function(string content, string encoding) {...}; - * Parameter content: Content of the resource (potentially encoded). - * Parameter encoding: Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported. - */ + /** + * Gets the content of the resource. + * @param callback A function that receives resource content when the request completes. + * The callback parameter should be a function that looks like this: + * function(string content, string encoding) {...}; + * Parameter content: Content of the resource (potentially encoded). + * Parameter encoding: Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported. + */ getContent(callback: (content: string, encoding: string) => void): void; - /** - * Sets the content of the resource. - * @param content New content of the resource. Only resources with the text type are currently supported. - * @param commit True if the user has finished editing the resource, and the new content of the resource should be persisted; false if this is a minor change sent in progress of the user editing the resource. - * @param callback A function called upon request completion. - * If you specify the callback parameter, it should be a function that looks like this: - * function(object error) {...}; - * Optional parameter error: Set to undefined if the resource content was set successfully; describes error otherwise. - */ + /** + * Sets the content of the resource. + * @param content New content of the resource. Only resources with the text type are currently supported. + * @param commit True if the user has finished editing the resource, and the new content of the resource should be persisted; false if this is a minor change sent in progress of the user editing the resource. + * @param callback A function called upon request completion. + * If you specify the callback parameter, it should be a function that looks like this: + * function(object error) {...}; + * Optional parameter error: Set to undefined if the resource content was set successfully; describes error otherwise. + */ setContent(content: string, commit: boolean, callback?: (error: Object) => void): void; } interface ReloadOptions { - /** Optional. If specified, the string will override the value of the User-Agent HTTP header that's sent while loading the resources of the inspected page. The string will also override the value of the navigator.userAgent property that's returned to any scripts that are running within the inspected page. */ + /** Optional. If specified, the string will override the value of the User-Agent HTTP header that's sent while loading the resources of the inspected page. The string will also override the value of the navigator.userAgent property that's returned to any scripts that are running within the inspected page. */ userAgent?: string; - /** Optional. When true, the loader will ignore the cache for all inspected page resources loaded before the load event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools window. */ + /** Optional. When true, the loader will ignore the cache for all inspected page resources loaded before the load event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools window. */ ignoreCache?: boolean; - /** Optional. If specified, the script will be injected into every frame of the inspected page immediately upon load, before any of the frame's scripts. The script will not be injected after subsequent reloads—for example, if the user presses Ctrl+R. */ + /** Optional. If specified, the script will be injected into every frame of the inspected page immediately upon load, before any of the frame's scripts. The script will not be injected after subsequent reloads—for example, if the user presses Ctrl+R. */ injectedScript?: string; - /** - * Optional. - * If specified, this script evaluates into a function that accepts three string arguments: the source to preprocess, the URL of the source, and a function name if the source is an DOM event handler. The preprocessorerScript function should return a string to be compiled by Chrome in place of the input source. In the case that the source is a DOM event handler, the returned source must compile to a single JS function. - * @deprecated Deprecated since Chrome 41. Please avoid using this parameter, it will be removed soon. - */ - preprocessorScript?: string; + /** + * Optional. + * If specified, this script evaluates into a function that accepts three string arguments: the source to preprocess, the URL of the source, and a function name if the source is an DOM event handler. The preprocessorerScript function should return a string to be compiled by Chrome in place of the input source. In the case that the source is a DOM event handler, the returned source must compile to a single JS function. + * @deprecated Deprecated since Chrome 41. Please avoid using this parameter, it will be removed soon. + */ + preprocessorScript?: string; } - interface EvaluationExceptionInfo { - /** Set if the error occurred on the DevTools side before the expression is evaluated. */ - isError: boolean; - /** Set if the error occurred on the DevTools side before the expression is evaluated. */ - code: string; - /** Set if the error occurred on the DevTools side before the expression is evaluated. */ - description: string; - /** Set if the error occurred on the DevTools side before the expression is evaluated, contains the array of the values that may be substituted into the description string to provide more information about the cause of the error. */ - details: any[]; - /** Set if the evaluated code produces an unhandled exception. */ - isException: boolean; - /** Set if the evaluated code produces an unhandled exception. */ - value: string; + interface EvaluationExceptionInfo { + /** Set if the error occurred on the DevTools side before the expression is evaluated. */ + isError: boolean; + /** Set if the error occurred on the DevTools side before the expression is evaluated. */ + code: string; + /** Set if the error occurred on the DevTools side before the expression is evaluated. */ + description: string; + /** Set if the error occurred on the DevTools side before the expression is evaluated, contains the array of the values that may be substituted into the description string to provide more information about the cause of the error. */ + details: any[]; + /** Set if the evaluated code produces an unhandled exception. */ + isException: boolean; + /** Set if the evaluated code produces an unhandled exception. */ + value: string; } interface ResourceAddedEvent extends chrome.events.Event<(resource: Resource) => void> {} interface ResourceContentCommittedEvent extends chrome.events.Event<(resource: Resource, content: string) => void> {} - /** The ID of the tab being inspected. This ID may be used with chrome.tabs.* API. */ + /** The ID of the tab being inspected. This ID may be used with chrome.tabs.* API. */ var tabId: number; - /** Reloads the inspected page. */ + /** Reloads the inspected page. */ export function reload(reloadOptions: ReloadOptions): void; - /** - * Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object. - * @param expression An expression to evaluate. - * @param callback A function called when evaluation completes. - * If you specify the callback parameter, it should be a function that looks like this: - * function(object result, object exceptionInfo) {...}; - * Parameter result: The result of evaluation. - * Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression. - */ + /** + * Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object. + * @param expression An expression to evaluate. + * @param callback A function called when evaluation completes. + * If you specify the callback parameter, it should be a function that looks like this: + * function(object result, object exceptionInfo) {...}; + * Parameter result: The result of evaluation. + * Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression. + */ export function eval(expression: string, callback?: (result: Object, exceptionInfo: EvaluationExceptionInfo) => void): void; - /** - * Retrieves the list of resources from the inspected page. - * @param callback A function that receives the list of resources when the request completes. - * The callback parameter should be a function that looks like this: - * function(array of Resource resources) {...}; - */ + /** + * Retrieves the list of resources from the inspected page. + * @param callback A function that receives the list of resources when the request completes. + * The callback parameter should be a function that looks like this: + * function(array of Resource resources) {...}; + */ export function getResources(callback: (resources: Resource[]) => void): void; - /** Fired when a new resource is added to the inspected page. */ + /** Fired when a new resource is added to the inspected page. */ var onResourceAdded: ResourceAddedEvent; - /** Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools). */ + /** Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools). */ var onResourceContentCommitted: ResourceContentCommittedEvent; } @@ -1682,16 +1682,16 @@ declare namespace chrome.devtools.inspectedWindow { * Availability: Since Chrome 18. */ declare namespace chrome.devtools.network { - /** Represents a network request for a document resource (script, image and so on). See HAR Specification for reference. */ + /** Represents a network request for a document resource (script, image and so on). See HAR Specification for reference. */ interface Request { - /** - * Returns content of the response body. - * @param callback A function that receives the response body when the request completes. - * The callback parameter should be a function that looks like this: - * function(string content, string encoding) {...}; - * Parameter content: Content of the response body (potentially encoded). - * Parameter encoding: Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported. - */ + /** + * Returns content of the response body. + * @param callback A function that receives the response body when the request completes. + * The callback parameter should be a function that looks like this: + * function(string content, string encoding) {...}; + * Parameter content: Content of the response body (potentially encoded). + * Parameter encoding: Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported. + */ getContent(callback: (content: string, encoding: string) => void): void; } @@ -1699,18 +1699,18 @@ declare namespace chrome.devtools.network { interface NavigatedEvent extends chrome.events.Event<(url: string) => void> {} - /** - * Returns HAR log that contains all known network requests. - * @param callback A function that receives the HAR log when the request completes. - * The callback parameter should be a function that looks like this: - * function(object harLog) {...}; - * Parameter harLog: A HAR log. See HAR specification for details. - */ + /** + * Returns HAR log that contains all known network requests. + * @param callback A function that receives the HAR log when the request completes. + * The callback parameter should be a function that looks like this: + * function(object harLog) {...}; + * Parameter harLog: A HAR log. See HAR specification for details. + */ export function getHAR(callback: (harLog: Object) => void): void; - /** Fired when a network request is finished and all request data are available. */ + /** Fired when a network request is finished and all request data are available. */ var onRequestFinished: RequestFinishedEvent; - /** Fired when the inspected window navigates to a new page. */ + /** Fired when the inspected window navigates to a new page. */ var onNavigated: NavigatedEvent; } @@ -1728,70 +1728,70 @@ declare namespace chrome.devtools.panels { interface PanelSearchEvent extends chrome.events.Event<(action: string, queryString?: string) => void> {} - /** Represents a panel created by extension. */ + /** Represents a panel created by extension. */ interface ExtensionPanel { - /** - * Appends a button to the status bar of the panel. - * @param iconPath Path to the icon of the button. The file should contain a 64x24-pixel image composed of two 32x24 icons. The left icon is used when the button is inactive; the right icon is displayed when the button is pressed. - * @param tooltipText Text shown as a tooltip when user hovers the mouse over the button. - * @param disabled Whether the button is disabled. - */ + /** + * Appends a button to the status bar of the panel. + * @param iconPath Path to the icon of the button. The file should contain a 64x24-pixel image composed of two 32x24 icons. The left icon is used when the button is inactive; the right icon is displayed when the button is pressed. + * @param tooltipText Text shown as a tooltip when user hovers the mouse over the button. + * @param disabled Whether the button is disabled. + */ createStatusBarButton(iconPath: string, tooltipText: string, disabled: boolean): Button; - /** Fired when the user switches to the panel. */ + /** Fired when the user switches to the panel. */ onShown: PanelShownEvent; - /** Fired when the user switches away from the panel. */ + /** Fired when the user switches away from the panel. */ onHidden: PanelHiddenEvent; - /** Fired upon a search action (start of a new search, search result navigation, or search being canceled). */ + /** Fired upon a search action (start of a new search, search result navigation, or search being canceled). */ onSearch: PanelSearchEvent; } interface ButtonClickedEvent extends chrome.events.Event<() => void> {} - /** A button created by the extension. */ + /** A button created by the extension. */ interface Button { - /** - * Updates the attributes of the button. If some of the arguments are omitted or null, the corresponding attributes are not updated. - * @param iconPath Path to the new icon of the button. - * @param tooltipText Text shown as a tooltip when user hovers the mouse over the button. - * @param disabled Whether the button is disabled. - */ + /** + * Updates the attributes of the button. If some of the arguments are omitted or null, the corresponding attributes are not updated. + * @param iconPath Path to the new icon of the button. + * @param tooltipText Text shown as a tooltip when user hovers the mouse over the button. + * @param disabled Whether the button is disabled. + */ update(iconPath?: string | null, tooltipText?: string | null, disabled?: boolean | null): void; - /** Fired when the button is clicked. */ + /** Fired when the button is clicked. */ onClicked: ButtonClickedEvent; } interface SelectionChangedEvent extends chrome.events.Event<() => void> {} - /** Represents the Elements panel. */ + /** Represents the Elements panel. */ interface ElementsPanel { - /** - * Creates a pane within panel's sidebar. - * @param title Text that is displayed in sidebar caption. - * @param callback A callback invoked when the sidebar is created. - * If you specify the callback parameter, it should be a function that looks like this: - * function( ExtensionSidebarPane result) {...}; - * Parameter result: An ExtensionSidebarPane object for created sidebar pane. - */ + /** + * Creates a pane within panel's sidebar. + * @param title Text that is displayed in sidebar caption. + * @param callback A callback invoked when the sidebar is created. + * If you specify the callback parameter, it should be a function that looks like this: + * function( ExtensionSidebarPane result) {...}; + * Parameter result: An ExtensionSidebarPane object for created sidebar pane. + */ createSidebarPane(title: string, callback?: (result: ExtensionSidebarPane) => void): void; - /** Fired when an object is selected in the panel. */ + /** Fired when an object is selected in the panel. */ onSelectionChanged: SelectionChangedEvent; } - /** - * Since Chrome 41. - * Represents the Sources panel. - */ - interface SourcesPanel { - /** - * Creates a pane within panel's sidebar. - * @param title Text that is displayed in sidebar caption. - * @param callback A callback invoked when the sidebar is created. - * If you specify the callback parameter, it should be a function that looks like this: - * function( ExtensionSidebarPane result) {...}; - * Parameter result: An ExtensionSidebarPane object for created sidebar pane. - */ + /** + * Since Chrome 41. + * Represents the Sources panel. + */ + interface SourcesPanel { + /** + * Creates a pane within panel's sidebar. + * @param title Text that is displayed in sidebar caption. + * @param callback A callback invoked when the sidebar is created. + * If you specify the callback parameter, it should be a function that looks like this: + * function( ExtensionSidebarPane result) {...}; + * Parameter result: An ExtensionSidebarPane object for created sidebar pane. + */ createSidebarPane(title: string, callback?: (result: ExtensionSidebarPane) => void): void; - /** Fired when an object is selected in the panel. */ + /** Fired when an object is selected in the panel. */ onSelectionChanged: SelectionChangedEvent; } @@ -1799,95 +1799,95 @@ declare namespace chrome.devtools.panels { interface ExtensionSidebarPaneHiddenEvent extends chrome.events.Event<() => void> {} - /** A sidebar created by the extension. */ + /** A sidebar created by the extension. */ interface ExtensionSidebarPane { - /** - * Sets the height of the sidebar. - * @param height A CSS-like size specification, such as '100px' or '12ex'. - */ + /** + * Sets the height of the sidebar. + * @param height A CSS-like size specification, such as '100px' or '12ex'. + */ setHeight(height: string): void; - /** - * Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane. - * @param expression An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch. - * @param rootTitle An optional title for the root of the expression tree. - * @param callback A callback invoked after the sidebar pane is updated with the expression evaluation results. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane. + * @param expression An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch. + * @param rootTitle An optional title for the root of the expression tree. + * @param callback A callback invoked after the sidebar pane is updated with the expression evaluation results. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ setExpression(expression: string, rootTitle?: string, callback?: () => void): void; - /** - * Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane. - * @param expression An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch. - * @param callback A callback invoked after the sidebar pane is updated with the expression evaluation results. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane. + * @param expression An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch. + * @param callback A callback invoked after the sidebar pane is updated with the expression evaluation results. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ setExpression(expression: string, callback?: () => void): void; - /** - * Sets a JSON-compliant object to be displayed in the sidebar pane. - * @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client). - * @param rootTitle An optional title for the root of the expression tree. - * @param callback A callback invoked after the sidebar is updated with the object. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Sets a JSON-compliant object to be displayed in the sidebar pane. + * @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client). + * @param rootTitle An optional title for the root of the expression tree. + * @param callback A callback invoked after the sidebar is updated with the object. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ setObject(jsonObject: string, rootTitle?: string, callback?: () => void): void; - /** - * Sets a JSON-compliant object to be displayed in the sidebar pane. - * @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client). - * @param callback A callback invoked after the sidebar is updated with the object. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Sets a JSON-compliant object to be displayed in the sidebar pane. + * @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client). + * @param callback A callback invoked after the sidebar is updated with the object. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ setObject(jsonObject: string, callback?: () => void): void; - /** - * Sets an HTML page to be displayed in the sidebar pane. - * @param path Relative path of an extension page to display within the sidebar. - */ + /** + * Sets an HTML page to be displayed in the sidebar pane. + * @param path Relative path of an extension page to display within the sidebar. + */ setPage(path: string): void; - /** Fired when the sidebar pane becomes visible as a result of user switching to the panel that hosts it. */ + /** Fired when the sidebar pane becomes visible as a result of user switching to the panel that hosts it. */ onShown: ExtensionSidebarPaneShownEvent; - /** Fired when the sidebar pane becomes hidden as a result of the user switching away from the panel that hosts the sidebar pane. */ + /** Fired when the sidebar pane becomes hidden as a result of the user switching away from the panel that hosts the sidebar pane. */ onHidden: ExtensionSidebarPaneHiddenEvent; } - /** Elements panel. */ + /** Elements panel. */ var elements: ElementsPanel; - /** - * Since Chrome 38. - * Sources panel. - */ - var sources: SourcesPanel; + /** + * Since Chrome 38. + * Sources panel. + */ + var sources: SourcesPanel; - /** - * Creates an extension panel. - * @param title Title that is displayed next to the extension icon in the Developer Tools toolbar. - * @param iconPath Path of the panel's icon relative to the extension directory. - * @param pagePath Path of the panel's HTML page relative to the extension directory. - * @param callback A function that is called when the panel is created. - * If you specify the callback parameter, it should be a function that looks like this: - * function( ExtensionPanel panel) {...}; - * Parameter panel: An ExtensionPanel object representing the created panel. - */ + /** + * Creates an extension panel. + * @param title Title that is displayed next to the extension icon in the Developer Tools toolbar. + * @param iconPath Path of the panel's icon relative to the extension directory. + * @param pagePath Path of the panel's HTML page relative to the extension directory. + * @param callback A function that is called when the panel is created. + * If you specify the callback parameter, it should be a function that looks like this: + * function( ExtensionPanel panel) {...}; + * Parameter panel: An ExtensionPanel object representing the created panel. + */ export function create(title: string, iconPath: string, pagePath: string, callback?: (panel: ExtensionPanel) => void): void; - /** - * Specifies the function to be called when the user clicks a resource link in the Developer Tools window. To unset the handler, either call the method with no parameters or pass null as the parameter. - * @param callback A function that is called when the user clicks on a valid resource link in Developer Tools window. Note that if the user clicks an invalid URL or an XHR, this function is not called. - * If you specify the callback parameter, it should be a function that looks like this: - * function( devtools.inspectedWindow.Resource resource) {...}; - * Parameter resource: A devtools.inspectedWindow.Resource object for the resource that was clicked. - */ + /** + * Specifies the function to be called when the user clicks a resource link in the Developer Tools window. To unset the handler, either call the method with no parameters or pass null as the parameter. + * @param callback A function that is called when the user clicks on a valid resource link in Developer Tools window. Note that if the user clicks an invalid URL or an XHR, this function is not called. + * If you specify the callback parameter, it should be a function that looks like this: + * function( devtools.inspectedWindow.Resource resource) {...}; + * Parameter resource: A devtools.inspectedWindow.Resource object for the resource that was clicked. + */ export function setOpenResourceHandler(callback?: (resource: chrome.devtools.inspectedWindow.Resource) => void): void; - /** - * Since Chrome 38. - * Requests DevTools to open a URL in a Developer Tools panel. - * @param url The URL of the resource to open. - * @param lineNumber Specifies the line number to scroll to when the resource is loaded. - * @param callback A function that is called when the resource has been successfully loaded. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function openResource(url: string, lineNumber: number, callback: () => void): void; + /** + * Since Chrome 38. + * Requests DevTools to open a URL in a Developer Tools panel. + * @param url The URL of the resource to open. + * @param lineNumber Specifies the line number to scroll to when the resource is loaded. + * @param callback A function that is called when the resource has been successfully loaded. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function openResource(url: string, lineNumber: number, callback: () => void): void; } //////////////////// @@ -1900,28 +1900,28 @@ declare namespace chrome.devtools.panels { * Important: This API works only on Chrome OS. */ declare namespace chrome.documentScan { - interface DocumentScanOptions { - /** Optional. The MIME types that are accepted by the caller. */ - mimeTypes?: string[]; - /** Optional. The number of scanned images allowed (defaults to 1). */ - maxImages?: number; - } + interface DocumentScanOptions { + /** Optional. The MIME types that are accepted by the caller. */ + mimeTypes?: string[]; + /** Optional. The number of scanned images allowed (defaults to 1). */ + maxImages?: number; + } - interface DocumentScanCallbackArg { - /** The data image URLs in a form that can be passed as the "src" value to an image tag. */ - dataUrls: string[]; - /** The MIME type of dataUrls. */ - mimeType: string; - } + interface DocumentScanCallbackArg { + /** The data image URLs in a form that can be passed as the "src" value to an image tag. */ + dataUrls: string[]; + /** The MIME type of dataUrls. */ + mimeType: string; + } - /** - * Performs a document scan. On success, the PNG data will be sent to the callback. - * @param options Object containing scan parameters. - * @param callback Called with the result and data from the scan. - * The callback parameter should be a function that looks like this: - * function(object result) {...}; - */ - export function scan(options: DocumentScanOptions, callback: (result: DocumentScanCallbackArg) => void): void; + /** + * Performs a document scan. On success, the PNG data will be sent to the callback. + * @param options Object containing scan parameters. + * @param callback Called with the result and data from the scan. + * The callback parameter should be a function that looks like this: + * function(object result) {...}; + */ + export function scan(options: DocumentScanOptions, callback: (result: DocumentScanCallbackArg) => void): void; } //////////////////// @@ -1934,58 +1934,58 @@ declare namespace chrome.documentScan { */ declare namespace chrome.downloads { interface HeaderNameValuePair { - /** Name of the HTTP header. */ + /** Name of the HTTP header. */ name: string; - /** Value of the HTTP header. */ + /** Value of the HTTP header. */ value: string; } interface DownloadOptions { - /** Optional. Post body. */ + /** Optional. Post body. */ body?: string; - /** Optional. Use a file-chooser to allow the user to select a filename regardless of whether filename is set or already exists. */ + /** Optional. Use a file-chooser to allow the user to select a filename regardless of whether filename is set or already exists. */ saveAs?: boolean; - /** The URL to download. */ + /** The URL to download. */ url: string; - /** Optional. A file path relative to the Downloads directory to contain the downloaded file, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will cause an error. onDeterminingFilename allows suggesting a filename after the file's MIME type and a tentative filename have been determined. */ + /** Optional. A file path relative to the Downloads directory to contain the downloaded file, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will cause an error. onDeterminingFilename allows suggesting a filename after the file's MIME type and a tentative filename have been determined. */ filename?: string; - /** Optional. Extra HTTP headers to send with the request if the URL uses the HTTP[s] protocol. Each header is represented as a dictionary containing the keys name and either value or binaryValue, restricted to those allowed by XMLHttpRequest. */ + /** Optional. Extra HTTP headers to send with the request if the URL uses the HTTP[s] protocol. Each header is represented as a dictionary containing the keys name and either value or binaryValue, restricted to those allowed by XMLHttpRequest. */ headers?: HeaderNameValuePair[]; - /** Optional. The HTTP method to use if the URL uses the HTTP[S] protocol. */ + /** Optional. The HTTP method to use if the URL uses the HTTP[S] protocol. */ method?: string; - /** Optional. The action to take if filename already exists. */ - conflictAction?: string; + /** Optional. The action to take if filename already exists. */ + conflictAction?: string; } interface DownloadDelta { - /** Optional. The change in danger, if any. */ - danger?: StringDelta; - /** Optional. The change in url, if any. */ - url?: StringDelta; - /** Optional. The change in totalBytes, if any. */ - totalBytes?: DoubleDelta; - /** Optional. The change in filename, if any. */ - filename?: StringDelta; - /** Optional. The change in paused, if any. */ - paused?: BooleanDelta; - /** Optional. The change in state, if any. */ - state?: StringDelta; - /** Optional. The change in mime, if any. */ - mime?: StringDelta; - /** Optional. The change in fileSize, if any. */ - fileSize?: DoubleDelta; - /** Optional. The change in startTime, if any. */ - startTime?: DoubleDelta; - /** Optional. The change in error, if any. */ - error?: StringDelta; - /** Optional. The change in endTime, if any. */ - endTime?: DoubleDelta; - /** The id of the DownloadItem that changed. */ + /** Optional. The change in danger, if any. */ + danger?: StringDelta; + /** Optional. The change in url, if any. */ + url?: StringDelta; + /** Optional. The change in totalBytes, if any. */ + totalBytes?: DoubleDelta; + /** Optional. The change in filename, if any. */ + filename?: StringDelta; + /** Optional. The change in paused, if any. */ + paused?: BooleanDelta; + /** Optional. The change in state, if any. */ + state?: StringDelta; + /** Optional. The change in mime, if any. */ + mime?: StringDelta; + /** Optional. The change in fileSize, if any. */ + fileSize?: DoubleDelta; + /** Optional. The change in startTime, if any. */ + startTime?: DoubleDelta; + /** Optional. The change in error, if any. */ + error?: StringDelta; + /** Optional. The change in endTime, if any. */ + endTime?: DoubleDelta; + /** The id of the DownloadItem that changed. */ id: number; - /** Optional. The change in canResume, if any. */ - canResume?: BooleanDelta; - /** Optional. The change in exists, if any. */ - exists?: BooleanDelta; + /** Optional. The change in canResume, if any. */ + canResume?: BooleanDelta; + /** Optional. The change in exists, if any. */ + exists?: BooleanDelta; } interface BooleanDelta { @@ -1993,7 +1993,7 @@ declare namespace chrome.downloads { previous?: boolean; } - /** Since Chrome 34. */ + /** Since Chrome 34. */ interface DoubleDelta { current?: number; previous?: number; @@ -2005,113 +2005,113 @@ declare namespace chrome.downloads { } interface DownloadItem { - /** Number of bytes received so far from the host, without considering file compression. */ + /** Number of bytes received so far from the host, without considering file compression. */ bytesReceived: number; - /** Indication of whether this download is thought to be safe or known to be suspicious. */ + /** Indication of whether this download is thought to be safe or known to be suspicious. */ danger: string; - /** Absolute URL. */ + /** Absolute URL. */ url: string; - /** Number of bytes in the whole file, without considering file compression, or -1 if unknown. */ + /** Number of bytes in the whole file, without considering file compression, or -1 if unknown. */ totalBytes: number; - /** Absolute local path. */ + /** Absolute local path. */ filename: string; - /** True if the download has stopped reading data from the host, but kept the connection open. */ + /** True if the download has stopped reading data from the host, but kept the connection open. */ paused: boolean; - /** Indicates whether the download is progressing, interrupted, or complete. */ + /** Indicates whether the download is progressing, interrupted, or complete. */ state: string; - /** The file's MIME type. */ + /** The file's MIME type. */ mime: string; - /** Number of bytes in the whole file post-decompression, or -1 if unknown. */ + /** Number of bytes in the whole file post-decompression, or -1 if unknown. */ fileSize: number; - /** The time when the download began in ISO 8601 format. May be passed directly to the Date constructor: chrome.downloads.search({}, function(items){items.forEach(function(item){console.log(new Date(item.startTime))})}) */ + /** The time when the download began in ISO 8601 format. May be passed directly to the Date constructor: chrome.downloads.search({}, function(items){items.forEach(function(item){console.log(new Date(item.startTime))})}) */ startTime: string; - /** Optional. Why the download was interrupted. Several kinds of HTTP errors may be grouped under one of the errors beginning with SERVER_. Errors relating to the network begin with NETWORK_, errors relating to the process of writing the file to the file system begin with FILE_, and interruptions initiated by the user begin with USER_. */ - error?: string; - /** Optional. The time when the download ended in ISO 8601 format. May be passed directly to the Date constructor: chrome.downloads.search({}, function(items){items.forEach(function(item){if (item.endTime) console.log(new Date(item.endTime))})}) */ - endTime?: string; - /** An identifier that is persistent across browser sessions. */ + /** Optional. Why the download was interrupted. Several kinds of HTTP errors may be grouped under one of the errors beginning with SERVER_. Errors relating to the network begin with NETWORK_, errors relating to the process of writing the file to the file system begin with FILE_, and interruptions initiated by the user begin with USER_. */ + error?: string; + /** Optional. The time when the download ended in ISO 8601 format. May be passed directly to the Date constructor: chrome.downloads.search({}, function(items){items.forEach(function(item){if (item.endTime) console.log(new Date(item.endTime))})}) */ + endTime?: string; + /** An identifier that is persistent across browser sessions. */ id: number; - /** False if this download is recorded in the history, true if it is not recorded. */ + /** False if this download is recorded in the history, true if it is not recorded. */ incognito: boolean; - /** Absolute URL. */ - referrer: string; - /** Optional. Estimated time when the download will complete in ISO 8601 format. May be passed directly to the Date constructor: chrome.downloads.search({}, function(items){items.forEach(function(item){if (item.estimatedEndTime) console.log(new Date(item.estimatedEndTime))})}) */ - estimatedEndTime?: string; - /** True if the download is in progress and paused, or else if it is interrupted and can be resumed starting from where it was interrupted. */ - canResume: boolean; - /** Whether the downloaded file still exists. This information may be out of date because Chrome does not automatically watch for file removal. Call search() in order to trigger the check for file existence. When the existence check completes, if the file has been deleted, then an onChanged event will fire. Note that search() does not wait for the existence check to finish before returning, so results from search() may not accurately reflect the file system. Also, search() may be called as often as necessary, but will not check for file existence any more frequently than once every 10 seconds. */ - exists: boolean; - /** Optional. The identifier for the extension that initiated this download if this download was initiated by an extension. Does not change once it is set. */ - byExtensionId?: string; - /** Optional. The localized name of the extension that initiated this download if this download was initiated by an extension. May change if the extension changes its name or if the user changes their locale. */ - byExtensionName?: string; + /** Absolute URL. */ + referrer: string; + /** Optional. Estimated time when the download will complete in ISO 8601 format. May be passed directly to the Date constructor: chrome.downloads.search({}, function(items){items.forEach(function(item){if (item.estimatedEndTime) console.log(new Date(item.estimatedEndTime))})}) */ + estimatedEndTime?: string; + /** True if the download is in progress and paused, or else if it is interrupted and can be resumed starting from where it was interrupted. */ + canResume: boolean; + /** Whether the downloaded file still exists. This information may be out of date because Chrome does not automatically watch for file removal. Call search() in order to trigger the check for file existence. When the existence check completes, if the file has been deleted, then an onChanged event will fire. Note that search() does not wait for the existence check to finish before returning, so results from search() may not accurately reflect the file system. Also, search() may be called as often as necessary, but will not check for file existence any more frequently than once every 10 seconds. */ + exists: boolean; + /** Optional. The identifier for the extension that initiated this download if this download was initiated by an extension. Does not change once it is set. */ + byExtensionId?: string; + /** Optional. The localized name of the extension that initiated this download if this download was initiated by an extension. May change if the extension changes its name or if the user changes their locale. */ + byExtensionName?: string; } interface GetFileIconOptions { - /** Optional. * The size of the returned icon. The icon will be square with dimensions size * size pixels. The default and largest size for the icon is 32x32 pixels. The only supported sizes are 16 and 32. It is an error to specify any other size. + /** Optional. * The size of the returned icon. The icon will be square with dimensions size * size pixels. The default and largest size for the icon is 32x32 pixels. The only supported sizes are 16 and 32. It is an error to specify any other size. */ size?: number; } interface DownloadQuery { - /** Optional. Set elements of this array to DownloadItem properties in order to sort search results. For example, setting orderBy=['startTime'] sorts the DownloadItem by their start time in ascending order. To specify descending order, prefix with a hyphen: '-startTime'. */ - orderBy?: string[]; - /** Optional. Limits results to DownloadItem whose url matches the given regular expression. */ + /** Optional. Set elements of this array to DownloadItem properties in order to sort search results. For example, setting orderBy=['startTime'] sorts the DownloadItem by their start time in ascending order. To specify descending order, prefix with a hyphen: '-startTime'. */ + orderBy?: string[]; + /** Optional. Limits results to DownloadItem whose url matches the given regular expression. */ urlRegex?: string; - /** Optional. Limits results to DownloadItem that ended before the given ms since the epoch. */ + /** Optional. Limits results to DownloadItem that ended before the given ms since the epoch. */ endedBefore?: number; - /** Optional. Limits results to DownloadItem whose totalBytes is greater than the given integer. */ + /** Optional. Limits results to DownloadItem whose totalBytes is greater than the given integer. */ totalBytesGreater?: number; - /** Optional. Indication of whether this download is thought to be safe or known to be suspicious. */ + /** Optional. Indication of whether this download is thought to be safe or known to be suspicious. */ danger?: string; - /** Optional. Number of bytes in the whole file, without considering file compression, or -1 if unknown. */ + /** Optional. Number of bytes in the whole file, without considering file compression, or -1 if unknown. */ totalBytes?: number; - /** Optional. True if the download has stopped reading data from the host, but kept the connection open. */ + /** Optional. True if the download has stopped reading data from the host, but kept the connection open. */ paused?: boolean; - /** Optional. Limits results to DownloadItem whose filename matches the given regular expression. */ + /** Optional. Limits results to DownloadItem whose filename matches the given regular expression. */ filenameRegex?: string; - /** Optional. This array of search terms limits results to DownloadItem whose filename or url contain all of the search terms that do not begin with a dash '-' and none of the search terms that do begin with a dash. */ - query?: string[]; - /** Optional. Limits results to DownloadItem whose totalBytes is less than the given integer. */ + /** Optional. This array of search terms limits results to DownloadItem whose filename or url contain all of the search terms that do not begin with a dash '-' and none of the search terms that do begin with a dash. */ + query?: string[]; + /** Optional. Limits results to DownloadItem whose totalBytes is less than the given integer. */ totalBytesLess?: number; - /** Optional. The id of the DownloadItem to query. */ + /** Optional. The id of the DownloadItem to query. */ id?: number; - /** Optional. Number of bytes received so far from the host, without considering file compression. */ + /** Optional. Number of bytes received so far from the host, without considering file compression. */ bytesReceived?: number; - /** Optional. Limits results to DownloadItem that ended after the given ms since the epoch. */ + /** Optional. Limits results to DownloadItem that ended after the given ms since the epoch. */ endedAfter?: number; - /** Optional. Absolute local path. */ + /** Optional. Absolute local path. */ filename?: string; - /** Optional. Indicates whether the download is progressing, interrupted, or complete. */ + /** Optional. Indicates whether the download is progressing, interrupted, or complete. */ state?: string; - /** Optional. Limits results to DownloadItem that started after the given ms since the epoch. */ + /** Optional. Limits results to DownloadItem that started after the given ms since the epoch. */ startedAfter?: number; - /** Optional. The file's MIME type. */ + /** Optional. The file's MIME type. */ mime?: string; - /** Optional. Number of bytes in the whole file post-decompression, or -1 if unknown. */ + /** Optional. Number of bytes in the whole file post-decompression, or -1 if unknown. */ fileSize?: number; - /** Optional. The time when the download began in ISO 8601 format. */ + /** Optional. The time when the download began in ISO 8601 format. */ startTime?: number; - /** Optional. Absolute URL. */ + /** Optional. Absolute URL. */ url?: string; - /** Optional. Limits results to DownloadItem that started before the given ms since the epoch. */ + /** Optional. Limits results to DownloadItem that started before the given ms since the epoch. */ startedBefore?: number; - /** Optional. The maximum number of matching DownloadItem returned. Defaults to 1000. Set to 0 in order to return all matching DownloadItem. See search for how to page through results. */ + /** Optional. The maximum number of matching DownloadItem returned. Defaults to 1000. Set to 0 in order to return all matching DownloadItem. See search for how to page through results. */ limit?: number; - /** Optional. Why a download was interrupted. */ + /** Optional. Why a download was interrupted. */ error?: number; - /** Optional. The time when the download ended in ISO 8601 format. */ + /** Optional. The time when the download ended in ISO 8601 format. */ endTime?: number; - /** Optional. Whether the downloaded file exists; */ - exists?: boolean; + /** Optional. Whether the downloaded file exists; */ + exists?: boolean; } - interface DownloadFilenameSuggestion { - /** The DownloadItem's new target DownloadItem.filename, as a path relative to the user's default Downloads directory, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will be ignored. */ - filename: string; - /** Optional. The action to take if filename already exists. */ - conflictAction?: string; - } + interface DownloadFilenameSuggestion { + /** The DownloadItem's new target DownloadItem.filename, as a path relative to the user's default Downloads directory, possibly containing subdirectories. Absolute paths, empty paths, and paths containing back-references ".." will be ignored. */ + filename: string; + /** Optional. The action to take if filename already exists. */ + conflictAction?: string; + } interface DownloadChangedEvent extends chrome.events.Event<(downloadDelta: DownloadDelta) => void> {} @@ -2119,107 +2119,107 @@ declare namespace chrome.downloads { interface DownloadErasedEvent extends chrome.events.Event<(downloadId: number) => void> {} - interface DownloadDeterminingFilenameEvent extends chrome.events.Event<(downloadItem: DownloadItem, suggest: (suggestion?: DownloadFilenameSuggestion) => void) => void> {} + interface DownloadDeterminingFilenameEvent extends chrome.events.Event<(downloadItem: DownloadItem, suggest: (suggestion?: DownloadFilenameSuggestion) => void) => void> {} - /** - * Find DownloadItem. Set query to the empty object to get all DownloadItem. To get a specific DownloadItem, set only the id field. To page through a large number of items, set orderBy: ['-startTime'], set limit to the number of items per page, and set startedAfter to the startTime of the last item from the last page. - * @param callback The callback parameter should be a function that looks like this: - * function(array of DownloadItem results) {...}; - */ + /** + * Find DownloadItem. Set query to the empty object to get all DownloadItem. To get a specific DownloadItem, set only the id field. To page through a large number of items, set orderBy: ['-startTime'], set limit to the number of items per page, and set startedAfter to the startTime of the last item from the last page. + * @param callback The callback parameter should be a function that looks like this: + * function(array of DownloadItem results) {...}; + */ export function search(query: DownloadQuery, callback: (results: DownloadItem[]) => void): void; - /** - * Pause the download. If the request was successful the download is in a paused state. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active. - * @param downloadId The id of the download to pause. - * @param callback Called when the pause request is completed. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Pause the download. If the request was successful the download is in a paused state. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active. + * @param downloadId The id of the download to pause. + * @param callback Called when the pause request is completed. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function pause(downloadId: number, callback?: () => void): void; - /** - * Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message. - * @param downloadId The identifier for the download. - * @param callback A URL to an image that represents the download. - * The callback parameter should be a function that looks like this: - * function(string iconURL) {...}; - */ + /** + * Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message. + * @param downloadId The identifier for the download. + * @param callback A URL to an image that represents the download. + * The callback parameter should be a function that looks like this: + * function(string iconURL) {...}; + */ export function getFileIcon(downloadId: number, callback: (iconURL: string) => void): void; - /** - * Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message. - * @param downloadId The identifier for the download. - * @param callback A URL to an image that represents the download. - * The callback parameter should be a function that looks like this: - * function(string iconURL) {...}; - */ + /** + * Retrieve an icon for the specified download. For new downloads, file icons are available after the onCreated event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, runtime.lastError will contain an error message. + * @param downloadId The identifier for the download. + * @param callback A URL to an image that represents the download. + * The callback parameter should be a function that looks like this: + * function(string iconURL) {...}; + */ export function getFileIcon(downloadId: number, options: GetFileIconOptions, callback: (iconURL: string) => void): void; - /** - * Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active. - * @param downloadId The id of the download to resume. - * @param callback Called when the resume request is completed. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise runtime.lastError contains an error message. The request will fail if the download is not active. + * @param downloadId The id of the download to resume. + * @param callback Called when the resume request is completed. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function resume(downloadId: number, callback?: () => void): void; - /** - * Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore. - * @param downloadId The id of the download to cancel. - * @param callback Called when the cancel request is completed. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore. + * @param downloadId The id of the download to cancel. + * @param callback Called when the cancel request is completed. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function cancel(downloadId: number, callback?: () => void): void; - /** - * Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename. If the download started successfully, callback will be called with the new DownloadItem's downloadId. If there was an error starting the download, then callback will be called with downloadId=undefined and runtime.lastError will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. Extensions must not parse it. - * @param options What to download and how. - * @param callback Called with the id of the new DownloadItem. - * If you specify the callback parameter, it should be a function that looks like this: - * function(integer downloadId) {...}; - */ + /** + * Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename. If the download started successfully, callback will be called with the new DownloadItem's downloadId. If there was an error starting the download, then callback will be called with downloadId=undefined and runtime.lastError will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. Extensions must not parse it. + * @param options What to download and how. + * @param callback Called with the id of the new DownloadItem. + * If you specify the callback parameter, it should be a function that looks like this: + * function(integer downloadId) {...}; + */ export function download(options: DownloadOptions, callback?: (downloadId: number) => void): void; - /** - * Open the downloaded file now if the DownloadItem is complete; otherwise returns an error through runtime.lastError. Requires the "downloads.open" permission in addition to the "downloads" permission. An onChanged event will fire when the item is opened for the first time. - * @param downloadId The identifier for the downloaded file. - */ + /** + * Open the downloaded file now if the DownloadItem is complete; otherwise returns an error through runtime.lastError. Requires the "downloads.open" permission in addition to the "downloads" permission. An onChanged event will fire when the item is opened for the first time. + * @param downloadId The identifier for the downloaded file. + */ export function open(downloadId: number): void; - /** - * Show the downloaded file in its folder in a file manager. - * @param downloadId The identifier for the downloaded file. - */ + /** + * Show the downloaded file in its folder in a file manager. + * @param downloadId The identifier for the downloaded file. + */ export function show(downloadId: number): void; - /** Show the default Downloads folder in a file manager. */ + /** Show the default Downloads folder in a file manager. */ export function showDefaultFolder(): void; - /** - * Erase matching DownloadItem from history without deleting the downloaded file. An onErased event will fire for each DownloadItem that matches query, then callback will be called. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(array of integer erasedIds) {...}; - */ + /** + * Erase matching DownloadItem from history without deleting the downloaded file. An onErased event will fire for each DownloadItem that matches query, then callback will be called. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(array of integer erasedIds) {...}; + */ export function erase(query: DownloadQuery, callback: (erasedIds: number[]) => void): void; - /** - * Remove the downloaded file if it exists and the DownloadItem is complete; otherwise return an error through runtime.lastError. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Remove the downloaded file if it exists and the DownloadItem is complete; otherwise return an error through runtime.lastError. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function removeFile(downloadId: number, callback?: () => void): void; - /** - * Prompt the user to accept a dangerous download. Can only be called from a visible context (tab, window, or page/browser action popup). Does not automatically accept dangerous downloads. If the download is accepted, then an onChanged event will fire, otherwise nothing will happen. When all the data is fetched into a temporary file and either the download is not dangerous or the danger has been accepted, then the temporary file is renamed to the target filename, the |state| changes to 'complete', and onChanged fires. - * @param downloadId The identifier for the DownloadItem. - * @param callback Called when the danger prompt dialog closes. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Prompt the user to accept a dangerous download. Can only be called from a visible context (tab, window, or page/browser action popup). Does not automatically accept dangerous downloads. If the download is accepted, then an onChanged event will fire, otherwise nothing will happen. When all the data is fetched into a temporary file and either the download is not dangerous or the danger has been accepted, then the temporary file is renamed to the target filename, the |state| changes to 'complete', and onChanged fires. + * @param downloadId The identifier for the DownloadItem. + * @param callback Called when the danger prompt dialog closes. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function acceptDanger(downloadId: number, callback: () => void): void; - /** Initiate dragging the downloaded file to another application. Call in a javascript ondragstart handler. */ + /** Initiate dragging the downloaded file to another application. Call in a javascript ondragstart handler. */ export function drag(downloadId: number): void; - /** Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has disabled it will return an error through runtime.lastError. Requires the "downloads.shelf" permission in addition to the "downloads" permission. */ + /** Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has disabled it will return an error through runtime.lastError. Requires the "downloads.shelf" permission in addition to the "downloads" permission. */ export function setShelfEnabled(enabled: boolean): void; - /** When any of a DownloadItem's properties except bytesReceived and estimatedEndTime changes, this event fires with the downloadId and an object containing the properties that changed. */ + /** When any of a DownloadItem's properties except bytesReceived and estimatedEndTime changes, this event fires with the downloadId and an object containing the properties that changed. */ var onChanged: DownloadChangedEvent; - /** This event fires with the DownloadItem object when a download begins. */ + /** This event fires with the DownloadItem object when a download begins. */ var onCreated: DownloadCreatedEvent; - /** Fires with the downloadId when a download is erased from history. */ + /** Fires with the downloadId when a download is erased from history. */ var onErased: DownloadErasedEvent; - /** During the filename determination process, extensions will be given the opportunity to override the target DownloadItem.filename. Each extension may not register more than one listener for this event. Each listener must call suggest exactly once, either synchronously or asynchronously. If the listener calls suggest asynchronously, then it must return true. If the listener neither calls suggest synchronously nor returns true, then suggest will be called automatically. The DownloadItem will not complete until all listeners have called suggest. Listeners may call suggest without any arguments in order to allow the download to use downloadItem.filename for its filename, or pass a suggestion object to suggest in order to override the target filename. If more than one extension overrides the filename, then the last extension installed whose listener passes a suggestion object to suggest wins. In order to avoid confusion regarding which extension will win, users should not install extensions that may conflict. If the download is initiated by download and the target filename is known before the MIME type and tentative filename have been determined, pass filename to download instead. */ - var onDeterminingFilename: DownloadDeterminingFilenameEvent; + /** During the filename determination process, extensions will be given the opportunity to override the target DownloadItem.filename. Each extension may not register more than one listener for this event. Each listener must call suggest exactly once, either synchronously or asynchronously. If the listener calls suggest asynchronously, then it must return true. If the listener neither calls suggest synchronously nor returns true, then suggest will be called automatically. The DownloadItem will not complete until all listeners have called suggest. Listeners may call suggest without any arguments in order to allow the download to use downloadItem.filename for its filename, or pass a suggestion object to suggest in order to override the target filename. If more than one extension overrides the filename, then the last extension installed whose listener passes a suggestion object to suggest wins. In order to avoid confusion regarding which extension will win, users should not install extensions that may conflict. If the download is initiated by download and the target filename is known before the MIME type and tentative filename have been determined, pass filename to download instead. */ + var onDeterminingFilename: DownloadDeterminingFilenameEvent; } //////////////////// @@ -2233,55 +2233,55 @@ declare namespace chrome.downloads { * Note: This API is only for extensions pre-installed by policy. */ declare namespace chrome.enterprise.platformKeys { - interface Token { - /** - * Uniquely identifies this Token. - * Static IDs are "user" and "system", referring to the platform's user-specific and the system-wide hardware token, respectively. Any other tokens (with other identifiers) might be returned by enterprise.platformKeys.getTokens. - */ - id: string; - /** - * Implements the WebCrypto's SubtleCrypto interface. The cryptographic operations, including key generation, are hardware-backed. - * Only non-extractable RSASSA-PKCS1-V1_5 keys with modulusLength up to 2048 can be generated. Each key can be used for signing data at most once. - * Keys generated on a specific Token cannot be used with any other Tokens, nor can they be used with window.crypto.subtle. Equally, Key objects created with window.crypto.subtle cannot be used with this interface. - */ - subtleCrypto: SubtleCrypto; - } + interface Token { + /** + * Uniquely identifies this Token. + * Static IDs are "user" and "system", referring to the platform's user-specific and the system-wide hardware token, respectively. Any other tokens (with other identifiers) might be returned by enterprise.platformKeys.getTokens. + */ + id: string; + /** + * Implements the WebCrypto's SubtleCrypto interface. The cryptographic operations, including key generation, are hardware-backed. + * Only non-extractable RSASSA-PKCS1-V1_5 keys with modulusLength up to 2048 can be generated. Each key can be used for signing data at most once. + * Keys generated on a specific Token cannot be used with any other Tokens, nor can they be used with window.crypto.subtle. Equally, Key objects created with window.crypto.subtle cannot be used with this interface. + */ + subtleCrypto: SubtleCrypto; + } - /** - * Returns the available Tokens. In a regular user's session the list will always contain the user's token with id "user". If a system-wide TPM token is available, the returned list will also contain the system-wide token with id "system". The system-wide token will be the same for all sessions on this device (device in the sense of e.g. a Chromebook). - * @param callback Invoked by getTokens with the list of available Tokens. - * The callback parameter should be a function that looks like this: - * function(array of Token tokens) {...}; - * Parameter tokens: The list of available tokens. - */ - export function getToken(callback: (tokens: Token[]) => void): void; - /** - * Returns the list of all client certificates available from the given token. Can be used to check for the existence and expiration of client certificates that are usable for a certain authentication. - * @param tokenId The id of a Token returned by getTokens. - * @param callback Called back with the list of the available certificates. - * The callback parameter should be a function that looks like this: - * function(array of ArrayBuffer certificates) {...}; - * Parameter certificates: The list of certificates, each in DER encoding of a X.509 certificate. - */ - export function getCertificates(tokenId: string, callback: (certificates: ArrayBuffer) => void): void; - /** - * Imports certificate to the given token if the certified key is already stored in this token. After a successful certification request, this function should be used to store the obtained certificate and to make it available to the operating system and browser for authentication. - * @param tokenId The id of a Token returned by getTokens. - * @param certificate The DER encoding of a X.509 certificate. - * @param callback Called back when this operation is finished. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function importCertificate(tokenId: string, certificate: ArrayBuffer, callback?: () => void): void; - /** - * Removes certificate from the given token if present. Should be used to remove obsolete certificates so that they are not considered during authentication and do not clutter the certificate choice. Should be used to free storage in the certificate store. - * @param tokenId The id of a Token returned by getTokens. - * @param certificate The DER encoding of a X.509 certificate. - * @param callback Called back when this operation is finished. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function removeCertificate(tokenId: string, certificate: ArrayBuffer, callback?: () => void): void; + /** + * Returns the available Tokens. In a regular user's session the list will always contain the user's token with id "user". If a system-wide TPM token is available, the returned list will also contain the system-wide token with id "system". The system-wide token will be the same for all sessions on this device (device in the sense of e.g. a Chromebook). + * @param callback Invoked by getTokens with the list of available Tokens. + * The callback parameter should be a function that looks like this: + * function(array of Token tokens) {...}; + * Parameter tokens: The list of available tokens. + */ + export function getToken(callback: (tokens: Token[]) => void): void; + /** + * Returns the list of all client certificates available from the given token. Can be used to check for the existence and expiration of client certificates that are usable for a certain authentication. + * @param tokenId The id of a Token returned by getTokens. + * @param callback Called back with the list of the available certificates. + * The callback parameter should be a function that looks like this: + * function(array of ArrayBuffer certificates) {...}; + * Parameter certificates: The list of certificates, each in DER encoding of a X.509 certificate. + */ + export function getCertificates(tokenId: string, callback: (certificates: ArrayBuffer) => void): void; + /** + * Imports certificate to the given token if the certified key is already stored in this token. After a successful certification request, this function should be used to store the obtained certificate and to make it available to the operating system and browser for authentication. + * @param tokenId The id of a Token returned by getTokens. + * @param certificate The DER encoding of a X.509 certificate. + * @param callback Called back when this operation is finished. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function importCertificate(tokenId: string, certificate: ArrayBuffer, callback?: () => void): void; + /** + * Removes certificate from the given token if present. Should be used to remove obsolete certificates so that they are not considered during authentication and do not clutter the certificate choice. Should be used to free storage in the certificate store. + * @param tokenId The id of a Token returned by getTokens. + * @param certificate The DER encoding of a X.509 certificate. + * @param callback Called back when this operation is finished. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function removeCertificate(tokenId: string, certificate: ArrayBuffer, callback?: () => void): void; } //////////////////// @@ -2292,138 +2292,138 @@ declare namespace chrome.enterprise.platformKeys { * Availability: Since Chrome 21. */ declare namespace chrome.events { - /** Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */ + /** Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */ interface UrlFilter { - /** Optional. Matches if the scheme of the URL is equal to any of the schemes specified in the array. */ + /** Optional. Matches if the scheme of the URL is equal to any of the schemes specified in the array. */ schemes?: string[]; - /** - * Optional. - * Since Chrome 23. - * Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. - */ + /** + * Optional. + * Since Chrome 23. + * Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. + */ urlMatches?: string; - /** Optional. Matches if the path segment of the URL contains a specified string. */ + /** Optional. Matches if the path segment of the URL contains a specified string. */ pathContains?: string; - /** Optional. Matches if the host name of the URL ends with a specified string. */ + /** Optional. Matches if the host name of the URL ends with a specified string. */ hostSuffix?: string; - /** Optional. Matches if the host name of the URL starts with a specified string. */ + /** Optional. Matches if the host name of the URL starts with a specified string. */ hostPrefix?: string; - /** Optional. Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name. */ + /** Optional. Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name. */ hostContains?: string; - /** Optional. Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number. */ + /** Optional. Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number. */ urlContains?: string; - /** Optional. Matches if the query segment of the URL ends with a specified string. */ + /** Optional. Matches if the query segment of the URL ends with a specified string. */ querySuffix?: string; - /** Optional. Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number. */ + /** Optional. Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number. */ urlPrefix?: string; - /** Optional. Matches if the host name of the URL is equal to a specified string. */ + /** Optional. Matches if the host name of the URL is equal to a specified string. */ hostEquals?: string; - /** Optional. Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number. */ + /** Optional. Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number. */ urlEquals?: string; - /** Optional. Matches if the query segment of the URL contains a specified string. */ + /** Optional. Matches if the query segment of the URL contains a specified string. */ queryContains?: string; - /** Optional. Matches if the path segment of the URL starts with a specified string. */ + /** Optional. Matches if the path segment of the URL starts with a specified string. */ pathPrefix?: string; - /** Optional. Matches if the path segment of the URL is equal to a specified string. */ + /** Optional. Matches if the path segment of the URL is equal to a specified string. */ pathEquals?: string; - /** Optional. Matches if the path segment of the URL ends with a specified string. */ + /** Optional. Matches if the path segment of the URL ends with a specified string. */ pathSuffix?: string; - /** Optional. Matches if the query segment of the URL is equal to a specified string. */ + /** Optional. Matches if the query segment of the URL is equal to a specified string. */ queryEquals?: string; - /** Optional. Matches if the query segment of the URL starts with a specified string. */ + /** Optional. Matches if the query segment of the URL starts with a specified string. */ queryPrefix?: string; - /** Optional. Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number. */ + /** Optional. Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number. */ urlSuffix?: string; - /** Optional. Matches if the port of the URL is contained in any of the specified port lists. For example [80, 443, [1000, 1200]] matches all requests on port 80, 443 and in the range 1000-1200. */ + /** Optional. Matches if the port of the URL is contained in any of the specified port lists. For example [80, 443, [1000, 1200]] matches all requests on port 80, 443 and in the range 1000-1200. */ ports?: any[]; - /** - * Optional. - * Since Chrome 28. - * Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. - */ - originAndPathMatches?: string; + /** + * Optional. + * Since Chrome 28. + * Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the RE2 syntax. + */ + originAndPathMatches?: string; } - /** An object which allows the addition and removal of listeners for a Chrome event. */ + /** An object which allows the addition and removal of listeners for a Chrome event. */ interface Event { - /** - * Registers an event listener callback to an event. - * @param callback Called when an event occurs. The parameters of this function depend on the type of event. - * The callback parameter should be a function that looks like this: - * function() {...}; - */ + /** + * Registers an event listener callback to an event. + * @param callback Called when an event occurs. The parameters of this function depend on the type of event. + * The callback parameter should be a function that looks like this: + * function() {...}; + */ addListener(callback: T): void; - /** - * Returns currently registered rules. - * @param callback Called with registered rules. - * The callback parameter should be a function that looks like this: - * function(array of Rule rules) {...}; - * Parameter rules: Rules that were registered, the optional parameters are filled with values. - */ + /** + * Returns currently registered rules. + * @param callback Called with registered rules. + * The callback parameter should be a function that looks like this: + * function(array of Rule rules) {...}; + * Parameter rules: Rules that were registered, the optional parameters are filled with values. + */ getRules(callback: (rules: Rule[]) => void): void; - /** - * Returns currently registered rules. - * @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are returned. - * @param callback Called with registered rules. - * The callback parameter should be a function that looks like this: - * function(array of Rule rules) {...}; - * Parameter rules: Rules that were registered, the optional parameters are filled with values. - */ + /** + * Returns currently registered rules. + * @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are returned. + * @param callback Called with registered rules. + * The callback parameter should be a function that looks like this: + * function(array of Rule rules) {...}; + * Parameter rules: Rules that were registered, the optional parameters are filled with values. + */ getRules(ruleIdentifiers: string[], callback: (rules: Rule[]) => void): void; /** - * @param callback Listener whose registration status shall be tested. - */ + * @param callback Listener whose registration status shall be tested. + */ hasListener(callback: T): boolean; - /** - * Unregisters currently registered rules. - * @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are unregistered. - * @param callback Called when rules were unregistered. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Unregisters currently registered rules. + * @param ruleIdentifiers If an array is passed, only rules with identifiers contained in this array are unregistered. + * @param callback Called when rules were unregistered. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ removeRules(ruleIdentifiers?: string[], callback?: () => void): void; - /** - * Unregisters currently registered rules. - * @param callback Called when rules were unregistered. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Unregisters currently registered rules. + * @param callback Called when rules were unregistered. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ removeRules(callback?: () => void): void; - /** - * Registers rules to handle events. - * @param rules Rules to be registered. These do not replace previously registered rules. - * @param callback Called with registered rules. - * If you specify the callback parameter, it should be a function that looks like this: - * function(array of Rule rules) {...}; - * Parameter rules: Rules that were registered, the optional parameters are filled with values. - */ + /** + * Registers rules to handle events. + * @param rules Rules to be registered. These do not replace previously registered rules. + * @param callback Called with registered rules. + * If you specify the callback parameter, it should be a function that looks like this: + * function(array of Rule rules) {...}; + * Parameter rules: Rules that were registered, the optional parameters are filled with values. + */ addRules(rules: Rule[], callback?: (rules: Rule[]) => void): void; - /** - * Deregisters an event listener callback from an event. - * @param callback Listener that shall be unregistered. - * The callback parameter should be a function that looks like this: - * function() {...}; - */ + /** + * Deregisters an event listener callback from an event. + * @param callback Listener that shall be unregistered. + * The callback parameter should be a function that looks like this: + * function() {...}; + */ removeListener(callback: T): void; hasListeners(): boolean; } - /** Description of a declarative rule for handling events. */ + /** Description of a declarative rule for handling events. */ interface Rule { - /** Optional. Optional priority of this rule. Defaults to 100. */ + /** Optional. Optional priority of this rule. Defaults to 100. */ priority?: number; - /** List of conditions that can trigger the actions. */ + /** List of conditions that can trigger the actions. */ conditions: any[]; - /** Optional. Optional identifier that allows referencing this rule. */ + /** Optional. Optional identifier that allows referencing this rule. */ id?: string; - /** List of actions that are triggered if one of the condtions is fulfilled. */ + /** List of actions that are triggered if one of the condtions is fulfilled. */ actions: any[]; - /** - * Optional. - * Since Chrome 28. - * Tags can be used to annotate rules and perform operations on sets of rules. - */ - tags?: string[]; + /** + * Optional. + * Since Chrome 28. + * Tags can be used to annotate rules and perform operations on sets of rules. + */ + tags?: string[]; } } @@ -2436,90 +2436,90 @@ declare namespace chrome.events { */ declare namespace chrome.extension { interface FetchProperties { - /** Optional. The window to restrict the search to. If omitted, returns all views. */ + /** Optional. The window to restrict the search to. If omitted, returns all views. */ windowId?: number; - /** Optional. The type of view to get. If omitted, returns all views (including background pages and tabs). Valid values: 'tab', 'notification', 'popup'. */ + /** Optional. The type of view to get. If omitted, returns all views (including background pages and tabs). Valid values: 'tab', 'notification', 'popup'. */ type?: string; } interface LastError { - /** Description of the error that has taken place. */ + /** Description of the error that has taken place. */ message: string; } - interface OnRequestEvent extends chrome.events.Event<((request: any, sender: runtime.MessageSender, sendResponse: (response: any) => void) => void) | ((sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)> {} + interface OnRequestEvent extends chrome.events.Event<((request: any, sender: runtime.MessageSender, sendResponse: (response: any) => void) => void) | ((sender: runtime.MessageSender, sendResponse: (response: any) => void) => void)> {} - /** - * Since Chrome 7. - * True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. The latter only applies to extensions with 'split' incognito_behavior. - */ + /** + * Since Chrome 7. + * True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. The latter only applies to extensions with 'split' incognito_behavior. + */ var inIncognitoContext: boolean; - /** Set for the lifetime of a callback if an ansychronous extension api has resulted in an error. If no error has occured lastError will be undefined. */ + /** Set for the lifetime of a callback if an ansychronous extension api has resulted in an error. If no error has occured lastError will be undefined. */ var lastError: LastError; - /** Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page. */ + /** Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page. */ export function getBackgroundPage(): Window | null; - /** - * Converts a relative path within an extension install directory to a fully-qualified URL. - * @param path A path to a resource within an extension expressed relative to its install directory. - */ + /** + * Converts a relative path within an extension install directory to a fully-qualified URL. + * @param path A path to a resource within an extension expressed relative to its install directory. + */ export function getURL(path: string): string; - /** - * Sets the value of the ap CGI parameter used in the extension's update URL. This value is ignored for extensions that are hosted in the Chrome Extension Gallery. - * Since Chrome 9. - */ + /** + * Sets the value of the ap CGI parameter used in the extension's update URL. This value is ignored for extensions that are hosted in the Chrome Extension Gallery. + * Since Chrome 9. + */ export function setUpdateUrlData(data: string): void; - /** Returns an array of the JavaScript 'window' objects for each of the pages running inside the current extension. */ + /** Returns an array of the JavaScript 'window' objects for each of the pages running inside the current extension. */ export function getViews(fetchProperties?: FetchProperties): Window[]; - /** - * Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox. - * Since Chrome 12. - * @param callback The callback parameter should be a function that looks like this: - * function(boolean isAllowedAccess) {...}; - * Parameter isAllowedAccess: True if the extension can access the 'file://' scheme, false otherwise. - */ + /** + * Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox. + * Since Chrome 12. + * @param callback The callback parameter should be a function that looks like this: + * function(boolean isAllowedAccess) {...}; + * Parameter isAllowedAccess: True if the extension can access the 'file://' scheme, false otherwise. + */ export function isAllowedFileSchemeAccess(callback: (isAllowedAccess: boolean) => void): void; - /** - * Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox. - * Since Chrome 12. - * @param callback The callback parameter should be a function that looks like this: - * function(boolean isAllowedAccess) {...}; - * Parameter isAllowedAccess: True if the extension has access to Incognito mode, false otherwise. - */ + /** + * Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox. + * Since Chrome 12. + * @param callback The callback parameter should be a function that looks like this: + * function(boolean isAllowedAccess) {...}; + * Parameter isAllowedAccess: True if the extension has access to Incognito mode, false otherwise. + */ export function isAllowedIncognitoAccess(callback: (isAllowedAccess: boolean) => void): void; - /** - * Sends a single request to other listeners within the extension. Similar to runtime.connect, but only sends a single request with an optional response. The extension.onRequest event is fired in each page of the extension. - * @deprecated Deprecated since Chrome 33. Please use runtime.sendMessage. - * @param extensionId The extension ID of the extension you want to connect to. If omitted, default is your own extension. - * @param responseCallback If you specify the responseCallback parameter, it should be a function that looks like this: - * function(any response) {...}; - * Parameter response: The JSON response object sent by the handler of the request. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message. - */ - export function sendRequest(extensionId: string, request: any, responseCallback?: (response: any) => void): void; - /** - * Sends a single request to other listeners within the extension. Similar to runtime.connect, but only sends a single request with an optional response. The extension.onRequest event is fired in each page of the extension. - * @deprecated Deprecated since Chrome 33. Please use runtime.sendMessage. - * @param responseCallback If you specify the responseCallback parameter, it should be a function that looks like this: - * function(any response) {...}; - * Parameter response: The JSON response object sent by the handler of the request. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message. - */ - export function sendRequest(request: any, responseCallback?: (response: any) => void): void; - /** - * Returns an array of the JavaScript 'window' objects for each of the tabs running inside the current extension. If windowId is specified, returns only the 'window' objects of tabs attached to the specified window. - * @deprecated Deprecated since Chrome 33. Please use extension.getViews {type: "tab"}. - */ - export function getExtensionTabs(windowId?: number): Window[]; + /** + * Sends a single request to other listeners within the extension. Similar to runtime.connect, but only sends a single request with an optional response. The extension.onRequest event is fired in each page of the extension. + * @deprecated Deprecated since Chrome 33. Please use runtime.sendMessage. + * @param extensionId The extension ID of the extension you want to connect to. If omitted, default is your own extension. + * @param responseCallback If you specify the responseCallback parameter, it should be a function that looks like this: + * function(any response) {...}; + * Parameter response: The JSON response object sent by the handler of the request. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message. + */ + export function sendRequest(extensionId: string, request: any, responseCallback?: (response: any) => void): void; + /** + * Sends a single request to other listeners within the extension. Similar to runtime.connect, but only sends a single request with an optional response. The extension.onRequest event is fired in each page of the extension. + * @deprecated Deprecated since Chrome 33. Please use runtime.sendMessage. + * @param responseCallback If you specify the responseCallback parameter, it should be a function that looks like this: + * function(any response) {...}; + * Parameter response: The JSON response object sent by the handler of the request. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message. + */ + export function sendRequest(request: any, responseCallback?: (response: any) => void): void; + /** + * Returns an array of the JavaScript 'window' objects for each of the tabs running inside the current extension. If windowId is specified, returns only the 'window' objects of tabs attached to the specified window. + * @deprecated Deprecated since Chrome 33. Please use extension.getViews {type: "tab"}. + */ + export function getExtensionTabs(windowId?: number): Window[]; - /** - * Fired when a request is sent from either an extension process or a content script. - * @deprecated Deprecated since Chrome 33. Please use runtime.onMessage. - */ - var onRequest: OnRequestEvent; - /** - * Fired when a request is sent from another extension. - * @deprecated Deprecated since Chrome 33. Please use runtime.onMessageExternal. - */ - var onRequestExternal: OnRequestEvent; + /** + * Fired when a request is sent from either an extension process or a content script. + * @deprecated Deprecated since Chrome 33. Please use runtime.onMessage. + */ + var onRequest: OnRequestEvent; + /** + * Fired when a request is sent from another extension. + * @deprecated Deprecated since Chrome 33. Please use runtime.onMessageExternal. + */ + var onRequestExternal: OnRequestEvent; } //////////////////// @@ -2533,45 +2533,45 @@ declare namespace chrome.extension { */ declare namespace chrome.fileBrowserHandler { interface SelectionParams { - /** - * Optional. - * List of file extensions that the selected file can have. The list is also used to specify what files to be shown in the select file dialog. Files with the listed extensions are only shown in the dialog. Extensions should not include the leading '.'. Example: ['jpg', 'png'] - * Since Chrome 23. - */ + /** + * Optional. + * List of file extensions that the selected file can have. The list is also used to specify what files to be shown in the select file dialog. Files with the listed extensions are only shown in the dialog. Extensions should not include the leading '.'. Example: ['jpg', 'png'] + * Since Chrome 23. + */ allowedFileExtensions?: string[]; - /** Suggested name for the file. */ + /** Suggested name for the file. */ suggestedName: string; } interface SelectionResult { - /** Optional. Selected file entry. It will be null if a file hasn't been selected. */ + /** Optional. Selected file entry. It will be null if a file hasn't been selected. */ entry?: Object | null; - /** Whether the file has been selected. */ + /** Whether the file has been selected. */ success: boolean; } - /** Event details payload for fileBrowserHandler.onExecute event. */ + /** Event details payload for fileBrowserHandler.onExecute event. */ interface FileHandlerExecuteEventDetails { - /** Optional. The ID of the tab that raised this event. Tab IDs are unique within a browser session. */ + /** Optional. The ID of the tab that raised this event. Tab IDs are unique within a browser session. */ tab_id?: number; - /** Array of Entry instances representing files that are targets of this action (selected in ChromeOS file browser). */ + /** Array of Entry instances representing files that are targets of this action (selected in ChromeOS file browser). */ entries: any[]; } interface FileBrowserHandlerExecuteEvent extends chrome.events.Event<(id: string, details: FileHandlerExecuteEventDetails) => void> {} - /** - * Prompts user to select file path under which file should be saved. When the file is selected, file access permission required to use the file (read, write and create) are granted to the caller. The file will not actually get created during the function call, so function caller must ensure its existence before using it. The function has to be invoked with a user gesture. - * Since Chrome 21. - * @param selectionParams Parameters that will be used while selecting the file. - * @param callback Function called upon completion. - * The callback parameter should be a function that looks like this: - * function(object result) {...}; - * Parameter result: Result of the method. - */ - export function selectFile(selectionParams: SelectionParams, callback: (result: SelectionResult) => void): void; + /** + * Prompts user to select file path under which file should be saved. When the file is selected, file access permission required to use the file (read, write and create) are granted to the caller. The file will not actually get created during the function call, so function caller must ensure its existence before using it. The function has to be invoked with a user gesture. + * Since Chrome 21. + * @param selectionParams Parameters that will be used while selecting the file. + * @param callback Function called upon completion. + * The callback parameter should be a function that looks like this: + * function(object result) {...}; + * Parameter result: Result of the method. + */ + export function selectFile(selectionParams: SelectionParams, callback: (result: SelectionResult) => void): void; - /** Fired when file system action is executed from ChromeOS file browser. */ + /** Fired when file system action is executed from ChromeOS file browser. */ var onExecute: FileBrowserHandlerExecuteEvent; } @@ -2585,346 +2585,346 @@ declare namespace chrome.fileBrowserHandler { * Important: This API works only on Chrome OS. */ declare namespace chrome.fileSystemProvider { - interface OpenedFileInfo { - /** A request ID to be be used by consecutive read/write and close requests. */ - openRequestId: number; - /** The path of the opened file. */ - filePath: string; - /** Whether the file was opened for reading or writing. */ - mode: string; - } + interface OpenedFileInfo { + /** A request ID to be be used by consecutive read/write and close requests. */ + openRequestId: number; + /** The path of the opened file. */ + filePath: string; + /** Whether the file was opened for reading or writing. */ + mode: string; + } - interface FileWatchersInfo { - /** The path of the entry being observed. */ - entryPath: string; - /** Whether watching should include all child entries recursively. It can be true for directories only. */ - recursive: boolean; - /** Optional. Tag used by the last notification for the watcher. */ - lastTag?: string; - } + interface FileWatchersInfo { + /** The path of the entry being observed. */ + entryPath: string; + /** Whether watching should include all child entries recursively. It can be true for directories only. */ + recursive: boolean; + /** Optional. Tag used by the last notification for the watcher. */ + lastTag?: string; + } - interface EntryMetadata { - /** True if it is a directory. */ - isDirectory: boolean; - /** Name of this entry (not full path name). Must not contain '/'. For root it must be empty. */ - name: string; - /** File size in bytes. */ - size: number; - /** The last modified time of this entry. */ - modificationTime: Date; - /** Optional. Mime type for the entry. */ - mimeType?: string; - /** Optional. Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most 32 KB in size. Optional, but can be provided only when explicitly requested by the onGetMetadataRequested event. */ - thumbnail?: string; - } + interface EntryMetadata { + /** True if it is a directory. */ + isDirectory: boolean; + /** Name of this entry (not full path name). Must not contain '/'. For root it must be empty. */ + name: string; + /** File size in bytes. */ + size: number; + /** The last modified time of this entry. */ + modificationTime: Date; + /** Optional. Mime type for the entry. */ + mimeType?: string; + /** Optional. Thumbnail image as a data URI in either PNG, JPEG or WEBP format, at most 32 KB in size. Optional, but can be provided only when explicitly requested by the onGetMetadataRequested event. */ + thumbnail?: string; + } - interface FileSystemInfo { - /** The identifier of the file system. */ - fileSystemId: string; - /** A human-readable name for the file system. */ - displayName: string; - /** Whether the file system supports operations which may change contents of the file system (such as creating, deleting or writing to files). */ - writable: boolean; - /** - * The maximum number of files that can be opened at once. If 0, then not limited. - * @since Since Chrome 42. - */ - openedFilesLimit: number; - /** - * List of currently opened files. - * @since Since Chrome 42. - */ - openedFiles: OpenedFileInfo[]; - /** - * Optional. - * Whether the file system supports the tag field for observing directories. - * @since Since Chrome 45. Warning: this is the current Beta channel. - */ - supportsNotifyTag?: boolean; - /** - * List of watchers. - * @since Since Chrome 45. Warning: this is the current Beta channel. - */ - watchers: FileWatchersInfo[]; - } + interface FileSystemInfo { + /** The identifier of the file system. */ + fileSystemId: string; + /** A human-readable name for the file system. */ + displayName: string; + /** Whether the file system supports operations which may change contents of the file system (such as creating, deleting or writing to files). */ + writable: boolean; + /** + * The maximum number of files that can be opened at once. If 0, then not limited. + * @since Since Chrome 42. + */ + openedFilesLimit: number; + /** + * List of currently opened files. + * @since Since Chrome 42. + */ + openedFiles: OpenedFileInfo[]; + /** + * Optional. + * Whether the file system supports the tag field for observing directories. + * @since Since Chrome 45. Warning: this is the current Beta channel. + */ + supportsNotifyTag?: boolean; + /** + * List of watchers. + * @since Since Chrome 45. Warning: this is the current Beta channel. + */ + watchers: FileWatchersInfo[]; + } - /** @since Since Chrome 45. Warning: this is the current Beta channel. */ - interface GetActionsRequestedOptions { - /** The identifier of the file system related to this operation. */ - fileSystemId: string; - /** The unique identifier of this request. */ - requestId: number; - /** The path of the entry to return the list of actions for. */ - entryPath: string; - } + /** @since Since Chrome 45. Warning: this is the current Beta channel. */ + interface GetActionsRequestedOptions { + /** The identifier of the file system related to this operation. */ + fileSystemId: string; + /** The unique identifier of this request. */ + requestId: number; + /** The path of the entry to return the list of actions for. */ + entryPath: string; + } - /** @since Since Chrome 45. Warning: this is the current Beta channel. */ - interface Action { - /** The identifier of the action. Any string or CommonActionId for common actions. */ - id: string; - /** Optional. The title of the action. It may be ignored for common actions. */ - title?: string; - } + /** @since Since Chrome 45. Warning: this is the current Beta channel. */ + interface Action { + /** The identifier of the action. Any string or CommonActionId for common actions. */ + id: string; + /** Optional. The title of the action. It may be ignored for common actions. */ + title?: string; + } - /** @since Since Chrome 45. Warning: this is the current Beta channel. */ - interface ExecuteActionRequestedOptions { - /** The identifier of the file system related to this operation. */ - fileSystemId: string; - /** The unique identifier of this request. */ - requestId: number; - /** The path of the entry to be used for the action. */ - entryPath: string; - /** The identifier of the action to be executed. */ - actionId: string; - } + /** @since Since Chrome 45. Warning: this is the current Beta channel. */ + interface ExecuteActionRequestedOptions { + /** The identifier of the file system related to this operation. */ + fileSystemId: string; + /** The unique identifier of this request. */ + requestId: number; + /** The path of the entry to be used for the action. */ + entryPath: string; + /** The identifier of the action to be executed. */ + actionId: string; + } - interface MountOptions { - /** The string indentifier of the file system. Must be unique per each extension. */ - fileSystemId: string; - /** A human-readable name for the file system. */ - displayName: string; - /** Optional. Whether the file system supports operations which may change contents of the file system (such as creating, deleting or writing to files). */ - writable?: boolean; - /** - * Optional. - * The maximum number of files that can be opened at once. If not specified, or 0, then not limited. - * @since Since Chrome 41. - */ - openedFilesLimit?: number; - /** - * Optional. - * Whether the file system supports the tag field for observed directories. - * @since Since Chrome 45. Warning: this is the current Beta channel. - */ - supportsNotifyTag?: boolean; - } + interface MountOptions { + /** The string indentifier of the file system. Must be unique per each extension. */ + fileSystemId: string; + /** A human-readable name for the file system. */ + displayName: string; + /** Optional. Whether the file system supports operations which may change contents of the file system (such as creating, deleting or writing to files). */ + writable?: boolean; + /** + * Optional. + * The maximum number of files that can be opened at once. If not specified, or 0, then not limited. + * @since Since Chrome 41. + */ + openedFilesLimit?: number; + /** + * Optional. + * Whether the file system supports the tag field for observed directories. + * @since Since Chrome 45. Warning: this is the current Beta channel. + */ + supportsNotifyTag?: boolean; + } - interface UnmountOptions { - /** The identifier of the file system to be unmounted. */ - fileSystemId: string; - } + interface UnmountOptions { + /** The identifier of the file system to be unmounted. */ + fileSystemId: string; + } - interface NotificationChange { - /** The path of the changed entry. */ - entryPath: string; - /** The type of the change which happened to the entry. */ - changeType: string; - } + interface NotificationChange { + /** The path of the changed entry. */ + entryPath: string; + /** The type of the change which happened to the entry. */ + changeType: string; + } - interface NotificationOptions { - /** The identifier of the file system related to this change. */ - fileSystemId: string; - /** The path of the observed entry. */ - observedPath: string; - /** Mode of the observed entry. */ - recursive: boolean; - /** The type of the change which happened to the observed entry. If it is DELETED, then the observed entry will be automatically removed from the list of observed entries. */ - changeType: string; - /** Optional. List of changes to entries within the observed directory (including the entry itself) */ - changes?: NotificationChange[]; - /** Optional. Tag for the notification. Required if the file system was mounted with the supportsNotifyTag option. Note, that this flag is necessary to provide notifications about changes which changed even when the system was shutdown. */ - tag?: string; - } + interface NotificationOptions { + /** The identifier of the file system related to this change. */ + fileSystemId: string; + /** The path of the observed entry. */ + observedPath: string; + /** Mode of the observed entry. */ + recursive: boolean; + /** The type of the change which happened to the observed entry. If it is DELETED, then the observed entry will be automatically removed from the list of observed entries. */ + changeType: string; + /** Optional. List of changes to entries within the observed directory (including the entry itself) */ + changes?: NotificationChange[]; + /** Optional. Tag for the notification. Required if the file system was mounted with the supportsNotifyTag option. Note, that this flag is necessary to provide notifications about changes which changed even when the system was shutdown. */ + tag?: string; + } - interface RequestedEventOptions { - /** The identifier of the file system related to this operation. */ - fileSystemId: string; - /** The unique identifier of this request. */ - requestId: number; - } + interface RequestedEventOptions { + /** The identifier of the file system related to this operation. */ + fileSystemId: string; + /** The unique identifier of this request. */ + requestId: number; + } - interface EntryPathRequestedEventOptions extends RequestedEventOptions { - /** The path of the entry to which this operation is related to. */ - entryPath: string; - } + interface EntryPathRequestedEventOptions extends RequestedEventOptions { + /** The path of the entry to which this operation is related to. */ + entryPath: string; + } - interface MetadataRequestedEventOptions extends EntryPathRequestedEventOptions { - /** Set to true if the thumbnail is requested. */ - thumbnail: boolean; - } + interface MetadataRequestedEventOptions extends EntryPathRequestedEventOptions { + /** Set to true if the thumbnail is requested. */ + thumbnail: boolean; + } - interface DirectoryPathRequestedEventOptions extends RequestedEventOptions { - /** The path of the directory which is to be operated on. */ - directoryPath: string; - } + interface DirectoryPathRequestedEventOptions extends RequestedEventOptions { + /** The path of the directory which is to be operated on. */ + directoryPath: string; + } - interface FilePathRequestedEventOptions extends RequestedEventOptions { - /** The path of the entry for the operation */ - filePath: string; - } + interface FilePathRequestedEventOptions extends RequestedEventOptions { + /** The path of the entry for the operation */ + filePath: string; + } - interface OpenFileRequestedEventOptions extends FilePathRequestedEventOptions { - /** Whether the file will be used for reading or writing. */ - mode: string; - } + interface OpenFileRequestedEventOptions extends FilePathRequestedEventOptions { + /** Whether the file will be used for reading or writing. */ + mode: string; + } - interface OpenedFileRequestedEventOptions extends RequestedEventOptions { - /** A request ID used to open the file. */ - openRequestId: number; - } + interface OpenedFileRequestedEventOptions extends RequestedEventOptions { + /** A request ID used to open the file. */ + openRequestId: number; + } - interface OpenedFileOffsetRequestedEventOptions extends OpenedFileRequestedEventOptions { - /** Position in the file (in bytes) to start reading from. */ - offset: number; - /** Number of bytes to be returned. */ - length: number; - } + interface OpenedFileOffsetRequestedEventOptions extends OpenedFileRequestedEventOptions { + /** Position in the file (in bytes) to start reading from. */ + offset: number; + /** Number of bytes to be returned. */ + length: number; + } - interface DirectoryPathRecursiveRequestedEventOptions extends DirectoryPathRequestedEventOptions { - /** Whether the operation is recursive (for directories only). */ - recursive: boolean; - } + interface DirectoryPathRecursiveRequestedEventOptions extends DirectoryPathRequestedEventOptions { + /** Whether the operation is recursive (for directories only). */ + recursive: boolean; + } - interface EntryPathRecursiveRequestedEventOptions extends EntryPathRequestedEventOptions { - /** Whether the operation is recursive (for directories only). */ - recursive: boolean; - } + interface EntryPathRecursiveRequestedEventOptions extends EntryPathRequestedEventOptions { + /** Whether the operation is recursive (for directories only). */ + recursive: boolean; + } - interface SourceTargetPathRequestedEventOptions extends RequestedEventOptions { - /** The source path for the operation. */ - sourcePath: string; - /** The destination path for the operation. */ - targetPath: string; - } + interface SourceTargetPathRequestedEventOptions extends RequestedEventOptions { + /** The source path for the operation. */ + sourcePath: string; + /** The destination path for the operation. */ + targetPath: string; + } - interface FilePathLengthRequestedEventOptions extends FilePathRequestedEventOptions { - /** Number of bytes to be retained after the operation completes. */ - length: number; - } + interface FilePathLengthRequestedEventOptions extends FilePathRequestedEventOptions { + /** Number of bytes to be retained after the operation completes. */ + length: number; + } - interface OpenedFileIoRequestedEventOptions extends OpenedFileRequestedEventOptions { - /** Position in the file (in bytes) to start operating from. */ - offset: number; - /** Buffer of bytes to be operated on the file. */ - data: ArrayBuffer; - } + interface OpenedFileIoRequestedEventOptions extends OpenedFileRequestedEventOptions { + /** Position in the file (in bytes) to start operating from. */ + offset: number; + /** Buffer of bytes to be operated on the file. */ + data: ArrayBuffer; + } - interface OperationRequestedEventOptions extends RequestedEventOptions { - /** An ID of the request to which this operation is related. */ - operationRequestId: number; - } + interface OperationRequestedEventOptions extends RequestedEventOptions { + /** An ID of the request to which this operation is related. */ + operationRequestId: number; + } - interface RequestedEvent extends chrome.events.Event<(options: RequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface RequestedEvent extends chrome.events.Event<(options: RequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface MetadataRequestedEvent extends chrome.events.Event<(options: MetadataRequestedEventOptions, successCallback: (metadata: EntryMetadata) => void, errorCallback: (error: string) => void) => void> {} + interface MetadataRequestedEvent extends chrome.events.Event<(options: MetadataRequestedEventOptions, successCallback: (metadata: EntryMetadata) => void, errorCallback: (error: string) => void) => void> {} - interface DirectoryPathRequestedEvent extends chrome.events.Event<(options: DirectoryPathRequestedEventOptions, successCallback: (entries: EntryMetadata[], hasMore: boolean) => void, errorCallback: (error: string) => void) => void> {} + interface DirectoryPathRequestedEvent extends chrome.events.Event<(options: DirectoryPathRequestedEventOptions, successCallback: (entries: EntryMetadata[], hasMore: boolean) => void, errorCallback: (error: string) => void) => void> {} - interface OpenFileRequestedEvent extends chrome.events.Event<(options: OpenFileRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface OpenFileRequestedEvent extends chrome.events.Event<(options: OpenFileRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OpenedFileRequestedEvent extends chrome.events.Event<(options: OpenedFileRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface OpenedFileRequestedEvent extends chrome.events.Event<(options: OpenedFileRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OpenedFileOffsetRequestedEvent extends chrome.events.Event<(options: OpenedFileOffsetRequestedEventOptions, successCallback: (data: ArrayBuffer, hasMore: boolean) => void, errorCallback: (error: string) => void) => void> {} + interface OpenedFileOffsetRequestedEvent extends chrome.events.Event<(options: OpenedFileOffsetRequestedEventOptions, successCallback: (data: ArrayBuffer, hasMore: boolean) => void, errorCallback: (error: string) => void) => void> {} - interface DirectoryPathRecursiveRequestedEvent extends chrome.events.Event<(options: DirectoryPathRecursiveRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface DirectoryPathRecursiveRequestedEvent extends chrome.events.Event<(options: DirectoryPathRecursiveRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface EntryPathRecursiveRequestedEvent extends chrome.events.Event<(options: EntryPathRecursiveRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface EntryPathRecursiveRequestedEvent extends chrome.events.Event<(options: EntryPathRecursiveRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface FilePathRequestedEvent extends chrome.events.Event<(options: FilePathRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface FilePathRequestedEvent extends chrome.events.Event<(options: FilePathRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface SourceTargetPathRequestedEvent extends chrome.events.Event<(options: SourceTargetPathRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface SourceTargetPathRequestedEvent extends chrome.events.Event<(options: SourceTargetPathRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface FilePathLengthRequestedEvent extends chrome.events.Event<(options: FilePathLengthRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface FilePathLengthRequestedEvent extends chrome.events.Event<(options: FilePathLengthRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OpenedFileIoRequestedEvent extends chrome.events.Event<(options: OpenedFileIoRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface OpenedFileIoRequestedEvent extends chrome.events.Event<(options: OpenedFileIoRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OperationRequestedEvent extends chrome.events.Event<(options: OperationRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface OperationRequestedEvent extends chrome.events.Event<(options: OperationRequestedEventOptions, successCallback: Function, errorCallback: (error: string) => void) => void> {} - interface OptionlessRequestedEvent extends chrome.events.Event<(successCallback: Function, errorCallback: (error: string) => void) => void> {} + interface OptionlessRequestedEvent extends chrome.events.Event<(successCallback: Function, errorCallback: (error: string) => void) => void> {} - /** - * Mounts a file system with the given fileSystemId and displayName. displayName will be shown in the left panel of Files.app. displayName can contain any characters including '/', but cannot be an empty string. displayName must be descriptive but doesn't have to be unique. The fileSystemId must not be an empty string. - * Depending on the type of the file system being mounted, the source option must be set appropriately. - * In case of an error, runtime.lastError will be set with a corresponding error code. - * @param callback A generic result callback to indicate success or failure. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function mount(options: MountOptions, callback?: () => void): void; - /** - * Unmounts a file system with the given fileSystemId. It must be called after onUnmountRequested is invoked. Also, the providing extension can decide to perform unmounting if not requested (eg. in case of lost connection, or a file error). - * In case of an error, runtime.lastError will be set with a corresponding error code. - * @param callback A generic result callback to indicate success or failure. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function unmount(options: UnmountOptions, callback?: () => void): void; - /** - * Returns all file systems mounted by the extension. - * @param callback Callback to receive the result of getAll function. - * The callback parameter should be a function that looks like this: - * function(array of FileSystemInfo fileSystems) {...}; - */ - export function getAll(callback: (fileSystems: FileSystemInfo[]) => void): void; - /** - * Returns information about a file system with the passed fileSystemId. - * @since Since Chrome 42. - * @param callback Callback to receive the result of get function. - * The callback parameter should be a function that looks like this: - * function(FileSystemInfo fileSystem) {...}; - */ - export function get(fileSystemId: string, callback: (fileSystem: FileSystemInfo) => void): void; - /** - * Notifies about changes in the watched directory at observedPath in recursive mode. If the file system is mounted with supportsNofityTag, then tag must be provided, and all changes since the last notification always reported, even if the system was shutdown. The last tag can be obtained with getAll. - * To use, the file_system_provider.notify manifest option must be set to true. - * Value of tag can be any string which is unique per call, so it's possible to identify the last registered notification. Eg. if the providing extension starts after a reboot, and the last registered notification's tag is equal to "123", then it should call notify for all changes which happened since the change tagged as "123". It cannot be an empty string. - * Not all providers are able to provide a tag, but if the file system has a changelog, then the tag can be eg. a change number, or a revision number. - * Note that if a parent directory is removed, then all descendant entries are also removed, and if they are watched, then the API must be notified about the fact. Also, if a directory is renamed, then all descendant entries are in fact removed, as there is no entry under their original paths anymore. - * In case of an error, runtime.lastError will be set will a corresponding error code. - * @param callback A generic result callback to indicate success or failure. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function notify(options: NotificationOptions, callback: () => void): void; + /** + * Mounts a file system with the given fileSystemId and displayName. displayName will be shown in the left panel of Files.app. displayName can contain any characters including '/', but cannot be an empty string. displayName must be descriptive but doesn't have to be unique. The fileSystemId must not be an empty string. + * Depending on the type of the file system being mounted, the source option must be set appropriately. + * In case of an error, runtime.lastError will be set with a corresponding error code. + * @param callback A generic result callback to indicate success or failure. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function mount(options: MountOptions, callback?: () => void): void; + /** + * Unmounts a file system with the given fileSystemId. It must be called after onUnmountRequested is invoked. Also, the providing extension can decide to perform unmounting if not requested (eg. in case of lost connection, or a file error). + * In case of an error, runtime.lastError will be set with a corresponding error code. + * @param callback A generic result callback to indicate success or failure. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function unmount(options: UnmountOptions, callback?: () => void): void; + /** + * Returns all file systems mounted by the extension. + * @param callback Callback to receive the result of getAll function. + * The callback parameter should be a function that looks like this: + * function(array of FileSystemInfo fileSystems) {...}; + */ + export function getAll(callback: (fileSystems: FileSystemInfo[]) => void): void; + /** + * Returns information about a file system with the passed fileSystemId. + * @since Since Chrome 42. + * @param callback Callback to receive the result of get function. + * The callback parameter should be a function that looks like this: + * function(FileSystemInfo fileSystem) {...}; + */ + export function get(fileSystemId: string, callback: (fileSystem: FileSystemInfo) => void): void; + /** + * Notifies about changes in the watched directory at observedPath in recursive mode. If the file system is mounted with supportsNofityTag, then tag must be provided, and all changes since the last notification always reported, even if the system was shutdown. The last tag can be obtained with getAll. + * To use, the file_system_provider.notify manifest option must be set to true. + * Value of tag can be any string which is unique per call, so it's possible to identify the last registered notification. Eg. if the providing extension starts after a reboot, and the last registered notification's tag is equal to "123", then it should call notify for all changes which happened since the change tagged as "123". It cannot be an empty string. + * Not all providers are able to provide a tag, but if the file system has a changelog, then the tag can be eg. a change number, or a revision number. + * Note that if a parent directory is removed, then all descendant entries are also removed, and if they are watched, then the API must be notified about the fact. Also, if a directory is renamed, then all descendant entries are in fact removed, as there is no entry under their original paths anymore. + * In case of an error, runtime.lastError will be set will a corresponding error code. + * @param callback A generic result callback to indicate success or failure. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function notify(options: NotificationOptions, callback: () => void): void; - /** Raised when unmounting for the file system with the fileSystemId identifier is requested. In the response, the unmount API method must be called together with successCallback. If unmounting is not possible (eg. due to a pending operation), then errorCallback must be called. */ - var onUnmountRequested: RequestedEvent; - /** Raised when metadata of a file or a directory at entryPath is requested. The metadata must be returned with the successCallback call. In case of an error, errorCallback must be called. */ - var onGetMetadataRequested: MetadataRequestedEvent; - /** Raised when contents of a directory at directoryPath are requested. The results must be returned in chunks by calling the successCallback several times. In case of an error, errorCallback must be called. */ - var onReadDirectoryRequested: DirectoryPathRequestedEvent; - /** Raised when opening a file at filePath is requested. If the file does not exist, then the operation must fail. Maximum number of files opened at once can be specified with MountOptions. */ - var onOpenFileRequested: OpenFileRequestedEvent; - /** Raised when opening a file previously opened with openRequestId is requested to be closed. */ - var onCloseFileRequested: OpenedFileRequestedEvent; - /** Raised when reading contents of a file opened previously with openRequestId is requested. The results must be returned in chunks by calling successCallback several times. In case of an error, errorCallback must be called. */ - var onReadFileRequested: OpenedFileOffsetRequestedEvent; - /** Raised when creating a directory is requested. The operation must fail with the EXISTS error if the target directory already exists. If recursive is true, then all of the missing directories on the directory path must be created. */ - var onCreateDirectoryRequested: DirectoryPathRecursiveRequestedEvent; - /** Raised when deleting an entry is requested. If recursive is true, and the entry is a directory, then all of the entries inside must be recursively deleted as well. */ - var onDeleteEntryRequested: EntryPathRecursiveRequestedEvent; - /** Raised when creating a file is requested. If the file already exists, then errorCallback must be called with the "EXISTS" error code. */ - var onCreateFileRequested: FilePathRequestedEvent; - /** Raised when copying an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called. */ - var onCopyEntryRequested: SourceTargetPathRequestedEvent; - /** Raised when moving an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called. */ - var onMoveEntryRequested: SourceTargetPathRequestedEvent; - /** Raised when truncating a file to a desired length is requested. If an error occurs, then errorCallback must be called. */ - var onTruncateRequested: FilePathLengthRequestedEvent; - /** Raised when writing contents to a file opened previously with openRequestId is requested. */ - var onWriteFileRequested: OpenedFileIoRequestedEvent; - /** Raised when aborting an operation with operationRequestId is requested. The operation executed with operationRequestId must be immediately stopped and successCallback of this abort request executed. If aborting fails, then errorCallback must be called. Note, that callbacks of the aborted operation must not be called, as they will be ignored. Despite calling errorCallback, the request may be forcibly aborted. */ - var onAbortRequested: OperationRequestedEvent; - /** - * Raised when showing a configuration dialog for fileSystemId is requested. If it's handled, the file_system_provider.configurable manfiest option must be set to true. - * @since Since Chrome 44. - */ - var onConfigureRequested: RequestedEvent; - /** - * Raised when showing a dialog for mounting a new file system is requested. If the extension/app is a file handler, then this event shouldn't be handled. Instead app.runtime.onLaunched should be handled in order to mount new file systems when a file is opened. For multiple mounts, the file_system_provider.multiple_mounts manifest option must be set to true. - * @since Since Chrome 44. - */ - var onMountRequested: OptionlessRequestedEvent; - /** - * Raised when setting a new directory watcher is requested. If an error occurs, then errorCallback must be called. - * @since Since Chrome 45. Warning: this is the current Beta channel. - */ - var onAddWatcherRequested: EntryPathRecursiveRequestedEvent; - /** - * Raised when the watcher should be removed. If an error occurs, then errorCallback must be called. - * @since Since Chrome 45. Warning: this is the current Beta channel. - */ - var onRemoveWatcherRequested: EntryPathRecursiveRequestedEvent; + /** Raised when unmounting for the file system with the fileSystemId identifier is requested. In the response, the unmount API method must be called together with successCallback. If unmounting is not possible (eg. due to a pending operation), then errorCallback must be called. */ + var onUnmountRequested: RequestedEvent; + /** Raised when metadata of a file or a directory at entryPath is requested. The metadata must be returned with the successCallback call. In case of an error, errorCallback must be called. */ + var onGetMetadataRequested: MetadataRequestedEvent; + /** Raised when contents of a directory at directoryPath are requested. The results must be returned in chunks by calling the successCallback several times. In case of an error, errorCallback must be called. */ + var onReadDirectoryRequested: DirectoryPathRequestedEvent; + /** Raised when opening a file at filePath is requested. If the file does not exist, then the operation must fail. Maximum number of files opened at once can be specified with MountOptions. */ + var onOpenFileRequested: OpenFileRequestedEvent; + /** Raised when opening a file previously opened with openRequestId is requested to be closed. */ + var onCloseFileRequested: OpenedFileRequestedEvent; + /** Raised when reading contents of a file opened previously with openRequestId is requested. The results must be returned in chunks by calling successCallback several times. In case of an error, errorCallback must be called. */ + var onReadFileRequested: OpenedFileOffsetRequestedEvent; + /** Raised when creating a directory is requested. The operation must fail with the EXISTS error if the target directory already exists. If recursive is true, then all of the missing directories on the directory path must be created. */ + var onCreateDirectoryRequested: DirectoryPathRecursiveRequestedEvent; + /** Raised when deleting an entry is requested. If recursive is true, and the entry is a directory, then all of the entries inside must be recursively deleted as well. */ + var onDeleteEntryRequested: EntryPathRecursiveRequestedEvent; + /** Raised when creating a file is requested. If the file already exists, then errorCallback must be called with the "EXISTS" error code. */ + var onCreateFileRequested: FilePathRequestedEvent; + /** Raised when copying an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called. */ + var onCopyEntryRequested: SourceTargetPathRequestedEvent; + /** Raised when moving an entry (recursively if a directory) is requested. If an error occurs, then errorCallback must be called. */ + var onMoveEntryRequested: SourceTargetPathRequestedEvent; + /** Raised when truncating a file to a desired length is requested. If an error occurs, then errorCallback must be called. */ + var onTruncateRequested: FilePathLengthRequestedEvent; + /** Raised when writing contents to a file opened previously with openRequestId is requested. */ + var onWriteFileRequested: OpenedFileIoRequestedEvent; + /** Raised when aborting an operation with operationRequestId is requested. The operation executed with operationRequestId must be immediately stopped and successCallback of this abort request executed. If aborting fails, then errorCallback must be called. Note, that callbacks of the aborted operation must not be called, as they will be ignored. Despite calling errorCallback, the request may be forcibly aborted. */ + var onAbortRequested: OperationRequestedEvent; + /** + * Raised when showing a configuration dialog for fileSystemId is requested. If it's handled, the file_system_provider.configurable manfiest option must be set to true. + * @since Since Chrome 44. + */ + var onConfigureRequested: RequestedEvent; + /** + * Raised when showing a dialog for mounting a new file system is requested. If the extension/app is a file handler, then this event shouldn't be handled. Instead app.runtime.onLaunched should be handled in order to mount new file systems when a file is opened. For multiple mounts, the file_system_provider.multiple_mounts manifest option must be set to true. + * @since Since Chrome 44. + */ + var onMountRequested: OptionlessRequestedEvent; + /** + * Raised when setting a new directory watcher is requested. If an error occurs, then errorCallback must be called. + * @since Since Chrome 45. Warning: this is the current Beta channel. + */ + var onAddWatcherRequested: EntryPathRecursiveRequestedEvent; + /** + * Raised when the watcher should be removed. If an error occurs, then errorCallback must be called. + * @since Since Chrome 45. Warning: this is the current Beta channel. + */ + var onRemoveWatcherRequested: EntryPathRecursiveRequestedEvent; } //////////////////// @@ -2936,58 +2936,58 @@ declare namespace chrome.fileSystemProvider { * Permissions: "fontSettings" */ declare namespace chrome.fontSettings { - /** Represents a font name. */ + /** Represents a font name. */ interface FontName { - /** The display name of the font. */ + /** The display name of the font. */ displayName: string; - /** The font ID. */ + /** The font ID. */ fontId: string; } interface DefaultFontSizeDetails { - /** The font size in pixels. */ + /** The font size in pixels. */ pixelSize: number; } interface FontDetails { - /** The generic font family for the font. */ + /** The generic font family for the font. */ genericFamily: string; - /** Optional. The script for the font. If omitted, the global script font setting is affected. */ + /** Optional. The script for the font. If omitted, the global script font setting is affected. */ script?: string; } interface FullFontDetails { - /** The generic font family for which the font setting has changed. */ + /** The generic font family for which the font setting has changed. */ genericFamily: string; - /** The level of control this extension has over the setting. */ + /** The level of control this extension has over the setting. */ levelOfControl: string; - /** Optional. The script code for which the font setting has changed. */ + /** Optional. The script code for which the font setting has changed. */ script?: string; - /** The font ID. See the description in getFont. */ + /** The font ID. See the description in getFont. */ fontId: string; } interface FontDetailsResult { - /** The level of control this extension has over the setting. */ + /** The level of control this extension has over the setting. */ levelOfControl: string; - /** The font ID. Rather than the literal font ID preference value, this may be the ID of the font that the system resolves the preference value to. So, fontId can differ from the font passed to setFont, if, for example, the font is not available on the system. The empty string signifies fallback to the global script font setting. */ + /** The font ID. Rather than the literal font ID preference value, this may be the ID of the font that the system resolves the preference value to. So, fontId can differ from the font passed to setFont, if, for example, the font is not available on the system. The empty string signifies fallback to the global script font setting. */ fontId: string; } interface FontSizeDetails { - /** The font size in pixels. */ + /** The font size in pixels. */ pixelSize: number; - /** The level of control this extension has over the setting. */ + /** The level of control this extension has over the setting. */ levelOfControl: string; } interface SetFontSizeDetails { - /** The font size in pixels. */ + /** The font size in pixels. */ pixelSize: number; } - interface SetFontDetails extends FontDetails { - /** The font ID. The empty string means to fallback to the global script font setting. */ + interface SetFontDetails extends FontDetails { + /** The font ID. The empty string means to fallback to the global script font setting. */ fontId: string; } @@ -2999,98 +2999,98 @@ declare namespace chrome.fontSettings { interface FontChangedEvent extends chrome.events.Event<(details: FullFontDetails) => void> {} - /** - * Sets the default font size. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Sets the default font size. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function setDefaultFontSize(details: DefaultFontSizeDetails, callback?: Function): void; - /** - * Gets the font for a given script and generic font family. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(object details) {...}; - */ + /** + * Gets the font for a given script and generic font family. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(object details) {...}; + */ export function getFont(details: FontDetails, callback?: (details: FontDetailsResult) => void): void; - /** - * Gets the default font size. - * @param details This parameter is currently unused. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(object details) {...}; - */ - export function getDefaultFontSize(details?: Object, callback?: (options: FontSizeDetails) => void): void; - /** - * Gets the minimum font size. - * @param details This parameter is currently unused. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(object details) {...}; - */ + /** + * Gets the default font size. + * @param details This parameter is currently unused. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(object details) {...}; + */ + export function getDefaultFontSize(details?: Object, callback?: (options: FontSizeDetails) => void): void; + /** + * Gets the minimum font size. + * @param details This parameter is currently unused. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(object details) {...}; + */ export function getMinimumFontSize(details?: FontSizeDetails, callback?: (options: FontSizeDetails) => void): void; - /** - * Sets the minimum font size. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Sets the minimum font size. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function setMinimumFontSize(details: SetFontSizeDetails, callback?: Function): void; - /** - * Gets the default size for fixed width fonts. - * @param details This parameter is currently unused. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(object details) {...}; - */ + /** + * Gets the default size for fixed width fonts. + * @param details This parameter is currently unused. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(object details) {...}; + */ export function getDefaultFixedFontSize(details?: Object, callback?: (details: FontSizeDetails) => void): void; - /** - * Clears the default font size set by this extension, if any. - * @param details This parameter is currently unused. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the default font size set by this extension, if any. + * @param details This parameter is currently unused. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function clearDefaultFontSize(details?: Object, callback?: Function): void; - /** - * Sets the default size for fixed width fonts. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Sets the default size for fixed width fonts. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function setDefaultFixedFontSize(details: SetFontSizeDetails, callback?: Function): void; - /** - * Clears the font set by this extension, if any. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the font set by this extension, if any. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function clearFont(details: FontDetails, callback?: Function): void; - /** - * Sets the font for a given script and generic font family. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(object details) {...}; - */ + /** + * Sets the font for a given script and generic font family. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(object details) {...}; + */ export function setFont(details: SetFontDetails, callback?: Function): void; - /** - * Clears the minimum font size set by this extension, if any. - * @param details This parameter is currently unused. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the minimum font size set by this extension, if any. + * @param details This parameter is currently unused. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function clearMinimumFontSize(details?: Object, callback?: Function): void; - /** - * Gets a list of fonts on the system. - * @param callback The callback parameter should be a function that looks like this: - * function(array of FontName results) {...}; - */ + /** + * Gets a list of fonts on the system. + * @param callback The callback parameter should be a function that looks like this: + * function(array of FontName results) {...}; + */ export function getFontList(callback: (results: FontName[]) => void): void; - /** - * Clears the default fixed font size set by this extension, if any. - * @param details This parameter is currently unused. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ + /** + * Clears the default fixed font size set by this extension, if any. + * @param details This parameter is currently unused. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ export function clearDefaultFixedFontSize(details: Object, callback?: Function): void; - /** Fired when the default fixed font size setting changes. */ + /** Fired when the default fixed font size setting changes. */ var onDefaultFixedFontSizeChanged: DefaultFixedFontSizeChangedEvent; - /** Fired when the default font size setting changes. */ + /** Fired when the default font size setting changes. */ var onDefaultFontSizeChanged: DefaultFontSizeChangedEvent; - /** Fired when the minimum font size setting changes. */ + /** Fired when the minimum font size setting changes. */ var onMinimumFontSizeChanged: MinimumFontSizeChangedEvent; - /** Fired when a font setting changes. */ + /** Fired when a font setting changes. */ var onFontChanged: FontChangedEvent; } @@ -3103,83 +3103,83 @@ declare namespace chrome.fontSettings { * Permissions: "gcm" */ declare namespace chrome.gcm { - interface OutgoingMessage { - /** The ID of the server to send the message to as assigned by Google API Console. */ - destinationId: string; - /** The ID of the message. It must be unique for each message in scope of the applications. See the Cloud Messaging documentation for advice for picking and handling an ID. */ - messageId: string; - /** Optional. Time-to-live of the message in seconds. If it is not possible to send the message within that time, an onSendError event will be raised. A time-to-live of 0 indicates that the message should be sent immediately or fail if it's not possible. The maximum and a default value of time-to-live is 86400 seconds (1 day). */ - timeToLive?: number; - /** Message data to send to the server. Case-insensitive goog. and google, as well as case-sensitive collapse_key are disallowed as key prefixes. Sum of all key/value pairs should not exceed gcm.MAX_MESSAGE_SIZE. */ - data: Object; - } + interface OutgoingMessage { + /** The ID of the server to send the message to as assigned by Google API Console. */ + destinationId: string; + /** The ID of the message. It must be unique for each message in scope of the applications. See the Cloud Messaging documentation for advice for picking and handling an ID. */ + messageId: string; + /** Optional. Time-to-live of the message in seconds. If it is not possible to send the message within that time, an onSendError event will be raised. A time-to-live of 0 indicates that the message should be sent immediately or fail if it's not possible. The maximum and a default value of time-to-live is 86400 seconds (1 day). */ + timeToLive?: number; + /** Message data to send to the server. Case-insensitive goog. and google, as well as case-sensitive collapse_key are disallowed as key prefixes. Sum of all key/value pairs should not exceed gcm.MAX_MESSAGE_SIZE. */ + data: Object; + } - interface IncomingMessage { - /** The message data. */ - data: Object; - /** - * Optional. - * The sender who issued the message. - * @since Since Chrome 41. - */ - from?: string; - /** - * Optional. - * The collapse key of a message. See Collapsible Messages section of Cloud Messaging documentation for details. - */ - collapseKey?: string; - } + interface IncomingMessage { + /** The message data. */ + data: Object; + /** + * Optional. + * The sender who issued the message. + * @since Since Chrome 41. + */ + from?: string; + /** + * Optional. + * The collapse key of a message. See Collapsible Messages section of Cloud Messaging documentation for details. + */ + collapseKey?: string; + } - interface GcmError { - /** The error message describing the problem. */ - errorMessage: string; - /** Optional. The ID of the message with this error, if error is related to a specific message. */ - messageId?: string; - /** Additional details related to the error, when available. */ - detail: Object; - } + interface GcmError { + /** The error message describing the problem. */ + errorMessage: string; + /** Optional. The ID of the message with this error, if error is related to a specific message. */ + messageId?: string; + /** Additional details related to the error, when available. */ + detail: Object; + } - interface MessageReceptionEvent extends chrome.events.Event<(message: IncomingMessage) => void> {} + interface MessageReceptionEvent extends chrome.events.Event<(message: IncomingMessage) => void> {} - interface MessageDeletionEvent extends chrome.events.Event<() => void> {} + interface MessageDeletionEvent extends chrome.events.Event<() => void> {} - interface GcmErrorEvent extends chrome.events.Event<(error: GcmError) => void> {} + interface GcmErrorEvent extends chrome.events.Event<(error: GcmError) => void> {} - /** The maximum size (in bytes) of all key/value pairs in a message. */ - var MAX_MESSAGE_SIZE: number; + /** The maximum size (in bytes) of all key/value pairs in a message. */ + var MAX_MESSAGE_SIZE: number; - /** - * Registers the application with GCM. The registration ID will be returned by the callback. If register is called again with the same list of senderIds, the same registration ID will be returned. - * @param senderIds A list of server IDs that are allowed to send messages to the application. It should contain at least one and no more than 100 sender IDs. - * @param callback Function called when registration completes. It should check runtime.lastError for error when registrationId is empty. - * The callback parameter should be a function that looks like this: - * function(string registrationId) {...}; - * Parameter registrationId: A registration ID assigned to the application by the GCM. - */ - export function register(senderIds: string[], callback: (registrationId: string) => void): void; - /** - * Unregisters the application from GCM. - * @param callback A function called after the unregistration completes. Unregistration was successful if runtime.lastError is not set. - * The callback parameter should be a function that looks like this: - * function() {...}; - */ - export function unregister(callback: () => void): void; - /** - * Sends a message according to its contents. - * @param message A message to send to the other party via GCM. - * @param callback A function called after the message is successfully queued for sending. runtime.lastError should be checked, to ensure a message was sent without problems. - * The callback parameter should be a function that looks like this: - * function(string messageId) {...}; - * Parameter messageId: The ID of the message that the callback was issued for. - */ - export function send(message: OutgoingMessage, callback: (messageId: string) => void): void; + /** + * Registers the application with GCM. The registration ID will be returned by the callback. If register is called again with the same list of senderIds, the same registration ID will be returned. + * @param senderIds A list of server IDs that are allowed to send messages to the application. It should contain at least one and no more than 100 sender IDs. + * @param callback Function called when registration completes. It should check runtime.lastError for error when registrationId is empty. + * The callback parameter should be a function that looks like this: + * function(string registrationId) {...}; + * Parameter registrationId: A registration ID assigned to the application by the GCM. + */ + export function register(senderIds: string[], callback: (registrationId: string) => void): void; + /** + * Unregisters the application from GCM. + * @param callback A function called after the unregistration completes. Unregistration was successful if runtime.lastError is not set. + * The callback parameter should be a function that looks like this: + * function() {...}; + */ + export function unregister(callback: () => void): void; + /** + * Sends a message according to its contents. + * @param message A message to send to the other party via GCM. + * @param callback A function called after the message is successfully queued for sending. runtime.lastError should be checked, to ensure a message was sent without problems. + * The callback parameter should be a function that looks like this: + * function(string messageId) {...}; + * Parameter messageId: The ID of the message that the callback was issued for. + */ + export function send(message: OutgoingMessage, callback: (messageId: string) => void): void; - /** Fired when a message is received through GCM. */ - var onMessage: MessageReceptionEvent; - /** Fired when a GCM server had to delete messages sent by an app server to the application. See Messages deleted event section of Cloud Messaging documentation for details on handling this event. */ - var onMessagesDeleted: MessageDeletionEvent; - /** Fired when it was not possible to send a message to the GCM server. */ - var onSendError: GcmErrorEvent; + /** Fired when a message is received through GCM. */ + var onMessage: MessageReceptionEvent; + /** Fired when a GCM server had to delete messages sent by an app server to the application. See Messages deleted event section of Cloud Messaging documentation for details on handling this event. */ + var onMessagesDeleted: MessageDeletionEvent; + /** Fired when it was not possible to send a message to the GCM server. */ + var onSendError: GcmErrorEvent; } //////////////////// @@ -3191,63 +3191,63 @@ declare namespace chrome.gcm { * Permissions: "history" */ declare namespace chrome.history { - /** An object encapsulating one visit to a URL. */ + /** An object encapsulating one visit to a URL. */ interface VisitItem { - /** The transition type for this visit from its referrer. */ + /** The transition type for this visit from its referrer. */ transition: string; - /** Optional. When this visit occurred, represented in milliseconds since the epoch. */ + /** Optional. When this visit occurred, represented in milliseconds since the epoch. */ visitTime?: number; - /** The unique identifier for this visit. */ + /** The unique identifier for this visit. */ visitId: string; - /** The visit ID of the referrer. */ + /** The visit ID of the referrer. */ referringVisitId: string; - /** The unique identifier for the item. */ + /** The unique identifier for the item. */ id: string; } - /** An object encapsulating one result of a history query. */ + /** An object encapsulating one result of a history query. */ interface HistoryItem { - /** Optional. The number of times the user has navigated to this page by typing in the address. */ + /** Optional. The number of times the user has navigated to this page by typing in the address. */ typedCount?: number; - /** Optional. The title of the page when it was last loaded. */ + /** Optional. The title of the page when it was last loaded. */ title?: string; - /** Optional. The URL navigated to by a user. */ + /** Optional. The URL navigated to by a user. */ url?: string; - /** Optional. When this page was last loaded, represented in milliseconds since the epoch. */ + /** Optional. When this page was last loaded, represented in milliseconds since the epoch. */ lastVisitTime?: number; - /** Optional. The number of times the user has navigated to this page. */ + /** Optional. The number of times the user has navigated to this page. */ visitCount?: number; - /** The unique identifier for the item. */ + /** The unique identifier for the item. */ id: string; } interface HistoryQuery { - /** A free-text query to the history service. Leave empty to retrieve all pages. */ + /** A free-text query to the history service. Leave empty to retrieve all pages. */ text: string; - /** Optional. The maximum number of results to retrieve. Defaults to 100. */ + /** Optional. The maximum number of results to retrieve. Defaults to 100. */ maxResults?: number; - /** Optional. Limit results to those visited after this date, represented in milliseconds since the epoch. */ + /** Optional. Limit results to those visited after this date, represented in milliseconds since the epoch. */ startTime?: number; - /** Optional. Limit results to those visited before this date, represented in milliseconds since the epoch. */ + /** Optional. Limit results to those visited before this date, represented in milliseconds since the epoch. */ endTime?: number; } interface Url { - /** The URL for the operation. It must be in the format as returned from a call to history.search. */ + /** The URL for the operation. It must be in the format as returned from a call to history.search. */ url: string; } interface Range { - /** Items added to history before this date, represented in milliseconds since the epoch. */ + /** Items added to history before this date, represented in milliseconds since the epoch. */ endTime: number; - /** Items added to history after this date, represented in milliseconds since the epoch. */ + /** Items added to history after this date, represented in milliseconds since the epoch. */ startTime: number; } interface RemovedResult { - /** True if all history was removed. If true, then urls will be empty. */ + /** True if all history was removed. If true, then urls will be empty. */ allHistory: boolean; - /** Optional. */ + /** Optional. */ urls?: string[]; } @@ -3255,46 +3255,46 @@ declare namespace chrome.history { interface HistoryVisitRemovedEvent extends chrome.events.Event<(removed: RemovedResult) => void> {} - /** - * Searches the history for the last visit time of each page matching the query. - * @param callback The callback parameter should be a function that looks like this: - * function(array of HistoryItem results) {...}; - */ + /** + * Searches the history for the last visit time of each page matching the query. + * @param callback The callback parameter should be a function that looks like this: + * function(array of HistoryItem results) {...}; + */ export function search(query: HistoryQuery, callback: (results: HistoryItem[]) => void): void; - /** - * Adds a URL to the history at the current time with a transition type of "link". - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function addUrl(details: Url, callback?: () => void): void; - /** - * Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range. - * @param callback The callback parameter should be a function that looks like this: - * function() {...}; - */ - export function deleteRange(range: Range, callback: () => void): void; - /** - * Deletes all items from the history. - * @param callback The callback parameter should be a function that looks like this: - * function() {...}; - */ - export function deleteAll(callback: () => void): void; - /** - * Retrieves information about visits to a URL. - * @param callback The callback parameter should be a function that looks like this: - * function(array of VisitItem results) {...}; - */ + /** + * Adds a URL to the history at the current time with a transition type of "link". + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function addUrl(details: Url, callback?: () => void): void; + /** + * Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range. + * @param callback The callback parameter should be a function that looks like this: + * function() {...}; + */ + export function deleteRange(range: Range, callback: () => void): void; + /** + * Deletes all items from the history. + * @param callback The callback parameter should be a function that looks like this: + * function() {...}; + */ + export function deleteAll(callback: () => void): void; + /** + * Retrieves information about visits to a URL. + * @param callback The callback parameter should be a function that looks like this: + * function(array of VisitItem results) {...}; + */ export function getVisits(details: Url, callback: (results: VisitItem[]) => void): void; - /** - * Removes all occurrences of the given URL from the history. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function deleteUrl(details: Url, callback?: () => void): void; + /** + * Removes all occurrences of the given URL from the history. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function deleteUrl(details: Url, callback?: () => void): void; - /** Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded. */ + /** Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded. */ var onVisited: HistoryVisitedEvent; - /** Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history. */ + /** Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history. */ var onVisitRemoved: HistoryVisitRemovedEvent; } @@ -3306,24 +3306,24 @@ declare namespace chrome.history { * @since Chrome 5. */ declare namespace chrome.i18n { - /** - * Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use i18n.getUILanguage. - * @param callback The callback parameter should be a function that looks like this: - * function(array of string languages) {...}; - * Parameter languages: Array of the accept languages of the browser, such as en-US,en,zh-CN - */ - export function getAcceptLanguages(callback: (languages: string[]) => void): void; - /** - * Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the getMessage() call is wrong — for example, messageName is not a string or the substitutions array has more than 9 elements — this method returns undefined. - * @param messageName The name of the message, as specified in the messages.json file. - * @param substitutions Optional. Up to 9 substitution strings, if the message requires any. - */ - export function getMessage(messageName: string, substitutions?: any): string; - /** - * Gets the browser UI language of the browser. This is different from i18n.getAcceptLanguages which returns the preferred user languages. - * @since Chrome 35. - */ - export function getUILanguage(): string; + /** + * Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use i18n.getUILanguage. + * @param callback The callback parameter should be a function that looks like this: + * function(array of string languages) {...}; + * Parameter languages: Array of the accept languages of the browser, such as en-US,en,zh-CN + */ + export function getAcceptLanguages(callback: (languages: string[]) => void): void; + /** + * Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the getMessage() call is wrong — for example, messageName is not a string or the substitutions array has more than 9 elements — this method returns undefined. + * @param messageName The name of the message, as specified in the messages.json file. + * @param substitutions Optional. Up to 9 substitution strings, if the message requires any. + */ + export function getMessage(messageName: string, substitutions?: any): string; + /** + * Gets the browser UI language of the browser. This is different from i18n.getAcceptLanguages which returns the preferred user languages. + * @since Chrome 35. + */ + export function getUILanguage(): string; } //////////////////// @@ -3335,114 +3335,114 @@ declare namespace chrome.i18n { * @since Chrome 29. */ declare namespace chrome.identity { - /** @since Chrome 32. */ - interface AccountInfo { - /** A unique identifier for the account. This ID will not change for the lifetime of the account. */ - id: string; - } + /** @since Chrome 32. */ + interface AccountInfo { + /** A unique identifier for the account. This ID will not change for the lifetime of the account. */ + id: string; + } - interface TokenDetails { - /** - * Optional. - * Fetching a token may require the user to sign-in to Chrome, or approve the application's requested scopes. If the interactive flag is true, getAuthToken will prompt the user as necessary. When the flag is false or omitted, getAuthToken will return failure any time a prompt would be required. - */ - interactive?: boolean; - /** - * Optional. - * The account ID whose token should be returned. If not specified, the primary account for the profile will be used. - * account is only supported when the "enable-new-profile-management" flag is set. - * @since Chrome 37. - */ - account?: AccountInfo; - /** - * Optional. - * A list of OAuth2 scopes to request. - * When the scopes field is present, it overrides the list of scopes specified in manifest.json. - * @since Chrome 37. - */ - scopes?: string[]; - } + interface TokenDetails { + /** + * Optional. + * Fetching a token may require the user to sign-in to Chrome, or approve the application's requested scopes. If the interactive flag is true, getAuthToken will prompt the user as necessary. When the flag is false or omitted, getAuthToken will return failure any time a prompt would be required. + */ + interactive?: boolean; + /** + * Optional. + * The account ID whose token should be returned. If not specified, the primary account for the profile will be used. + * account is only supported when the "enable-new-profile-management" flag is set. + * @since Chrome 37. + */ + account?: AccountInfo; + /** + * Optional. + * A list of OAuth2 scopes to request. + * When the scopes field is present, it overrides the list of scopes specified in manifest.json. + * @since Chrome 37. + */ + scopes?: string[]; + } - interface UserInfo { - /** An email address for the user account signed into the current profile. Empty if the user is not signed in or the identity.email manifest permission is not specified. */ - email: string; - /** A unique identifier for the account. This ID will not change for the lifetime of the account. Empty if the user is not signed in or (in M41+) the identity.email manifest permission is not specified. */ - id: string; - } + interface UserInfo { + /** An email address for the user account signed into the current profile. Empty if the user is not signed in or the identity.email manifest permission is not specified. */ + email: string; + /** A unique identifier for the account. This ID will not change for the lifetime of the account. Empty if the user is not signed in or (in M41+) the identity.email manifest permission is not specified. */ + id: string; + } - interface TokenInformation { - /** The specific token that should be removed from the cache. */ - token: string; - } + interface TokenInformation { + /** The specific token that should be removed from the cache. */ + token: string; + } - interface WebAuthFlowOptions { - /** The URL that initiates the auth flow. */ - url: string; - /** - * Optional. - * Whether to launch auth flow in interactive mode. - * Since some auth flows may immediately redirect to a result URL, launchWebAuthFlow hides its web view until the first navigation either redirects to the final URL, or finishes loading a page meant to be displayed. - * If the interactive flag is true, the window will be displayed when a page load completes. If the flag is false or omitted, launchWebAuthFlow will return with an error if the initial navigation does not complete the flow. - */ - interactive?: boolean; - } + interface WebAuthFlowOptions { + /** The URL that initiates the auth flow. */ + url: string; + /** + * Optional. + * Whether to launch auth flow in interactive mode. + * Since some auth flows may immediately redirect to a result URL, launchWebAuthFlow hides its web view until the first navigation either redirects to the final URL, or finishes loading a page meant to be displayed. + * If the interactive flag is true, the window will be displayed when a page load completes. If the flag is false or omitted, launchWebAuthFlow will return with an error if the initial navigation does not complete the flow. + */ + interactive?: boolean; + } - interface SignInChangeEvent extends chrome.events.Event<(account: AccountInfo, signedIn: boolean) => void> {} + interface SignInChangeEvent extends chrome.events.Event<(account: AccountInfo, signedIn: boolean) => void> {} - /** - * Retrieves a list of AccountInfo objects describing the accounts present on the profile. - * getAccounts is only supported on dev channel. - * Dev channel only. - */ - export function getAccounts(callback: (accounts: AccountInfo[]) => void): void; - /** - * Gets an OAuth2 access token using the client ID and scopes specified in the oauth2 section of manifest.json. - * The Identity API caches access tokens in memory, so it's ok to call getAuthToken non-interactively any time a token is required. The token cache automatically handles expiration. - * For a good user experience it is important interactive token requests are initiated by UI in your app explaining what the authorization is for. Failing to do this will cause your users to get authorization requests, or Chrome sign in screens if they are not signed in, with with no context. In particular, do not use getAuthToken interactively when your app is first launched. - * @param details Token options. - * @param callback Called with an OAuth2 access token as specified by the manifest, or undefined if there was an error. - * If you specify the callback parameter, it should be a function that looks like this: - * function(string token) {...}; - */ - export function getAuthToken(details: TokenDetails, callback?: (token: string) => void): void; - /** - * Retrieves email address and obfuscated gaia id of the user signed into a profile. - * This API is different from identity.getAccounts in two ways. The information returned is available offline, and it only applies to the primary account for the profile. - * @since Chrome 37. - */ - export function getProfileUserInfo(callback: (userInfo: UserInfo) => void): void; - /** - * Removes an OAuth2 access token from the Identity API's token cache. - * If an access token is discovered to be invalid, it should be passed to removeCachedAuthToken to remove it from the cache. The app may then retrieve a fresh token with getAuthToken. - * @param details Token information. - * @param callback Called when the token has been removed from the cache. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function removeCachedAuthToken(details: TokenInformation, callback?: () => void): void; - /** - * Starts an auth flow at the specified URL. - * This method enables auth flows with non-Google identity providers by launching a web view and navigating it to the first URL in the provider's auth flow. When the provider redirects to a URL matching the pattern https://.chromiumapp.org/*, the window will close, and the final redirect URL will be passed to the callback function. - * For a good user experience it is important interactive auth flows are initiated by UI in your app explaining what the authorization is for. Failing to do this will cause your users to get authorization requests with no context. In particular, do not launch an interactive auth flow when your app is first launched. - * @param details WebAuth flow options. - * @param callback Called with the URL redirected back to your application. - * The callback parameter should be a function that looks like this: - * function(string responseUrl) {...}; - */ - export function launchWebAuthFlow(details: WebAuthFlowOptions, callback: (responseUrl?: string) => void): void; - /** - * Generates a redirect URL to be used in launchWebAuthFlow. - * The generated URLs match the pattern https://.chromiumapp.org/*. - * @since Chrome 33. - * @param path Optional. The path appended to the end of the generated URL. - */ - export function getRedirectURL(path?: string): string; + /** + * Retrieves a list of AccountInfo objects describing the accounts present on the profile. + * getAccounts is only supported on dev channel. + * Dev channel only. + */ + export function getAccounts(callback: (accounts: AccountInfo[]) => void): void; + /** + * Gets an OAuth2 access token using the client ID and scopes specified in the oauth2 section of manifest.json. + * The Identity API caches access tokens in memory, so it's ok to call getAuthToken non-interactively any time a token is required. The token cache automatically handles expiration. + * For a good user experience it is important interactive token requests are initiated by UI in your app explaining what the authorization is for. Failing to do this will cause your users to get authorization requests, or Chrome sign in screens if they are not signed in, with with no context. In particular, do not use getAuthToken interactively when your app is first launched. + * @param details Token options. + * @param callback Called with an OAuth2 access token as specified by the manifest, or undefined if there was an error. + * If you specify the callback parameter, it should be a function that looks like this: + * function(string token) {...}; + */ + export function getAuthToken(details: TokenDetails, callback?: (token: string) => void): void; + /** + * Retrieves email address and obfuscated gaia id of the user signed into a profile. + * This API is different from identity.getAccounts in two ways. The information returned is available offline, and it only applies to the primary account for the profile. + * @since Chrome 37. + */ + export function getProfileUserInfo(callback: (userInfo: UserInfo) => void): void; + /** + * Removes an OAuth2 access token from the Identity API's token cache. + * If an access token is discovered to be invalid, it should be passed to removeCachedAuthToken to remove it from the cache. The app may then retrieve a fresh token with getAuthToken. + * @param details Token information. + * @param callback Called when the token has been removed from the cache. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function removeCachedAuthToken(details: TokenInformation, callback?: () => void): void; + /** + * Starts an auth flow at the specified URL. + * This method enables auth flows with non-Google identity providers by launching a web view and navigating it to the first URL in the provider's auth flow. When the provider redirects to a URL matching the pattern https://.chromiumapp.org/*, the window will close, and the final redirect URL will be passed to the callback function. + * For a good user experience it is important interactive auth flows are initiated by UI in your app explaining what the authorization is for. Failing to do this will cause your users to get authorization requests with no context. In particular, do not launch an interactive auth flow when your app is first launched. + * @param details WebAuth flow options. + * @param callback Called with the URL redirected back to your application. + * The callback parameter should be a function that looks like this: + * function(string responseUrl) {...}; + */ + export function launchWebAuthFlow(details: WebAuthFlowOptions, callback: (responseUrl?: string) => void): void; + /** + * Generates a redirect URL to be used in launchWebAuthFlow. + * The generated URLs match the pattern https://.chromiumapp.org/*. + * @since Chrome 33. + * @param path Optional. The path appended to the end of the generated URL. + */ + export function getRedirectURL(path?: string): string; - /** - * Fired when signin state changes for an account on the user's profile. - * @since Chrome 33. - */ - var onSignInChanged: SignInChangeEvent; + /** + * Fired when signin state changes for an account on the user's profile. + * @since Chrome 33. + */ + var onSignInChanged: SignInChangeEvent; } //////////////////// @@ -3456,22 +3456,22 @@ declare namespace chrome.identity { declare namespace chrome.idle { interface IdleStateChangedEvent extends chrome.events.Event<(newState: string) => void> {} - /** - * Returns "locked" if the system is locked, "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise. - * @param detectionIntervalInSeconds The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected. - * Since Chrome 25. - * @param callback The callback parameter should be a function that looks like this: - * function( IdleState newState) {...}; - */ - export function queryState(detectionIntervalInSeconds: number, callback: (newState: string) => void): void; - /** - * Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds. - * @since Chrome 25. - * @param intervalInSeconds Threshold, in seconds, used to determine when the system is in an idle state. - */ - export function setDetectionInterval(intervalInSeconds: number): void; + /** + * Returns "locked" if the system is locked, "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise. + * @param detectionIntervalInSeconds The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected. + * Since Chrome 25. + * @param callback The callback parameter should be a function that looks like this: + * function( IdleState newState) {...}; + */ + export function queryState(detectionIntervalInSeconds: number, callback: (newState: string) => void): void; + /** + * Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds. + * @since Chrome 25. + * @param intervalInSeconds Threshold, in seconds, used to determine when the system is in an idle state. + */ + export function setDetectionInterval(intervalInSeconds: number): void; - /** Fired when the system changes to an active, idle or locked state. The event fires with "locked" if the screen is locked or the screensaver activates, "idle" if the system is unlocked and the user has not generated any input for a specified number of seconds, and "active" when the user generates input on an idle system. */ + /** Fired when the system changes to an active, idle or locked state. The event fires with "locked" if the screen is locked or the screensaver activates, "idle" if the system is unlocked and the user has not generated any input for a specified number of seconds, and "active" when the user generates input on an idle system. */ var onStateChanged: IdleStateChangedEvent; } @@ -3484,173 +3484,173 @@ declare namespace chrome.idle { * @since Chrome 21. */ declare namespace chrome.input.ime { - /** See http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent */ + /** See http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent */ interface KeyboardEvent { - /** - * Optional. - * Whether or not the SHIFT key is pressed. - */ + /** + * Optional. + * Whether or not the SHIFT key is pressed. + */ shiftKey?: boolean; - /** - * Optional. - * Whether or not the ALT key is pressed. - */ + /** + * Optional. + * Whether or not the ALT key is pressed. + */ altKey?: boolean; - /** The ID of the request. */ + /** The ID of the request. */ requestId: string; - /** Value of the key being pressed */ + /** Value of the key being pressed */ key: string; - /** - * Optional. - * Whether or not the CTRL key is pressed. - */ + /** + * Optional. + * Whether or not the CTRL key is pressed. + */ ctrlKey?: boolean; - /** One of keyup or keydown. */ + /** One of keyup or keydown. */ type: string; - /** - * Optional. - * The extension ID of the sender of this keyevent. - * @since Chrome 34. - */ - extensionId?: string; - /** - * Optional. - * Value of the physical key being pressed. The value is not affected by current keyboard layout or modifier state. - * @since Chrome 26. - */ - code: string; - /** - * Optional. - * The deprecated HTML keyCode, which is system- and implementation-dependent numerical code signifying the unmodified identifier associated with the key pressed. - * @since Chrome 37. - */ - keyCode?: number; - /** - * Optional. - * Whether or not the CAPS_LOCK is enabled. - * @since Chrome 29. - */ - capsLock?: boolean; + /** + * Optional. + * The extension ID of the sender of this keyevent. + * @since Chrome 34. + */ + extensionId?: string; + /** + * Optional. + * Value of the physical key being pressed. The value is not affected by current keyboard layout or modifier state. + * @since Chrome 26. + */ + code: string; + /** + * Optional. + * The deprecated HTML keyCode, which is system- and implementation-dependent numerical code signifying the unmodified identifier associated with the key pressed. + * @since Chrome 37. + */ + keyCode?: number; + /** + * Optional. + * Whether or not the CAPS_LOCK is enabled. + * @since Chrome 29. + */ + capsLock?: boolean; } - /** Describes an input Context */ + /** Describes an input Context */ interface InputContext { - /** This is used to specify targets of text field operations. This ID becomes invalid as soon as onBlur is called. */ + /** This is used to specify targets of text field operations. This ID becomes invalid as soon as onBlur is called. */ contextID: number; - /** Type of value this text field edits, (Text, Number, URL, etc) */ + /** Type of value this text field edits, (Text, Number, URL, etc) */ type: string; - /** - * Whether the text field wants auto-correct. - * @since Chrome 40. - */ - autoCorrect: boolean; - /** - * Whether the text field wants auto-complete. - * @since Chrome 40. - */ - autoComplete: boolean; - /** - * Whether the text field wants spell-check. - * @since Chrome 40. - */ - spellCheck: boolean; - } + /** + * Whether the text field wants auto-correct. + * @since Chrome 40. + */ + autoCorrect: boolean; + /** + * Whether the text field wants auto-complete. + * @since Chrome 40. + */ + autoComplete: boolean; + /** + * Whether the text field wants spell-check. + * @since Chrome 40. + */ + spellCheck: boolean; + } - /** - * A menu item used by an input method to interact with the user from the language menu. - * @since Chrome 30. - */ - interface MenuItem { - /** String that will be passed to callbacks referencing this MenuItem. */ - id: string; - /** Optional. Text displayed in the menu for this item. */ - label?: string; - /** Optional. The type of menu item. */ - style?: string; - /** Optional. Indicates this item is visible. */ - visible?: boolean; - /** Indicates this item should be drawn with a check. */ - checked?: boolean; - /** Indicates this item is enabled. */ - enabled?: boolean; + /** + * A menu item used by an input method to interact with the user from the language menu. + * @since Chrome 30. + */ + interface MenuItem { + /** String that will be passed to callbacks referencing this MenuItem. */ + id: string; + /** Optional. Text displayed in the menu for this item. */ + label?: string; + /** Optional. The type of menu item. */ + style?: string; + /** Optional. Indicates this item is visible. */ + visible?: boolean; + /** Indicates this item should be drawn with a check. */ + checked?: boolean; + /** Indicates this item is enabled. */ + enabled?: boolean; } interface ImeParameters { - /** MenuItems to use. */ - items: MenuItem[]; - /** ID of the engine to use */ + /** MenuItems to use. */ + items: MenuItem[]; + /** ID of the engine to use */ engineID: string; } interface CommitTextParameters { - /** The text to commit */ + /** The text to commit */ text: string; - /** ID of the context where the text will be committed */ + /** ID of the context where the text will be committed */ contextID: number; } - interface CandidateUsage { - /** The title string of details description. */ - title: string; - /** The body string of detail description. */ - body: string; - } + interface CandidateUsage { + /** The title string of details description. */ + title: string; + /** The body string of detail description. */ + body: string; + } - interface CandidateTemplate { - /** The candidate */ - candidate: string; - /** The candidate's id */ - id: number; - /** - * Optional. - * The id to add these candidates under - */ - parentId?: number; - /** - * Optional. - * Short string displayed to next to the candidate, often the shortcut key or index - */ - label?: string; - /** - * Optional. - * Additional text describing the candidate - */ - annotation?: string; - /** - * Optional. - * The usage or detail description of word. - */ - usage?: CandidateUsage; - } + interface CandidateTemplate { + /** The candidate */ + candidate: string; + /** The candidate's id */ + id: number; + /** + * Optional. + * The id to add these candidates under + */ + parentId?: number; + /** + * Optional. + * Short string displayed to next to the candidate, often the shortcut key or index + */ + label?: string; + /** + * Optional. + * Additional text describing the candidate + */ + annotation?: string; + /** + * Optional. + * The usage or detail description of word. + */ + usage?: CandidateUsage; + } interface CandidatesParameters { - /** ID of the context that owns the candidate window. */ + /** ID of the context that owns the candidate window. */ contextID: number; - /** List of candidates to show in the candidate window */ - candidates: CandidateTemplate[]; - } + /** List of candidates to show in the candidate window */ + candidates: CandidateTemplate[]; + } - interface CompositionParameterSegment { - /** Index of the character to start this segment at */ - start: number; - /** Index of the character to end this segment after. */ - end: number; - /** The type of the underline to modify this segment. */ - style: string; + interface CompositionParameterSegment { + /** Index of the character to start this segment at */ + start: number; + /** Index of the character to end this segment after. */ + end: number; + /** The type of the underline to modify this segment. */ + style: string; } interface CompositionParameters { - /** ID of the context where the composition text will be set */ + /** ID of the context where the composition text will be set */ contextID: number; - /** Text to set */ + /** Text to set */ text: string; - /** Optional. List of segments and their associated types. */ - segments: CompositionParameterSegment[]; - /** Position in the text of the cursor. */ + /** Optional. List of segments and their associated types. */ + segments: CompositionParameterSegment[]; + /** Position in the text of the cursor. */ cursor: number; - /** Optional. Position in the text that the selection starts at. */ + /** Optional. Position in the text that the selection starts at. */ selectionStart?: number; - /** Optional. Position in the text that the selection ends at. */ + /** Optional. Position in the text that the selection ends at. */ selectionEnd?: number; } @@ -3659,88 +3659,88 @@ declare namespace chrome.input.ime { engineId: string; } - interface CandidateWindowParameterProperties { - /** - * Optional. - * True to show the cursor, false to hide it. - */ + interface CandidateWindowParameterProperties { + /** + * Optional. + * True to show the cursor, false to hide it. + */ cursorVisible?: boolean; - /** - * Optional. - * True if the candidate window should be rendered vertical, false to make it horizontal. - */ + /** + * Optional. + * True if the candidate window should be rendered vertical, false to make it horizontal. + */ vertical?: boolean; - /** - * Optional. - * The number of candidates to display per page. - */ + /** + * Optional. + * The number of candidates to display per page. + */ pageSize?: number; - /** - * Optional. - * True to display the auxiliary text, false to hide it. - */ + /** + * Optional. + * True to display the auxiliary text, false to hide it. + */ auxiliaryTextVisible?: boolean; - /** - * Optional. - * Text that is shown at the bottom of the candidate window. - */ + /** + * Optional. + * Text that is shown at the bottom of the candidate window. + */ auxiliaryText?: string; - /** - * Optional. - * True to show the Candidate window, false to hide it. - */ + /** + * Optional. + * True to show the Candidate window, false to hide it. + */ visible?: boolean; - /** - * Optional. - * Where to display the candidate window. - * @since Chrome 28. - */ - windowPosition?: string; - } + /** + * Optional. + * Where to display the candidate window. + * @since Chrome 28. + */ + windowPosition?: string; + } - interface CandidateWindowParameter { - /** ID of the engine to set properties on. */ - engineID: string; - properties: CandidateWindowParameterProperties; + interface CandidateWindowParameter { + /** ID of the engine to set properties on. */ + engineID: string; + properties: CandidateWindowParameterProperties; } interface ClearCompositionParameters { - /** ID of the context where the composition will be cleared */ + /** ID of the context where the composition will be cleared */ contextID: number; } interface CursorPositionParameters { - /** ID of the candidate to select. */ + /** ID of the candidate to select. */ candidateID: number; - /** ID of the context that owns the candidate window. */ - contextID: number; - } - - interface SendKeyEventParameters { - /** ID of the context where the key events will be sent, or zero to send key events to non-input field. */ - contextID: number; - /** Data on the key event. */ - keyData: KeyboardEvent[]; - } - - interface DeleteSurroundingTextParameters { - /** ID of the engine receiving the event. */ - engineID: string; - /** ID of the context where the surrounding text will be deleted. */ + /** ID of the context that owns the candidate window. */ contextID: number; - /** The offset from the caret position where deletion will start. This value can be negative. */ - offset: number; - /** The number of characters to be deleted */ - length: number; - } + } - interface SurroundingTextInfo { - /** The text around cursor. */ - text: string; - /** The ending position of the selection. This value indicates caret position if there is no selection. */ - focus: number; - /** The beginning position of the selection. This value indicates caret position if is no selection. */ - anchor: number; + interface SendKeyEventParameters { + /** ID of the context where the key events will be sent, or zero to send key events to non-input field. */ + contextID: number; + /** Data on the key event. */ + keyData: KeyboardEvent[]; + } + + interface DeleteSurroundingTextParameters { + /** ID of the engine receiving the event. */ + engineID: string; + /** ID of the context where the surrounding text will be deleted. */ + contextID: number; + /** The offset from the caret position where deletion will start. This value can be negative. */ + offset: number; + /** The number of characters to be deleted */ + length: number; + } + + interface SurroundingTextInfo { + /** The text around cursor. */ + text: string; + /** The ending position of the selection. This value indicates caret position if there is no selection. */ + focus: number; + /** The beginning position of the selection. This value indicates caret position if is no selection. */ + anchor: number; } interface BlurEvent extends chrome.events.Event<(contextID: number) => void> {} @@ -3759,117 +3759,117 @@ declare namespace chrome.input.ime { interface MenuItemActivatedEvent extends chrome.events.Event<(engineID: string, name: string) => void> {} - interface SurroundingTextChangedEvent extends chrome.events.Event<(engineID: string, surroundingInfo: SurroundingTextInfo) => void> {} + interface SurroundingTextChangedEvent extends chrome.events.Event<(engineID: string, surroundingInfo: SurroundingTextInfo) => void> {} - interface InputResetEvent extends chrome.events.Event<(engineID: string) => void> {} + interface InputResetEvent extends chrome.events.Event<(engineID: string) => void> {} - /** - * Adds the provided menu items to the language menu when this IME is active. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function setMenuItems(parameters: ImeParameters, callback?: () => void): void; - /** - * Commits the provided text to the current input. - * @param callback Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set. - * If you specify the callback parameter, it should be a function that looks like this: - * function(boolean success) {...}; - */ + /** + * Adds the provided menu items to the language menu when this IME is active. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function setMenuItems(parameters: ImeParameters, callback?: () => void): void; + /** + * Commits the provided text to the current input. + * @param callback Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set. + * If you specify the callback parameter, it should be a function that looks like this: + * function(boolean success) {...}; + */ export function commitText(parameters: CommitTextParameters, callback?: (success: boolean) => void): void; - /** - * Sets the current candidate list. This fails if this extension doesn't own the active IME - * @param callback Called when the operation completes. - * If you specify the callback parameter, it should be a function that looks like this: - * function(boolean success) {...}; - */ + /** + * Sets the current candidate list. This fails if this extension doesn't own the active IME + * @param callback Called when the operation completes. + * If you specify the callback parameter, it should be a function that looks like this: + * function(boolean success) {...}; + */ export function setCandidates(parameters: CandidatesParameters, callback?: (success: boolean) => void): void; - /** - * Set the current composition. If this extension does not own the active IME, this fails. - * @param callback Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set. - * If you specify the callback parameter, it should be a function that looks like this: - * function(boolean success) {...}; - */ + /** + * Set the current composition. If this extension does not own the active IME, this fails. + * @param callback Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set. + * If you specify the callback parameter, it should be a function that looks like this: + * function(boolean success) {...}; + */ export function setComposition(parameters: CompositionParameters, callback?: (success: boolean) => void): void; - /** - * Updates the state of the MenuItems specified - * @param callback Called when the operation completes - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function updateMenuItems(parameters: MenuItemParameters, callback?: () => void): void; - /** - * Sets the properties of the candidate window. This fails if the extension doesn't own the active IME - * @param callback Called when the operation completes. - * If you specify the callback parameter, it should be a function that looks like this: - * function(boolean success) {...}; - */ - export function setCandidateWindowProperties(parameters: CandidateWindowParameter, callback?: (success: boolean) => void): void; - /** - * Clear the current composition. If this extension does not own the active IME, this fails. - * @param callback Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set. - * If you specify the callback parameter, it should be a function that looks like this: - * function(boolean success) {...}; - */ + /** + * Updates the state of the MenuItems specified + * @param callback Called when the operation completes + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function updateMenuItems(parameters: MenuItemParameters, callback?: () => void): void; + /** + * Sets the properties of the candidate window. This fails if the extension doesn't own the active IME + * @param callback Called when the operation completes. + * If you specify the callback parameter, it should be a function that looks like this: + * function(boolean success) {...}; + */ + export function setCandidateWindowProperties(parameters: CandidateWindowParameter, callback?: (success: boolean) => void): void; + /** + * Clear the current composition. If this extension does not own the active IME, this fails. + * @param callback Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set. + * If you specify the callback parameter, it should be a function that looks like this: + * function(boolean success) {...}; + */ export function clearComposition(parameters: ClearCompositionParameters, callback?: (success: boolean) => void): void; - /** - * Set the position of the cursor in the candidate window. This is a no-op if this extension does not own the active IME. - * @param callback Called when the operation completes - * If you specify the callback parameter, it should be a function that looks like this: - * function(boolean success) {...}; - */ + /** + * Set the position of the cursor in the candidate window. This is a no-op if this extension does not own the active IME. + * @param callback Called when the operation completes + * If you specify the callback parameter, it should be a function that looks like this: + * function(boolean success) {...}; + */ export function setCursorPosition(parameters: CursorPositionParameters, callback?: (success: boolean) => void): void; - /** - * Sends the key events. This function is expected to be used by virtual keyboards. When key(s) on a virtual keyboard is pressed by a user, this function is used to propagate that event to the system. - * @since Chrome 33. - * @param callback Called when the operation completes. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function sendKeyEvents(parameters: SendKeyEventParameters, callback?: () => void): void; - /** - * Hides the input view window, which is popped up automatically by system. If the input view window is already hidden, this function will do nothing. - * @since Chrome 34. - */ - export function hideInputView(): void; - /** - * Deletes the text around the caret. - * @since Chrome 27. - */ - export function deleteSurroundingText(parameters: DeleteSurroundingTextParameters, callback?: () => void): void; - /** - * Indicates that the key event received by onKeyEvent is handled. This should only be called if the onKeyEvent listener is asynchronous. - * @since Chrome 25. - * @param requestId Request id of the event that was handled. This should come from keyEvent.requestId - * @param response True if the keystroke was handled, false if not - */ - export function keyEventHandled(requestId: string, response: boolean): void; + /** + * Sends the key events. This function is expected to be used by virtual keyboards. When key(s) on a virtual keyboard is pressed by a user, this function is used to propagate that event to the system. + * @since Chrome 33. + * @param callback Called when the operation completes. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function sendKeyEvents(parameters: SendKeyEventParameters, callback?: () => void): void; + /** + * Hides the input view window, which is popped up automatically by system. If the input view window is already hidden, this function will do nothing. + * @since Chrome 34. + */ + export function hideInputView(): void; + /** + * Deletes the text around the caret. + * @since Chrome 27. + */ + export function deleteSurroundingText(parameters: DeleteSurroundingTextParameters, callback?: () => void): void; + /** + * Indicates that the key event received by onKeyEvent is handled. This should only be called if the onKeyEvent listener is asynchronous. + * @since Chrome 25. + * @param requestId Request id of the event that was handled. This should come from keyEvent.requestId + * @param response True if the keystroke was handled, false if not + */ + export function keyEventHandled(requestId: string, response: boolean): void; - /** This event is sent when focus leaves a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */ + /** This event is sent when focus leaves a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */ var onBlur: BlurEvent; - /** This event is sent if this extension owns the active IME. */ + /** This event is sent if this extension owns the active IME. */ var onCandidateClicked: CandidateClickedEvent; - /** This event is sent if this extension owns the active IME. */ + /** This event is sent if this extension owns the active IME. */ var onKeyEvent: KeyEventEvent; - /** This event is sent when an IME is deactivated. It signals that the IME will no longer be receiving onKeyPress events. */ + /** This event is sent when an IME is deactivated. It signals that the IME will no longer be receiving onKeyPress events. */ var onDeactivated: DeactivatedEvent; - /** This event is sent when the properties of the current InputContext change, such as the the type. It is sent to all extensions that are listening to this event, and enabled by the user. */ + /** This event is sent when the properties of the current InputContext change, such as the the type. It is sent to all extensions that are listening to this event, and enabled by the user. */ var onInputContextUpdate: InputContextUpdateEvent; - /** This event is sent when an IME is activated. It signals that the IME will be receiving onKeyPress events. */ + /** This event is sent when an IME is activated. It signals that the IME will be receiving onKeyPress events. */ var onActivate: ActivateEvent; - /** This event is sent when focus enters a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */ + /** This event is sent when focus enters a text box. It is sent to all extensions that are listening to this event, and enabled by the user. */ var onFocus: FocusEvent; - /** Called when the user selects a menu item */ + /** Called when the user selects a menu item */ var onMenuItemActivated: MenuItemActivatedEvent; - /** - * Called when the editable string around caret is changed or when the caret position is moved. The text length is limited to 100 characters for each back and forth direction. - * @since Chrome 27. - */ - var onSurroundingTextChanged: SurroundingTextChangedEvent; - /** - * This event is sent when chrome terminates ongoing text input session. - * @since Chrome 29. - */ - var onReset: InputResetEvent; + /** + * Called when the editable string around caret is changed or when the caret position is moved. The text length is limited to 100 characters for each back and forth direction. + * @since Chrome 27. + */ + var onSurroundingTextChanged: SurroundingTextChangedEvent; + /** + * This event is sent when chrome terminates ongoing text input session. + * @since Chrome 29. + */ + var onReset: InputResetEvent; } //////////////////// @@ -3881,115 +3881,115 @@ declare namespace chrome.input.ime { * @since Chrome 8. */ declare namespace chrome.management { - /** Information about an installed extension, app, or theme. */ + /** Information about an installed extension, app, or theme. */ interface ExtensionInfo { - /** - * Optional. - * A reason the item is disabled. - * @since Chrome 17. - */ + /** + * Optional. + * A reason the item is disabled. + * @since Chrome 17. + */ disabledReason?: string; - /** Optional. The launch url (only present for apps). */ + /** Optional. The launch url (only present for apps). */ appLaunchUrl?: string; - /** - * The description of this extension, app, or theme. - * @since Chrome 9. - */ + /** + * The description of this extension, app, or theme. + * @since Chrome 9. + */ description: string; - /** - * Returns a list of API based permissions. - * @since Chrome 9. - */ + /** + * Returns a list of API based permissions. + * @since Chrome 9. + */ permissions: string[]; - /** - * Optional. - * A list of icon information. Note that this just reflects what was declared in the manifest, and the actual image at that url may be larger or smaller than what was declared, so you might consider using explicit width and height attributes on img tags referencing these images. See the manifest documentation on icons for more details. - */ + /** + * Optional. + * A list of icon information. Note that this just reflects what was declared in the manifest, and the actual image at that url may be larger or smaller than what was declared, so you might consider using explicit width and height attributes on img tags referencing these images. See the manifest documentation on icons for more details. + */ icons?: IconInfo[]; - /** - * Returns a list of host based permissions. - * @since Chrome 9. - */ + /** + * Returns a list of host based permissions. + * @since Chrome 9. + */ hostPermissions: string[]; - /** Whether it is currently enabled or disabled. */ + /** Whether it is currently enabled or disabled. */ enabled: boolean; - /** - * Optional. - * The URL of the homepage of this extension, app, or theme. - * @since Chrome 11. - */ + /** + * Optional. + * The URL of the homepage of this extension, app, or theme. + * @since Chrome 11. + */ homepageUrl?: string; - /** - * Whether this extension can be disabled or uninstalled by the user. - * @since Chrome 12. - */ + /** + * Whether this extension can be disabled or uninstalled by the user. + * @since Chrome 12. + */ mayDisable: boolean; - /** - * How the extension was installed. - * @since Chrome 22. - */ + /** + * How the extension was installed. + * @since Chrome 22. + */ installType: string; - /** The version of this extension, app, or theme. */ + /** The version of this extension, app, or theme. */ version: string; - /** The extension's unique identifier. */ + /** The extension's unique identifier. */ id: string; - /** - * Whether the extension, app, or theme declares that it supports offline. - * @since Chrome 15. - */ + /** + * Whether the extension, app, or theme declares that it supports offline. + * @since Chrome 15. + */ offlineEnabled: boolean; - /** - * Optional. - * The update URL of this extension, app, or theme. - * @since Chrome 16. - */ + /** + * Optional. + * The update URL of this extension, app, or theme. + * @since Chrome 16. + */ updateUrl?: string; - /** - * The type of this extension, app, or theme. - * @since Chrome 23. - */ + /** + * The type of this extension, app, or theme. + * @since Chrome 23. + */ type: string; - /** The url for the item's options page, if it has one. */ + /** The url for the item's options page, if it has one. */ optionsUrl: string; - /** The name of this extension, app, or theme. */ + /** The name of this extension, app, or theme. */ name: string; - /** - * A short version of the name of this extension, app, or theme. - * @since Chrome 31. - */ - shortName: string; - /** - * True if this is an app. - * @deprecated since Chrome 33. Please use management.ExtensionInfo.type. - */ - isApp: boolean; - /** - * Optional. - * The app launch type (only present for apps). - * @since Chrome 37. - */ - launchType?: string; - /** - * Optional. - * The currently available launch types (only present for apps). - * @since Chrome 37. - */ - availableLaunchTypes?: string[]; + /** + * A short version of the name of this extension, app, or theme. + * @since Chrome 31. + */ + shortName: string; + /** + * True if this is an app. + * @deprecated since Chrome 33. Please use management.ExtensionInfo.type. + */ + isApp: boolean; + /** + * Optional. + * The app launch type (only present for apps). + * @since Chrome 37. + */ + launchType?: string; + /** + * Optional. + * The currently available launch types (only present for apps). + * @since Chrome 37. + */ + availableLaunchTypes?: string[]; } - /** Information about an icon belonging to an extension, app, or theme. */ + /** Information about an icon belonging to an extension, app, or theme. */ interface IconInfo { - /** The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is disabled, for example), append ?grayscale=true to the URL. */ + /** The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is disabled, for example), append ?grayscale=true to the URL. */ url: string; - /** A number representing the width and height of the icon. Likely values include (but are not limited to) 128, 48, 24, and 16. */ + /** A number representing the width and height of the icon. Likely values include (but are not limited to) 128, 48, 24, and 16. */ size: number; } interface UninstallOptions { - /** - * Optional. - * Whether or not a confirm-uninstall dialog should prompt the user. Defaults to false for self uninstalls. If an extension uninstalls another extension, this parameter is ignored and the dialog is always shown. - */ + /** + * Optional. + * Whether or not a confirm-uninstall dialog should prompt the user. Defaults to false for self uninstalls. If an extension uninstalls another extension, this parameter is ignored and the dialog is always shown. + */ showConfirmDialog?: boolean; } @@ -4001,123 +4001,123 @@ declare namespace chrome.management { interface ManagementEnabledEvent extends chrome.events.Event<(info: ExtensionInfo) => void> {} - /** - * Enables or disables an app or extension. - * @param id This should be the id from an item of management.ExtensionInfo. - * @param enabled Whether this item should be enabled or disabled. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function setEnabled(id: string, enabled: boolean, callback?: () => void): void; - /** - * Returns a list of permission warnings for the given extension id. - * @since Chrome 15. - * @param id The ID of an already installed extension. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(array of string permissionWarnings) {...}; - */ + /** + * Enables or disables an app or extension. + * @param id This should be the id from an item of management.ExtensionInfo. + * @param enabled Whether this item should be enabled or disabled. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function setEnabled(id: string, enabled: boolean, callback?: () => void): void; + /** + * Returns a list of permission warnings for the given extension id. + * @since Chrome 15. + * @param id The ID of an already installed extension. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(array of string permissionWarnings) {...}; + */ export function getPermissionWarningsById(id: string, callback?: (permissionWarnings: string[]) => void): void; - /** - * Returns information about the installed extension, app, or theme that has the given ID. - * @since Chrome 9. - * @param id The ID from an item of management.ExtensionInfo. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function( ExtensionInfo result) {...}; - */ + /** + * Returns information about the installed extension, app, or theme that has the given ID. + * @since Chrome 9. + * @param id The ID from an item of management.ExtensionInfo. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function( ExtensionInfo result) {...}; + */ export function get(id: string, callback?: (result: ExtensionInfo) => void): void; - /** - * Returns a list of information about installed extensions and apps. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(array of ExtensionInfo result) {...}; - */ + /** + * Returns a list of information about installed extensions and apps. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(array of ExtensionInfo result) {...}; + */ export function getAll(callback?: (result: ExtensionInfo[]) => void): void; - /** - * Returns a list of permission warnings for the given extension manifest string. Note: This function can be used without requesting the 'management' permission in the manifest. - * @since Chrome 15. - * @param manifestStr Extension manifest JSON string. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(array of string permissionWarnings) {...}; - */ + /** + * Returns a list of permission warnings for the given extension manifest string. Note: This function can be used without requesting the 'management' permission in the manifest. + * @since Chrome 15. + * @param manifestStr Extension manifest JSON string. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(array of string permissionWarnings) {...}; + */ export function getPermissionWarningsByManifest(manifestStr: string, callback?: (permissionwarnings: string[]) => void): void; - /** - * Launches an application. - * @param id The extension id of the application. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function launchApp(id: string, callback?: () => void): void; - /** - * Uninstalls a currently installed app or extension. - * @since Chrome 21. - * @param id This should be the id from an item of management.ExtensionInfo. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function uninstall(id: string, options?: UninstallOptions, callback?: () => void): void; - /** - * Uninstalls a currently installed app or extension. - * @deprecated since Chrome 21. The options parameter was added to this function. - * @param id This should be the id from an item of management.ExtensionInfo. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function uninstall(id: string, callback?: () => void): void; - /** - * Returns information about the calling extension, app, or theme. Note: This function can be used without requesting the 'management' permission in the manifest. - * @since Chrome 39. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function( ExtensionInfo result) {...}; - */ - export function getSelf(callback?: (result: ExtensionInfo) => void): void; - /** - * Uninstalls the calling extension. - * Note: This function can be used without requesting the 'management' permission in the manifest. - * @since Chrome 26. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function uninstallSelf(options?: UninstallOptions, callback?: () => void): void; - /** - * Uninstalls the calling extension. - * Note: This function can be used without requesting the 'management' permission in the manifest. - * @since Chrome 26. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function uninstallSelf(callback?: () => void): void; - /** - * Display options to create shortcuts for an app. On Mac, only packaged app shortcuts can be created. - * @since Chrome 37. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function createAppShortcut(id: string, callback?: () => void): void; - /** - * Set the launch type of an app. - * @since Chrome 37. - * @param id This should be the id from an app item of management.ExtensionInfo. - * @param launchType The target launch type. Always check and make sure this launch type is in ExtensionInfo.availableLaunchTypes, because the available launch types vary on different platforms and configurations. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function setLaunchType(id: string, launchType: string, callback?: () => void): void; - /** - * Generate an app for a URL. Returns the generated bookmark app. - * @since Chrome 37. - * @param url The URL of a web page. The scheme of the URL can only be "http" or "https". - * @param title The title of the generated app. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function( ExtensionInfo result) {...}; - */ - export function generateAppForLink(url: string, title: string, callback?: (result: ExtensionInfo) => void): void; + /** + * Launches an application. + * @param id The extension id of the application. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function launchApp(id: string, callback?: () => void): void; + /** + * Uninstalls a currently installed app or extension. + * @since Chrome 21. + * @param id This should be the id from an item of management.ExtensionInfo. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function uninstall(id: string, options?: UninstallOptions, callback?: () => void): void; + /** + * Uninstalls a currently installed app or extension. + * @deprecated since Chrome 21. The options parameter was added to this function. + * @param id This should be the id from an item of management.ExtensionInfo. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function uninstall(id: string, callback?: () => void): void; + /** + * Returns information about the calling extension, app, or theme. Note: This function can be used without requesting the 'management' permission in the manifest. + * @since Chrome 39. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function( ExtensionInfo result) {...}; + */ + export function getSelf(callback?: (result: ExtensionInfo) => void): void; + /** + * Uninstalls the calling extension. + * Note: This function can be used without requesting the 'management' permission in the manifest. + * @since Chrome 26. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function uninstallSelf(options?: UninstallOptions, callback?: () => void): void; + /** + * Uninstalls the calling extension. + * Note: This function can be used without requesting the 'management' permission in the manifest. + * @since Chrome 26. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function uninstallSelf(callback?: () => void): void; + /** + * Display options to create shortcuts for an app. On Mac, only packaged app shortcuts can be created. + * @since Chrome 37. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function createAppShortcut(id: string, callback?: () => void): void; + /** + * Set the launch type of an app. + * @since Chrome 37. + * @param id This should be the id from an app item of management.ExtensionInfo. + * @param launchType The target launch type. Always check and make sure this launch type is in ExtensionInfo.availableLaunchTypes, because the available launch types vary on different platforms and configurations. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function setLaunchType(id: string, launchType: string, callback?: () => void): void; + /** + * Generate an app for a URL. Returns the generated bookmark app. + * @since Chrome 37. + * @param url The URL of a web page. The scheme of the URL can only be "http" or "https". + * @param title The title of the generated app. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function( ExtensionInfo result) {...}; + */ + export function generateAppForLink(url: string, title: string, callback?: (result: ExtensionInfo) => void): void; - /** Fired when an app or extension has been disabled. */ + /** Fired when an app or extension has been disabled. */ var onDisabled: ManagementDisabledEvent; - /** Fired when an app or extension has been uninstalled. */ + /** Fired when an app or extension has been uninstalled. */ var onUninstalled: ManagementUninstalledEvent; - /** Fired when an app or extension has been installed. */ + /** Fired when an app or extension has been installed. */ var onInstalled: ManagementInstalledEvent; - /** Fired when an app or extension has been enabled. */ + /** Fired when an app or extension has been enabled. */ var onEnabled: ManagementEnabledEvent; } @@ -4131,47 +4131,47 @@ declare namespace chrome.management { * @since Chrome 43. */ declare namespace chrome.networking.config { - interface NetworkInfo { - /** Currently only WiFi supported. */ - Type: string; - /** Optional. A unique identifier of the network. */ - GUID?: string; - /** Optional. A hex-encoded byte sequence. */ - HexSSID?: string; - /** Optional. The decoded SSID of the network (default encoding is UTF-8). To filter for non-UTF-8 SSIDs, use HexSSID instead. */ - SSID?: string; - /** Optional. The basic service set identification (BSSID) uniquely identifying the basic service set. BSSID is represented as a human readable, hex-encoded string with bytes separated by colons, e.g. 45:67:89:ab:cd:ef. */ - BSSID?: string; - /** Optional. Identifier indicating the security type of the network. Valid values are None, WEP-PSK, WPA-PSK and WPA-EAP. */ - Security?: string; - } + interface NetworkInfo { + /** Currently only WiFi supported. */ + Type: string; + /** Optional. A unique identifier of the network. */ + GUID?: string; + /** Optional. A hex-encoded byte sequence. */ + HexSSID?: string; + /** Optional. The decoded SSID of the network (default encoding is UTF-8). To filter for non-UTF-8 SSIDs, use HexSSID instead. */ + SSID?: string; + /** Optional. The basic service set identification (BSSID) uniquely identifying the basic service set. BSSID is represented as a human readable, hex-encoded string with bytes separated by colons, e.g. 45:67:89:ab:cd:ef. */ + BSSID?: string; + /** Optional. Identifier indicating the security type of the network. Valid values are None, WEP-PSK, WPA-PSK and WPA-EAP. */ + Security?: string; + } - interface CaptivePorttalDetectedEvent extends chrome.events.Event<(networkInfo: NetworkInfo) => void> {} + interface CaptivePorttalDetectedEvent extends chrome.events.Event<(networkInfo: NetworkInfo) => void> {} - /** - * Allows an extension to define network filters for the networks it can handle. A call to this function will remove all filters previously installed by the extension before setting the new list. - * @param networks Network filters to set. Every NetworkInfo must either have the SSID or HexSSID set. Other fields will be ignored. - * @param callback Called back when this operation is finished. - * The callback parameter should be a function that looks like this: - * function() {...}; - */ - export function setNetworkFilter(networks: NetworkInfo[], callback: () => void): void; - /** - * Called by the extension to notify the network config API that it finished a captive portal authentication attempt and hand over the result of the attempt. This function must only be called with the GUID of the latest onCaptivePortalDetected event. - * @param GUID Unique network identifier obtained from onCaptivePortalDetected. - * @param result The result of the authentication attempt. - * unhandled: The extension does not handle this network or captive portal (e.g. server end-point not found or not compatible). - * succeeded: The extension handled this network and authenticated successfully. - * rejected: The extension handled this network, tried to authenticate, however was rejected by the server. - * failed: The extension handled this network, tried to authenticate, however failed due to an unspecified error. - * @param callback Called back when this operation is finished. - * If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function finishAuthentication(GUID: string, result: string, callback?: () => void): void; + /** + * Allows an extension to define network filters for the networks it can handle. A call to this function will remove all filters previously installed by the extension before setting the new list. + * @param networks Network filters to set. Every NetworkInfo must either have the SSID or HexSSID set. Other fields will be ignored. + * @param callback Called back when this operation is finished. + * The callback parameter should be a function that looks like this: + * function() {...}; + */ + export function setNetworkFilter(networks: NetworkInfo[], callback: () => void): void; + /** + * Called by the extension to notify the network config API that it finished a captive portal authentication attempt and hand over the result of the attempt. This function must only be called with the GUID of the latest onCaptivePortalDetected event. + * @param GUID Unique network identifier obtained from onCaptivePortalDetected. + * @param result The result of the authentication attempt. + * unhandled: The extension does not handle this network or captive portal (e.g. server end-point not found or not compatible). + * succeeded: The extension handled this network and authenticated successfully. + * rejected: The extension handled this network, tried to authenticate, however was rejected by the server. + * failed: The extension handled this network, tried to authenticate, however failed due to an unspecified error. + * @param callback Called back when this operation is finished. + * If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function finishAuthentication(GUID: string, result: string, callback?: () => void): void; - /** This event fires everytime a captive portal is detected on a network matching any of the currently registered network filters and the user consents to use the extension for authentication. Network filters may be set using the setNetworkFilter. Upon receiving this event the extension should start its authentication attempt with the captive portal. When the extension finishes its attempt, it must call finishAuthentication with the GUID received with this event and the appropriate authentication result. */ - var onCaptivePortalDetected: CaptivePorttalDetectedEvent; + /** This event fires everytime a captive portal is detected on a network matching any of the currently registered network filters and the user consents to use the extension for authentication. Network filters may be set using the setNetworkFilter. Upon receiving this event the extension should start its authentication attempt with the captive portal. When the extension finishes its attempt, it must call finishAuthentication with the GUID received with this event and the appropriate authentication result. */ + var onCaptivePortalDetected: CaptivePorttalDetectedEvent; } //////////////////// @@ -4190,144 +4190,144 @@ declare namespace chrome.notifications { } interface ItemOptions { - /** Title of one item of a list notification. */ + /** Title of one item of a list notification. */ title: string; - /** Additional details about this item. */ + /** Additional details about this item. */ message: string; } interface NotificationOptions { - /** Optional. Which type of notification to display. Required for notifications.create method. */ + /** Optional. Which type of notification to display. Required for notifications.create method. */ type?: string; - /** - * Optional. - * A URL to the sender's avatar, app icon, or a thumbnail for image notifications. - * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file Required for notifications.create method. - */ + /** + * Optional. + * A URL to the sender's avatar, app icon, or a thumbnail for image notifications. + * URLs can be a data URL, a blob URL, or a URL relative to a resource within this extension's .crx file Required for notifications.create method. + */ iconUrl?: string; - /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */ + /** Optional. Title of the notification (e.g. sender name for email). Required for notifications.create method. */ title?: string; - /** Optional. Main notification content. Required for notifications.create method. */ + /** Optional. Main notification content. Required for notifications.create method. */ message?: string; - /** - * Optional. - * Alternate notification content with a lower-weight font. - * @since Chrome 31. - */ + /** + * Optional. + * Alternate notification content with a lower-weight font. + * @since Chrome 31. + */ contextMessage?: string; - /** Optional. Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. */ + /** Optional. Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. */ priority?: number; - /** Optional. A timestamp associated with the notification, in milliseconds past the epoch (e.g. Date.now() + n). */ + /** Optional. A timestamp associated with the notification, in milliseconds past the epoch (e.g. Date.now() + n). */ eventTime?: number; - /** Optional. Text and icons for up to two notification action buttons. */ - buttons?: ButtonOptions[]; - /** Optional. Items for multi-item notifications. */ - items?: ItemOptions[]; - /** - * Optional. - * Current progress ranges from 0 to 100. - * @since Chrome 30. - */ + /** Optional. Text and icons for up to two notification action buttons. */ + buttons?: ButtonOptions[]; + /** Optional. Items for multi-item notifications. */ + items?: ItemOptions[]; + /** + * Optional. + * Current progress ranges from 0 to 100. + * @since Chrome 30. + */ progress?: number; - /** - * Optional. - * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification. - * @since Chrome 32. - */ + /** + * Optional. + * Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification. + * @since Chrome 32. + */ isClickable?: boolean; - /** - * Optional. - * A URL to the app icon mask. URLs have the same restrictions as iconUrl. The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered. - * @since Chrome 38. - */ - appIconMaskUrl?: string; - /** Optional. A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as iconUrl. */ - imageUrl?: string; + /** + * Optional. + * A URL to the app icon mask. URLs have the same restrictions as iconUrl. The app icon mask should be in alpha channel, as only the alpha channel of the image will be considered. + * @since Chrome 38. + */ + appIconMaskUrl?: string; + /** Optional. A URL to the image thumbnail for image-type notifications. URLs have the same restrictions as iconUrl. */ + imageUrl?: string; } - interface NotificationClosedEvent extends chrome.events.Event<(notificationId: string, byUser: boolean) => void> {} + interface NotificationClosedEvent extends chrome.events.Event<(notificationId: string, byUser: boolean) => void> {} - interface NotificationClickedEvent extends chrome.events.Event<(notificationId: string) => void> {} + interface NotificationClickedEvent extends chrome.events.Event<(notificationId: string) => void> {} - interface NotificationButtonClickedEvent extends chrome.events.Event<(notificationId: string, buttonIndex: number) => void> {} + interface NotificationButtonClickedEvent extends chrome.events.Event<(notificationId: string, buttonIndex: number) => void> {} - interface NotificationPermissionLevelChangedEvent extends chrome.events.Event<(level: string) => void> {} + interface NotificationPermissionLevelChangedEvent extends chrome.events.Event<(level: string) => void> {} - interface NotificationShowSettingsEvent extends chrome.events.Event<() => void> {} + interface NotificationShowSettingsEvent extends chrome.events.Event<() => void> {} - /** The notification closed, either by the system or by user action. */ - export var onClosed: NotificationClosedEvent; - /** The user clicked in a non-button area of the notification. */ - export var onClicked: NotificationClickedEvent; - /** The user pressed a button in the notification. */ - export var onButtonClicked: NotificationButtonClickedEvent; - /** - * The user changes the permission level. - * @since Chrome 32. - */ - export var onPermissionLevelChanged: NotificationPermissionLevelChangedEvent; - /** - * The user clicked on a link for the app's notification settings. - * @since Chrome 32. - */ - export var onShowSettings: NotificationShowSettingsEvent; + /** The notification closed, either by the system or by user action. */ + export var onClosed: NotificationClosedEvent; + /** The user clicked in a non-button area of the notification. */ + export var onClicked: NotificationClickedEvent; + /** The user pressed a button in the notification. */ + export var onButtonClicked: NotificationButtonClickedEvent; + /** + * The user changes the permission level. + * @since Chrome 32. + */ + export var onPermissionLevelChanged: NotificationPermissionLevelChangedEvent; + /** + * The user clicked on a link for the app's notification settings. + * @since Chrome 32. + */ + export var onShowSettings: NotificationShowSettingsEvent; - /** - * Creates and displays a notification. - * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. - * The notificationId parameter is required before Chrome 42. - * @param options Contents of the notification. - * @param callback Returns the notification id (either supplied or generated) that represents the created notification. - * The callback is required before Chrome 42. - * If you specify the callback parameter, it should be a function that looks like this: - * function(string notificationId) {...}; - */ - export function create(notificationId: string, options: NotificationOptions, callback?: (notificationId: string) => void): void; - /** - * Creates and displays a notification. - * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. - * The notificationId parameter is required before Chrome 42. - * @param options Contents of the notification. - * @param callback Returns the notification id (either supplied or generated) that represents the created notification. - * The callback is required before Chrome 42. - * If you specify the callback parameter, it should be a function that looks like this: - * function(string notificationId) {...}; - */ - export function create(options: NotificationOptions, callback?: (notificationId: string) => void): void; - /** - * Updates an existing notification. - * @param notificationId The id of the notification to be updated. This is returned by notifications.create method. - * @param options Contents of the notification to update to. - * @param callback Called to indicate whether a matching notification existed. - * The callback is required before Chrome 42. - * If you specify the callback parameter, it should be a function that looks like this: - * function(boolean wasUpdated) {...}; - */ - export function update(notificationId: string, options: NotificationOptions, callback?: (wasUpdated: boolean) => void): void; - /** - * Clears the specified notification. - * @param notificationId The id of the notification to be cleared. This is returned by notifications.create method. - * @param callback Called to indicate whether a matching notification existed. - * The callback is required before Chrome 42. - * If you specify the callback parameter, it should be a function that looks like this: - * function(boolean wasCleared) {...}; - */ - export function clear(notificationId: string, callback?: (wasCleared: boolean) => void): void; - /** - * Retrieves all the notifications. - * @since Chrome 29. - * @param callback Returns the set of notification_ids currently in the system. - * The callback parameter should be a function that looks like this: - * function(object notifications) {...}; - */ - export function getAll(callback: (notifications: Object) => void): void; - /** - * Retrieves whether the user has enabled notifications from this app or extension. - * @since Chrome 32. - * @param callback Returns the current permission level. - * The callback parameter should be a function that looks like this: - * function( PermissionLevel level) {...}; - */ + /** + * Creates and displays a notification. + * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. + * The notificationId parameter is required before Chrome 42. + * @param options Contents of the notification. + * @param callback Returns the notification id (either supplied or generated) that represents the created notification. + * The callback is required before Chrome 42. + * If you specify the callback parameter, it should be a function that looks like this: + * function(string notificationId) {...}; + */ + export function create(notificationId: string, options: NotificationOptions, callback?: (notificationId: string) => void): void; + /** + * Creates and displays a notification. + * @param notificationId Identifier of the notification. If not set or empty, an ID will automatically be generated. If it matches an existing notification, this method first clears that notification before proceeding with the create operation. + * The notificationId parameter is required before Chrome 42. + * @param options Contents of the notification. + * @param callback Returns the notification id (either supplied or generated) that represents the created notification. + * The callback is required before Chrome 42. + * If you specify the callback parameter, it should be a function that looks like this: + * function(string notificationId) {...}; + */ + export function create(options: NotificationOptions, callback?: (notificationId: string) => void): void; + /** + * Updates an existing notification. + * @param notificationId The id of the notification to be updated. This is returned by notifications.create method. + * @param options Contents of the notification to update to. + * @param callback Called to indicate whether a matching notification existed. + * The callback is required before Chrome 42. + * If you specify the callback parameter, it should be a function that looks like this: + * function(boolean wasUpdated) {...}; + */ + export function update(notificationId: string, options: NotificationOptions, callback?: (wasUpdated: boolean) => void): void; + /** + * Clears the specified notification. + * @param notificationId The id of the notification to be cleared. This is returned by notifications.create method. + * @param callback Called to indicate whether a matching notification existed. + * The callback is required before Chrome 42. + * If you specify the callback parameter, it should be a function that looks like this: + * function(boolean wasCleared) {...}; + */ + export function clear(notificationId: string, callback?: (wasCleared: boolean) => void): void; + /** + * Retrieves all the notifications. + * @since Chrome 29. + * @param callback Returns the set of notification_ids currently in the system. + * The callback parameter should be a function that looks like this: + * function(object notifications) {...}; + */ + export function getAll(callback: (notifications: Object) => void): void; + /** + * Retrieves whether the user has enabled notifications from this app or extension. + * @since Chrome 32. + * @param callback Returns the current permission level. + * The callback parameter should be a function that looks like this: + * function( PermissionLevel level) {...}; + */ export function getPermissionLevel(callback: (level: string) => void): void; } @@ -4340,16 +4340,16 @@ declare namespace chrome.notifications { * @since Chrome 9. */ declare namespace chrome.omnibox { - /** A suggest result. */ + /** A suggest result. */ interface SuggestResult { - /** The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry. */ + /** The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry. */ content: string; - /** The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match. You must escape the five predefined entities to display them as text: stackoverflow.com/a/1091953/89484 */ + /** The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match. You must escape the five predefined entities to display them as text: stackoverflow.com/a/1091953/89484 */ description: string; } interface Suggestion { - /** The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match. */ + /** The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. dimmed match. */ description: string; } @@ -4361,19 +4361,19 @@ declare namespace chrome.omnibox { interface OmniboxInputCancelledEvent extends chrome.events.Event<() => void> {} - /** - * Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar. - * @param suggestion A partial SuggestResult object, without the 'content' parameter. - */ + /** + * Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar. + * @param suggestion A partial SuggestResult object, without the 'content' parameter. + */ export function setDefaultSuggestion(suggestion: Suggestion): void; - /** User has accepted what is typed into the omnibox. */ + /** User has accepted what is typed into the omnibox. */ var onInputEntered: OmniboxInputEnteredEvent; - /** User has changed what is typed into the omnibox. */ + /** User has changed what is typed into the omnibox. */ var onInputChanged: OmniboxInputChangedEvent; - /** User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events. */ + /** User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events. */ var onInputStarted: OmniboxInputStartedEvent; - /** User has ended the keyword input session without accepting the input. */ + /** User has ended the keyword input session without accepting the input. */ var onInputCancelled: OmniboxInputCancelledEvent; } @@ -4389,80 +4389,80 @@ declare namespace chrome.pageAction { interface PageActionClickedEvent extends chrome.events.Event<(tab: chrome.tabs.Tab) => void> {} interface TitleDetails { - /** The id of the tab for which you want to modify the page action. */ + /** The id of the tab for which you want to modify the page action. */ tabId: number; - /** The tooltip string. */ + /** The tooltip string. */ title: string; } interface GetDetails { - /** Specify the tab to get the title from. */ + /** Specify the tab to get the title from. */ tabId: number; } interface PopupDetails { - /** The id of the tab for which you want to modify the page action. */ + /** The id of the tab for which you want to modify the page action. */ tabId: number; - /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */ + /** The html file to show in a popup. If set to the empty string (''), no popup is shown. */ popup: string; } interface IconDetails { - /** The id of the tab for which you want to modify the page action. */ + /** The id of the tab for which you want to modify the page action. */ tabId: number; - /** - * Optional. - * @deprecated This argument is ignored. - */ + /** + * Optional. + * @deprecated This argument is ignored. + */ iconIndex?: number; - /** - * Optional. - * Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' - */ + /** + * Optional. + * Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' + */ imageData?: ImageData; - /** - * Optional. - * Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' - */ + /** + * Optional. + * Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals scale, then image with size scale * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' + */ path?: any; } - /** - * Shows the page action. The page action is shown whenever the tab is selected. - * @param tabId The id of the tab for which you want to modify the page action. - */ + /** + * Shows the page action. The page action is shown whenever the tab is selected. + * @param tabId The id of the tab for which you want to modify the page action. + */ export function hide(tabId: number): void; - /** - * Shows the page action. The page action is shown whenever the tab is selected. - * @param tabId The id of the tab for which you want to modify the page action. - */ + /** + * Shows the page action. The page action is shown whenever the tab is selected. + * @param tabId The id of the tab for which you want to modify the page action. + */ export function show(tabId: number): void; - /** Sets the title of the page action. This is displayed in a tooltip over the page action. */ + /** Sets the title of the page action. This is displayed in a tooltip over the page action. */ export function setTitle(details: TitleDetails): void; - /** Sets the html document to be opened as a popup when the user clicks on the page action's icon. */ + /** Sets the html document to be opened as a popup when the user clicks on the page action's icon. */ export function setPopup(details: PopupDetails): void; - /** - * Gets the title of the page action. - * @since Chrome 19. - * @param callback The callback parameter should be a function that looks like this: - * function(string result) {...}; - */ + /** + * Gets the title of the page action. + * @since Chrome 19. + * @param callback The callback parameter should be a function that looks like this: + * function(string result) {...}; + */ export function getTitle(details: GetDetails, callback: (result: string) => void): void; - /** - * Gets the html document set as the popup for this page action. - * @since Chrome 19. - * @param callback The callback parameter should be a function that looks like this: - * function(string result) {...}; - */ + /** + * Gets the html document set as the popup for this page action. + * @since Chrome 19. + * @param callback The callback parameter should be a function that looks like this: + * function(string result) {...}; + */ export function getPopup(details: GetDetails, callback: (result: string) => void): void; - /** - * Sets the icon for the page action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function() {...}; - */ - export function setIcon(details: IconDetails, callback?: () => void): void; + /** + * Sets the icon for the page action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the path or the imageData property must be specified. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function() {...}; + */ + export function setIcon(details: IconDetails, callback?: () => void): void; - /** Fired when a page action icon is clicked. This event will not fire if the page action has a popup. */ + /** Fired when a page action icon is clicked. This event will not fire if the page action has a popup. */ var onClicked: PageActionClickedEvent; } @@ -4476,17 +4476,17 @@ declare namespace chrome.pageAction { */ declare namespace chrome.pageCapture { interface SaveDetails { - /** The id of the tab to save as MHTML. */ + /** The id of the tab to save as MHTML. */ tabId: number; } - /** - * Saves the content of the tab with given id as MHTML. - * @param callback Called when the MHTML has been generated. - * The callback parameter should be a function that looks like this: - * function(binary mhtmlData) {...}; - * Parameter mhtmlData: The MHTML data as a Blob. - */ + /** + * Saves the content of the tab with given id as MHTML. + * @param callback Called when the MHTML has been generated. + * The callback parameter should be a function that looks like this: + * function(binary mhtmlData) {...}; + * Parameter mhtmlData: The MHTML data as a Blob. + */ export function saveAsMHTML(details: SaveDetails, callback: (mhtmlData: any) => void): void; } @@ -4499,68 +4499,68 @@ declare namespace chrome.pageCapture { */ declare namespace chrome.permissions { interface Permissions { - /** - * Optional. - * List of named permissions (does not include hosts or origins). Anything listed here must appear in the optional_permissions list in the manifest. - */ + /** + * Optional. + * List of named permissions (does not include hosts or origins). Anything listed here must appear in the optional_permissions list in the manifest. + */ origins?: string[]; - /** - * Optional. - * List of origin permissions. Anything listed here must be a subset of a host that appears in the optional_permissions list in the manifest. For example, if http://*.example.com/ or http://* appears in optional_permissions, you can request an origin of http://help.example.com/. Any path is ignored. - */ + /** + * Optional. + * List of origin permissions. Anything listed here must be a subset of a host that appears in the optional_permissions list in the manifest. For example, if http://*.example.com/ or http://* appears in optional_permissions, you can request an origin of http://help.example.com/. Any path is ignored. + */ permissions?: string[]; } interface PermissionsRemovedEvent { - /** - * @param callback The callback parameter should be a function that looks like this: - * function( Permissions permissions) {...}; - * Parameter permissions: The permissions that have been removed. - */ + /** + * @param callback The callback parameter should be a function that looks like this: + * function( Permissions permissions) {...}; + * Parameter permissions: The permissions that have been removed. + */ addListener(callback: (permissions: Permissions) => void): void; } interface PermissionsAddedEvent { - /** - * @param callback The callback parameter should be a function that looks like this: - * function( Permissions permissions) {...}; - * Parameter permissions: The newly acquired permissions. - */ + /** + * @param callback The callback parameter should be a function that looks like this: + * function( Permissions permissions) {...}; + * Parameter permissions: The newly acquired permissions. + */ addListener(callback: (permissions: Permissions) => void): void; } - /** - * Checks if the extension has the specified permissions. - * @param callback The callback parameter should be a function that looks like this: - * function(boolean result) {...}; - * Parameter result: True if the extension has the specified permissions. - */ + /** + * Checks if the extension has the specified permissions. + * @param callback The callback parameter should be a function that looks like this: + * function(boolean result) {...}; + * Parameter result: True if the extension has the specified permissions. + */ export function contains(permissions: Permissions, callback: (result: boolean) => void): void; - /** - * Gets the extension's current set of permissions. - * @param callback The callback parameter should be a function that looks like this: - * function( Permissions permissions) {...}; - * Parameter permissions: The extension's active permissions. - */ + /** + * Gets the extension's current set of permissions. + * @param callback The callback parameter should be a function that looks like this: + * function( Permissions permissions) {...}; + * Parameter permissions: The extension's active permissions. + */ export function getAll(callback: (permissions: Permissions) => void): void; - /** - * Requests access to the specified permissions. These permissions must be defined in the optional_permissions field of the manifest. If there are any problems requesting the permissions, runtime.lastError will be set. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(boolean granted) {...}; - * Parameter granted: True if the user granted the specified permissions. - */ + /** + * Requests access to the specified permissions. These permissions must be defined in the optional_permissions field of the manifest. If there are any problems requesting the permissions, runtime.lastError will be set. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(boolean granted) {...}; + * Parameter granted: True if the user granted the specified permissions. + */ export function request(permissions: Permissions, callback?: (granted: boolean) => void): void; - /** - * Removes access to the specified permissions. If there are any problems removing the permissions, runtime.lastError will be set. - * @param callback If you specify the callback parameter, it should be a function that looks like this: - * function(boolean removed) {...}; - * Parameter removed: True if the permissions were removed. - */ + /** + * Removes access to the specified permissions. If there are any problems removing the permissions, runtime.lastError will be set. + * @param callback If you specify the callback parameter, it should be a function that looks like this: + * function(boolean removed) {...}; + * Parameter removed: True if the permissions were removed. + */ export function remove(permissions: Permissions, callback?: (removed: boolean) => void): void; - /** Fired when access to permissions has been removed from the extension. */ + /** Fired when access to permissions has been removed from the extension. */ var onRemoved: PermissionsRemovedEvent; - /** Fired when the extension acquires new permissions. */ + /** Fired when the extension acquires new permissions. */ var onAdded: PermissionsAddedEvent; } @@ -4574,74 +4574,74 @@ declare namespace chrome.permissions { * @since Chrome 45. */ declare namespace chrome.platformKeys { - interface Match { - /** The DER encoding of a X.509 certificate. */ - certificate: ArrayBuffer; - /** The KeyAlgorithm of the certified key. This contains algorithm parameters that are inherent to the key of the certificate (e.g. the key length). Other parameters like the hash function used by the sign function are not included. */ - keyAlgorithm: KeyAlgorithm; - } + interface Match { + /** The DER encoding of a X.509 certificate. */ + certificate: ArrayBuffer; + /** The KeyAlgorithm of the certified key. This contains algorithm parameters that are inherent to the key of the certificate (e.g. the key length). Other parameters like the hash function used by the sign function are not included. */ + keyAlgorithm: KeyAlgorithm; + } - interface ClientCertificateSelectRequestDetails { - /** This field is a list of the types of certificates requested, sorted in order of the server's preference. Only certificates of a type contained in this list will be retrieved. If certificateTypes is the empty list, however, certificates of any type will be returned. */ - certificateTypes: string[]; - /** List of distinguished names of certificate authorities allowed by the server. Each entry must be a DER-encoded X.509 DistinguishedName. */ - certificateAuthorities: ArrayBuffer[]; - } + interface ClientCertificateSelectRequestDetails { + /** This field is a list of the types of certificates requested, sorted in order of the server's preference. Only certificates of a type contained in this list will be retrieved. If certificateTypes is the empty list, however, certificates of any type will be returned. */ + certificateTypes: string[]; + /** List of distinguished names of certificate authorities allowed by the server. Each entry must be a DER-encoded X.509 DistinguishedName. */ + certificateAuthorities: ArrayBuffer[]; + } - interface ClientCertificateSelectDetails { - /** Only certificates that match this request will be returned. */ - request: ClientCertificateSelectRequestDetails; - /** - * Optional. - * If given, the selectClientCertificates operates on this list. Otherwise, obtains the list of all certificates from the platform's certificate stores that are available to this extensions. Entries that the extension doesn't have permission for or which doesn't match the request, are removed. - */ - clientCerts?: ArrayBuffer[]; - /** If true, the filtered list is presented to the user to manually select a certificate and thereby granting the extension access to the certificate(s) and key(s). Only the selected certificate(s) will be returned. If is false, the list is reduced to all certificates that the extension has been granted access to (automatically or manually). */ - interactive: boolean; - } + interface ClientCertificateSelectDetails { + /** Only certificates that match this request will be returned. */ + request: ClientCertificateSelectRequestDetails; + /** + * Optional. + * If given, the selectClientCertificates operates on this list. Otherwise, obtains the list of all certificates from the platform's certificate stores that are available to this extensions. Entries that the extension doesn't have permission for or which doesn't match the request, are removed. + */ + clientCerts?: ArrayBuffer[]; + /** If true, the filtered list is presented to the user to manually select a certificate and thereby granting the extension access to the certificate(s) and key(s). Only the selected certificate(s) will be returned. If is false, the list is reduced to all certificates that the extension has been granted access to (automatically or manually). */ + interactive: boolean; + } - interface ServerCertificateVerificationDetails { - /** Each chain entry must be the DER encoding of a X.509 certificate, the first entry must be the server certificate and each entry must certify the entry preceding it. */ - serverCertificateChain: ArrayBuffer[]; - /** The hostname of the server to verify the certificate for, e.g. the server that presented the serverCertificateChain. */ - hostname: string; - } + interface ServerCertificateVerificationDetails { + /** Each chain entry must be the DER encoding of a X.509 certificate, the first entry must be the server certificate and each entry must certify the entry preceding it. */ + serverCertificateChain: ArrayBuffer[]; + /** The hostname of the server to verify the certificate for, e.g. the server that presented the serverCertificateChain. */ + hostname: string; + } - interface ServerCertificateVerificationResult { - /** The result of the trust verification: true if trust for the given verification details could be established and false if trust is rejected for any reason. */ - trusted: boolean; - /** - * If the trust verification failed, this array contains the errors reported by the underlying network layer. Otherwise, this array is empty. - * Note: This list is meant for debugging only and may not contain all relevant errors. The errors returned may change in future revisions of this API, and are not guaranteed to be forwards or backwards compatible. - */ - debug_errors: string[]; - } + interface ServerCertificateVerificationResult { + /** The result of the trust verification: true if trust for the given verification details could be established and false if trust is rejected for any reason. */ + trusted: boolean; + /** + * If the trust verification failed, this array contains the errors reported by the underlying network layer. Otherwise, this array is empty. + * Note: This list is meant for debugging only and may not contain all relevant errors. The errors returned may change in future revisions of this API, and are not guaranteed to be forwards or backwards compatible. + */ + debug_errors: string[]; + } - /** - * This function filters from a list of client certificates the ones that are known to the platform, match request and for which the extension has permission to access the certificate and its private key. If interactive is true, the user is presented a dialog where he can select from matching certificates and grant the extension access to the certificate. The selected/filtered client certificates will be passed to callback. - * @param callback The callback parameter should be a function that looks like this: - * function(array of Match matches) {...}; - * Parameter matches: The list of certificates that match the request, that the extension has permission for and, if interactive is true, that were selected by the user. - */ - export function selectClientCertificates(details: ClientCertificateSelectDetails, callback: (matches: Match[]) => void): void; - /** - * Passes the key pair of certificate for usage with platformKeys.subtleCrypto to callback. - * @param certificate The certificate of a Match returned by selectClientCertificates. - * @param parameters Determines signature/hash algorithm parameters additionally to the parameters fixed by the key itself. The same parameters are accepted as by WebCrypto's importKey function, e.g. RsaHashedImportParams for a RSASSA-PKCS1-v1_5 key. For RSASSA-PKCS1-v1_5 keys, additionally the parameters { 'hash': { 'name': 'none' } } are supported. The sign function will then apply PKCS#1 v1.5 padding and but not hash the given data. - * @param callback The public and private CryptoKey of a certificate which can only be used with platformKeys.subtleCrypto. - * The callback parameter should be a function that looks like this: - * function(object publicKey, object privateKey) {...}; - * Optional parameter privateKey: Might be null if this extension does not have access to it. - */ - export function getKeyPair(certificate: ArrayBuffer, parameters: Object, callback: (publicKey: CryptoKey, privateKey: CryptoKey | null) => void): void; - /** An implementation of WebCrypto's SubtleCrypto that allows crypto operations on keys of client certificates that are available to this extension. */ - export function subtleCrypto(): SubtleCrypto; - /** - * Checks whether details.serverCertificateChain can be trusted for details.hostname according to the trust settings of the platform. Note: The actual behavior of the trust verification is not fully specified and might change in the future. The API implementation verifies certificate expiration, validates the certification path and checks trust by a known CA. The implementation is supposed to respect the EKU serverAuth and to support subject alternative names. - * @param callback The callback parameter should be a function that looks like this: - * function(object result) {...}; - */ - export function verifyTLSServerCertificate(details: ServerCertificateVerificationDetails, callback: (result: ServerCertificateVerificationResult) => void): void; + /** + * This function filters from a list of client certificates the ones that are known to the platform, match request and for which the extension has permission to access the certificate and its private key. If interactive is true, the user is presented a dialog where he can select from matching certificates and grant the extension access to the certificate. The selected/filtered client certificates will be passed to callback. + * @param callback The callback parameter should be a function that looks like this: + * function(array of Match matches) {...}; + * Parameter matches: The list of certificates that match the request, that the extension has permission for and, if interactive is true, that were selected by the user. + */ + export function selectClientCertificates(details: ClientCertificateSelectDetails, callback: (matches: Match[]) => void): void; + /** + * Passes the key pair of certificate for usage with platformKeys.subtleCrypto to callback. + * @param certificate The certificate of a Match returned by selectClientCertificates. + * @param parameters Determines signature/hash algorithm parameters additionally to the parameters fixed by the key itself. The same parameters are accepted as by WebCrypto's importKey function, e.g. RsaHashedImportParams for a RSASSA-PKCS1-v1_5 key. For RSASSA-PKCS1-v1_5 keys, additionally the parameters { 'hash': { 'name': 'none' } } are supported. The sign function will then apply PKCS#1 v1.5 padding and but not hash the given data. + * @param callback The public and private CryptoKey of a certificate which can only be used with platformKeys.subtleCrypto. + * The callback parameter should be a function that looks like this: + * function(object publicKey, object privateKey) {...}; + * Optional parameter privateKey: Might be null if this extension does not have access to it. + */ + export function getKeyPair(certificate: ArrayBuffer, parameters: Object, callback: (publicKey: CryptoKey, privateKey: CryptoKey | null) => void): void; + /** An implementation of WebCrypto's SubtleCrypto that allows crypto operations on keys of client certificates that are available to this extension. */ + export function subtleCrypto(): SubtleCrypto; + /** + * Checks whether details.serverCertificateChain can be trusted for details.hostname according to the trust settings of the platform. Note: The actual behavior of the trust verification is not fully specified and might change in the future. The API implementation verifies certificate expiration, validates the certification path and checks trust by a known CA. The implementation is supposed to respect the EKU serverAuth and to support subject alternative names. + * @param callback The callback parameter should be a function that looks like this: + * function(object result) {...}; + */ + export function verifyTLSServerCertificate(details: ServerCertificateVerificationDetails, callback: (result: ServerCertificateVerificationResult) => void): void; } //////////////////// @@ -4653,10 +4653,10 @@ declare namespace chrome.platformKeys { * @since Chrome 27. */ declare namespace chrome.power { - /** Requests that power management be temporarily disabled. |level| describes the degree to which power management should be disabled. If a request previously made by the same app is still active, it will be replaced by the new request. */ - export function requestKeepAwake(level: string): void; - /** Releases a request previously made via requestKeepAwake(). */ - export function releaseKeepAwake(): void; + /** Requests that power management be temporarily disabled. |level| describes the degree to which power management should be disabled. If a request previously made by the same app is still active, it will be replaced by the new request. */ + export function requestKeepAwake(level: string): void; + /** Releases a request previously made via requestKeepAwake(). */ + export function releaseKeepAwake(): void; } //////////////////// @@ -4668,53 +4668,53 @@ declare namespace chrome.power { * @since Chrome 44. */ declare namespace chrome.printerProvider { - interface PrinterInfo { - /** Unique printer ID. */ - id: string; - /** Printer's human readable name. */ - name: string; - /** Optional. Printer's human readable description. */ - description?: string; - } + interface PrinterInfo { + /** Unique printer ID. */ + id: string; + /** Printer's human readable name. */ + name: string; + /** Optional. Printer's human readable description. */ + description?: string; + } - interface PrinterCapabilities { - /** Device capabilities in CDD format. */ - capabilities: any; - } + interface PrinterCapabilities { + /** Device capabilities in CDD format. */ + capabilities: any; + } - interface PrintJob { - /** ID of the printer which should handle the job. */ - printerId: string; - /** The print job title. */ - title: string; - /** Print ticket in CJT format. */ - ticket: Object; - /** The document content type. Supported formats are "application/pdf" and "image/pwg-raster". */ - contentType: string; - /** Blob containing the document data to print. Format must match |contentType|. */ - document: Blob; - } + interface PrintJob { + /** ID of the printer which should handle the job. */ + printerId: string; + /** The print job title. */ + title: string; + /** Print ticket in CJT format. */ + ticket: Object; + /** The document content type. Supported formats are "application/pdf" and "image/pwg-raster". */ + contentType: string; + /** Blob containing the document data to print. Format must match |contentType|. */ + document: Blob; + } - interface PrinterRequestedEvent extends chrome.events.Event<(resultCallback: (printerInfo: PrinterInfo[]) => void) => void> {} + interface PrinterRequestedEvent extends chrome.events.Event<(resultCallback: (printerInfo: PrinterInfo[]) => void) => void> {} - interface PrinterInfoRequestedEvent extends chrome.events.Event<(device: any, resultCallback: (printerInfo?: PrinterInfo) => void) => void> {} + interface PrinterInfoRequestedEvent extends chrome.events.Event<(device: any, resultCallback: (printerInfo?: PrinterInfo) => void) => void> {} - interface CapabilityRequestedEvent extends chrome.events.Event<(printerId: string, resultCallback: (capabilities: PrinterCapabilities) => void) => void> {} + interface CapabilityRequestedEvent extends chrome.events.Event<(printerId: string, resultCallback: (capabilities: PrinterCapabilities) => void) => void> {} - interface PrintRequestedEvent extends chrome.events.Event<(printJob: PrintJob, resultCallback: (result: string) => void) => void> {} + interface PrintRequestedEvent extends chrome.events.Event<(printJob: PrintJob, resultCallback: (result: string) => void) => void> {} - /** Event fired when print manager requests printers provided by extensions. */ - export var onGetPrintersRequested: PrinterRequestedEvent; - /** - * Event fired when print manager requests information about a USB device that may be a printer. - * Note: An application should not rely on this event being fired more than once per device. If a connected device is supported it should be returned in the onGetPrintersRequested event. - * @since Chrome 45. - */ - export var onGetUsbPrinterInfoRequested: PrinterInfoRequestedEvent; - /** Event fired when print manager requests printer capabilities. */ - export var onGetCapabilityRequested: CapabilityRequestedEvent; - /** Event fired when print manager requests printing. */ - export var onPrintRequested: PrintRequestedEvent; + /** Event fired when print manager requests printers provided by extensions. */ + export var onGetPrintersRequested: PrinterRequestedEvent; + /** + * Event fired when print manager requests information about a USB device that may be a printer. + * Note: An application should not rely on this event being fired more than once per device. If a connected device is supported it should be returned in the onGetPrintersRequested event. + * @since Chrome 45. + */ + export var onGetUsbPrinterInfoRequested: PrinterInfoRequestedEvent; + /** Event fired when print manager requests printer capabilities. */ + export var onGetCapabilityRequested: CapabilityRequestedEvent; + /** Event fired when print manager requests printing. */ + export var onPrintRequested: PrintRequestedEvent; } //////////////////// @@ -4728,7 +4728,7 @@ declare namespace chrome.printerProvider { */ declare namespace chrome.privacy { interface Services { - /** since Chrome 20. */ + /** since Chrome 20. */ spellingServiceEnabled: chrome.types.ChromeSetting; searchSuggestEnabled: chrome.types.ChromeSetting; instantEnabled: chrome.types.ChromeSetting; @@ -4736,35 +4736,35 @@ declare namespace chrome.privacy { safeBrowsingEnabled: chrome.types.ChromeSetting; autofillEnabled: chrome.types.ChromeSetting; translationServiceEnabled: chrome.types.ChromeSetting; - /** @since Chrome 38. */ - passwordSavingEnabled: chrome.types.ChromeSetting; - /** @since Chrome 42. */ - hotwordSearchEnabled: chrome.types.ChromeSetting; - /** @since Chrome 42. */ - safeBrowsingExtendedReportingEnabled: chrome.types.ChromeSetting; + /** @since Chrome 38. */ + passwordSavingEnabled: chrome.types.ChromeSetting; + /** @since Chrome 42. */ + hotwordSearchEnabled: chrome.types.ChromeSetting; + /** @since Chrome 42. */ + safeBrowsingExtendedReportingEnabled: chrome.types.ChromeSetting; } interface Network { networkPredictionEnabled: chrome.types.ChromeSetting; - /** @since Chrome 42. */ - webRTCMultipleRoutesEnabled: chrome.types.ChromeSetting; - /** @since Chrome 47. Warning: this is the current Dev channel. */ - webRTCNonProxiedUdpEnabled: chrome.types.ChromeSetting; + /** @since Chrome 42. */ + webRTCMultipleRoutesEnabled: chrome.types.ChromeSetting; + /** @since Chrome 47. Warning: this is the current Dev channel. */ + webRTCNonProxiedUdpEnabled: chrome.types.ChromeSetting; } interface Websites { thirdPartyCookiesAllowed: chrome.types.ChromeSetting; referrersEnabled: chrome.types.ChromeSetting; hyperlinkAuditingEnabled: chrome.types.ChromeSetting; - /** @since Chrome 21. */ + /** @since Chrome 21. */ protectedContentEnabled: chrome.types.ChromeSetting; } - /** Settings that enable or disable features that require third-party network services provided by Google and your default search provider. */ + /** Settings that enable or disable features that require third-party network services provided by Google and your default search provider. */ var services: Services; - /** Settings that influence Chrome's handling of network connections in general. */ + /** Settings that influence Chrome's handling of network connections in general. */ var network: Network; - /** Settings that determine what information Chrome makes available to websites. */ + /** Settings that determine what information Chrome makes available to websites. */ var websites: Websites; } @@ -4820,7 +4820,7 @@ declare namespace chrome.proxy { /** Optional. The proxy server to be used for HTTP requests. */ proxyForHttp?: ProxyServer; /** Optional. The proxy server to be used for everthing else or if any of the specific proxyFor... is not specified. */ - fallbackProxy?: ProxyServer; + fallbackProxy?: ProxyServer; /** Optional. The proxy server to be used for all per-URL requests (that is http, https, and ftp). */ singleProxy?: ProxyServer; /** Optional. The proxy server to be used for HTTPS requests. */ @@ -4868,22 +4868,22 @@ declare namespace chrome.runtime { } interface InstalledDetails { - /** - * The reason that this event is being dispatched. - * One of: "install", "update", "chrome_update", or "shared_module_update" - */ + /** + * The reason that this event is being dispatched. + * One of: "install", "update", "chrome_update", or "shared_module_update" + */ reason: string; - /** - * Optional. - * Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'. - */ + /** + * Optional. + * Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'. + */ previousVersion?: string; - /** - * Optional. - * Indicates the ID of the imported shared module extension which updated. This is present only if 'reason' is 'shared_module_update'. - * @since Chrome 29. - */ - id?: string; + /** + * Optional. + * Indicates the ID of the imported shared module extension which updated. This is present only if 'reason' is 'shared_module_update'. + * @since Chrome 29. + */ + id?: string; } interface MessageOptions { @@ -4952,14 +4952,14 @@ declare namespace chrome.runtime { */ sender?: MessageSender; /** An object which allows the addition and removal of listeners for a Chrome event. */ - onDisconnect: chrome.events.Event<() => void>; + onDisconnect: PortDisconnectEvent; /** An object which allows the addition and removal of listeners for a Chrome event. */ onMessage: PortMessageEvent; name: string; } interface UpdateAvailableDetails { - /** The version number of the available update. */ + /** The version number of the available update. */ version: string; } @@ -4968,6 +4968,8 @@ declare namespace chrome.runtime { version: string; } + interface PortDisconnectEvent extends chrome.events.Event<(port: Port) => void> {} + interface PortMessageEvent extends chrome.events.Event<(message: Object, port: Port) => void> {} interface ExtensionMessageEvent extends chrome.events.Event<(message: any, sender: MessageSender, sendResponse: (response: any) => void) => void> {} @@ -4976,225 +4978,225 @@ declare namespace chrome.runtime { interface RuntimeInstalledEvent extends chrome.events.Event<(details: InstalledDetails) => void> {} - interface RuntimeEvent extends chrome.events.Event<() => void> {} + interface RuntimeEvent extends chrome.events.Event<() => void> {} interface RuntimeRestartRequiredEvent extends chrome.events.Event<(reason: string) => void> {} interface RuntimeUpdateAvailableEvent extends chrome.events.Event<(details: UpdateAvailableDetails) => void> {} - interface ManifestIcons { - [size: number]: string; - } + interface ManifestIcons { + [size: number]: string; + } - interface ManifestAction { - default_icon?: ManifestIcons; - default_title?: string; - default_popup?: string; - } + interface ManifestAction { + default_icon?: ManifestIcons; + default_title?: string; + default_popup?: string; + } - interface SearchProvider { - name?: string; - keyword?: string; - favicon_url?: string; - search_url: string; - encoding?: string; - suggest_url?: string; - instant_url?: string; - image_url?: string; - search_url_post_params?: string; - suggest_url_post_params?: string; - instant_url_post_params?: string; - image_url_post_params?: string; - alternate_urls?: string[]; - prepopulated_id?: number; - is_default?: boolean; - } + interface SearchProvider { + name?: string; + keyword?: string; + favicon_url?: string; + search_url: string; + encoding?: string; + suggest_url?: string; + instant_url?: string; + image_url?: string; + search_url_post_params?: string; + suggest_url_post_params?: string; + instant_url_post_params?: string; + image_url_post_params?: string; + alternate_urls?: string[]; + prepopulated_id?: number; + is_default?: boolean; + } - interface Manifest { - // Required - manifest_version: number; - name: string; - version: string; + interface Manifest { + // Required + manifest_version: number; + name: string; + version: string; - // Recommended - default_locale?: string; - description?: string; - icons?: ManifestIcons; + // Recommended + default_locale?: string; + description?: string; + icons?: ManifestIcons; - // Pick one (or none) - browser_action?: ManifestAction; - page_action?: ManifestAction; + // Pick one (or none) + browser_action?: ManifestAction; + page_action?: ManifestAction; - // Optional - author?: any; - automation?: any; - background?: { - scripts?: string[]; - page?: string; - persistent?: boolean; - }; - background_page?: string; - chrome_settings_overrides?: { - homepage?: string; - search_provider?: SearchProvider; - startup_pages?: string[]; - }; - chrome_ui_overrides?: { - bookmarks_ui?: { - remove_bookmark_shortcut?: boolean; - remove_button?: boolean; - } - }; - chrome_url_overrides?: { - bookmarks?: string; - history?: string; - newtab?: string; - }; - commands?: { - [name: string]: { - suggested_key?: { + // Optional + author?: any; + automation?: any; + background?: { + scripts?: string[]; + page?: string; + persistent?: boolean; + }; + background_page?: string; + chrome_settings_overrides?: { + homepage?: string; + search_provider?: SearchProvider; + startup_pages?: string[]; + }; + chrome_ui_overrides?: { + bookmarks_ui?: { + remove_bookmark_shortcut?: boolean; + remove_button?: boolean; + } + }; + chrome_url_overrides?: { + bookmarks?: string; + history?: string; + newtab?: string; + }; + commands?: { + [name: string]: { + suggested_key?: { default?: string; - windows?: string; - mac?: string; - chromeos?: string; - linux?: string; - }; - description?: string; - global?: boolean - } - }; - content_capabilities?: { - matches?: string[]; - permissions?: string[]; - }; - content_scripts?: { - matches?: string[]; - exclude_matches?: string[]; - css?: string[]; - js?: string[]; - run_at?: string; - all_frames?: boolean; - include_globs?: string[]; - exclude_globs?: string[]; - }[]; - content_security_policy?: string; - converted_from_user_script?: boolean; - copresence?: any; - current_locale?: string; - devtools_page?: string; - event_rules?: { - event?: string; - actions?: { - type: string; - }[]; + windows?: string; + mac?: string; + chromeos?: string; + linux?: string; + }; + description?: string; + global?: boolean + } + }; + content_capabilities?: { + matches?: string[]; + permissions?: string[]; + }; + content_scripts?: { + matches?: string[]; + exclude_matches?: string[]; + css?: string[]; + js?: string[]; + run_at?: string; + all_frames?: boolean; + include_globs?: string[]; + exclude_globs?: string[]; + }[]; + content_security_policy?: string; + converted_from_user_script?: boolean; + copresence?: any; + current_locale?: string; + devtools_page?: string; + event_rules?: { + event?: string; + actions?: { + type: string; + }[]; conditions?: chrome.declarativeContent.PageStateMatcher[] - }[]; - externally_connectable?: { + }[]; + externally_connectable?: { ids?: string[]; - matches?: string[]; + matches?: string[]; accepts_tls_channel_id?: boolean; - }; - file_browser_handlers?: { - id?: string; - default_title?: string; - file_filters?: string[]; - }[]; - file_system_provider_capabilities?: { - configurable?: boolean; - watchable?: boolean; - multiple_mounts?: boolean; - source?: string; - }; - homepage_url?: string; - import?: { - id: string; - minimum_version?: string - }[]; - export?: { - whitelist?: string[] - }; - incognito?: string; - input_components?: { - name?: string; - type?: string; - id?: string; - description?: string; - language?: string; - layouts?: any[]; - }[]; - key?: string; - minimum_chrome_version?: string; - nacl_modules?: { - path: string; - mime_type: string; - }[]; - oauth2?: { - client_id: string; - scopes?: string[]; - }; - offline_enabled?: boolean; - omnibox?: { - keyword: string; - }; - optional_permissions?: string[]; - options_page?: string; - options_ui?: { - page?: string; - chrome_style?: boolean; - open_in_tab?: boolean; - }; - permissions?: string[]; - platforms?: { - nacl_arch?: string; - sub_package_path: string; - }[]; - plugins?: { - path: string; - }[]; - requirements?: { - '3D'?: { - features?: string[] - }; - plugins?: { - npapi?: boolean; - } - }; - sandbox?: { - pages: string[]; - content_security_policy?: string; - }; - short_name?: string; - signature?: any; - spellcheck?: { - dictionary_language?: string; - dictionary_locale?: string; - dictionary_format?: string; - dictionary_path?: string; - }; - storage?: { - managed_schema: string - }; - system_indicator?: any; - tts_engine?: { - voices: { - voice_name: string; - lang?: string; - gender?: string; - event_types?: string[]; - }[] - }; - update_url?: string; - version_name?: string; - web_accessible_resources?: string[]; - [key: string]: any; - } + }; + file_browser_handlers?: { + id?: string; + default_title?: string; + file_filters?: string[]; + }[]; + file_system_provider_capabilities?: { + configurable?: boolean; + watchable?: boolean; + multiple_mounts?: boolean; + source?: string; + }; + homepage_url?: string; + import?: { + id: string; + minimum_version?: string + }[]; + export?: { + whitelist?: string[] + }; + incognito?: string; + input_components?: { + name?: string; + type?: string; + id?: string; + description?: string; + language?: string; + layouts?: any[]; + }[]; + key?: string; + minimum_chrome_version?: string; + nacl_modules?: { + path: string; + mime_type: string; + }[]; + oauth2?: { + client_id: string; + scopes?: string[]; + }; + offline_enabled?: boolean; + omnibox?: { + keyword: string; + }; + optional_permissions?: string[]; + options_page?: string; + options_ui?: { + page?: string; + chrome_style?: boolean; + open_in_tab?: boolean; + }; + permissions?: string[]; + platforms?: { + nacl_arch?: string; + sub_package_path: string; + }[]; + plugins?: { + path: string; + }[]; + requirements?: { + '3D'?: { + features?: string[] + }; + plugins?: { + npapi?: boolean; + } + }; + sandbox?: { + pages: string[]; + content_security_policy?: string; + }; + short_name?: string; + signature?: any; + spellcheck?: { + dictionary_language?: string; + dictionary_locale?: string; + dictionary_format?: string; + dictionary_path?: string; + }; + storage?: { + managed_schema: string + }; + system_indicator?: any; + tts_engine?: { + voices: { + voice_name: string; + lang?: string; + gender?: string; + event_types?: string[]; + }[] + }; + update_url?: string; + version_name?: string; + web_accessible_resources?: string[]; + [key: string]: any; + } /** * Attempts to connect to connect listeners within an extension/app (such as the background page), or other extensions/apps. This is useful for content scripts connecting to their extension processes, inter-app/extension communication, and web messaging. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via tabs.connect. * @since Chrome 26. */ export function connect(connectInfo?: ConnectInfo): Port; - /** + /** * Attempts to connect to connect listeners within an extension/app (such as the background page), or other extensions/apps. This is useful for content scripts connecting to their extension processes, inter-app/extension communication, and web messaging. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via tabs.connect. * @since Chrome 26. * @param extensionId Optional. @@ -5218,7 +5220,7 @@ declare namespace chrome.runtime { * Returns a DirectoryEntry for the package directory. * @since Chrome 29. */ - export function getPackageDirectoryEntry(callback: (directoryEntry: DirectoryEntry) => void): void; + export function getPackageDirectoryEntry(callback: (directoryEntry: DirectoryEntry) => void): void; /** * Returns information about the current platform. * @since Chrome 29. @@ -5248,21 +5250,21 @@ declare namespace chrome.runtime { * @since Chrome 32. */ export function restart(): void; - /** + /** * Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage. * @since Chrome 26. * @param responseCallback Optional * Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message. */ export function sendMessage(message: any, responseCallback?: (response: any) => void): void; - /** + /** * Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage. * @since Chrome 32. * @param responseCallback Optional * Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime.lastError will be set to the error message. */ export function sendMessage(message: any, options: MessageOptions, responseCallback?: (response: any) => void): void; - /** + /** * Sends a single message to event listeners within your extension/app or a different extension/app. Similar to runtime.connect but only sends a single message, with an optional response. If sending to your extension, the runtime.onMessage event will be fired in each page, or runtime.onMessageExternal, if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs.sendMessage. * @since Chrome 26. * @param extensionId The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for web messaging. @@ -5286,7 +5288,7 @@ declare namespace chrome.runtime { * @param responseCallback Optional. * Parameter response: The response message sent by the native messaging host. If an error occurs while connecting to the native messaging host, the callback will be called with no arguments and runtime.lastError will be set to the error message. */ - export function sendNativeMessage(application: string, message: Object, responseCallback?: (response: any) => void): void; + export function sendNativeMessage(application: string, message: Object, responseCallback?: (response: any) => void): void; /** * Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 255 characters. * @since Chrome 41. @@ -5294,7 +5296,7 @@ declare namespace chrome.runtime { * URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation. * @param callback Called when the uninstall URL is set. If the given URL is invalid, runtime.lastError will be set. */ - export function setUninstallURL(url: string, callback?: () => void): void; + export function setUninstallURL(url: string, callback?: () => void): void; /** * Open your Extension's options page, if possible. * The precise behavior may depend on your manifest's options_ui or options_page key, or what Chrome happens to support at the time. For example, the page may be opened in a new tab, within chrome://extensions, within an App, or it may just focus an open options page. It will never cause the caller page to reload. @@ -5303,52 +5305,52 @@ declare namespace chrome.runtime { */ export function openOptionsPage(callback?: () => void): void; - /** - * Fired when a connection is made from either an extension process or a content script. - * @since Chrome 26. - */ + /** + * Fired when a connection is made from either an extension process or a content script. + * @since Chrome 26. + */ var onConnect: ExtensionConnectEvent; - /** - * Fired when a connection is made from another extension. - * @since Chrome 26. - */ - var onConnectExternal: ExtensionConnectEvent; - /** Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. */ - var onSuspend: RuntimeEvent; - /** - * Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode. - * @since Chrome 23. - */ - var onStartup: RuntimeEvent; - /** Fired when the extension is first installed, when the extension is updated to a new version, and when Chrome is updated to a new version. */ + /** + * Fired when a connection is made from another extension. + * @since Chrome 26. + */ + var onConnectExternal: ExtensionConnectEvent; + /** Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. */ + var onSuspend: RuntimeEvent; + /** + * Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode. + * @since Chrome 23. + */ + var onStartup: RuntimeEvent; + /** Fired when the extension is first installed, when the extension is updated to a new version, and when Chrome is updated to a new version. */ var onInstalled: RuntimeInstalledEvent; - /** Sent after onSuspend to indicate that the app won't be unloaded after all. */ - var onSuspendCanceled: RuntimeEvent; - /** - * Fired when a message is sent from either an extension process or a content script. - * @since Chrome 26. - */ + /** Sent after onSuspend to indicate that the app won't be unloaded after all. */ + var onSuspendCanceled: RuntimeEvent; + /** + * Fired when a message is sent from either an extension process or a content script. + * @since Chrome 26. + */ var onMessage: ExtensionMessageEvent; - /** - * Fired when a message is sent from another extension/app. Cannot be used in a content script. - * @since Chrome 26. - */ - var onMessageExternal: ExtensionMessageEvent; - /** - * Fired when an app or the device that it runs on needs to be restarted. The app should close all its windows at its earliest convenient time to let the restart to happen. If the app does nothing, a restart will be enforced after a 24-hour grace period has passed. Currently, this event is only fired for Chrome OS kiosk apps. - * @since Chrome 29. - */ + /** + * Fired when a message is sent from another extension/app. Cannot be used in a content script. + * @since Chrome 26. + */ + var onMessageExternal: ExtensionMessageEvent; + /** + * Fired when an app or the device that it runs on needs to be restarted. The app should close all its windows at its earliest convenient time to let the restart to happen. If the app does nothing, a restart will be enforced after a 24-hour grace period has passed. Currently, this event is only fired for Chrome OS kiosk apps. + * @since Chrome 29. + */ var onRestartRequired: RuntimeRestartRequiredEvent; - /** - * Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call chrome.runtime.reload(). If your extension is using a persistent background page, the background page of course never gets unloaded, so unless you call chrome.runtime.reload() manually in response to this event the update will not get installed until the next time chrome itself restarts. If no handlers are listening for this event, and your extension has a persistent background page, it behaves as if chrome.runtime.reload() is called in response to this event. - * @since Chrome 25. - */ + /** + * Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call chrome.runtime.reload(). If your extension is using a persistent background page, the background page of course never gets unloaded, so unless you call chrome.runtime.reload() manually in response to this event the update will not get installed until the next time chrome itself restarts. If no handlers are listening for this event, and your extension has a persistent background page, it behaves as if chrome.runtime.reload() is called in response to this event. + * @since Chrome 25. + */ var onUpdateAvailable: RuntimeUpdateAvailableEvent; - /** - * @deprecated since Chrome 33. Please use chrome.runtime.onRestartRequired. - * Fired when a Chrome update is available, but isn't installed immediately because a browser restart is required. - */ - var onBrowserUpdateAvailable: RuntimeEvent; + /** + * @deprecated since Chrome 33. Please use chrome.runtime.onRestartRequired. + * Fired when a Chrome update is available, but isn't installed immediately because a browser restart is required. + */ + var onBrowserUpdateAvailable: RuntimeEvent; } //////////////////// @@ -5386,76 +5388,76 @@ declare namespace chrome.scriptBadge { * @since Chrome 37. */ declare namespace chrome.sessions { - interface Filter { - /** - * Optional. - * The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of entries (sessions.MAX_SESSION_RESULTS). - */ - maxResults?: number; - } + interface Filter { + /** + * Optional. + * The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of entries (sessions.MAX_SESSION_RESULTS). + */ + maxResults?: number; + } - interface Session { - /** The time when the window or tab was closed or modified, represented in milliseconds since the epoch. */ - lastModified: number; - /** - * Optional. - * The tabs.Tab, if this entry describes a tab. Either this or sessions.Session.window will be set. - */ - tab?: tabs.Tab; - /** - * Optional. - * The windows.Window, if this entry describes a window. Either this or sessions.Session.tab will be set. - */ - window?: windows.Window; - } + interface Session { + /** The time when the window or tab was closed or modified, represented in milliseconds since the epoch. */ + lastModified: number; + /** + * Optional. + * The tabs.Tab, if this entry describes a tab. Either this or sessions.Session.window will be set. + */ + tab?: tabs.Tab; + /** + * Optional. + * The windows.Window, if this entry describes a window. Either this or sessions.Session.tab will be set. + */ + window?: windows.Window; + } - interface Device { - /** The name of the foreign device. */ - deviceName: string; - /** A list of open window sessions for the foreign device, sorted from most recently to least recently modified session. */ - sessions: Session[]; - } + interface Device { + /** The name of the foreign device. */ + deviceName: string; + /** A list of open window sessions for the foreign device, sorted from most recently to least recently modified session. */ + sessions: Session[]; + } - interface SessionChangedEvent extends chrome.events.Event<() => void> {} + interface SessionChangedEvent extends chrome.events.Event<() => void> {} - /** The maximum number of sessions.Session that will be included in a requested list. */ - export var MAX_SESSION_RESULTS: number; + /** The maximum number of sessions.Session that will be included in a requested list. */ + export var MAX_SESSION_RESULTS: number; - /** - * Gets the list of recently closed tabs and/or windows. - * @param callback - * Parameter sessions: The list of closed entries in reverse order that they were closed (the most recently closed tab or window will be at index 0). The entries may contain either tabs or windows. - */ - export function getRecentlyClosed(filter: Filter, callback: (sessions: Session[]) => void): void; - /** - * Gets the list of recently closed tabs and/or windows. - * @param callback - * Parameter sessions: The list of closed entries in reverse order that they were closed (the most recently closed tab or window will be at index 0). The entries may contain either tabs or windows. - */ - export function getRecentlyClosed(callback: (sessions: Session[]) => void): void; - /** - * Retrieves all devices with synced sessions. - * @param callback - * Parameter devices: The list of sessions.Device objects for each synced session, sorted in order from device with most recently modified session to device with least recently modified session. tabs.Tab objects are sorted by recency in the windows.Window of the sessions.Session objects. - */ - export function getDevices(filter: Filter, callback: (devices: Device[]) => void): void; - /** - * Retrieves all devices with synced sessions. - * @param callback - * Parameter devices: The list of sessions.Device objects for each synced session, sorted in order from device with most recently modified session to device with least recently modified session. tabs.Tab objects are sorted by recency in the windows.Window of the sessions.Session objects. - */ - export function getDevices(callback: (devices: Device[]) => void): void; - /** - * Reopens a windows.Window or tabs.Tab, with an optional callback to run when the entry has been restored. - * @param sessionId Optional. - * The windows.Window.sessionId, or tabs.Tab.sessionId to restore. If this parameter is not specified, the most recently closed session is restored. - * @param callback Optional. - * Parameter restoredSession: A sessions.Session containing the restored windows.Window or tabs.Tab object. - */ - export function restore(sessionId?: string, callback?: (restoredSession: Session) => void): void; + /** + * Gets the list of recently closed tabs and/or windows. + * @param callback + * Parameter sessions: The list of closed entries in reverse order that they were closed (the most recently closed tab or window will be at index 0). The entries may contain either tabs or windows. + */ + export function getRecentlyClosed(filter: Filter, callback: (sessions: Session[]) => void): void; + /** + * Gets the list of recently closed tabs and/or windows. + * @param callback + * Parameter sessions: The list of closed entries in reverse order that they were closed (the most recently closed tab or window will be at index 0). The entries may contain either tabs or windows. + */ + export function getRecentlyClosed(callback: (sessions: Session[]) => void): void; + /** + * Retrieves all devices with synced sessions. + * @param callback + * Parameter devices: The list of sessions.Device objects for each synced session, sorted in order from device with most recently modified session to device with least recently modified session. tabs.Tab objects are sorted by recency in the windows.Window of the sessions.Session objects. + */ + export function getDevices(filter: Filter, callback: (devices: Device[]) => void): void; + /** + * Retrieves all devices with synced sessions. + * @param callback + * Parameter devices: The list of sessions.Device objects for each synced session, sorted in order from device with most recently modified session to device with least recently modified session. tabs.Tab objects are sorted by recency in the windows.Window of the sessions.Session objects. + */ + export function getDevices(callback: (devices: Device[]) => void): void; + /** + * Reopens a windows.Window or tabs.Tab, with an optional callback to run when the entry has been restored. + * @param sessionId Optional. + * The windows.Window.sessionId, or tabs.Tab.sessionId to restore. If this parameter is not specified, the most recently closed session is restored. + * @param callback Optional. + * Parameter restoredSession: A sessions.Session containing the restored windows.Window or tabs.Tab object. + */ + export function restore(sessionId?: string, callback?: (restoredSession: Session) => void): void; - /** Fired when recently closed tabs and/or windows are changed. This event does not monitor synced sessions changes. */ - export var onChanged: SessionChangedEvent; + /** Fired when recently closed tabs and/or windows are changed. This event does not monitor synced sessions changes. */ + export var onChanged: SessionChangedEvent; } //////////////////// @@ -5467,113 +5469,113 @@ declare namespace chrome.sessions { * @since Chrome 20. */ declare namespace chrome.storage { - interface StorageArea { - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(callback: (bytesInUse: number) => void): void; - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param keys A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(keys: string | string[] | null, callback: (bytesInUse: number) => void): void; - /** - * Removes all items from storage. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - clear(callback?: () => void): void; - /** - * Sets multiple items. - * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. - * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - set(items: Object, callback?: () => void): void; - /** - * Removes one item from storage. - * @param key A single key for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(key: string, callback?: () => void): void; - /** - * Removes items from storage. - * @param keys A list of keys for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(keys: string[], callback?: () => void): void; - /** - * Gets one or more items from storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(callback: (items: { [key: string]: any }) => void): void; - /** - * Gets one or more items from storage. - * @param keys A single key to get, list of keys to get, or a dictionary specifying default values. - * An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(keys: string | string[] | Object | null, callback: (items: { [key: string]: any }) => void): void; - } + interface StorageArea { + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(callback: (bytesInUse: number) => void): void; + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param keys A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(keys: string | string[] | null, callback: (bytesInUse: number) => void): void; + /** + * Removes all items from storage. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + clear(callback?: () => void): void; + /** + * Sets multiple items. + * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. + * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + set(items: Object, callback?: () => void): void; + /** + * Removes one item from storage. + * @param key A single key for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(key: string, callback?: () => void): void; + /** + * Removes items from storage. + * @param keys A list of keys for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(keys: string[], callback?: () => void): void; + /** + * Gets one or more items from storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param keys A single key to get, list of keys to get, or a dictionary specifying default values. + * An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(keys: string | string[] | Object | null, callback: (items: { [key: string]: any }) => void): void; + } - interface StorageChange { - /** Optional. The new value of the item, if there is a new value. */ - newValue?: any; - /** Optional. The old value of the item, if there was an old value. */ - oldValue?: any; - } + interface StorageChange { + /** Optional. The new value of the item, if there is a new value. */ + newValue?: any; + /** Optional. The old value of the item, if there was an old value. */ + oldValue?: any; + } - interface LocalStorageArea extends StorageArea { - /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - } + interface LocalStorageArea extends StorageArea { + /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + } - interface SyncStorageArea extends StorageArea { - /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ - MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; - /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ - QUOTA_BYTES_PER_ITEM: number; - /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ - MAX_ITEMS: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - */ - MAX_WRITE_OPERATIONS_PER_HOUR: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - * @since Chrome 40. - */ - MAX_WRITE_OPERATIONS_PER_MINUTE: number; - } + interface SyncStorageArea extends StorageArea { + /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ + MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; + /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ + QUOTA_BYTES_PER_ITEM: number; + /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ + MAX_ITEMS: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + */ + MAX_WRITE_OPERATIONS_PER_HOUR: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + * @since Chrome 40. + */ + MAX_WRITE_OPERATIONS_PER_MINUTE: number; + } - interface StorageChangedEvent extends chrome.events.Event<(changes: { [key: string]: StorageChange }, areaName: string) => void> {} + interface StorageChangedEvent extends chrome.events.Event<(changes: { [key: string]: StorageChange }, areaName: string) => void> {} - /** Items in the local storage area are local to each machine. */ - var local: LocalStorageArea; - /** Items in the sync storage area are synced using Chrome Sync. */ - var sync: SyncStorageArea; + /** Items in the local storage area are local to each machine. */ + var local: LocalStorageArea; + /** Items in the sync storage area are synced using Chrome Sync. */ + var sync: SyncStorageArea; - /** - * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. - * @since Chrome 33. - */ - var managed: StorageArea; + /** + * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. + * @since Chrome 33. + */ + var managed: StorageArea; - /** Fired when one or more items change. */ - var onChanged: StorageChangedEvent; + /** Fired when one or more items change. */ + var onChanged: StorageChangedEvent; } //////////////////// @@ -5645,40 +5647,40 @@ declare namespace chrome.socket { * @since Chrome 32. */ declare namespace chrome.system.cpu { - interface ProcessorUsage { - /** The cumulative time used by userspace programs on this processor. */ - user: number; - /** The cumulative time used by kernel programs on this processor. */ - kernel: number; - /** The cumulative time spent idle by this processor. */ - idle: number; - /** The total cumulative time for this processor. This value is equal to user + kernel + idle. */ - total: number; - } + interface ProcessorUsage { + /** The cumulative time used by userspace programs on this processor. */ + user: number; + /** The cumulative time used by kernel programs on this processor. */ + kernel: number; + /** The cumulative time spent idle by this processor. */ + idle: number; + /** The total cumulative time for this processor. This value is equal to user + kernel + idle. */ + total: number; + } - interface ProcessorInfo { - /** Cumulative usage info for this logical processor. */ - usage: ProcessorUsage; - } + interface ProcessorInfo { + /** Cumulative usage info for this logical processor. */ + usage: ProcessorUsage; + } - interface CpuInfo { - /** The number of logical processors. */ - numOfProcessors: number; - /** The architecture name of the processors. */ - archName: string; - /** The model name of the processors. */ - modelName: string; - /** - * A set of feature codes indicating some of the processor's capabilities. - * The currently supported codes are "mmx", "sse", "sse2", "sse3", "ssse3", "sse4_1", "sse4_2", and "avx". - */ - features: string[]; - /** Information about each logical processor. */ - processors: ProcessorInfo[]; - } + interface CpuInfo { + /** The number of logical processors. */ + numOfProcessors: number; + /** The architecture name of the processors. */ + archName: string; + /** The model name of the processors. */ + modelName: string; + /** + * A set of feature codes indicating some of the processor's capabilities. + * The currently supported codes are "mmx", "sse", "sse2", "sse3", "ssse3", "sse4_1", "sse4_2", and "avx". + */ + features: string[]; + /** Information about each logical processor. */ + processors: ProcessorInfo[]; + } - /** Queries basic CPU information of the system. */ - export function getInfo(callback: (info: CpuInfo) => void): void; + /** Queries basic CPU information of the system. */ + export function getInfo(callback: (info: CpuInfo) => void): void; } //////////////////// @@ -5690,15 +5692,15 @@ declare namespace chrome.system.cpu { * @since Chrome 32. */ declare namespace chrome.system.memory { - interface MemoryInfo { - /** The total amount of physical memory capacity, in bytes. */ - capacity: number; - /** The amount of available capacity, in bytes. */ - availableCapacity: number; - } + interface MemoryInfo { + /** The total amount of physical memory capacity, in bytes. */ + capacity: number; + /** The amount of available capacity, in bytes. */ + availableCapacity: number; + } - /** Get physical memory information. */ - export function getInfo(callback: (info: MemoryInfo) => void): void; + /** Get physical memory information. */ + export function getInfo(callback: (info: MemoryInfo) => void): void; } //////////////////// @@ -5710,51 +5712,51 @@ declare namespace chrome.system.memory { * @since Chrome 30. */ declare namespace chrome.system.storage { - interface StorageUnitInfo { - /** The transient ID that uniquely identifies the storage device. This ID will be persistent within the same run of a single application. It will not be a persistent identifier between different runs of an application, or between different applications. */ - id: string; - /** The name of the storage unit. */ - name: string; - /** - * The media type of the storage unit. - * fixed: The storage has fixed media, e.g. hard disk or SSD. - * removable: The storage is removable, e.g. USB flash drive. - * unknown: The storage type is unknown. - */ - type: string; - /** The total amount of the storage space, in bytes. */ - capacity: number; - } + interface StorageUnitInfo { + /** The transient ID that uniquely identifies the storage device. This ID will be persistent within the same run of a single application. It will not be a persistent identifier between different runs of an application, or between different applications. */ + id: string; + /** The name of the storage unit. */ + name: string; + /** + * The media type of the storage unit. + * fixed: The storage has fixed media, e.g. hard disk or SSD. + * removable: The storage is removable, e.g. USB flash drive. + * unknown: The storage type is unknown. + */ + type: string; + /** The total amount of the storage space, in bytes. */ + capacity: number; + } - interface StorageCapacityInfo { - /** A copied |id| of getAvailableCapacity function parameter |id|. */ - id: string; - /** The available capacity of the storage device, in bytes. */ - availableCapacity: number; - } + interface StorageCapacityInfo { + /** A copied |id| of getAvailableCapacity function parameter |id|. */ + id: string; + /** The available capacity of the storage device, in bytes. */ + availableCapacity: number; + } - interface SystemStorageAttachedEvent extends chrome.events.Event<(info: StorageUnitInfo) => void> {} + interface SystemStorageAttachedEvent extends chrome.events.Event<(info: StorageUnitInfo) => void> {} - interface SystemStorageDetachedEvent extends chrome.events.Event<(id: string) => void> {} + interface SystemStorageDetachedEvent extends chrome.events.Event<(id: string) => void> {} - /** Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects. */ - export function getInfo(callback: (info: StorageUnitInfo[]) => void): void; - /** - * Ejects a removable storage device. - * @param callback - * Parameter result: success: The ejection command is successful -- the application can prompt the user to remove the device; in_use: The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device; no_such_device: There is no such device known. failure: The ejection command failed. - */ - export function ejectDevice(id: string, callback: (result: string) => void): void; - /** - * Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo. - * @since Dev channel only. - */ - export function getAvailableCapacity(id: string, callback: (info: StorageCapacityInfo) => void): void; + /** Get the storage information from the system. The argument passed to the callback is an array of StorageUnitInfo objects. */ + export function getInfo(callback: (info: StorageUnitInfo[]) => void): void; + /** + * Ejects a removable storage device. + * @param callback + * Parameter result: success: The ejection command is successful -- the application can prompt the user to remove the device; in_use: The device is in use by another application. The ejection did not succeed; the user should not remove the device until the other application is done with the device; no_such_device: There is no such device known. failure: The ejection command failed. + */ + export function ejectDevice(id: string, callback: (result: string) => void): void; + /** + * Get the available capacity of a specified |id| storage device. The |id| is the transient device ID from StorageUnitInfo. + * @since Dev channel only. + */ + export function getAvailableCapacity(id: string, callback: (info: StorageCapacityInfo) => void): void; - /** Fired when a new removable storage is attached to the system. */ - export var onAttached: SystemStorageAttachedEvent; - /** Fired when a removable storage is detached from the system. */ - export var onDetached: SystemStorageDetachedEvent; + /** Fired when a new removable storage is attached to the system. */ + export var onAttached: SystemStorageAttachedEvent; + /** Fired when a removable storage is detached from the system. */ + export var onDetached: SystemStorageDetachedEvent; } //////////////////// @@ -5767,44 +5769,44 @@ declare namespace chrome.system.storage { */ declare namespace chrome.tabCapture { interface CaptureInfo { - /** The id of the tab whose status changed. */ + /** The id of the tab whose status changed. */ tabId: number; - /** - * The new capture status of the tab. - * One of: "pending", "active", "stopped", or "error" - */ + /** + * The new capture status of the tab. + * One of: "pending", "active", "stopped", or "error" + */ status: string; - /** Whether an element in the tab being captured is in fullscreen mode. */ + /** Whether an element in the tab being captured is in fullscreen mode. */ fullscreen: boolean; } interface CaptureOptions { - /** Optional. */ + /** Optional. */ audio?: boolean; - /** Optional. */ + /** Optional. */ video?: boolean; - /** Optional. */ - audioConstraints?: MediaStreamConstraints; - /** Optional. */ - videoConstraints?: MediaStreamConstraints; - } + /** Optional. */ + audioConstraints?: MediaStreamConstraints; + /** Optional. */ + videoConstraints?: MediaStreamConstraints; + } - interface CaptureStatusChangedEvent extends chrome.events.Event<(info: CaptureInfo) => void> {} + interface CaptureStatusChangedEvent extends chrome.events.Event<(info: CaptureInfo) => void> {} - /** - * Captures the visible area of the currently active tab. Capture can only be started on the currently active tab after the extension has been invoked. Capture is maintained across page navigations within the tab, and stops when the tab is closed, or the media stream is closed by the extension. - * @param options Configures the returned media stream. - * @param callback Callback with either the tab capture stream or null. - */ + /** + * Captures the visible area of the currently active tab. Capture can only be started on the currently active tab after the extension has been invoked. Capture is maintained across page navigations within the tab, and stops when the tab is closed, or the media stream is closed by the extension. + * @param options Configures the returned media stream. + * @param callback Callback with either the tab capture stream or null. + */ export function capture(options: CaptureOptions, callback: (stream: MediaStream | null) => void): void; - /** - * Returns a list of tabs that have requested capture or are being captured, i.e. status != stopped and status != error. This allows extensions to inform the user that there is an existing tab capture that would prevent a new tab capture from succeeding (or to prevent redundant requests for the same tab). - * @param callback Callback invoked with CaptureInfo[] for captured tabs. - */ + /** + * Returns a list of tabs that have requested capture or are being captured, i.e. status != stopped and status != error. This allows extensions to inform the user that there is an existing tab capture that would prevent a new tab capture from succeeding (or to prevent redundant requests for the same tab). + * @param callback Callback invoked with CaptureInfo[] for captured tabs. + */ export function getCapturedTabs(callback: (result: CaptureInfo[]) => void): void; - /** Event fired when the capture status of a tab changes. This allows extension authors to keep track of the capture status of tabs to keep UI elements like page actions in sync. */ - var onStatusChanged: CaptureStatusChangedEvent; + /** Event fired when the capture status of a tab changes. This allows extension authors to keep track of the capture status of tabs to keep UI elements like page actions in sync. */ + var onStatusChanged: CaptureStatusChangedEvent; } //////////////////// @@ -5816,334 +5818,334 @@ declare namespace chrome.tabCapture { * @since Chrome 5. */ declare namespace chrome.tabs { - /** - * Tab muted state and the reason for the last state change. - * @since Chrome 46. Warning: this is the current Beta channel. - */ - interface MutedInfo { - /** Whether the tab is prevented from playing sound (but hasn't necessarily recently produced sound). Equivalent to whether the muted audio indicator is showing. */ - muted: boolean; - /** - * Optional. - * The reason the tab was muted or unmuted. Not set if the tab's mute state has never been changed. - * "user": A user input action has set/overridden the muted state. - * "capture": Tab capture started, forcing a muted state change. - * "extension": An extension, identified by the extensionId field, set the muted state. - */ - reason?: string; - /** - * Optional. - * The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last changed. - */ - extensionId?: string; - } - - interface Tab { - /** - * Optional. - * Either loading or complete. - */ - status?: string; - /** The zero-based index of the tab within its window. */ - index: number; - /** - * Optional. - * The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists. - * @since Chrome 18. - */ - openerTabId?: number; - /** - * Optional. - * The title of the tab. This property is only present if the extension's manifest includes the "tabs" permission. - */ - title?: string; - /** - * Optional. - * The URL the tab is displaying. This property is only present if the extension's manifest includes the "tabs" permission. - */ - url?: string; - /** - * Whether the tab is pinned. - * @since Chrome 9. - */ - pinned: boolean; - /** - * Whether the tab is highlighted. - * @since Chrome 16. - */ - highlighted: boolean; - /** The ID of the window the tab is contained within. */ - windowId: number; - /** - * Whether the tab is active in its window. (Does not necessarily mean the window is focused.) - * @since Chrome 16. - */ - active: boolean; - /** - * Optional. - * The URL of the tab's favicon. This property is only present if the extension's manifest includes the "tabs" permission. It may also be an empty string if the tab is loading. - */ - favIconUrl?: string; - /** - * Optional. - * The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a Tab may not be assigned an ID, for example when querying foreign tabs using the sessions API, in which case a session ID may be present. Tab ID can also be set to chrome.tabs.TAB_ID_NONE for apps and devtools windows. - */ - id?: number; - /** Whether the tab is in an incognito window. */ - incognito: boolean; - /** - * Whether the tab is selected. - * @deprecated since Chrome 33. Please use tabs.Tab.highlighted. - */ - selected: boolean; - /** - * Optional. - * Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the speaker audio indicator is showing. - * @since Chrome 45. - */ - audible?: boolean; - /** - * Optional. - * Current tab muted state and the reason for the last state change. - * @since Chrome 46. Warning: this is the current Beta channel. - */ - mutedInfo?: MutedInfo; - /** - * Optional. The width of the tab in pixels. - * @since Chrome 31. - */ - width?: number; - /** - * Optional. The height of the tab in pixels. - * @since Chrome 31. - */ - height?: number; - /** - * Optional. The session ID used to uniquely identify a Tab obtained from the sessions API. - * @since Chrome 31. - */ - sessionId?: string; + /** + * Tab muted state and the reason for the last state change. + * @since Chrome 46. Warning: this is the current Beta channel. + */ + interface MutedInfo { + /** Whether the tab is prevented from playing sound (but hasn't necessarily recently produced sound). Equivalent to whether the muted audio indicator is showing. */ + muted: boolean; + /** + * Optional. + * The reason the tab was muted or unmuted. Not set if the tab's mute state has never been changed. + * "user": A user input action has set/overridden the muted state. + * "capture": Tab capture started, forcing a muted state change. + * "extension": An extension, identified by the extensionId field, set the muted state. + */ + reason?: string; + /** + * Optional. + * The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last changed. + */ + extensionId?: string; } - /** - * Defines how zoom changes in a tab are handled and at what scope. - * @since Chrome 38. - */ - interface ZoomSettings { - /** - * Optional. - * Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to "automatic". - * "automatic": Zoom changes are handled automatically by the browser. - * "manual": Overrides the automatic handling of zoom changes. The onZoomChange event will still be dispatched, and it is the responsibility of the extension to listen for this event and manually scale the page. This mode does not support per-origin zooming, and will thus ignore the scope zoom setting and assume per-tab. - * "disabled": Disables all zooming in the tab. The tab will revert to the default zoom level, and all attempted zoom changes will be ignored. - */ - mode?: string; - /** - * Optional. - * Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to per-origin when in automatic mode, and per-tab otherwise. - * "per-origin": Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin will be zoomed as well. Moreover, per-origin zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor. The per-origin scope is only available in the automatic mode. - * "per-tab": Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this tab. Also, per-tab zoom changes are reset on navigation; navigating a tab will always load pages with their per-origin zoom factors. - */ - scope?: string; - /** - * Optional. - * Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings. - * @since Chrome 43. - */ - defaultZoomFactor?: number; - } + interface Tab { + /** + * Optional. + * Either loading or complete. + */ + status?: string; + /** The zero-based index of the tab within its window. */ + index: number; + /** + * Optional. + * The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists. + * @since Chrome 18. + */ + openerTabId?: number; + /** + * Optional. + * The title of the tab. This property is only present if the extension's manifest includes the "tabs" permission. + */ + title?: string; + /** + * Optional. + * The URL the tab is displaying. This property is only present if the extension's manifest includes the "tabs" permission. + */ + url?: string; + /** + * Whether the tab is pinned. + * @since Chrome 9. + */ + pinned: boolean; + /** + * Whether the tab is highlighted. + * @since Chrome 16. + */ + highlighted: boolean; + /** The ID of the window the tab is contained within. */ + windowId: number; + /** + * Whether the tab is active in its window. (Does not necessarily mean the window is focused.) + * @since Chrome 16. + */ + active: boolean; + /** + * Optional. + * The URL of the tab's favicon. This property is only present if the extension's manifest includes the "tabs" permission. It may also be an empty string if the tab is loading. + */ + favIconUrl?: string; + /** + * Optional. + * The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a Tab may not be assigned an ID, for example when querying foreign tabs using the sessions API, in which case a session ID may be present. Tab ID can also be set to chrome.tabs.TAB_ID_NONE for apps and devtools windows. + */ + id?: number; + /** Whether the tab is in an incognito window. */ + incognito: boolean; + /** + * Whether the tab is selected. + * @deprecated since Chrome 33. Please use tabs.Tab.highlighted. + */ + selected: boolean; + /** + * Optional. + * Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the speaker audio indicator is showing. + * @since Chrome 45. + */ + audible?: boolean; + /** + * Optional. + * Current tab muted state and the reason for the last state change. + * @since Chrome 46. Warning: this is the current Beta channel. + */ + mutedInfo?: MutedInfo; + /** + * Optional. The width of the tab in pixels. + * @since Chrome 31. + */ + width?: number; + /** + * Optional. The height of the tab in pixels. + * @since Chrome 31. + */ + height?: number; + /** + * Optional. The session ID used to uniquely identify a Tab obtained from the sessions API. + * @since Chrome 31. + */ + sessionId?: string; + } + + /** + * Defines how zoom changes in a tab are handled and at what scope. + * @since Chrome 38. + */ + interface ZoomSettings { + /** + * Optional. + * Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to "automatic". + * "automatic": Zoom changes are handled automatically by the browser. + * "manual": Overrides the automatic handling of zoom changes. The onZoomChange event will still be dispatched, and it is the responsibility of the extension to listen for this event and manually scale the page. This mode does not support per-origin zooming, and will thus ignore the scope zoom setting and assume per-tab. + * "disabled": Disables all zooming in the tab. The tab will revert to the default zoom level, and all attempted zoom changes will be ignored. + */ + mode?: string; + /** + * Optional. + * Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to per-origin when in automatic mode, and per-tab otherwise. + * "per-origin": Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin will be zoomed as well. Moreover, per-origin zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor. The per-origin scope is only available in the automatic mode. + * "per-tab": Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this tab. Also, per-tab zoom changes are reset on navigation; navigating a tab will always load pages with their per-origin zoom factors. + */ + scope?: string; + /** + * Optional. + * Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings. + * @since Chrome 43. + */ + defaultZoomFactor?: number; + } interface InjectDetails { - /** - * Optional. - * If allFrames is true, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's false and is only injected into the top frame. - */ + /** + * Optional. + * If allFrames is true, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's false and is only injected into the top frame. + */ allFrames?: boolean; - /** - * Optional. JavaScript or CSS code to inject. - * Warning: Be careful using the code parameter. Incorrect use of it may open your extension to cross site scripting attacks. - */ + /** + * Optional. JavaScript or CSS code to inject. + * Warning: Be careful using the code parameter. Incorrect use of it may open your extension to cross site scripting attacks. + */ code?: string; - /** - * Optional. The soonest that the JavaScript or CSS will be injected into the tab. - * One of: "document_start", "document_end", or "document_idle" - * @since Chrome 20. - */ + /** + * Optional. The soonest that the JavaScript or CSS will be injected into the tab. + * One of: "document_start", "document_end", or "document_idle" + * @since Chrome 20. + */ runAt?: string; - /** Optional. JavaScript or CSS file to inject. */ + /** Optional. JavaScript or CSS file to inject. */ file?: string; - /** - * Optional. - * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is false. - * @since Chrome 39. - */ - matchAboutBlank?: boolean; + /** + * Optional. + * If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is false. + * @since Chrome 39. + */ + matchAboutBlank?: boolean; } interface CreateProperties { - /** Optional. The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window. */ + /** Optional. The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window. */ index?: number; - /** - * Optional. - * The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab. - * @since Chrome 18. - */ + /** + * Optional. + * The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab. + * @since Chrome 18. + */ openerTabId?: number; - /** - * Optional. - * The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page. - */ + /** + * Optional. + * The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page. + */ url?: string; - /** - * Optional. Whether the tab should be pinned. Defaults to false - * @since Chrome 9. - */ + /** + * Optional. Whether the tab should be pinned. Defaults to false + * @since Chrome 9. + */ pinned?: boolean; - /** Optional. The window to create the new tab in. Defaults to the current window. */ + /** Optional. The window to create the new tab in. Defaults to the current window. */ windowId?: number; - /** - * Optional. - * Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see windows.update). Defaults to true. - * @since Chrome 16. - */ + /** + * Optional. + * Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see windows.update). Defaults to true. + * @since Chrome 16. + */ active?: boolean; - /** - * Optional. Whether the tab should become the selected tab in the window. Defaults to true - * @deprecated since Chrome 33. Please use active. - */ - selected?: boolean; + /** + * Optional. Whether the tab should become the selected tab in the window. Defaults to true + * @deprecated since Chrome 33. Please use active. + */ + selected?: boolean; } interface MoveProperties { - /** The position to move the window to. -1 will place the tab at the end of the window. */ + /** The position to move the window to. -1 will place the tab at the end of the window. */ index: number; - /** Optional. Defaults to the window the tab is currently in. */ + /** Optional. Defaults to the window the tab is currently in. */ windowId?: number; } interface UpdateProperties { - /** - * Optional. Whether the tab should be pinned. - * @since Chrome 9. - */ + /** + * Optional. Whether the tab should be pinned. + * @since Chrome 9. + */ pinned?: boolean; - /** - * Optional. The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab. - * @since Chrome 18. - */ + /** + * Optional. The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab. + * @since Chrome 18. + */ openerTabId?: number; - /** Optional. A URL to navigate the tab to. */ + /** Optional. A URL to navigate the tab to. */ url?: string; - /** - * Optional. Adds or removes the tab from the current selection. - * @since Chrome 16. - */ + /** + * Optional. Adds or removes the tab from the current selection. + * @since Chrome 16. + */ highlighted?: boolean; - /** - * Optional. Whether the tab should be active. Does not affect whether the window is focused (see windows.update). - * @since Chrome 16. - */ + /** + * Optional. Whether the tab should be active. Does not affect whether the window is focused (see windows.update). + * @since Chrome 16. + */ active?: boolean; - /** - * Optional. Whether the tab should be selected. - * @deprecated since Chrome 33. Please use highlighted. - */ - selected?: boolean; - /** - * Optional. Whether the tab should be muted. - * @since Chrome 45. - */ - muted?: boolean; + /** + * Optional. Whether the tab should be selected. + * @deprecated since Chrome 33. Please use highlighted. + */ + selected?: boolean; + /** + * Optional. Whether the tab should be muted. + * @since Chrome 45. + */ + muted?: boolean; } interface CaptureVisibleTabOptions { - /** - * Optional. - * When format is "jpeg", controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease. - */ + /** + * Optional. + * When format is "jpeg", controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease. + */ quality?: number; - /** - * Optional. The format of an image. - * One of: "jpeg", or "png" - */ + /** + * Optional. The format of an image. + * One of: "jpeg", or "png" + */ format?: string; } interface ReloadProperties { - /** Optional. Whether using any local cache. Default is false. */ + /** Optional. Whether using any local cache. Default is false. */ bypassCache?: boolean; } interface ConnectInfo { - /** Optional. Will be passed into onConnect for content scripts that are listening for the connection event. */ + /** Optional. Will be passed into onConnect for content scripts that are listening for the connection event. */ name?: string; - /** - * Open a port to a specific frame identified by frameId instead of all frames in the tab. - * @since Chrome 41. - */ - frameId?: number; + /** + * Open a port to a specific frame identified by frameId instead of all frames in the tab. + * @since Chrome 41. + */ + frameId?: number; } - interface MessageSendOptions { - /** Optional. Send a message to a specific frame identified by frameId instead of all frames in the tab. */ - frameId?: number; - } + interface MessageSendOptions { + /** Optional. Send a message to a specific frame identified by frameId instead of all frames in the tab. */ + frameId?: number; + } interface HighlightInfo { - /** One or more tab indices to highlight. */ - tabs: number | number[]; - /** Optional. The window that contains the tabs. */ + /** One or more tab indices to highlight. */ + tabs: number | number[]; + /** Optional. The window that contains the tabs. */ windowId?: number; } interface QueryInfo { - /** - * Optional. Whether the tabs have completed loading. - * One of: "loading", or "complete" - */ + /** + * Optional. Whether the tabs have completed loading. + * One of: "loading", or "complete" + */ status?: string; - /** - * Optional. Whether the tabs are in the last focused window. - * @since Chrome 19. - */ + /** + * Optional. Whether the tabs are in the last focused window. + * @since Chrome 19. + */ lastFocusedWindow?: boolean; - /** Optional. The ID of the parent window, or windows.WINDOW_ID_CURRENT for the current window. */ + /** Optional. The ID of the parent window, or windows.WINDOW_ID_CURRENT for the current window. */ windowId?: number; - /** - * Optional. The type of window the tabs are in. - * One of: "normal", "popup", "panel", "app", or "devtools" - */ + /** + * Optional. The type of window the tabs are in. + * One of: "normal", "popup", "panel", "app", or "devtools" + */ windowType?: string; - /** Optional. Whether the tabs are active in their windows. */ + /** Optional. Whether the tabs are active in their windows. */ active?: boolean; - /** - * Optional. The position of the tabs within their windows. - * @since Chrome 18. - */ + /** + * Optional. The position of the tabs within their windows. + * @since Chrome 18. + */ index?: number; - /** Optional. Match page titles against a pattern. */ + /** Optional. Match page titles against a pattern. */ title?: string; - /** Optional. Match tabs against one or more URL patterns. Note that fragment identifiers are not matched. */ + /** Optional. Match tabs against one or more URL patterns. Note that fragment identifiers are not matched. */ url?: string | string[]; - /** - * Optional. Whether the tabs are in the current window. - * @since Chrome 19. - */ + /** + * Optional. Whether the tabs are in the current window. + * @since Chrome 19. + */ currentWindow?: boolean; - /** Optional. Whether the tabs are highlighted. */ + /** Optional. Whether the tabs are highlighted. */ highlighted?: boolean; - /** Optional. Whether the tabs are pinned. */ + /** Optional. Whether the tabs are pinned. */ pinned?: boolean; - /** - * Optional. Whether the tabs are audible. - * @since Chrome 45. - */ - audible?: boolean; - /** - * Optional. Whether the tabs are muted. - * @since Chrome 45. - */ - muted?: boolean; + /** + * Optional. Whether the tabs are audible. + * @since Chrome 45. + */ + audible?: boolean; + /** + * Optional. Whether the tabs are muted. + * @since Chrome 45. + */ + muted?: boolean; } interface TabHighlightInfo { @@ -6152,12 +6154,12 @@ declare namespace chrome.tabs { } interface TabRemoveInfo { - /** - * The window whose tab is closed. - * @since Chrome 25. - */ + /** + * The window whose tab is closed. + * @since Chrome 25. + */ windowId: number; - /** True when the tab is being closed because its window is being closed. */ + /** True when the tab is being closed because its window is being closed. */ isWindowClosing: boolean; } @@ -6167,35 +6169,35 @@ declare namespace chrome.tabs { } interface TabChangeInfo { - /** Optional. The status of the tab. Can be either loading or complete. */ + /** Optional. The status of the tab. Can be either loading or complete. */ status?: string; - /** - * The tab's new pinned state. - * @since Chrome 9. - */ + /** + * The tab's new pinned state. + * @since Chrome 9. + */ pinned?: boolean; - /** Optional. The tab's URL if it has changed. */ + /** Optional. The tab's URL if it has changed. */ url?: string; - /** - * The tab's new audible state. - * @since Chrome 45. - */ - audible?: boolean; - /** - * The tab's new muted state and the reason for the change. - * @since Chrome 46. Warning: this is the current Beta channel. - */ - mutedInfo?: MutedInfo; - /** - * The tab's new favicon URL. - * @since Chrome 27. - */ - favIconUrl?: string; - /** - * The tab's new title. - * @since Chrome 48. - */ - title?: string; + /** + * The tab's new audible state. + * @since Chrome 45. + */ + audible?: boolean; + /** + * The tab's new muted state and the reason for the change. + * @since Chrome 46. Warning: this is the current Beta channel. + */ + mutedInfo?: MutedInfo; + /** + * The tab's new favicon URL. + * @since Chrome 27. + */ + favIconUrl?: string; + /** + * The tab's new title. + * @since Chrome 48. + */ + title?: string; } interface TabMoveInfo { @@ -6210,23 +6212,23 @@ declare namespace chrome.tabs { } interface TabActiveInfo { - /** The ID of the tab that has become active. */ + /** The ID of the tab that has become active. */ tabId: number; - /** The ID of the window the active tab changed inside of. */ + /** The ID of the window the active tab changed inside of. */ windowId: number; } - interface TabWindowInfo { - /** The ID of the window of where the tab is located. */ - windowId: number; - } + interface TabWindowInfo { + /** The ID of the window of where the tab is located. */ + windowId: number; + } - interface ZoomChangeInfo { - tabId: number; - oldZoomFactor: number; - newZoomFactor: number; - zoomSettings: ZoomSettings; - } + interface ZoomChangeInfo { + tabId: number; + oldZoomFactor: number; + newZoomFactor: number; + zoomSettings: ZoomSettings; + } interface TabHighlightedEvent extends chrome.events.Event<(highlightInfo: HighlightInfo) => void> {} @@ -6246,315 +6248,315 @@ declare namespace chrome.tabs { interface TabReplacedEvent extends chrome.events.Event<(addedTabId: number, removedTabId: number) => void> {} - interface TabSelectedEvent extends chrome.events.Event<(tabId: number, selectInfo: TabWindowInfo) => void> {} + interface TabSelectedEvent extends chrome.events.Event<(tabId: number, selectInfo: TabWindowInfo) => void> {} - interface TabZoomChangeEvent extends chrome.events.Event<(ZoomChangeInfo: ZoomChangeInfo) => void> {} + interface TabZoomChangeEvent extends chrome.events.Event<(ZoomChangeInfo: ZoomChangeInfo) => void> {} - /** - * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc. - * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. - * @param callback Optional. Called after all the JavaScript has been executed. - * Parameter result: The result of the script in every injected frame. - */ + /** + * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc. + * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. + * @param callback Optional. Called after all the JavaScript has been executed. + * Parameter result: The result of the script in every injected frame. + */ export function executeScript(details: InjectDetails, callback?: (result: any[]) => void): void; - /** - * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc. - * @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window. - * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. - * @param callback Optional. Called after all the JavaScript has been executed. - * Parameter result: The result of the script in every injected frame. - */ + /** + * Injects JavaScript code into a page. For details, see the programmatic injection section of the content scripts doc. + * @param tabId Optional. The ID of the tab in which to run the script; defaults to the active tab of the current window. + * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. + * @param callback Optional. Called after all the JavaScript has been executed. + * Parameter result: The result of the script in every injected frame. + */ export function executeScript(tabId: number, details: InjectDetails, callback?: (result: any[]) => void): void; - /** Retrieves details about the specified tab. */ + /** Retrieves details about the specified tab. */ export function get(tabId: number, callback: (tab: Tab) => void): void; - /** - * Gets details about all tabs in the specified window. - * @deprecated since Chrome 33. Please use tabs.query {windowId: windowId}. - */ - export function getAllInWindow(callback: (tab: Tab) => void): void; - /** - * Gets details about all tabs in the specified window. - * @deprecated since Chrome 33. Please use tabs.query {windowId: windowId}. - * @param windowId Optional. Defaults to the current window. - */ - export function getAllInWindow(windowId: number, callback: (tab: Tab) => void): void; - /** Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view). */ + /** + * Gets details about all tabs in the specified window. + * @deprecated since Chrome 33. Please use tabs.query {windowId: windowId}. + */ + export function getAllInWindow(callback: (tab: Tab) => void): void; + /** + * Gets details about all tabs in the specified window. + * @deprecated since Chrome 33. Please use tabs.query {windowId: windowId}. + * @param windowId Optional. Defaults to the current window. + */ + export function getAllInWindow(windowId: number, callback: (tab: Tab) => void): void; + /** Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view). */ export function getCurrent(callback: (tab?: Tab) => void): void; - /** - * Gets the tab that is selected in the specified window. - * @deprecated since Chrome 33. Please use tabs.query {active: true}. - */ - export function getSelected(callback: (tab: Tab) => void): void; - /** - * Gets the tab that is selected in the specified window. - * @deprecated since Chrome 33. Please use tabs.query {active: true}. - * @param windowId Optional. Defaults to the current window. - */ - export function getSelected(windowId: number, callback: (tab: Tab) => void): void; - /** - * Creates a new tab. - * @param callback Optional. - * Parameter tab: Details about the created tab. Will contain the ID of the new tab. - */ + /** + * Gets the tab that is selected in the specified window. + * @deprecated since Chrome 33. Please use tabs.query {active: true}. + */ + export function getSelected(callback: (tab: Tab) => void): void; + /** + * Gets the tab that is selected in the specified window. + * @deprecated since Chrome 33. Please use tabs.query {active: true}. + * @param windowId Optional. Defaults to the current window. + */ + export function getSelected(windowId: number, callback: (tab: Tab) => void): void; + /** + * Creates a new tab. + * @param callback Optional. + * Parameter tab: Details about the created tab. Will contain the ID of the new tab. + */ export function create(createProperties: CreateProperties, callback?: (tab: Tab) => void): void; - /** - * Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows. - * @param tabId The tab to move. - * @param callback Optional. - * Parameter tab: Details about the moved tab. - */ + /** + * Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows. + * @param tabId The tab to move. + * @param callback Optional. + * Parameter tab: Details about the moved tab. + */ export function move(tabId: number, moveProperties: MoveProperties, callback?: (tab: Tab) => void): void; - /** - * Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows. - * @param tabIds The tabs to move. - * @param callback Optional. - * Parameter tabs: Details about the moved tabs. - */ + /** + * Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === "normal") windows. + * @param tabIds The tabs to move. + * @param callback Optional. + * Parameter tabs: Details about the moved tabs. + */ export function move(tabIds: number[], moveProperties: MoveProperties, callback?: (tabs: Tab[]) => void): void; - /** - * Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified. - * @param callback Optional. - * Optional parameter tab: Details about the updated tab. The tabs.Tab object doesn't contain url, title and favIconUrl if the "tabs" permission has not been requested. - */ + /** + * Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified. + * @param callback Optional. + * Optional parameter tab: Details about the updated tab. The tabs.Tab object doesn't contain url, title and favIconUrl if the "tabs" permission has not been requested. + */ export function update(updateProperties: UpdateProperties, callback?: (tab?: Tab) => void): void; - /** - * Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified. - * @param tabId Defaults to the selected tab of the current window. - * @param callback Optional. - * Optional parameter tab: Details about the updated tab. The tabs.Tab object doesn't contain url, title and favIconUrl if the "tabs" permission has not been requested. - */ + /** + * Modifies the properties of a tab. Properties that are not specified in updateProperties are not modified. + * @param tabId Defaults to the selected tab of the current window. + * @param callback Optional. + * Optional parameter tab: Details about the updated tab. The tabs.Tab object doesn't contain url, title and favIconUrl if the "tabs" permission has not been requested. + */ export function update(tabId: number, updateProperties: UpdateProperties, callback?: (tab?: Tab) => void): void; - /** - * Closes a tab. - * @param tabId The tab to close. - */ + /** + * Closes a tab. + * @param tabId The tab to close. + */ export function remove(tabId: number, callback?: Function): void; - /** - * Closes several tabs. - * @param tabIds The list of tabs to close. - */ + /** + * Closes several tabs. + * @param tabIds The list of tabs to close. + */ export function remove(tabIds: number[], callback?: Function): void; - /** - * Captures the visible area of the currently active tab in the specified window. You must have permission to use this method. - * @param callback - * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display. - */ + /** + * Captures the visible area of the currently active tab in the specified window. You must have permission to use this method. + * @param callback + * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display. + */ export function captureVisibleTab(callback: (dataUrl: string) => void): void; - /** - * Captures the visible area of the currently active tab in the specified window. You must have permission to use this method. - * @param windowId Optional. The target window. Defaults to the current window. - * @param callback - * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display. - */ + /** + * Captures the visible area of the currently active tab in the specified window. You must have permission to use this method. + * @param windowId Optional. The target window. Defaults to the current window. + * @param callback + * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display. + */ export function captureVisibleTab(windowId: number, callback: (dataUrl: string) => void): void; - /** - * Captures the visible area of the currently active tab in the specified window. You must have permission to use this method. - * @param options Optional. Details about the format and quality of an image. - * @param callback - * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display. - */ + /** + * Captures the visible area of the currently active tab in the specified window. You must have permission to use this method. + * @param options Optional. Details about the format and quality of an image. + * @param callback + * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display. + */ export function captureVisibleTab(options: CaptureVisibleTabOptions, callback: (dataUrl: string) => void): void; - /** - * Captures the visible area of the currently active tab in the specified window. You must have permission to use this method. - * @param windowId Optional. The target window. Defaults to the current window. - * @param options Optional. Details about the format and quality of an image. - * @param callback - * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display. - */ + /** + * Captures the visible area of the currently active tab in the specified window. You must have permission to use this method. + * @param windowId Optional. The target window. Defaults to the current window. + * @param options Optional. Details about the format and quality of an image. + * @param callback + * Parameter dataUrl: A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display. + */ export function captureVisibleTab(windowId: number, options: CaptureVisibleTabOptions, callback: (dataUrl: string) => void): void; - /** - * Reload a tab. - * @since Chrome 16. - * @param tabId The ID of the tab to reload; defaults to the selected tab of the current window. - */ - export function reload(tabId: number, reloadProperties?: ReloadProperties, callback?: () => void): void; - /** - * Reload the selected tab of the current window. - * @since Chrome 16. - */ - export function reload(reloadProperties: ReloadProperties, callback?: () => void): void; - /** - * Reload the selected tab of the current window. - * @since Chrome 16. - */ - export function reload(callback?: () => void): void; - /** - * Duplicates a tab. - * @since Chrome 23. - * @param tabId The ID of the tab which is to be duplicated. - * @param callback Optional. - * Optional parameter tab: Details about the duplicated tab. The tabs.Tab object doesn't contain url, title and favIconUrl if the "tabs" permission has not been requested. - */ + /** + * Reload a tab. + * @since Chrome 16. + * @param tabId The ID of the tab to reload; defaults to the selected tab of the current window. + */ + export function reload(tabId: number, reloadProperties?: ReloadProperties, callback?: () => void): void; + /** + * Reload the selected tab of the current window. + * @since Chrome 16. + */ + export function reload(reloadProperties: ReloadProperties, callback?: () => void): void; + /** + * Reload the selected tab of the current window. + * @since Chrome 16. + */ + export function reload(callback?: () => void): void; + /** + * Duplicates a tab. + * @since Chrome 23. + * @param tabId The ID of the tab which is to be duplicated. + * @param callback Optional. + * Optional parameter tab: Details about the duplicated tab. The tabs.Tab object doesn't contain url, title and favIconUrl if the "tabs" permission has not been requested. + */ export function duplicate(tabId: number, callback?: (tab?: Tab) => void): void; - /** - * Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension. - * @since Chrome 20. - */ + /** + * Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension. + * @since Chrome 20. + */ export function sendMessage(tabId: number, message: any, responseCallback?: (response: any) => void): void; - /** - * Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension. - * @since Chrome 41. - * @param responseCallback Optional. - * Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and runtime.lastError will be set to the error message. - */ - export function sendMessage(tabId: number, message: any, options: MessageSendOptions, responseCallback?: (response: any) => void): void; - /** - * Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The extension.onRequest event is fired in each content script running in the specified tab for the current extension. - * @deprecated since Chrome 33. Please use runtime.sendMessage. - * @param responseCallback Optional. - * Parameter response: The JSON response object sent by the handler of the request. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and runtime.lastError will be set to the error message. - */ - export function sendRequest(tabId: number, request: any, responseCallback?: (response: any) => void): void; - /** Connects to the content script(s) in the specified tab. The runtime.onConnect event is fired in each content script running in the specified tab for the current extension. */ + /** + * Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension. + * @since Chrome 41. + * @param responseCallback Optional. + * Parameter response: The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and runtime.lastError will be set to the error message. + */ + export function sendMessage(tabId: number, message: any, options: MessageSendOptions, responseCallback?: (response: any) => void): void; + /** + * Sends a single request to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The extension.onRequest event is fired in each content script running in the specified tab for the current extension. + * @deprecated since Chrome 33. Please use runtime.sendMessage. + * @param responseCallback Optional. + * Parameter response: The JSON response object sent by the handler of the request. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and runtime.lastError will be set to the error message. + */ + export function sendRequest(tabId: number, request: any, responseCallback?: (response: any) => void): void; + /** Connects to the content script(s) in the specified tab. The runtime.onConnect event is fired in each content script running in the specified tab for the current extension. */ export function connect(tabId: number, connectInfo?: ConnectInfo): runtime.Port; - /** - * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc. - * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. - * @param callback Optional. Called when all the CSS has been inserted. - */ - export function insertCSS(details: InjectDetails, callback?: Function): void; - /** - * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc. - * @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window. - * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. - * @param callback Optional. Called when all the CSS has been inserted. - */ + /** + * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc. + * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. + * @param callback Optional. Called when all the CSS has been inserted. + */ + export function insertCSS(details: InjectDetails, callback?: Function): void; + /** + * Injects CSS into a page. For details, see the programmatic injection section of the content scripts doc. + * @param tabId Optional. The ID of the tab in which to insert the CSS; defaults to the active tab of the current window. + * @param details Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. + * @param callback Optional. Called when all the CSS has been inserted. + */ export function insertCSS(tabId: number, details: InjectDetails, callback?: Function): void; - /** - * Highlights the given tabs. - * @since Chrome 16. - * @param callback Optional. - * Parameter window: Contains details about the window whose tabs were highlighted. - */ + /** + * Highlights the given tabs. + * @since Chrome 16. + * @param callback Optional. + * Parameter window: Contains details about the window whose tabs were highlighted. + */ export function highlight(highlightInfo: HighlightInfo, callback: (window: chrome.windows.Window) => void): void; - /** - * Gets all tabs that have the specified properties, or all tabs if no properties are specified. - * @since Chrome 16. - */ + /** + * Gets all tabs that have the specified properties, or all tabs if no properties are specified. + * @since Chrome 16. + */ export function query(queryInfo: QueryInfo, callback: (result: Tab[]) => void): void; - /** - * Detects the primary language of the content in a tab. - * @param callback - * Parameter language: An ISO language code such as en or fr. For a complete list of languages supported by this method, see kLanguageInfoTable. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, und will be returned. - */ + /** + * Detects the primary language of the content in a tab. + * @param callback + * Parameter language: An ISO language code such as en or fr. For a complete list of languages supported by this method, see kLanguageInfoTable. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, und will be returned. + */ export function detectLanguage(callback: (language: string) => void): void; - /** - * Detects the primary language of the content in a tab. - * @param tabId Optional. Defaults to the active tab of the current window. - * @param callback - * Parameter language: An ISO language code such as en or fr. For a complete list of languages supported by this method, see kLanguageInfoTable. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, und will be returned. - */ + /** + * Detects the primary language of the content in a tab. + * @param tabId Optional. Defaults to the active tab of the current window. + * @param callback + * Parameter language: An ISO language code such as en or fr. For a complete list of languages supported by this method, see kLanguageInfoTable. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, und will be returned. + */ export function detectLanguage(tabId: number, callback: (language: string) => void): void; - /** - * Zooms a specified tab. - * @since Chrome 42. - * @param zoomFactor The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Values greater than zero specify a (possibly non-default) zoom factor for the tab. - * @param callback Optional. Called after the zoom factor has been changed. - */ - export function setZoom(zoomFactor: number, callback?: () => void): void; - /** - * Zooms a specified tab. - * @since Chrome 42. - * @param tabId Optional. The ID of the tab to zoom; defaults to the active tab of the current window. - * @param zoomFactor The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Values greater than zero specify a (possibly non-default) zoom factor for the tab. - * @param callback Optional. Called after the zoom factor has been changed. - */ - export function setZoom(tabId: number, zoomFactor: number, callback?: () => void): void; - /** - * Gets the current zoom factor of a specified tab. - * @since Chrome 42. - * @param callback Called with the tab's current zoom factor after it has been fetched. - * Parameter zoomFactor: The tab's current zoom factor. - */ - export function getZoom(callback: (zoomFactor: number) => void): void; - /** - * Gets the current zoom factor of a specified tab. - * @since Chrome 42. - * @param tabId Optional. The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window. - * @param callback Called with the tab's current zoom factor after it has been fetched. - * Parameter zoomFactor: The tab's current zoom factor. - */ - export function getZoom(tabId: number, callback: (zoomFactor: number) => void): void; - /** - * Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab. - * @since Chrome 42. - * @param zoomSettings Defines how zoom changes are handled and at what scope. - * @param callback Optional. Called after the zoom settings have been changed. - */ - export function setZoomSettings(zoomSettings: ZoomSettings, callback?: () => void): void; - /** - * Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab. - * @since Chrome 42. - * @param tabId Optional. The ID of the tab to change the zoom settings for; defaults to the active tab of the current window. - * @param zoomSettings Defines how zoom changes are handled and at what scope. - * @param callback Optional. Called after the zoom settings have been changed. - */ - export function setZoomSettings(tabId: number, zoomSettings: ZoomSettings, callback?: () => void): void; - /** - * Gets the current zoom settings of a specified tab. - * @since Chrome 42. - * @param callback Called with the tab's current zoom settings. - * Paramater zoomSettings: The tab's current zoom settings. - */ - export function getZoomSettings(callback: (zoomSettings: ZoomSettings) => void): void; - /** - * Gets the current zoom settings of a specified tab. - * @since Chrome 42. - * @param tabId Optional. The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window. - * @param callback Called with the tab's current zoom settings. - * Paramater zoomSettings: The tab's current zoom settings. - */ - export function getZoomSettings(tabId: number, callback: (zoomSettings: ZoomSettings) => void): void; + /** + * Zooms a specified tab. + * @since Chrome 42. + * @param zoomFactor The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Values greater than zero specify a (possibly non-default) zoom factor for the tab. + * @param callback Optional. Called after the zoom factor has been changed. + */ + export function setZoom(zoomFactor: number, callback?: () => void): void; + /** + * Zooms a specified tab. + * @since Chrome 42. + * @param tabId Optional. The ID of the tab to zoom; defaults to the active tab of the current window. + * @param zoomFactor The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Values greater than zero specify a (possibly non-default) zoom factor for the tab. + * @param callback Optional. Called after the zoom factor has been changed. + */ + export function setZoom(tabId: number, zoomFactor: number, callback?: () => void): void; + /** + * Gets the current zoom factor of a specified tab. + * @since Chrome 42. + * @param callback Called with the tab's current zoom factor after it has been fetched. + * Parameter zoomFactor: The tab's current zoom factor. + */ + export function getZoom(callback: (zoomFactor: number) => void): void; + /** + * Gets the current zoom factor of a specified tab. + * @since Chrome 42. + * @param tabId Optional. The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window. + * @param callback Called with the tab's current zoom factor after it has been fetched. + * Parameter zoomFactor: The tab's current zoom factor. + */ + export function getZoom(tabId: number, callback: (zoomFactor: number) => void): void; + /** + * Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab. + * @since Chrome 42. + * @param zoomSettings Defines how zoom changes are handled and at what scope. + * @param callback Optional. Called after the zoom settings have been changed. + */ + export function setZoomSettings(zoomSettings: ZoomSettings, callback?: () => void): void; + /** + * Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab. + * @since Chrome 42. + * @param tabId Optional. The ID of the tab to change the zoom settings for; defaults to the active tab of the current window. + * @param zoomSettings Defines how zoom changes are handled and at what scope. + * @param callback Optional. Called after the zoom settings have been changed. + */ + export function setZoomSettings(tabId: number, zoomSettings: ZoomSettings, callback?: () => void): void; + /** + * Gets the current zoom settings of a specified tab. + * @since Chrome 42. + * @param callback Called with the tab's current zoom settings. + * Paramater zoomSettings: The tab's current zoom settings. + */ + export function getZoomSettings(callback: (zoomSettings: ZoomSettings) => void): void; + /** + * Gets the current zoom settings of a specified tab. + * @since Chrome 42. + * @param tabId Optional. The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window. + * @param callback Called with the tab's current zoom settings. + * Paramater zoomSettings: The tab's current zoom settings. + */ + export function getZoomSettings(tabId: number, callback: (zoomSettings: ZoomSettings) => void): void; - /** - * Fired when the highlighted or selected tabs in a window changes. - * @since Chrome 18. - */ + /** + * Fired when the highlighted or selected tabs in a window changes. + * @since Chrome 18. + */ var onHighlighted: TabHighlightedEvent; - /** Fired when a tab is closed. */ + /** Fired when a tab is closed. */ var onRemoved: TabRemovedEvent; - /** Fired when a tab is updated. */ + /** Fired when a tab is updated. */ var onUpdated: TabUpdatedEvent; - /** Fired when a tab is attached to a window, for example because it was moved between windows. */ + /** Fired when a tab is attached to a window, for example because it was moved between windows. */ var onAttached: TabAttachedEvent; - /** - * Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see tabs.onDetached. - */ + /** + * Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see tabs.onDetached. + */ var onMoved: TabMovedEvent; - /** Fired when a tab is detached from a window, for example because it is being moved between windows. */ + /** Fired when a tab is detached from a window, for example because it is being moved between windows. */ var onDetached: TabDetachedEvent; - /** Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set. */ + /** Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set. */ var onCreated: TabCreatedEvent; - /** - * Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set. - * @since Chrome 18. - */ + /** + * Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set. + * @since Chrome 18. + */ var onActivated: TabActivatedEvent; - /** - * Fired when a tab is replaced with another tab due to prerendering or instant. - * @since Chrome 26. - */ + /** + * Fired when a tab is replaced with another tab due to prerendering or instant. + * @since Chrome 26. + */ var onReplaced: TabReplacedEvent; - /** - * @deprecated since Chrome 33. Please use tabs.onActivated. - * Fires when the selected tab in a window changes. - */ - var onSelectionChanged: TabSelectedEvent; - /** - * @deprecated since Chrome 33. Please use tabs.onActivated. - * Fires when the selected tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to tabs.onUpdated events to be notified when a URL is set. - */ - var onActiveChanged: TabSelectedEvent; - /** - * @deprecated since Chrome 33. Please use tabs.onHighlighted. - * Fired when the highlighted or selected tabs in a window changes. - */ - var onHighlightChanged: TabHighlightedEvent; - /** - * Fired when a tab is zoomed. - * @since Chrome 38. - */ - var onZoomChange: TabZoomChangeEvent; + /** + * @deprecated since Chrome 33. Please use tabs.onActivated. + * Fires when the selected tab in a window changes. + */ + var onSelectionChanged: TabSelectedEvent; + /** + * @deprecated since Chrome 33. Please use tabs.onActivated. + * Fires when the selected tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to tabs.onUpdated events to be notified when a URL is set. + */ + var onActiveChanged: TabSelectedEvent; + /** + * @deprecated since Chrome 33. Please use tabs.onHighlighted. + * Fired when the highlighted or selected tabs in a window changes. + */ + var onHighlightChanged: TabHighlightedEvent; + /** + * Fired when a tab is zoomed. + * @since Chrome 38. + */ + var onZoomChange: TabZoomChangeEvent; } //////////////////// @@ -6566,16 +6568,16 @@ declare namespace chrome.tabs { * @since Chrome 19. */ declare namespace chrome.topSites { - /** An object encapsulating a most visited URL, such as the URLs on the new tab page. */ + /** An object encapsulating a most visited URL, such as the URLs on the new tab page. */ interface MostVisitedURL { - /** The most visited URL. */ + /** The most visited URL. */ url: string; - /** The title of the page */ + /** The title of the page */ title: string; } - /** Gets a list of top sites. */ - export function get(callback: (data: MostVisitedURL[]) => void): void; + /** Gets a list of top sites. */ + export function get(callback: (data: MostVisitedURL[]) => void): void; } //////////////////// @@ -6587,110 +6589,110 @@ declare namespace chrome.topSites { * @since Chrome 14. */ declare namespace chrome.tts { - /** An event from the TTS engine to communicate the status of an utterance. */ + /** An event from the TTS engine to communicate the status of an utterance. */ interface TtsEvent { - /** Optional. The index of the current character in the utterance. */ + /** Optional. The index of the current character in the utterance. */ charIndex?: number; - /** Optional. The error description, if the event type is 'error'. */ + /** Optional. The error description, if the event type is 'error'. */ errorMessage?: string; - /** - * The type can be 'start' as soon as speech has started, 'word' when a word boundary is reached, 'sentence' when a sentence boundary is reached, 'marker' when an SSML mark element is reached, 'end' when the end of the utterance is reached, 'interrupted' when the utterance is stopped or interrupted before reaching the end, 'cancelled' when it's removed from the queue before ever being synthesized, or 'error' when any other error occurs. When pausing speech, a 'pause' event is fired if a particular utterance is paused in the middle, and 'resume' if an utterance resumes speech. Note that pause and resume events may not fire if speech is paused in-between utterances. - * One of: "start", "end", "word", "sentence", "marker", "interrupted", "cancelled", "error", "pause", or "resume" - */ + /** + * The type can be 'start' as soon as speech has started, 'word' when a word boundary is reached, 'sentence' when a sentence boundary is reached, 'marker' when an SSML mark element is reached, 'end' when the end of the utterance is reached, 'interrupted' when the utterance is stopped or interrupted before reaching the end, 'cancelled' when it's removed from the queue before ever being synthesized, or 'error' when any other error occurs. When pausing speech, a 'pause' event is fired if a particular utterance is paused in the middle, and 'resume' if an utterance resumes speech. Note that pause and resume events may not fire if speech is paused in-between utterances. + * One of: "start", "end", "word", "sentence", "marker", "interrupted", "cancelled", "error", "pause", or "resume" + */ type: string; } - /** A description of a voice available for speech synthesis. */ + /** A description of a voice available for speech synthesis. */ interface TtsVoice { - /** Optional. The language that this voice supports, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */ + /** Optional. The language that this voice supports, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */ lang?: string; - /** - * Optional. This voice's gender. - * One of: "male", or "female" - */ + /** + * Optional. This voice's gender. + * One of: "male", or "female" + */ gender?: string; - /** Optional. The name of the voice. */ + /** Optional. The name of the voice. */ voiceName?: string; - /** The ID of the extension providing this voice. */ + /** The ID of the extension providing this voice. */ extensionsId?: string; - /** All of the callback event types that this voice is capable of sending. */ + /** All of the callback event types that this voice is capable of sending. */ eventTypes?: string[]; - /** - * If true, the synthesis engine is a remote network resource. It may be higher latency and may incur bandwidth costs. - * @since Chrome 33. - */ - remote?: boolean; + /** + * If true, the synthesis engine is a remote network resource. It may be higher latency and may incur bandwidth costs. + * @since Chrome 33. + */ + remote?: boolean; } interface SpeakOptions { - /** Optional. Speaking volume between 0 and 1 inclusive, with 0 being lowest and 1 being highest, with a default of 1.0. */ + /** Optional. Speaking volume between 0 and 1 inclusive, with 0 being lowest and 1 being highest, with a default of 1.0. */ volume?: number; - /** - * Optional. - * If true, enqueues this utterance if TTS is already in progress. If false (the default), interrupts any current speech and flushes the speech queue before speaking this new utterance. - */ + /** + * Optional. + * If true, enqueues this utterance if TTS is already in progress. If false (the default), interrupts any current speech and flushes the speech queue before speaking this new utterance. + */ enqueue?: boolean; - /** - * Optional. - * Speaking rate relative to the default rate for this voice. 1.0 is the default rate, normally around 180 to 220 words per minute. 2.0 is twice as fast, and 0.5 is half as fast. Values below 0.1 or above 10.0 are strictly disallowed, but many voices will constrain the minimum and maximum rates further—for example a particular voice may not actually speak faster than 3 times normal even if you specify a value larger than 3.0. - */ + /** + * Optional. + * Speaking rate relative to the default rate for this voice. 1.0 is the default rate, normally around 180 to 220 words per minute. 2.0 is twice as fast, and 0.5 is half as fast. Values below 0.1 or above 10.0 are strictly disallowed, but many voices will constrain the minimum and maximum rates further—for example a particular voice may not actually speak faster than 3 times normal even if you specify a value larger than 3.0. + */ rate?: number; - /** - * Optional. This function is called with events that occur in the process of speaking the utterance. - * @param event The update event from the text-to-speech engine indicating the status of this utterance. - */ + /** + * Optional. This function is called with events that occur in the process of speaking the utterance. + * @param event The update event from the text-to-speech engine indicating the status of this utterance. + */ onEvent?: (event: TtsEvent) => void; - /** - * Optional. - * Speaking pitch between 0 and 2 inclusive, with 0 being lowest and 2 being highest. 1.0 corresponds to a voice's default pitch. - */ + /** + * Optional. + * Speaking pitch between 0 and 2 inclusive, with 0 being lowest and 2 being highest. 1.0 corresponds to a voice's default pitch. + */ pitch?: number; - /** Optional. The language to be used for synthesis, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */ + /** Optional. The language to be used for synthesis, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */ lang?: string; - /** Optional. The name of the voice to use for synthesis. If empty, uses any available voice. */ + /** Optional. The name of the voice to use for synthesis. If empty, uses any available voice. */ voiceName?: string; - /** Optional. The extension ID of the speech engine to use, if known. */ + /** Optional. The extension ID of the speech engine to use, if known. */ extensionId?: string; - /** - * Optional. Gender of voice for synthesized speech. - * One of: "male", or "female" - */ + /** + * Optional. Gender of voice for synthesized speech. + * One of: "male", or "female" + */ gender?: string; - /** Optional. The TTS event types the voice must support. */ + /** Optional. The TTS event types the voice must support. */ requiredEventTypes?: string[]; - /** Optional. The TTS event types that you are interested in listening to. If missing, all event types may be sent. */ + /** Optional. The TTS event types that you are interested in listening to. If missing, all event types may be sent. */ desiredEventTypes?: string[]; } - /** Checks whether the engine is currently speaking. On Mac OS X, the result is true whenever the system speech engine is speaking, even if the speech wasn't initiated by Chrome. */ + /** Checks whether the engine is currently speaking. On Mac OS X, the result is true whenever the system speech engine is speaking, even if the speech wasn't initiated by Chrome. */ export function isSpeaking(callback?: (speaking: boolean) => void): void; - /** Stops any current speech and flushes the queue of any pending utterances. In addition, if speech was paused, it will now be un-paused for the next call to speak. */ + /** Stops any current speech and flushes the queue of any pending utterances. In addition, if speech was paused, it will now be un-paused for the next call to speak. */ export function stop(): void; - /** Gets an array of all available voices. */ + /** Gets an array of all available voices. */ export function getVoices(callback?: (voices: TtsVoice[]) => void): void; - /** - * Speaks text using a text-to-speech engine. - * @param utterance The text to speak, either plain text or a complete, well-formed SSML document. Speech engines that do not support SSML will strip away the tags and speak the text. The maximum length of the text is 32,768 characters. - * @param callback Optional. Called right away, before speech finishes. Check chrome.runtime.lastError to make sure there were no errors. Use options.onEvent to get more detailed feedback. - */ - export function speak(utterance: string, callback?: Function): void; - /** - * Speaks text using a text-to-speech engine. - * @param utterance The text to speak, either plain text or a complete, well-formed SSML document. Speech engines that do not support SSML will strip away the tags and speak the text. The maximum length of the text is 32,768 characters. - * @param options Optional. The speech options. - * @param callback Optional. Called right away, before speech finishes. Check chrome.runtime.lastError to make sure there were no errors. Use options.onEvent to get more detailed feedback. - */ - export function speak(utterance: string, options: SpeakOptions, callback?: Function): void; - /** - * Pauses speech synthesis, potentially in the middle of an utterance. A call to resume or stop will un-pause speech. - * @since Chrome 29. - */ - export function pause(): void; - /** - * If speech was paused, resumes speaking where it left off. - * @since Chrome 29. - */ - export function resume(): void; + /** + * Speaks text using a text-to-speech engine. + * @param utterance The text to speak, either plain text or a complete, well-formed SSML document. Speech engines that do not support SSML will strip away the tags and speak the text. The maximum length of the text is 32,768 characters. + * @param callback Optional. Called right away, before speech finishes. Check chrome.runtime.lastError to make sure there were no errors. Use options.onEvent to get more detailed feedback. + */ + export function speak(utterance: string, callback?: Function): void; + /** + * Speaks text using a text-to-speech engine. + * @param utterance The text to speak, either plain text or a complete, well-formed SSML document. Speech engines that do not support SSML will strip away the tags and speak the text. The maximum length of the text is 32,768 characters. + * @param options Optional. The speech options. + * @param callback Optional. Called right away, before speech finishes. Check chrome.runtime.lastError to make sure there were no errors. Use options.onEvent to get more detailed feedback. + */ + export function speak(utterance: string, options: SpeakOptions, callback?: Function): void; + /** + * Pauses speech synthesis, potentially in the middle of an utterance. A call to resume or stop will un-pause speech. + * @since Chrome 29. + */ + export function pause(): void; + /** + * If speech was paused, resumes speaking where it left off. + * @since Chrome 29. + */ + export function resume(): void; } //////////////////// @@ -6703,42 +6705,42 @@ declare namespace chrome.tts { */ declare namespace chrome.ttsEngine { interface SpeakOptions { - /** Optional. The language to be used for synthesis, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */ + /** Optional. The language to be used for synthesis, in the form language-region. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'. */ lang?: string; - /** Optional. The name of the voice to use for synthesis. */ + /** Optional. The name of the voice to use for synthesis. */ voiceName?: string; - /** - * Optional. Gender of voice for synthesized speech. - * One of: "male", or "female" - */ + /** + * Optional. Gender of voice for synthesized speech. + * One of: "male", or "female" + */ gender?: string; - /** Optional. Speaking volume between 0 and 1 inclusive, with 0 being lowest and 1 being highest, with a default of 1.0. */ + /** Optional. Speaking volume between 0 and 1 inclusive, with 0 being lowest and 1 being highest, with a default of 1.0. */ volume?: number; - /** - * Optional. - * Speaking rate relative to the default rate for this voice. 1.0 is the default rate, normally around 180 to 220 words per minute. 2.0 is twice as fast, and 0.5 is half as fast. This value is guaranteed to be between 0.1 and 10.0, inclusive. When a voice does not support this full range of rates, don't return an error. Instead, clip the rate to the range the voice supports. - */ + /** + * Optional. + * Speaking rate relative to the default rate for this voice. 1.0 is the default rate, normally around 180 to 220 words per minute. 2.0 is twice as fast, and 0.5 is half as fast. This value is guaranteed to be between 0.1 and 10.0, inclusive. When a voice does not support this full range of rates, don't return an error. Instead, clip the rate to the range the voice supports. + */ rate?: number; - /** Optional. Speaking pitch between 0 and 2 inclusive, with 0 being lowest and 2 being highest. 1.0 corresponds to this voice's default pitch. */ + /** Optional. Speaking pitch between 0 and 2 inclusive, with 0 being lowest and 2 being highest. 1.0 corresponds to this voice's default pitch. */ pitch?: number; } interface TtsEngineSpeakEvent extends chrome.events.Event<(utterance: string, options: SpeakOptions, sendTtsEvent: (event: chrome.tts.TtsEvent) => void) => void> {} - /** Called when the user makes a call to tts.speak() and one of the voices from this extension's manifest is the first to match the options object. */ + /** Called when the user makes a call to tts.speak() and one of the voices from this extension's manifest is the first to match the options object. */ var onSpeak: TtsEngineSpeakEvent; - /** Fired when a call is made to tts.stop and this extension may be in the middle of speaking. If an extension receives a call to onStop and speech is already stopped, it should do nothing (not raise an error). If speech is in the paused state, this should cancel the paused state. */ - var onStop: chrome.events.Event<() => void>; - /** - * Optional: if an engine supports the pause event, it should pause the current utterance being spoken, if any, until it receives a resume event or stop event. Note that a stop event should also clear the paused state. - * @since Chrome 29. - */ - var onPause: chrome.events.Event<() => void>; - /** - * Optional: if an engine supports the pause event, it should also support the resume event, to continue speaking the current utterance, if any. Note that a stop event should also clear the paused state. - * @since Chrome 29. - */ - var onResume: chrome.events.Event<() => void>; + /** Fired when a call is made to tts.stop and this extension may be in the middle of speaking. If an extension receives a call to onStop and speech is already stopped, it should do nothing (not raise an error). If speech is in the paused state, this should cancel the paused state. */ + var onStop: chrome.events.Event<() => void>; + /** + * Optional: if an engine supports the pause event, it should pause the current utterance being spoken, if any, until it receives a resume event or stop event. Note that a stop event should also clear the paused state. + * @since Chrome 29. + */ + var onPause: chrome.events.Event<() => void>; + /** + * Optional: if an engine supports the pause event, it should also support the resume event, to continue speaking the current utterance, if any. Note that a stop event should also clear the paused state. + * @since Chrome 29. + */ + var onResume: chrome.events.Event<() => void>; } //////////////////// @@ -6750,85 +6752,85 @@ declare namespace chrome.ttsEngine { */ declare namespace chrome.types { interface ChromeSettingClearDetails { - /** - * Optional. - * The scope of the ChromeSetting. One of - * • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere), - * • regular_only: setting for the regular profile only (not inherited by the incognito profile), - * • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences), - * • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences). - */ + /** + * Optional. + * The scope of the ChromeSetting. One of + * • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere), + * • regular_only: setting for the regular profile only (not inherited by the incognito profile), + * • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences), + * • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences). + */ scope?: string; } interface ChromeSettingSetDetails extends ChromeSettingClearDetails { - /** - * The value of the setting. - * Note that every setting has a specific value type, which is described together with the setting. An extension should not set a value of a different type. - */ + /** + * The value of the setting. + * Note that every setting has a specific value type, which is described together with the setting. An extension should not set a value of a different type. + */ value: any; - /** - * Optional. - * The scope of the ChromeSetting. One of - * • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere), - * • regular_only: setting for the regular profile only (not inherited by the incognito profile), - * • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences), - * • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences). - */ - scope?: string; + /** + * Optional. + * The scope of the ChromeSetting. One of + * • regular: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere), + * • regular_only: setting for the regular profile only (not inherited by the incognito profile), + * • incognito_persistent: setting for the incognito profile that survives browser restarts (overrides regular preferences), + * • incognito_session_only: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences). + */ + scope?: string; } interface ChromeSettingGetDetails { - /** Optional. Whether to return the value that applies to the incognito session (default false). */ + /** Optional. Whether to return the value that applies to the incognito session (default false). */ incognito?: boolean; } - /** - * @param details Details of the currently effective value. - */ + /** + * @param details Details of the currently effective value. + */ type DetailsCallback = (details: ChromeSettingGetResultDetails) => void; interface ChromeSettingGetResultDetails { - /** - * One of - * • not_controllable: cannot be controlled by any extension - * • controlled_by_other_extensions: controlled by extensions with higher precedence - * • controllable_by_this_extension: can be controlled by this extension - * • controlled_by_this_extension: controlled by this extension - */ + /** + * One of + * • not_controllable: cannot be controlled by any extension + * • controlled_by_other_extensions: controlled by extensions with higher precedence + * • controllable_by_this_extension: can be controlled by this extension + * • controlled_by_this_extension: controlled by this extension + */ levelOfControl: string; - /** The value of the setting. */ + /** The value of the setting. */ value: any; - /** - * Optional. - * Whether the effective value is specific to the incognito session. - * This property will only be present if the incognito property in the details parameter of get() was true. - */ + /** + * Optional. + * Whether the effective value is specific to the incognito session. + * This property will only be present if the incognito property in the details parameter of get() was true. + */ incognitoSpecific?: boolean; } interface ChromeSettingChangedEvent extends chrome.events.Event {} - /** An interface that allows access to a Chrome browser setting. See accessibilityFeatures for an example. */ + /** An interface that allows access to a Chrome browser setting. See accessibilityFeatures for an example. */ interface ChromeSetting { - /** - * Sets the value of a setting. - * @param details Which setting to change. - * @param callback Optional. Called at the completion of the set operation. - */ + /** + * Sets the value of a setting. + * @param details Which setting to change. + * @param callback Optional. Called at the completion of the set operation. + */ set(details: ChromeSettingSetDetails, callback?: Function): void; - /** - * Gets the value of a setting. - * @param details Which setting to consider. - */ + /** + * Gets the value of a setting. + * @param details Which setting to consider. + */ get(details: ChromeSettingGetDetails, callback?: DetailsCallback): void; - /** - * Clears the setting, restoring any default value. - * @param details Which setting to clear. - * @param callback Optional. Called at the completion of the clear operation. - */ + /** + * Clears the setting, restoring any default value. + * @param details Which setting to clear. + * @param callback Optional. Called at the completion of the clear operation. + */ clear(details: ChromeSettingClearDetails, callback?: Function): void; - /** Fired after the setting changes. */ + /** Fired after the setting changes. */ onChange: ChromeSettingChangedEvent; } } @@ -6843,81 +6845,81 @@ declare namespace chrome.types { * @since Chrome 43. */ declare namespace chrome.vpnProvider { - interface VpnSessionParameters { - /** IP address for the VPN interface in CIDR notation. IPv4 is currently the only supported mode. */ - address: string; - /** Optional. Broadcast address for the VPN interface. (default: deduced from IP address and mask) */ - broadcastAddress?: string; - /** Optional. MTU setting for the VPN interface. (default: 1500 bytes) */ - mtu?: string; - /** - * Exclude network traffic to the list of IP blocks in CIDR notation from the tunnel. This can be used to bypass traffic to and from the VPN server. When many rules match a destination, the rule with the longest matching prefix wins. Entries that correspond to the same CIDR block are treated as duplicates. Such duplicates in the collated (exclusionList + inclusionList) list are eliminated and the exact duplicate entry that will be eliminated is undefined. - */ - exclusionList: string[]; - /** - * Include network traffic to the list of IP blocks in CIDR notation to the tunnel. This parameter can be used to set up a split tunnel. By default no traffic is directed to the tunnel. Adding the entry "0.0.0.0/0" to this list gets all the user traffic redirected to the tunnel. When many rules match a destination, the rule with the longest matching prefix wins. Entries that correspond to the same CIDR block are treated as duplicates. Such duplicates in the collated (exclusionList + inclusionList) list are eliminated and the exact duplicate entry that will be eliminated is undefined. - */ - inclusionList: string[]; - /** Optional. A list of search domains. (default: no search domain) */ - domainSearch?: string[]; - /** A list of IPs for the DNS servers. */ - dnsServer: string[]; - } + interface VpnSessionParameters { + /** IP address for the VPN interface in CIDR notation. IPv4 is currently the only supported mode. */ + address: string; + /** Optional. Broadcast address for the VPN interface. (default: deduced from IP address and mask) */ + broadcastAddress?: string; + /** Optional. MTU setting for the VPN interface. (default: 1500 bytes) */ + mtu?: string; + /** + * Exclude network traffic to the list of IP blocks in CIDR notation from the tunnel. This can be used to bypass traffic to and from the VPN server. When many rules match a destination, the rule with the longest matching prefix wins. Entries that correspond to the same CIDR block are treated as duplicates. Such duplicates in the collated (exclusionList + inclusionList) list are eliminated and the exact duplicate entry that will be eliminated is undefined. + */ + exclusionList: string[]; + /** + * Include network traffic to the list of IP blocks in CIDR notation to the tunnel. This parameter can be used to set up a split tunnel. By default no traffic is directed to the tunnel. Adding the entry "0.0.0.0/0" to this list gets all the user traffic redirected to the tunnel. When many rules match a destination, the rule with the longest matching prefix wins. Entries that correspond to the same CIDR block are treated as duplicates. Such duplicates in the collated (exclusionList + inclusionList) list are eliminated and the exact duplicate entry that will be eliminated is undefined. + */ + inclusionList: string[]; + /** Optional. A list of search domains. (default: no search domain) */ + domainSearch?: string[]; + /** A list of IPs for the DNS servers. */ + dnsServer: string[]; + } - interface VpnPlatformMessageEvent extends chrome.events.Event<(id: string, message: string, error: string) => void> {} + interface VpnPlatformMessageEvent extends chrome.events.Event<(id: string, message: string, error: string) => void> {} - interface VpnPacketReceptionEvent extends chrome.events.Event<(data: ArrayBuffer) => void> {} + interface VpnPacketReceptionEvent extends chrome.events.Event<(data: ArrayBuffer) => void> {} - interface VpnConfigRemovalEvent extends chrome.events.Event<(id: string) => void> {} + interface VpnConfigRemovalEvent extends chrome.events.Event<(id: string) => void> {} - interface VpnConfigCreationEvent extends chrome.events.Event<(id: string, name: string, data: Object) => void> {} + interface VpnConfigCreationEvent extends chrome.events.Event<(id: string, name: string, data: Object) => void> {} - interface VpnUiEvent extends chrome.events.Event<(event: string, id?: string) => void> {} + interface VpnUiEvent extends chrome.events.Event<(event: string, id?: string) => void> {} - /** - * Creates a new VPN configuration that persists across multiple login sessions of the user. - * @param name The name of the VPN configuration. - * @param callback Called when the configuration is created or if there is an error. - * Parameter id: A unique ID for the created configuration, empty string on failure. - */ - export function createConfig(name: string, callback: (id: string) => void): void; - /** - * Destroys a VPN configuration created by the extension. - * @param id ID of the VPN configuration to destroy. - * @param callback Optional. Called when the configuration is destroyed or if there is an error. - */ - export function destroyConfig(id: string, callback?: Function): void; - /** - * Sets the parameters for the VPN session. This should be called immediately after "connected" is received from the platform. This will succeed only when the VPN session is owned by the extension. - * @param parameters The parameters for the VPN session. - * @param callback Called when the parameters are set or if there is an error. - */ - export function setParameters(parameters: VpnSessionParameters, callback: Function): void; - /** - * Sends an IP packet through the tunnel created for the VPN session. This will succeed only when the VPN session is owned by the extension. - * @param data The IP packet to be sent to the platform. - * @param callback Optional. Called when the packet is sent or if there is an error. - */ - export function sendPacket(data: ArrayBuffer, callback?: Function): void; - /** - * Notifies the VPN session state to the platform. This will succeed only when the VPN session is owned by the extension. - * @param state The VPN session state of the VPN client. - * connected: VPN connection was successful. - * failure: VPN connection failed. - * @param callback Optional. Called when the notification is complete or if there is an error. - */ - export function notifyConnectionStateChanged(state: string, callback?: Function): void; + /** + * Creates a new VPN configuration that persists across multiple login sessions of the user. + * @param name The name of the VPN configuration. + * @param callback Called when the configuration is created or if there is an error. + * Parameter id: A unique ID for the created configuration, empty string on failure. + */ + export function createConfig(name: string, callback: (id: string) => void): void; + /** + * Destroys a VPN configuration created by the extension. + * @param id ID of the VPN configuration to destroy. + * @param callback Optional. Called when the configuration is destroyed or if there is an error. + */ + export function destroyConfig(id: string, callback?: Function): void; + /** + * Sets the parameters for the VPN session. This should be called immediately after "connected" is received from the platform. This will succeed only when the VPN session is owned by the extension. + * @param parameters The parameters for the VPN session. + * @param callback Called when the parameters are set or if there is an error. + */ + export function setParameters(parameters: VpnSessionParameters, callback: Function): void; + /** + * Sends an IP packet through the tunnel created for the VPN session. This will succeed only when the VPN session is owned by the extension. + * @param data The IP packet to be sent to the platform. + * @param callback Optional. Called when the packet is sent or if there is an error. + */ + export function sendPacket(data: ArrayBuffer, callback?: Function): void; + /** + * Notifies the VPN session state to the platform. This will succeed only when the VPN session is owned by the extension. + * @param state The VPN session state of the VPN client. + * connected: VPN connection was successful. + * failure: VPN connection failed. + * @param callback Optional. Called when the notification is complete or if there is an error. + */ + export function notifyConnectionStateChanged(state: string, callback?: Function): void; - /** Triggered when a message is received from the platform for a VPN configuration owned by the extension. */ - var onPlatformMessage: VpnPlatformMessageEvent; - /** Triggered when an IP packet is received via the tunnel for the VPN session owned by the extension. */ - var onPacketReceived: VpnPacketReceptionEvent; - /** Triggered when a configuration created by the extension is removed by the platform. */ - var onConfigRemoved: VpnConfigRemovalEvent; - /** Triggered when a configuration is created by the platform for the extension. */ - var onConfigCreated: VpnConfigCreationEvent; - /** Triggered when there is a UI event for the extension. UI events are signals from the platform that indicate to the app that a UI dialog needs to be shown to the user. */ - var onUIEvent: VpnUiEvent; + /** Triggered when a message is received from the platform for a VPN configuration owned by the extension. */ + var onPlatformMessage: VpnPlatformMessageEvent; + /** Triggered when an IP packet is received via the tunnel for the VPN session owned by the extension. */ + var onPacketReceived: VpnPacketReceptionEvent; + /** Triggered when a configuration created by the extension is removed by the platform. */ + var onConfigRemoved: VpnConfigRemovalEvent; + /** Triggered when a configuration is created by the platform for the extension. */ + var onConfigCreated: VpnConfigCreationEvent; + /** Triggered when there is a UI event for the extension. UI events are signals from the platform that indicate to the app that a UI dialog needs to be shown to the user. */ + var onUIEvent: VpnUiEvent; } //////////////////// @@ -6930,28 +6932,28 @@ declare namespace chrome.vpnProvider { * @since Chrome 43. */ declare namespace chrome.wallpaper { - interface WallpaperDetails { - /** Optional. The jpeg or png encoded wallpaper image. */ - data?: any; - /** Optional. The URL of the wallpaper to be set. */ - url?: string; - /** - * The supported wallpaper layouts. - * One of: "STRETCH", "CENTER", or "CENTER_CROPPED" - */ - layout: string; - /** The file name of the saved wallpaper. */ - filename: string; - /** Optional. True if a 128x60 thumbnail should be generated. */ - thumbnail?: boolean; - } + interface WallpaperDetails { + /** Optional. The jpeg or png encoded wallpaper image. */ + data?: any; + /** Optional. The URL of the wallpaper to be set. */ + url?: string; + /** + * The supported wallpaper layouts. + * One of: "STRETCH", "CENTER", or "CENTER_CROPPED" + */ + layout: string; + /** The file name of the saved wallpaper. */ + filename: string; + /** Optional. True if a 128x60 thumbnail should be generated. */ + thumbnail?: boolean; + } - /** - * Sets wallpaper to the image at url or wallpaperData with the specified layout - * @param callback - * Optional parameter thumbnail: The jpeg encoded wallpaper thumbnail. It is generated by resizing the wallpaper to 128x60. - */ - export function setWallpaper(details: WallpaperDetails, callback: (thumbnail: any) => void): void; + /** + * Sets wallpaper to the image at url or wallpaperData with the specified layout + * @param callback + * Optional parameter thumbnail: The jpeg encoded wallpaper thumbnail. It is generated by resizing the wallpaper to 128x60. + */ + export function setWallpaper(details: WallpaperDetails, callback: (thumbnail: any) => void): void; } //////////////////// @@ -6964,162 +6966,162 @@ declare namespace chrome.wallpaper { */ declare namespace chrome.webNavigation { interface GetFrameDetails { - /** - * The ID of the process runs the renderer for this tab. - * @since Chrome 22. - */ + /** + * The ID of the process runs the renderer for this tab. + * @since Chrome 22. + */ processId: number; - /** The ID of the tab in which the frame is. */ + /** The ID of the tab in which the frame is. */ tabId: number; - /** The ID of the frame in the given tab. */ + /** The ID of the frame in the given tab. */ frameId: number; } interface GetFrameResultDetails { - /** The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists. */ + /** The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists. */ url: string; - /** True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. */ + /** True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired. */ errorOccurred: boolean; - /** ID of frame that wraps the frame. Set to -1 of no parent frame exists. */ + /** ID of frame that wraps the frame. Set to -1 of no parent frame exists. */ parentFrameId: number; } interface GetAllFrameDetails { - /** The ID of the tab. */ + /** The ID of the tab. */ tabId: number; } interface GetAllFrameResultDetails extends GetFrameResultDetails { - /** The ID of the process runs the renderer for this tab. */ + /** The ID of the process runs the renderer for this tab. */ processId: number; - /** The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe. */ + /** The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe. */ frameId: number; } - interface WebNavigationCallbackDetails { - /** The ID of the tab in which the navigation is about to occur. */ + interface WebNavigationCallbackDetails { + /** The ID of the tab in which the navigation is about to occur. */ tabId: number; - /** The time when the browser was about to start the navigation, in milliseconds since the epoch. */ + /** The time when the browser was about to start the navigation, in milliseconds since the epoch. */ timeStamp: number; } - interface WebNavigationUrlCallbackDetails extends WebNavigationCallbackDetails { + interface WebNavigationUrlCallbackDetails extends WebNavigationCallbackDetails { url: string; } - interface WebNavigationReplacementCallbackDetails extends WebNavigationCallbackDetails { - /** The ID of the tab that was replaced. */ - replacedTabId: number; + interface WebNavigationReplacementCallbackDetails extends WebNavigationCallbackDetails { + /** The ID of the tab that was replaced. */ + replacedTabId: number; } - interface WebNavigationFramedCallbackDetails extends WebNavigationUrlCallbackDetails { - /** 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process. */ - frameId: number; - /** - * The ID of the process runs the renderer for this tab. - * @since Chrome 22. - */ - processId: number; + interface WebNavigationFramedCallbackDetails extends WebNavigationUrlCallbackDetails { + /** 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process. */ + frameId: number; + /** + * The ID of the process runs the renderer for this tab. + * @since Chrome 22. + */ + processId: number; } - interface WebNavigationFramedErrorCallbackDetails extends WebNavigationFramedCallbackDetails { - /** The error description. */ - error: string; + interface WebNavigationFramedErrorCallbackDetails extends WebNavigationFramedCallbackDetails { + /** The error description. */ + error: string; } - interface WebNavigationSourceCallbackDetails extends WebNavigationUrlCallbackDetails { - /** The ID of the tab in which the navigation is triggered. */ + interface WebNavigationSourceCallbackDetails extends WebNavigationUrlCallbackDetails { + /** The ID of the tab in which the navigation is triggered. */ sourceTabId: number; - /** - * The ID of the process runs the renderer for the source tab. - * @since Chrome 22. - */ + /** + * The ID of the process runs the renderer for the source tab. + * @since Chrome 22. + */ sourceProcessId: number; - /** The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame. */ + /** The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame. */ sourceFrameId: number; } - interface WebNavigationParentedCallbackDetails extends WebNavigationFramedCallbackDetails { - /** - * ID of frame that wraps the frame. Set to -1 of no parent frame exists. - * @since Chrome 24. - */ + interface WebNavigationParentedCallbackDetails extends WebNavigationFramedCallbackDetails { + /** + * ID of frame that wraps the frame. Set to -1 of no parent frame exists. + * @since Chrome 24. + */ parentFrameId: number; } - interface WebNavigationTransitionCallbackDetails extends WebNavigationFramedCallbackDetails { - /** - * Cause of the navigation. - * One of: "link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", or "keyword_generated" - */ - transitionType: string; - /** - * A list of transition qualifiers. - * Each element one of: "client_redirect", "server_redirect", "forward_back", or "from_address_bar" - */ - transitionQualifiers: string[]; + interface WebNavigationTransitionCallbackDetails extends WebNavigationFramedCallbackDetails { + /** + * Cause of the navigation. + * One of: "link", "typed", "auto_bookmark", "auto_subframe", "manual_subframe", "generated", "start_page", "form_submit", "reload", "keyword", or "keyword_generated" + */ + transitionType: string; + /** + * A list of transition qualifiers. + * Each element one of: "client_redirect", "server_redirect", "forward_back", or "from_address_bar" + */ + transitionQualifiers: string[]; } - interface WebNavigationEventFilter { - /** Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event. */ + interface WebNavigationEventFilter { + /** Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event. */ url: chrome.events.UrlFilter[]; } - interface WebNavigationEvent extends chrome.events.Event<(details: T) => void> { - addListener(callback: (details: T) => void, filters?: WebNavigationEventFilter): void; + interface WebNavigationEvent extends chrome.events.Event<(details: T) => void> { + addListener(callback: (details: T) => void, filters?: WebNavigationEventFilter): void; } interface WebNavigationFramedEvent extends WebNavigationEvent {} - interface WebNavigationFramedErrorEvent extends WebNavigationEvent {} + interface WebNavigationFramedErrorEvent extends WebNavigationEvent {} - interface WebNavigationSourceEvent extends WebNavigationEvent {} + interface WebNavigationSourceEvent extends WebNavigationEvent {} - interface WebNavigationParentedEvent extends WebNavigationEvent {} + interface WebNavigationParentedEvent extends WebNavigationEvent {} - interface WebNavigationTransitionalEvent extends WebNavigationEvent {} + interface WebNavigationTransitionalEvent extends WebNavigationEvent {} - interface WebNavigationReplacementEvent extends WebNavigationEvent {} + interface WebNavigationReplacementEvent extends WebNavigationEvent {} - /** - * Retrieves information about the given frame. A frame refers to an