From 267a4a97a6f42ef3d5f17bf903aaa9bf123e97af Mon Sep 17 00:00:00 2001 From: godbasin Date: Thu, 20 Dec 2018 17:03:06 +0800 Subject: [PATCH] =?UTF-8?q?init=E8=B0=83=E6=95=B4=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 209 + package.json | 8 + src/api/init.ts | 6 +- src/api/login.ts | 4 +- src/api/request.ts | 4 +- src/index.ts | 4 +- src/store/config.ts | 8 +- src/store/status.ts | 8 +- src/typings/index.d.ts | 12 + src/typings/lib.wa.es6.d.ts | 5819 ++++++++++++++ src/typings/weRequest/index.d.ts | 112 + src/typings/wx/index.d.ts | 63 + src/typings/wx/lib.wx.api.d.ts | 12396 +++++++++++++++++++++++++++++ src/typings/wx/lib.wx.app.d.ts | 250 + src/typings/wx/lib.wx.cloud.d.ts | 687 ++ src/typings/wx/lib.wx.page.d.ts | 181 + src/util/loading.ts | 4 +- tsconfig.json | 37 +- tslint.json | 6 + typings/wx.d.ts | 5 - 20 files changed, 19794 insertions(+), 29 deletions(-) create mode 100644 src/typings/index.d.ts create mode 100644 src/typings/lib.wa.es6.d.ts create mode 100644 src/typings/weRequest/index.d.ts create mode 100644 src/typings/wx/index.d.ts create mode 100644 src/typings/wx/lib.wx.api.d.ts create mode 100644 src/typings/wx/lib.wx.app.d.ts create mode 100644 src/typings/wx/lib.wx.cloud.d.ts create mode 100644 src/typings/wx/lib.wx.page.d.ts create mode 100644 tslint.json delete mode 100644 typings/wx.d.ts diff --git a/package-lock.json b/package-lock.json index 3bc1d46..5c395ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -233,6 +233,17 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -321,6 +332,21 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "execa": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz", + "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -465,6 +491,15 @@ } } }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -480,6 +515,12 @@ "map-cache": "^0.2.2" } }, + "get-stream": { + "version": "3.0.0", + "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, "get-value": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", @@ -530,6 +571,12 @@ } } }, + "ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "dev": true + }, "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", @@ -636,6 +683,12 @@ "isobject": "^3.0.1" } }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -648,6 +701,12 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", @@ -677,6 +736,26 @@ "json5": "^0.5.0" } }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -744,6 +823,12 @@ } } }, + "mri": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.1.tgz", + "integrity": "sha1-haom09ru7t+A3FmEr5XMXKXK2fE=", + "dev": true + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -769,6 +854,15 @@ "to-regex": "^3.0.1" } }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", @@ -818,18 +912,79 @@ "isobject": "^3.0.1" } }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", "dev": true }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, + "prettier": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.15.3.tgz", + "integrity": "sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg==", + "dev": true + }, + "pretty-quick": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-1.8.0.tgz", + "integrity": "sha512-qV25sQF/ivJpdZ5efwemQYkQJa7sp3HqT/Vf/7z5vGYMcq1VrT2lDpFKAxJPf6219N1YAdR8mGkIhPAZ1odTmQ==", + "dev": true, + "requires": { + "chalk": "^2.3.0", + "execa": "^0.8.0", + "find-up": "^2.1.0", + "ignore": "^3.3.7", + "mri": "^1.1.0" + } + }, "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", @@ -842,6 +997,12 @@ "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", "dev": true }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, "readable-stream": { "version": "2.3.6", "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", @@ -935,6 +1096,27 @@ } } }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -1106,6 +1288,12 @@ "safe-buffer": "~5.1.0" } }, + "strip-eof": { + "version": "1.0.0", + "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -1176,6 +1364,12 @@ "semver": "^5.0.1" } }, + "tslint-config-prettier": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.17.0.tgz", + "integrity": "sha512-NKWNkThwqE4Snn4Cm6SZB7lV5RMDDFsBwz6fWUkTxOKGjMx8ycOHnjIbhn7dZd5XmssW3CwqUjlANR6EhP9YQw==", + "dev": true + }, "typescript": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.2.tgz", @@ -1274,6 +1468,21 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true } } } diff --git a/package.json b/package.json index 2aad149..ca2433b 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,16 @@ "webpack": "latest" }, "devDependencies": { + "prettier": "^1.15.3", + "pretty-quick": "^1.8.0", "ts-loader": "^5.3.1", + "tslint-config-prettier": "^1.17.0", "typescript": "^3.2.2", "webpack-cli": "^2.1.3" + }, + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } } } diff --git a/src/api/init.ts b/src/api/init.ts index 07f08d6..5c7c4b9 100644 --- a/src/api/init.ts +++ b/src/api/init.ts @@ -1,8 +1,8 @@ -import config from '../store/config' +import defaultConfig from '../store/config' import status from '../store/status' -export default (params) => { - Object.assign(config, params); +export default (params: IInitOption) => { + const config: IInitOption = {...params, ...defaultConfig)} // 如果配置更改了session的存储名字,则重新获取一次session if (params.sessionName) { try { diff --git a/src/api/login.ts b/src/api/login.ts index 3f2fb9e..cd17a1b 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -1,5 +1,5 @@ -import sessionManager from '../module/sessionManager' +import checkSession from '../module/sessionManager' export default (callback) => { - sessionManager(callback, {}) + return checkSession(callback, {}) } diff --git a/src/api/request.ts b/src/api/request.ts index 6934d31..16a1272 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -1,5 +1,5 @@ import requestHandler from '../module/requestHandler' -export default (obj) => { - requestHandler.request(obj) +export default (obj: IRequestOption) => { + return requestHandler.request(obj) } diff --git a/src/index.ts b/src/index.ts index d36a58b..5e0d0a6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ import login from './api/login' import getSession from './api/getSession' import getConfig from './api/getConfig' -export { +const weRequestObject: weRequest = { init, request, uploadFile, @@ -15,3 +15,5 @@ export { getSession, getConfig } + +export default weRequestObject diff --git a/src/store/config.ts b/src/store/config.ts index 138307a..ad111ad 100644 --- a/src/store/config.ts +++ b/src/store/config.ts @@ -1,4 +1,4 @@ -export default { +const defaultConfig: IInitOption = { sessionName: "session", loginTrigger() { return false @@ -8,12 +8,12 @@ export default { return true }, urlPerfix: "", - successData(res) { + successData(res: any) { return res }, doNotCheckSession: false, errorTitle: "操作失败", - errorContent(res) { + errorContent(res: any) { return res }, reLoginLimit: 3, @@ -24,3 +24,5 @@ export default { // session在本地缓存的key sessionExpireKey: "sessionExpireKey" } + +export default defaultConfig; \ No newline at end of file diff --git a/src/store/status.ts b/src/store/status.ts index 224f6a8..aae4b51 100644 --- a/src/store/status.ts +++ b/src/store/status.ts @@ -1,12 +1,12 @@ export default { - session: '', + session: '' as string, // session在本地缓存的有效时间 sessionExpireTime: null, // session过期的时间点 sessionExpire: Infinity, - sessionIsFresh: false, + sessionIsFresh: false as boolean, // 正在登录中,其他请求轮询稍后,避免重复调用登录接口 - logining: false, + logining: false as boolean, // 正在查询session有效期中,避免重复调用接口 - isCheckingSession: false + isCheckingSession: false as boolean } diff --git a/src/typings/index.d.ts b/src/typings/index.d.ts new file mode 100644 index 0000000..2694c23 --- /dev/null +++ b/src/typings/index.d.ts @@ -0,0 +1,12 @@ +/*! ***************************************************************************** +Copyright (c) 2018 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +***************************************************************************** */ + +/// +/// diff --git a/src/typings/lib.wa.es6.d.ts b/src/typings/lib.wa.es6.d.ts new file mode 100644 index 0000000..a8579df --- /dev/null +++ b/src/typings/lib.wa.es6.d.ts @@ -0,0 +1,5819 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + + +/// + + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare const NaN: number; +declare const Infinity: number; + + + +/*! ***************************************************************************** +Modifications Copyright (c) 2018 Tencent, Inc. All rights reserved. +***************************************************************************** */ +/** + * Evaluates JavaScript code and executes it. + * @ param x A String value that contains valid JavaScript code. + */ +// WA-no-eval +// declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get?(): any; + set?(v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new(value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + readonly prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor | undefined; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has the specified prototype or that has null prototype. + * @param o Object to use as a prototype. May be null. + */ + create(o: object | null): any; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor & ThisType): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap & ThisType): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(a: T[]): ReadonlyArray; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(f: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): Readonly; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: {}): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare const Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(this: Function, thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(this: Function, thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(this: Function, thisArg: any, ...argArray: any[]): any; + + /** Returns a string representation of a function. */ + toString(): string; + + prototype: any; + readonly length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new(...args: string[]): Function; + (...args: string[]): Function; + readonly prototype: Function; +} + +declare const Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string | RegExp): RegExpMatchArray | null; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: string | RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string | RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string | RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + readonly length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + readonly [index: number]: string; +} + +interface StringConstructor { + new(value?: any): String; + (value?: any): string; + readonly prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare const String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new(value?: any): Boolean; + (value?: any): boolean; + readonly prototype: Boolean; +} + +declare const Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new(value?: any): Number; + (value?: any): number; + readonly prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + readonly MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + readonly MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + readonly NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare const Number: NumberConstructor; + +interface TemplateStringsArray extends ReadonlyArray { + readonly raw: ReadonlyArray; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + readonly E: number; + /** The natural logarithm of 10. */ + readonly LN10: number; + /** The natural logarithm of 2. */ + readonly LN2: number; + /** The base-2 logarithm of e. */ + readonly LOG2E: number; + /** The base-10 logarithm of e. */ + readonly LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + readonly PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + readonly SQRT1_2: number; + /** The square root of 2. */ + readonly SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare const Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new(): Date; + new(value: number): Date; + new(value: string): Date; + new(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + readonly prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare const Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray | null; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ + readonly source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + readonly global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + readonly ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + readonly multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): this; +} + +interface RegExpConstructor { + new(pattern: RegExp | string): RegExp; + new(pattern: string, flags?: string): RegExp; + (pattern: RegExp | string): RegExp; + (pattern: string, flags?: string): RegExp; + readonly prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare const RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; + stack?: string; +} + +interface ErrorConstructor { + new(message?: string): Error; + (message?: string): Error; + readonly prototype: Error; +} + +declare const Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new(message?: string): EvalError; + (message?: string): EvalError; + readonly prototype: EvalError; +} + +declare const EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new(message?: string): RangeError; + (message?: string): RangeError; + readonly prototype: RangeError; +} + +declare const RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new(message?: string): ReferenceError; + (message?: string): ReferenceError; + readonly prototype: ReferenceError; +} + +declare const ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new(message?: string): SyntaxError; + (message?: string): SyntaxError; + readonly prototype: SyntaxError; +} + +declare const SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new(message?: string): TypeError; + (message?: string): TypeError; + readonly prototype: TypeError; +} + +declare const TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new(message?: string): URIError; + (message?: string): URIError; + readonly prototype: URIError; +} + +declare const URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; +} + +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare const JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + /** + * Returns a string representation of an array. The elements are converted to string using thier toLocalString methods. + */ + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: ReadonlyArray[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | ReadonlyArray)[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: ReadonlyArray) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: ReadonlyArray) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: ReadonlyArray) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => value is S, thisArg?: any): S[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: ReadonlyArray) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: ReadonlyArray) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: ReadonlyArray) => U, initialValue: U): U; + + readonly [n: number]: T; +} + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + /** + * Returns a string representation of an array. The elements are converted to string using thier toLocalString methods. + */ + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T | undefined; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: ReadonlyArray[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | ReadonlyArray)[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T | undefined; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): this; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + */ + splice(start: number, deleteCount?: number): T[]; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new(arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is Array; + readonly prototype: Array; +} + +declare const Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; + +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; +} + +interface ArrayLike { + readonly length: number; + readonly [n: number]: T; +} + +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P]; +}; + +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P]; +}; + +/** + * From T pick a set of properties K + */ +type Pick = { + [P in K]: T[P]; +}; + +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T; +}; + +/** + * Marker for contextual 'this' type + */ +interface ThisType { } + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin: number, end?: number): ArrayBuffer; +} + +/** + * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays. + */ +interface ArrayBufferTypes { + ArrayBuffer: ArrayBuffer; +} +type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes]; + +interface ArrayBufferConstructor { + readonly prototype: ArrayBuffer; + new(byteLength: number): ArrayBuffer; + isView(arg: any): arg is ArrayBufferView; +} +declare const ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView; +} +declare const DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + readonly prototype: Int8Array; + new(length: number): Int8Array; + new(arrayOrArrayBuffer: ArrayLike | ArrayBufferLike): Int8Array; + new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + + +} +declare const Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new(length: number): Uint8Array; + new(arrayOrArrayBuffer: ArrayLike | ArrayBufferLike): Uint8Array; + new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; + +} +declare const Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new(length: number): Uint8ClampedArray; + new(arrayOrArrayBuffer: ArrayLike | ArrayBufferLike): Uint8ClampedArray; + new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare const Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new(length: number): Int16Array; + new(arrayOrArrayBuffer: ArrayLike | ArrayBufferLike): Int16Array; + new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + + +} +declare const Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new(length: number): Uint16Array; + new(arrayOrArrayBuffer: ArrayLike | ArrayBufferLike): Uint16Array; + new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + + +} +declare const Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new(length: number): Int32Array; + new(arrayOrArrayBuffer: ArrayLike | ArrayBufferLike): Int32Array; + new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; + +} +declare const Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new(length: number): Uint32Array; + new(arrayOrArrayBuffer: ArrayLike | ArrayBufferLike): Uint32Array; + new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; + +} +declare const Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new(length: number): Float32Array; + new(arrayOrArrayBuffer: ArrayLike | ArrayBufferLike): Float32Array; + new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + + +} +declare const Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new(length: number): Float64Array; + new(arrayOrArrayBuffer: ArrayLike | ArrayBufferLike): Float64Array; + new(buffer: ArrayBufferLike, byteOffset: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; + +} +declare const Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare namespace Intl { + interface CollatorOptions { + usage?: string; + localeMatcher?: string; + numeric?: boolean; + caseFirst?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new(locales?: string | string[], options?: CollatorOptions): Collator; + (locales?: string | string[], options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; + }; + + interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new(locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; + }; + + interface DateTimeFormatOptions { + localeMatcher?: string; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + formatMatcher?: string; + hour12?: boolean; + timeZone?: string; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; + }; +} + +interface String { + /** + * Determines whether two strings are equivalent in the current or specified locale. + * @param that String to compare to target string + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +} + + +declare type PropertyKey = string | number | symbol; + +interface Array { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): this; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): this; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: T, k: number) => U, thisArg?: any): U[]; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): T[]; +} + +interface DateConstructor { + new(value: Date): Date; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + readonly name: string; +} + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[]): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + readonly EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFinite, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MAX_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + readonly MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + readonly MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source The source object from which to copy properties. + */ + assign(target: T, source: U): T & U; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V): T & U & V; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param source1 The first source object from which to copy properties. + * @param source2 The second source object from which to copy properties. + * @param source3 The third source object from which to copy properties. + */ + assign(target: T, source1: U, source2: V, source3: W): T & U & V & W; + + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ + assign(target: object, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: object | null): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor | undefined; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface ReadonlyArray { + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: ReadonlyArray) => boolean, thisArg?: any): T | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T, index: number, obj: ReadonlyArray) => boolean, thisArg?: any): number; +} + +interface RegExp { + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + readonly flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + readonly sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + readonly unicode: boolean; +} + +interface RegExpConstructor { + new(pattern: RegExp, flags?: string): RegExp; + (pattern: RegExp, flags?: string): RegExp; +} + +interface String { + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number | undefined; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string; + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + + +interface Map { + clear(): void; + delete(key: K): boolean; + forEach(callbackfn: (value: V, key: K, map: Map) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value: V): this; + readonly size: number; +} + +interface MapConstructor { + new(): Map; + new (entries?: [K, V][]): Map; + readonly prototype: Map; +} +declare var Map: MapConstructor; + +interface ReadonlyMap { + forEach(callbackfn: (value: V, key: K, map: ReadonlyMap) => void, thisArg?: any): void; + get(key: K): V | undefined; + has(key: K): boolean; + readonly size: number; +} + +interface WeakMap { + delete(key: K): boolean; + get(key: K): V | undefined; + has(key: K): boolean; + set(key: K, value: V): this; +} + +interface WeakMapConstructor { + new(): WeakMap; + new (entries?: [K, V][]): WeakMap; + readonly prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): this; + clear(): void; + delete(value: T): boolean; + forEach(callbackfn: (value: T, value2: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface SetConstructor { + new(): Set; + new (values?: T[]): Set; + readonly prototype: Set; +} +declare var Set: SetConstructor; + +interface ReadonlySet { + forEach(callbackfn: (value: T, value2: T, set: ReadonlySet) => void, thisArg?: any): void; + has(value: T): boolean; + readonly size: number; +} + +interface WeakSet { + add(value: T): this; + delete(value: T): boolean; + has(value: T): boolean; +} + +interface WeakSetConstructor { + new(): WeakSet; + new (values?: T[]): WeakSet; + readonly prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; + + +interface Generator extends Iterator { } + +interface GeneratorFunction { + /** + * Creates a new Generator object. + * @param args A list of arguments the function accepts. + */ + new(...args: any[]): Generator; + /** + * Creates a new Generator object. + * @param args A list of arguments the function accepts. + */ + (...args: any[]): Generator; + /** + * The length of the arguments. + */ + readonly length: number; + /** + * Returns the name of the function. + */ + readonly name: string; + /** + * A reference to the prototype. + */ + readonly prototype: Generator; +} + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new(...args: string[]): GeneratorFunction; + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + (...args: string[]): GeneratorFunction; + /** + * The length of the arguments. + */ + readonly length: number; + /** + * Returns the name of the function. + */ + readonly name: string; + /** + * A reference to the prototype. + */ + readonly prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; + + +/// + +interface SymbolConstructor { + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + readonly iterator: symbol; +} + +interface IteratorResult { + done: boolean; + value: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an iterable of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an iterable of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an iterable of values in the array + */ + values(): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn?: (v: T, k: number) => U, thisArg?: any): U[]; +} + +interface ReadonlyArray { + /** Iterator of values in the array. */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an iterable of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an iterable of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an iterable of values in the array + */ + values(): IterableIterator; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Map { + /** Returns an iterable of entries in the map. */ + [Symbol.iterator](): IterableIterator<[K, V]>; + + /** + * Returns an iterable of key, value pairs for every entry in the map. + */ + entries(): IterableIterator<[K, V]>; + + /** + * Returns an iterable of keys in the map + */ + keys(): IterableIterator; + + /** + * Returns an iterable of values in the map + */ + values(): IterableIterator; +} + +interface ReadonlyMap { + /** Returns an iterable of entries in the map. */ + [Symbol.iterator](): IterableIterator<[K, V]>; + + /** + * Returns an iterable of key, value pairs for every entry in the map. + */ + entries(): IterableIterator<[K, V]>; + + /** + * Returns an iterable of keys in the map + */ + keys(): IterableIterator; + + /** + * Returns an iterable of values in the map + */ + values(): IterableIterator; +} + +interface MapConstructor { + new (iterable: Iterable<[K, V]>): Map; +} + +interface WeakMap { } + +interface WeakMapConstructor { + new (iterable: Iterable<[K, V]>): WeakMap; +} + +interface Set { + /** Iterates over values in the set. */ + [Symbol.iterator](): IterableIterator; + /** + * Returns an iterable of [v,v] pairs for every value 'v' in the set. + */ + entries(): IterableIterator<[T, T]>; + /** + * Despite its name, returns an iterable of the values in the set, + */ + keys(): IterableIterator; + + /** + * Returns an iterable of values in the set. + */ + values(): IterableIterator; +} + +interface ReadonlySet { + /** Iterates over values in the set. */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an iterable of [v,v] pairs for every value 'v' in the set. + */ + entries(): IterableIterator<[T, T]>; + + /** + * Despite its name, returns an iterable of the values in the set, + */ + keys(): IterableIterator; + + /** + * Returns an iterable of values in the set. + */ + values(): IterableIterator; +} + +interface SetConstructor { + new (iterable: Iterable): Set; +} + +interface WeakSet { } + +interface WeakSetConstructor { + new (iterable: Iterable): WeakSet; +} + +interface Promise { } + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; +} + +declare namespace Reflect { + function enumerate(target: object): IterableIterator; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface Int8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int8ArrayConstructor { + new(elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +interface Uint8Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ArrayConstructor { + new(elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +interface Uint8ClampedArray { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new(elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +interface Int16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int16ArrayConstructor { + new(elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +interface Uint16Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint16ArrayConstructor { + new(elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +interface Int32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Int32ArrayConstructor { + new(elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +interface Uint32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Uint32ArrayConstructor { + new(elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +interface Float32Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float32ArrayConstructor { + new(elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +interface Float64Array { + [Symbol.iterator](): IterableIterator; + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; +} + +interface Float64ArrayConstructor { + new(elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} + + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise<[T1, T2, T3, T4, T5, T6]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise<[T1, T2, T3, T4, T5]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise<[T1, T2, T3, T4]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise<[T1, T2, T3]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise<[T1, T2]>; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: (T | PromiseLike)[]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike, T10 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike, T9 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike, T8 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike, T7 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike, T6 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike, T5 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike, T4 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike, T3 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: [T1 | PromiseLike, T2 | PromiseLike]): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: (T | PromiseLike)[]): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; +} + +declare var Promise: PromiseConstructor; + +interface ProxyHandler { + getPrototypeOf?(target: T): object | null; + setPrototypeOf?(target: T, v: any): boolean; + isExtensible?(target: T): boolean; + preventExtensions?(target: T): boolean; + getOwnPropertyDescriptor?(target: T, p: PropertyKey): PropertyDescriptor | undefined; + has?(target: T, p: PropertyKey): boolean; + get?(target: T, p: PropertyKey, receiver: any): any; + set?(target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty?(target: T, p: PropertyKey): boolean; + defineProperty?(target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate?(target: T): PropertyKey[]; + ownKeys?(target: T): PropertyKey[]; + apply?(target: T, thisArg: any, argArray?: any): any; + construct?(target: T, argArray: any, newTarget?: any): object; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T; +} +declare var Proxy: ProxyConstructor; + + +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: object, propertyKey: PropertyKey): boolean; + function get(target: object, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined; + function getPrototypeOf(target: object): object; + function has(target: object, propertyKey: PropertyKey): boolean; + function isExtensible(target: object): boolean; + function ownKeys(target: object): PropertyKey[]; + function preventExtensions(target: object): boolean; + function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean; + function setPrototypeOf(target: object, proto: any): boolean; +} + + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): symbol; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + readonly prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string | number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string | undefined; +} + +declare var Symbol: SymbolConstructor; + +/// + +interface SymbolConstructor { + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + readonly hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + readonly isConcatSpreadable: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + readonly match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + readonly replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + readonly search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + readonly species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + readonly split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + readonly toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + readonly toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + readonly unscopables: symbol; +} + +interface Symbol { + readonly [Symbol.toStringTag]: "Symbol"; +} + +interface Array { + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface Map { + readonly [Symbol.toStringTag]: "Map"; +} + +interface WeakMap { + readonly [Symbol.toStringTag]: "WeakMap"; +} + +interface Set { + readonly [Symbol.toStringTag]: "Set"; +} + +interface WeakSet { + readonly [Symbol.toStringTag]: "WeakSet"; +} + +interface JSON { + readonly [Symbol.toStringTag]: "JSON"; +} + +interface Function { + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface GeneratorFunction { + readonly [Symbol.toStringTag]: "GeneratorFunction"; +} + +interface Math { + readonly [Symbol.toStringTag]: "Math"; +} + +interface Promise { + readonly [Symbol.toStringTag]: "Promise"; +} + +interface PromiseConstructor { + readonly [Symbol.species]: Function; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray | null; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface String { + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; +} + +interface ArrayBuffer { + readonly [Symbol.toStringTag]: "ArrayBuffer"; +} + +interface DataView { + readonly [Symbol.toStringTag]: "DataView"; +} + +interface Int8Array { + readonly [Symbol.toStringTag]: "Int8Array"; +} + +interface Uint8Array { + readonly [Symbol.toStringTag]: "UInt8Array"; +} + +interface Uint8ClampedArray { + readonly [Symbol.toStringTag]: "Uint8ClampedArray"; +} + +interface Int16Array { + readonly [Symbol.toStringTag]: "Int16Array"; +} + +interface Uint16Array { + readonly [Symbol.toStringTag]: "Uint16Array"; +} + +interface Int32Array { + readonly [Symbol.toStringTag]: "Int32Array"; +} + +interface Uint32Array { + readonly [Symbol.toStringTag]: "Uint32Array"; +} + +interface Float32Array { + readonly [Symbol.toStringTag]: "Float32Array"; +} + +interface Float64Array { + readonly [Symbol.toStringTag]: "Float64Array"; +} + +/*! ***************************************************************************** +Modifications Copyright (c) 2018 Tencent, Inc. All rights reserved. +***************************************************************************** */ +///////////////////////////// +/// WA-Additional-APIs +///////////////////////////// + +declare function clearInterval(handle: number): void; +declare function clearTimeout(handle: number): void; +declare function setInterval(handler: (...args: any[]) => void, timeout: number): number; +declare function setInterval(handler: any, timeout?: any, ...args: any[]): number; +declare function setTimeout(handler: (...args: any[]) => void, timeout: number): number; +declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number; +declare function atob(encodedString: string): string; +declare function btoa(rawString: string): string; + +interface Console { + assert(test?: boolean, message?: string, ...optionalParams: any[]): void; + clear(): void; + count(countTitle?: string): void; + debug(message?: any, ...optionalParams: any[]): void; + dir(value?: any, ...optionalParams: any[]): void; + dirxml(value: any): void; + error(message?: any, ...optionalParams: any[]): void; + exception(message?: string, ...optionalParams: any[]): void; + group(groupTitle?: string, ...optionalParams: any[]): void; + groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void; + groupEnd(): void; + info(message?: any, ...optionalParams: any[]): void; + log(message?: any, ...optionalParams: any[]): void; + profile(reportName?: string): void; + profileEnd(): void; + table(...data: any[]): void; + time(timerName?: string): void; + timeEnd(timerName?: string): void; + trace(message?: any, ...optionalParams: any[]): void; + warn(message?: any, ...optionalParams: any[]): void; +} + +declare var Console: { + prototype: Console; + new(): Console; +}; + +declare var console: Console; diff --git a/src/typings/weRequest/index.d.ts b/src/typings/weRequest/index.d.ts new file mode 100644 index 0000000..d451329 --- /dev/null +++ b/src/typings/weRequest/index.d.ts @@ -0,0 +1,112 @@ +interface weRequest { + /** 小程序账号信息 */ + init?: (obj: IInitOption) => void; + /** 插件账号信息(仅在插件中调用时包含这一项) */ + request?: (option: IRequestOption) => Promise; + /** 插件账号信息(仅在插件中调用时包含这一项) */ + uploadFile?: (option: IUploadFileOption) => Promise; + /* 获取本地缓存中用户票据的值 */ + getSession?: () => string; + /* 获取weRequest的配置 */ + getConfig?: () => IGetConfigResult; + /* [不建议使用] 在不发起业务请求的情况下,单独执行登录逻辑 */ + login?: (callback: ) => void; + /* [不建议使用] 设置用户票据的值 */ + setSession?: (x: string) => void; +} +interface IInitOption { + /* 用code换取session的CGI配置 */ + codeToSession: ICodeToSessionOptions; + /* 储存在localStorage的session名称,且CGI请求的data中会自动带上以此为名称的session值;可不配置,默认为session */ + sessionName?: string; + /* 请求URL的固定前缀,如果配置了,后续请求的URL都会自动加上这个前缀,如果是函数,则为函数的返回值 */ + urlPerfix?: string | (() => string); + /* 是否需要调用checkSession,验证小程序的登录态过期;若业务不需要使用到session_key,则可配置为true */ + doNotCheckSession?: boolean; + /* 登录重试次数,当连续请求登录接口返回失败次数超过这个次数,将不再重试登录 */ + reLoginLimit?: number; + /* 当出现接口逻辑错误时,会执行统一的回调函数,这里可以做统一的错误上报等处理 */ + errorCallback?: null | (() => void); + /* 接口返回成功之后,会执行统一的回调函数,这里可以做统一的耗时上报等处理 */ + reportCGI?: boolean | ((...args: IReportCGIParam[]) => void); + /* 可为接口提供mock数据 */ + mockJson?: boolean | (() => object); + /** 所有请求都会自动带上这里的参数 */ + globalData?: boolean | object | (() => object); + /** session在本地缓存的key */ + sessionExpireKey: string; + /* 触发重新登录的条件;参数为CGI返回的数据,返回需要重新登录的条件 */ + loginTrigger?: () => boolean; + /* 触发请求成功的条件;参数为CGI返回的数据,返回接口逻辑成功的条件 */ + successTrigger?: (res: string | IAnyObject | ArrayBuffer) => boolean; + /* 成功之后返回数据;参数为CGI返回的数据,返回逻辑需要使用的数据 */ + successData?: (res: string | IAnyObject | ArrayBuffer) => boolean; + /* 接口逻辑失败时,错误弹窗的标题 */ + errorTitle?: string | ((res: string | IAnyObject | ArrayBuffer) => string); + /* 接口逻辑失败时,错误弹窗的内容 */ + errorContent?: string | ((res: string | IAnyObject | ArrayBuffer) => string); +} + +interface ICodeToSessionOptions{ + /* CGI的url */ + url?: string; + /* 调用该CGI的方法 */ + method?: 'OPTIONS' + | 'GET' + | 'HEAD' + | 'POST' + | 'PUT' + | 'DELETE' + | 'TRACE' + | 'CONNECT' | 'string', + /* CGI中传参时,存放code的名称 */ + codeName?: string; + /* 登录接口需要的其他参数 */ + data?: string | IAnyObject | ArrayBuffer; + /* 接口返回成功的函数;需要返回session的值 */ + success?: () => void; + /* code换取session的接口逻辑出错时,执行的函数,若配置了此函数,则不再默认弹窗报错 */ + fail?: () => void; +} + +interface IReportCGIParam{ + /* 调用的接口名字,可在request接口的report字段配置 */ + name: string; + /* 发起请求时的时间戳 */ + startTime: number; + /* 请求返回时的时间戳 */ + endTime: number; + /* 请求方法,可用于上报 */ + request: () => void; +} + +interface IRequestOption extends wx.RequestOption { + /* 发起请求前执行的函数 */ + beforeSend?: () => void; + /* 请求过程页面是否展示全屏的loading */ + showLoading?: boolean | string; + /* 接口请求成功后将自动执行init()中配置的reportCGI函数,其中的name字段值为这里配置的值 */ + report?: string; +} + +interface IUploadFileOption extends wx.UploadFileOption { + /* 发起请求前执行的函数 */ + beforeSend?: () => void; + /* 请求过程页面是否展示全屏的loading */ + showLoading?: boolean | string; + /* 接口请求成功后将自动执行init()中配置的reportCGI函数,其中的name字段值为这里配置的值 */ + report?: string; +} + +interface IGetConfigResult{ + /* 在组件初始化时传入的请求URL的固定前缀 */ + urlPerfix: string | (() => string); + /* 在组件初始化时传入的用户登陆态设置本地缓存时间 */ + sessionExpireTime: number; + /* 在组件初始化时传入的用户登陆态本地缓存时间Storage的key */ + sessionExpireKey: string; + /* 用户登陆态本地缓存过期的时间戳 */ + sessionExpire: number; +} + +declare const weRequest: weRequest diff --git a/src/typings/wx/index.d.ts b/src/typings/wx/index.d.ts new file mode 100644 index 0000000..2c0c6c8 --- /dev/null +++ b/src/typings/wx/index.d.ts @@ -0,0 +1,63 @@ +/*! ***************************************************************************** +Copyright (c) 2018 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +***************************************************************************** */ + +/// +/// +/// +/// + +declare type IAnyObject = Record; + +declare type KVInfer = { [K in keyof T]: T[K] }; + +declare type Void = T | undefined | null; + +type PartialOptional = Partial> & + Pick>; + +/** + * Make all properties in T required + */ +// type Required = { +// [P in keyof T]-?: T[P]; +// }; + +/** + * Exclude from T those types that are assignable to U + */ +// type Exclude = T extends U ? never : T; + +/** + * Extract from T those types that are assignable to U + */ +// type Extract = T extends U ? T : never; + +/** + * Exclude null and undefined from T + */ +// type NonNullable = T extends null | undefined ? never : T; + +/** + * Obtain the return type of a function type + */ +// type ReturnType any> = T extends (...args: any[]) => infer R ? R : any; + +/** + * Obtain the return type of a constructor function type + */ +// type InstanceType any> = T extends new (...args: any[]) => infer R ? R : any; + +type Optional = { [K in keyof T]+?: T[K] }; + +// 临时解决ts,后续小程序工具会更新 +declare function Component(...args: any[]): any; +declare function requirePlugin(pluginName: string): any; +declare function require(pluginName: string): any; +type TODO = any; diff --git a/src/typings/wx/lib.wx.api.d.ts b/src/typings/wx/lib.wx.api.d.ts new file mode 100644 index 0000000..d6ee6e8 --- /dev/null +++ b/src/typings/wx/lib.wx.api.d.ts @@ -0,0 +1,12396 @@ +/*! ***************************************************************************** +Copyright (c) 2018 Tencent, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +***************************************************************************** */ + +declare namespace wx { + /** 账号信息 */ + interface AccountInfo { + /** 小程序账号信息 */ + miniProgram: MiniProgram; + /** 插件账号信息(仅在插件中调用时包含这一项) */ + plugin: Plugin; + } + /** 需要添加的卡券列表 */ + interface AddCardRequestInfo { + /** 卡券 ID */ + cardId: string; + /** 卡券的扩展参数。需进行 JSON 序列化为**字符串**传入 */ + cardExt: CardExt; + } + /** 卡券添加结果列表 */ + interface AddCardResponseInfo { + /** 加密 code,为用户领取到卡券的code加密后的字符串,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */ + code: string; + /** 用户领取到卡券的 ID */ + cardId: string; + /** 卡券的扩展参数,结构请参考前文 */ + cardExt: string; + /** 是否成功 */ + isSuccess: boolean; + } + /** 动画效果 */ + interface AnimationOption { + /** 动画变化时间,单位 ms */ + duration?: number; + /** 动画变化方式 + * + * 可选值: + * - 'linear': 动画从头到尾的速度是相同的; + * - 'easeIn': 动画以低速开始; + * - 'easeOut': 动画以低速结束; + * - 'easeInOut': 动画以低速开始和结束; */ + timingFunc?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut'; + } + /** 用户授权设置信息 */ + interface AuthSetting { + /** 是否授权用户信息,对应接口 wx.getUserInfo */ + 'scope.userInfo': boolean; + /** 是否授权地理位置,对应接口 wx.getLocation wx.chooseLocation */ + 'scope.userLocation': boolean; + /** 是否授权通讯地址,对应接口 wx.chooseAddress */ + 'scope.address': boolean; + /** 是否授权发票抬头,对应接口 wx.chooseInvoiceTitle */ + 'scope.invoiceTitle': boolean; + /** 是否授权微信运动步数,对应接口 wx.getWeRunData */ + 'scope.werun': boolean; + /** 是否授权录音功能,对应接口 wx.startRecord */ + 'scope.record': boolean; + /** 是否授权保存到相册 wx.saveImageToPhotosAlbum, wx.saveVideoToPhotosAlbum */ + 'scope.writePhotosAlbum': boolean; + /** 是否授权摄像头 */ + 'scope.camera': boolean; + } + /** 设备服务列表 */ + interface BLECharacteristic { + /** 蓝牙设备特征值的 uuid */ + uuid: string; + /** 该特征值支持的操作类型 */ + properties: Properties; + } + /** 设备服务列表 */ + interface BLEService { + /** 蓝牙设备服务的 uuid */ + uuid: string; + /** 该服务是否为主服务 */ + isPrimary: boolean; + } + /** BackgroundAudioManager 实例,可通过 [wx.getBackgroundAudioManager]((wx.getBackgroundAudioManager)) 获取。 + * + * **示例代码** + * + * ```js + const backgroundAudioManager = wx.getBackgroundAudioManager() + backgroundAudioManager.title = '此时此刻' + backgroundAudioManager.epname = '此时此刻' + backgroundAudioManager.singer = '许巍' + backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000' + // 设置了 src 之后会自动播放 + backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' + ``` */ + interface BackgroundAudioManager { + /** 音频的数据源({% version('2.2.3') %} 开始支持云文件ID)。默认为空字符串,**当设置了新的 src 时,会自动开始播放**,目前支持的格式有 m4a, aac, mp3, wav。 */ + src: string; + /** 音频开始播放的位置(单位:s)。 */ + startTime: number; + /** 音频标题,用于原生音频播放器音频标题(必填)。原生音频播放器中的分享功能,分享出去的卡片标题,也将使用该值。 */ + title: string; + /** 专辑名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ + epname: string; + /** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ + singer: string; + /** 封面图 URL,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图。 */ + coverImgUrl: string; + /** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ + webUrl: string; + /** 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。 + * + * 最低基础库: `1.9.94` */ + protocol: string; + /** 当前音频的长度(单位:s),只有在有合法 src 时返回。(只读) */ + duration: number; + /** 当前音频的播放位置(单位:s),只有在有合法 src 时返回。(只读) */ + currentTime: number; + /** 当前是否暂停或停止。(只读) */ + paused: boolean; + /** 音频已缓冲的时间,仅保证当前播放时间点到此时间点内容已缓冲。(只读) */ + buffered: number; + } + /** 新搜索到的设备列表 */ + interface CallbackResultBlueToothDevice { + /** 蓝牙设备名称,某些设备可能没有 */ + name: string; + /** 用于区分设备的 id */ + deviceId: string; + /** 当前蓝牙设备的信号强度 */ + RSSI: number; + /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */ + advertisData: ArrayBuffer; + /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */ + advertisServiceUUIDs: Array; + /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */ + localName: string; + /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */ + serviceData: ArrayBuffer; + } + /** uuid 对应的的已连接设备列表 */ + interface GetBluetoothDevicesSuccessCallbackResultBlueToothDevice { + /** 蓝牙设备名称,某些设备可能没有 */ + name: string; + /** 用于区分设备的 id */ + deviceId: string; + /** 当前蓝牙设备的信号强度 */ + RSSI: number; + /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */ + advertisData: ArrayBuffer; + /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */ + advertisServiceUUIDs: Array; + /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */ + localName: string; + /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */ + serviceData: ArrayBuffer; + } + /** 搜索到的设备列表 */ + interface BluetoothDeviceInfo { + /** 蓝牙设备名称,某些设备可能没有 */ + name: string; + /** 用于区分设备的 id */ + deviceId: string; + } + /** 目标边界 */ + interface BoundingClientRectResult { + /** 左边界 */ + left: number; + /** 右边界 */ + right: number; + /** 上边界 */ + top: number; + /** 下边界 */ + bottom: number; + } + /** canvas 组件的绘图上下文 */ + interface CanvasContext { + /** 填充颜色。用法同 [CanvasContext.setFillStyle()]((CanvasContext.setFillStyle))。 + * + * 最低基础库: `1.9.90` */ + fillStyle: string; + /** 边框颜色。用法同 [CanvasContext.setFillStyle()]((CanvasContext.setStrokeStyle))。 + * + * 最低基础库: `1.9.90` */ + strokeStyle: string; + /** 阴影相对于形状在水平方向的偏移 + * + * 最低基础库: `1.9.90` */ + shadowOffsetX: number; + /** 阴影相对于形状在竖直方向的偏移 + * + * 最低基础库: `1.9.90` */ + shadowOffsetY: number; + /** 阴影的颜色 + * + * 最低基础库: `1.9.90` */ + shadowColor: number; + /** 阴影的模糊级别 + * + * 最低基础库: `1.9.90` */ + shadowBlur: number; + /** 线条的宽度。用法同 [CanvasContext.setLineWidth()]((CanvasContext.setLineWidth))。 + * + * 最低基础库: `1.9.90` */ + lineWidth: number; + /** 线条的端点样式。用法同 [CanvasContext.setLineCap()]((CanvasContext.setLineCap))。 + * + * 最低基础库: `1.9.90` */ + lineCap: number; + /** 线条的交点样式。用法同 [CanvasContext.setLineJoin()]((CanvasContext.setLineJoin))。 + * + * 最低基础库: `1.9.90` */ + lineJoin: number; + /** 最大斜接长度。用法同 [CanvasContext.setMiterLimit()]((CanvasContext.setMiterLimit))。 + * + * 最低基础库: `1.9.90` */ + miterLimit: number; + /** 虚线偏移量,初始值为0 + * + * 最低基础库: `1.9.90` */ + lineDashOffset: number; + /** 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。 + * + * 最低基础库: `1.9.90` */ + font: string; + /** 全局画笔透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */ + globalAlpha: number; + /** 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。 + * + * 目前支持的操作有 + * - 安卓:xor, source-over, source-atop, destination-out, lighter, overlay, darken, lighten, hard-light + * - iOS:xor, source-over, source-atop, destination-over, destination-out, lighter, multiply, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, saturation, luminosity + * + * 最低基础库: `1.9.90` */ + globalCompositeOperation: string; + } + /** 卡券的扩展参数。需进行 JSON 序列化为**字符串**传入 */ + interface CardExt { + /** 用户领取的 code,仅自定义 code 模式的卡券须填写,非自定义 code 模式卡券不可填写,[详情](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025056) */ + code?: string; + /** 指定领取者的 openid,只有该用户能领取。 bind_openid 字段为 true 的卡券必须填写,bind_openid 字段为 false 不可填写。 */ + openid?: string; + /** 时间戳,东八区时间,UTC+8,单位为秒 */ + timestamp: number; + /** 随机字符串,由开发者设置传入,加强安全性(若不填写可能被重放请求)。随机字符串,不长于 32 位。推荐使用大小写字母和数字,不同添加请求的 nonce_str 须动态生成,若重复将会导致领取失败。 */ + nonce_str?: string; + /** 卡券在第三方系统的实际领取时间,为东八区时间戳(UTC+8,精确到秒)。当卡券的有效期类为 DATE_TYPE_FIX_TERM 时专用,标识卡券的实际生效时间,用于解决商户系统内起始时间和领取微信卡券时间不同步的问题。 */ + fixed_begintimestamp?: number; + /** 领取渠道参数,用于标识本次领取的渠道值。 */ + outer_str?: string; + /** 签名,商户将接口列表中的参数按照指定方式进行签名,签名方式使用 SHA1,具体签名方案参见:[卡券签名](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */ + signature: string; + } + /** 颜色。可以用以下几种方式来表示 canvas 中使用的颜色: + * - RGB 颜色: 如 `'rgb(255, 0, 0)'` + * - RGBA 颜色:如 `'rgba(255, 0, 0, 0.3)'` + * - 16 进制颜色: 如 `'#FF0000'` + * - 预定义的颜色: 如 `'red'` + * + * 其中预定义颜色有以下148个: + * + * *注意**: Color Name 大小写不敏感 + * + * | Color Name | HEX | + * + * | -------------------- | ------- | + * + * | AliceBlue | #F0F8FF | + * + * | AntiqueWhite | #FAEBD7 | + * + * | Aqua | #00FFFF | + * + * | Aquamarine | #7FFFD4 | + * + * | Azure | #F0FFFF | + * + * | Beige | #F5F5DC | + * + * | Bisque | #FFE4C4 | + * + * | Black | #000000 | + * + * | BlanchedAlmond | #FFEBCD | + * + * | Blue | #0000FF | + * + * | BlueViolet | #8A2BE2 | + * + * | Brown | #A52A2A | + * + * | BurlyWood | #DEB887 | + * + * | CadetBlue | #5F9EA0 | + * + * | Chartreuse | #7FFF00 | + * + * | Chocolate | #D2691E | + * + * | Coral | #FF7F50 | + * + * | CornflowerBlue | #6495ED | + * + * | Cornsilk | #FFF8DC | + * + * | Crimson | #DC143C | + * + * | Cyan | #00FFFF | + * + * | DarkBlue | #00008B | + * + * | DarkCyan | #008B8B | + * + * | DarkGoldenRod | #B8860B | + * + * | DarkGray | #A9A9A9 | + * + * | DarkGrey | #A9A9A9 | + * + * | DarkGreen | #006400 | + * + * | DarkKhaki | #BDB76B | + * + * | DarkMagenta | #8B008B | + * + * | DarkOliveGreen | #556B2F | + * + * | DarkOrange | #FF8C00 | + * + * | DarkOrchid | #9932CC | + * + * | DarkRed | #8B0000 | + * + * | DarkSalmon | #E9967A | + * + * | DarkSeaGreen | #8FBC8F | + * + * | DarkSlateBlue | #483D8B | + * + * | DarkSlateGray | #2F4F4F | + * + * | DarkSlateGrey | #2F4F4F | + * + * | DarkTurquoise | #00CED1 | + * + * | DarkViolet | #9400D3 | + * + * | DeepPink | #FF1493 | + * + * | DeepSkyBlue | #00BFFF | + * + * | DimGray | #696969 | + * + * | DimGrey | #696969 | + * + * | DodgerBlue | #1E90FF | + * + * | FireBrick | #B22222 | + * + * | FloralWhite | #FFFAF0 | + * + * | ForestGreen | #228B22 | + * + * | Fuchsia | #FF00FF | + * + * | Gainsboro | #DCDCDC | + * + * | GhostWhite | #F8F8FF | + * + * | Gold | #FFD700 | + * + * | GoldenRod | #DAA520 | + * + * | Gray | #808080 | + * + * | Grey | #808080 | + * + * | Green | #008000 | + * + * | GreenYellow | #ADFF2F | + * + * | HoneyDew | #F0FFF0 | + * + * | HotPink | #FF69B4 | + * + * | IndianRed | #CD5C5C | + * + * | Indigo | #4B0082 | + * + * | Ivory | #FFFFF0 | + * + * | Khaki | #F0E68C | + * + * | Lavender | #E6E6FA | + * + * | LavenderBlush | #FFF0F5 | + * + * | LawnGreen | #7CFC00 | + * + * | LemonChiffon | #FFFACD | + * + * | LightBlue | #ADD8E6 | + * + * | LightCoral | #F08080 | + * + * | LightCyan | #E0FFFF | + * + * | LightGoldenRodYellow | #FAFAD2 | + * + * | LightGray | #D3D3D3 | + * + * | LightGrey | #D3D3D3 | + * + * | LightGreen | #90EE90 | + * + * | LightPink | #FFB6C1 | + * + * | LightSalmon | #FFA07A | + * + * | LightSeaGreen | #20B2AA | + * + * | LightSkyBlue | #87CEFA | + * + * | LightSlateGray | #778899 | + * + * | LightSlateGrey | #778899 | + * + * | LightSteelBlue | #B0C4DE | + * + * | LightYellow | #FFFFE0 | + * + * | Lime | #00FF00 | + * + * | LimeGreen | #32CD32 | + * + * | Linen | #FAF0E6 | + * + * | Magenta | #FF00FF | + * + * | Maroon | #800000 | + * + * | MediumAquaMarine | #66CDAA | + * + * | MediumBlue | #0000CD | + * + * | MediumOrchid | #BA55D3 | + * + * | MediumPurple | #9370DB | + * + * | MediumSeaGreen | #3CB371 | + * + * | MediumSlateBlue | #7B68EE | + * + * | MediumSpringGreen | #00FA9A | + * + * | MediumTurquoise | #48D1CC | + * + * | MediumVioletRed | #C71585 | + * + * | MidnightBlue | #191970 | + * + * | MintCream | #F5FFFA | + * + * | MistyRose | #FFE4E1 | + * + * | Moccasin | #FFE4B5 | + * + * | NavajoWhite | #FFDEAD | + * + * | Navy | #000080 | + * + * | OldLace | #FDF5E6 | + * + * | Olive | #808000 | + * + * | OliveDrab | #6B8E23 | + * + * | Orange | #FFA500 | + * + * | OrangeRed | #FF4500 | + * + * | Orchid | #DA70D6 | + * + * | PaleGoldenRod | #EEE8AA | + * + * | PaleGreen | #98FB98 | + * + * | PaleTurquoise | #AFEEEE | + * + * | PaleVioletRed | #DB7093 | + * + * | PapayaWhip | #FFEFD5 | + * + * | PeachPuff | #FFDAB9 | + * + * | Peru | #CD853F | + * + * | Pink | #FFC0CB | + * + * | Plum | #DDA0DD | + * + * | PowderBlue | #B0E0E6 | + * + * | Purple | #800080 | + * + * | RebeccaPurple | #663399 | + * + * | Red | #FF0000 | + * + * | RosyBrown | #BC8F8F | + * + * | RoyalBlue | #4169E1 | + * + * | SaddleBrown | #8B4513 | + * + * | Salmon | #FA8072 | + * + * | SandyBrown | #F4A460 | + * + * | SeaGreen | #2E8B57 | + * + * | SeaShell | #FFF5EE | + * + * | Sienna | #A0522D | + * + * | Silver | #C0C0C0 | + * + * | SkyBlue | #87CEEB | + * + * | SlateBlue | #6A5ACD | + * + * | SlateGray | #708090 | + * + * | SlateGrey | #708090 | + * + * | Snow | #FFFAFA | + * + * | SpringGreen | #00FF7F | + * + * | SteelBlue | #4682B4 | + * + * | Tan | #D2B48C | + * + * | Teal | #008080 | + * + * | Thistle | #D8BFD8 | + * + * | Tomato | #FF6347 | + * + * | Turquoise | #40E0D0 | + * + * | Violet | #EE82EE | + * + * | Wheat | #F5DEB3 | + * + * | White | #FFFFFF | + * + * | WhiteSmoke | #F5F5F5 | + * + * | Yellow | #FFFF00 | + * + * | YellowGreen | #9ACD32 | */ + interface Color { } + /** 弹幕内容 */ + interface Danmu { + /** 弹幕文字 */ + text: string; + /** 弹幕颜色 */ + color?: string; + } + /** 上报的自定义数据。 */ + interface Data { + /** 配置中的字段名 */ + key: string; + /** 上报的数据 */ + value: any; + } + /** 可选的字体描述符 */ + interface DescOption { + /** 字体样式,可选值为 normal / italic / oblique */ + style?: string; + /** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */ + weight?: string; + /** 设置小型大写字母的字体显示文本,可选值为 normal / small-caps / inherit */ + variant?: string; + } + /** 指定 marker 移动到的目标点 */ + interface DestinationOption { + /** 经度 */ + longitude: number; + /** 纬度 */ + latitude: number; + } + interface ExtInfo { + /** 第三方平台自定义的数据 */ + extConfig: IAnyObject; + } + interface Fields { + /** 是否返回节点 id */ + id?: boolean; + /** 是否返回节点 dataset */ + dataset?: boolean; + /** 是否返回节点布局位置(`left` `right` `top` `bottom`) */ + rect?: boolean; + /** 是否返回节点尺寸(`width` `height`) */ + size?: boolean; + /** 否 是否返回节点的 `scrollLeft` `scrollTop`,节点必须是 `scroll-view` 或者 `viewport` */ + scrollOffset?: boolean; + /** 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) */ + properties?: Array; + /** 指定样式名列表,返回节点对应样式名的当前值 + * + * 最低基础库: `2.1.0` */ + computedStyle?: Array; + } + /** 文件数组 */ + interface FileSystemManagerGetSavedFileListSuccessCallbackResultFileItem { + /** 本地路径 */ + filePath: string; + /** 本地文件大小,以字节为单位 */ + size: number; + /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */ + createTime: number; + } + /** 文件数组,每一项是一个 FileItem */ + interface WxGetSavedFileListSuccessCallbackResultFileItem { + /** 本地路径 */ + filePath: string; + /** 本地文件大小,以字节为单位 */ + size: number; + /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */ + createTime: number; + } + interface GetBatteryInfoSyncResult { + /** 设备电量,范围 1 - 100 */ + level: string; + /** 是否正在充电中 */ + isCharging: boolean; + } + interface GetStorageInfoSyncOption { + /** 当前 storage 中所有的 key */ + keys: Array; + /** 当前占用的空间大小, 单位 KB */ + currentSize: number; + /** 限制的空间大小,单位 KB */ + limitSize: number; + } + interface GetSystemInfoSyncResult { + /** 手机品牌 + * + * 最低基础库: `1.5.0` */ + brand: string; + /** 手机型号 */ + model: string; + /** 设备像素比 */ + pixelRatio: number; + /** 屏幕宽度 + * + * 最低基础库: `1.1.0` */ + screenWidth: number; + /** 屏幕高度 + * + * 最低基础库: `1.1.0` */ + screenHeight: number; + /** 可使用窗口宽度 */ + windowWidth: number; + /** 可使用窗口高度 */ + windowHeight: number; + /** 状态栏的高度 + * + * 最低基础库: `1.9.0` */ + statusBarHeight: number; + /** 微信设置的语言 */ + language: string; + /** 微信版本号 */ + version: string; + /** 操作系统版本 */ + system: string; + /** 客户端平台 */ + platform: string; + /** 用户字体大小设置。以“我-设置-通用-字体大小”中的设置为准,单位 px。 + * + * 最低基础库: `1.5.0` */ + fontSizeSetting: number; + /** 客户端基础库版本 + * + * 最低基础库: `1.1.0` */ + SDKVersion: string; + /** (仅Android小游戏) 性能等级,-2 或 0:该设备无法运行小游戏,-1:性能未知,>=1 设备性能值,该值越高,设备性能越好 (目前设备最高不到50) + * + * 最低基础库: `1.8.0` */ + benchmarkLevel: number; + } + interface IBeaconInfo { + /** iBeacon 设备广播的 uuid */ + uuid: string; + /** iBeacon 设备的主 id */ + major: string; + /** iBeacon 设备的次 id */ + minor: string; + /** 表示设备距离的枚举值 */ + proximity: number; + /** iBeacon 设备的距离 */ + accuracy: number; + /** 表示设备的信号强度 */ + rssi: number; + } + /** 图片的本地临时文件列表 + * + * 最低基础库: `1.2.0` */ + interface ImageFile { + /** 本地临时文件路径 */ + path: string; + /** 本地临时文件大小,单位 B */ + size: number; + } + /** InnerAudioContext 实例,可通过 [wx.createInnerAudioContext]((wx.createInnerAudioContext)) 接口获取实例。 + * + * **示例代码** + * + * ```js + const innerAudioContext = wx.createInnerAudioContext() + innerAudioContext.autoplay = true + innerAudioContext.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' + innerAudioContext.onPlay(() => { + console.log('开始播放') + }) + innerAudioContext.onError((res) => { + console.log(res.errMsg) + console.log(res.errCode) + }) + ``` */ + interface InnerAudioContext { + /** 音频资源的地址,用于直接播放。{% version('2.2.3') %} 开始支持云文件ID */ + src: string; + /** 开始播放的位置(单位:s),默认为 0 */ + startTime: number; + /** 是否自动开始播放,默认为 `false` */ + autoplay: boolean; + /** 是否循环播放,默认为 `false` */ + loop: boolean; + /** 是否遵循系统静音开关,默认为 `true`。当此参数为 `false` 时,即使用户打开了静音开关,也能继续发出声音 */ + obeyMuteSwitch: boolean; + /** 音量。范围 0~1。默认为 1 + * + * 最低基础库: `1.9.90` */ + volume: number; + /** 当前音频的长度(单位 s)。只有在当前有合法的 src 时返回(只读) */ + duration: number; + /** 当前音频的播放位置(单位 s)。只有在当前有合法的 src 时返回,时间保留小数点后 6 位(只读) */ + currentTime: number; + /** 当前是是否暂停或停止状态(只读) */ + paused: boolean; + /** 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲(只读) */ + buffered: number; + } + /** 相交区域的边界 */ + interface IntersectionRectResult { + /** 左边界 */ + left: number; + /** 右边界 */ + right: number; + /** 上边界 */ + top: number; + /** 下边界 */ + bottom: number; + } + /** 用户选中的发票列表 */ + interface InvoiceInfo { + /** 所选发票卡券的 cardId */ + cardId: string; + /** 所选发票卡券的加密 code,报销方可以通过 cardId 和 encryptCode 获得报销发票的信息 */ + encryptCode: string; + /** 发票方的 appId */ + publisherAppId: string; + } + /** 要显示在可视区域内的坐标点列表 */ + interface MapPostion { + /** 经度 */ + longitude: number; + /** 纬度 */ + latitude: number; + } + /** 用来扩展(或收缩)参照节点布局区域的边界 */ + interface RelativeToMargins { + /** 节点布局区域的左边界 */ + left?: number; + /** 节点布局区域的右边界 */ + right?: number; + /** 节点布局区域的上边界 */ + top?: number; + /** 节点布局区域的下边界 */ + bottom?: number; + } + /** 用来扩展(或收缩)参照节点布局区域的边界 */ + interface RelativeToViewportMargins { + /** 节点布局区域的左边界 */ + left?: number; + /** 节点布局区域的右边界 */ + right?: number; + /** 节点布局区域的上边界 */ + top?: number; + /** 节点布局区域的下边界 */ + bottom?: number; + } + /** 小程序账号信息 */ + interface MiniProgram { + /** 小程序 appId */ + appId: string; + } + /** 需要打开的卡券列表 */ + interface OpenCardRequestInfo { + /** 卡券 ID */ + cardId: string; + /** 由 [wx.addCard]((wx.addCard)) 的返回对象中的加密 code 通过解密后得到,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */ + code: string; + } + interface SendSocketMessageOption { + /** 需要发送的内容 */ + data: string | ArrayBuffer; + /** 接口调用成功的回调函数 */ + success?: SendSocketMessageSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SendSocketMessageFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SendSocketMessageCompleteCallback; + } + interface FaceVerifyForPayOption { + /** 场景值 */ + scene: number; + /** 支付传入的参数 */ + package: string; + /** 支付传入的参数,签名 */ + packageSign: string; + /** 别的验证方式woridng,不传就不显示入口 */ + otherVerifyTitle: string; + /** 接口调用成功的回调函数 */ + success?: FaceVerifyForPaySuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: FaceVerifyForPayFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: FaceVerifyForPayCompleteCallback; + } + interface SnapshotOption { + /** 接口调用成功的回调函数 */ + success?: SnapshotSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SnapshotFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SnapshotCompleteCallback; + } + interface GetBackgroundAudioPlayerStateOption { + /** 接口调用成功的回调函数 */ + success?: GetBackgroundAudioPlayerStateSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetBackgroundAudioPlayerStateFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBackgroundAudioPlayerStateCompleteCallback; + } + interface ShowTabBarRedDotOption { + /** tabBar 的哪一项,从左边算起 */ + index: number; + /** 接口调用成功的回调函数 */ + success?: ShowTabBarRedDotSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ShowTabBarRedDotFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowTabBarRedDotCompleteCallback; + } + interface StopWifiOption { + /** 接口调用成功的回调函数 */ + success?: StopWifiSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopWifiFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopWifiCompleteCallback; + } + interface SwitchCameraOption { + /** 接口调用成功的回调函数 */ + success?: SwitchCameraSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SwitchCameraFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SwitchCameraCompleteCallback; + } + interface StartWifiOption { + /** 接口调用成功的回调函数 */ + success?: StartWifiSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartWifiFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartWifiCompleteCallback; + } + interface LivePusherContextResumeOption { + /** 接口调用成功的回调函数 */ + success?: LivePusherContextResumeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: LivePusherContextResumeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LivePusherContextResumeCompleteCallback; + } + interface StatOption { + /** 文件/目录路径 */ + path: string; + /** 是否递归获取目录下的每个文件的 Stats 信息 + * + * 最低基础库: `2.3.0` */ + recursive?: boolean; + /** 接口调用成功的回调函数 */ + success?: StatSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StatFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StatCompleteCallback; + } + interface LivePusherContextPauseOption { + /** 接口调用成功的回调函数 */ + success?: LivePusherContextPauseSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: LivePusherContextPauseFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LivePusherContextPauseCompleteCallback; + } + interface SetWifiListOption { + /** 提供预设的 Wi-Fi 信息列表 */ + wifiList: WifiData; + /** 接口调用成功的回调函数 */ + success?: SetWifiListSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetWifiListFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetWifiListCompleteCallback; + } + interface NavigateBackOption { + /** 返回的页面数,如果 delta 大于现有页面数,则返回到首页。 */ + delta: number; + /** 接口调用成功的回调函数 */ + success?: NavigateBackSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: NavigateBackFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NavigateBackCompleteCallback; + } + interface UnlinkOption { + /** 要删除的文件路径 */ + filePath: string; + /** 接口调用成功的回调函数 */ + success?: UnlinkSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: UnlinkFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UnlinkCompleteCallback; + } + interface SwitchTabOption { + /** 需要跳转的 tabBar 页面的路径(需在 app.json 的 [tabBar]((config#tabbar)) 字段定义的页面),路径后不能带参数。 */ + url: string; + /** 接口调用成功的回调函数 */ + success?: SwitchTabSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SwitchTabFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SwitchTabCompleteCallback; + } + interface GetWifiListOption { + /** 接口调用成功的回调函数 */ + success?: GetWifiListSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetWifiListFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetWifiListCompleteCallback; + } + interface NavigateToOption { + /** 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */ + url: string; + /** 接口调用成功的回调函数 */ + success?: NavigateToSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: NavigateToFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NavigateToCompleteCallback; + } + interface UnzipOption { + /** 源文件路径,只可以是 zip 压缩文件 */ + zipFilePath: string; + /** 目标目录路径 */ + targetPath: string; + /** 接口调用成功的回调函数 */ + success?: UnzipSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: UnzipFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UnzipCompleteCallback; + } + interface VideoContextRequestFullScreenOption { + /** 设置全屏时视频的方向,不指定则根据宽高比自动判断。 + * + * 可选值: + * - 0: 正常竖向; + * - 90: 屏幕逆时针90度; + * - -90: 屏幕顺时针90度; + * + * 最低基础库: `1.7.0` */ + direction: 0 | 90 | -90; + } + interface GetConnectedWifiOption { + /** 接口调用成功的回调函数 */ + success?: GetConnectedWifiSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetConnectedWifiFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetConnectedWifiCompleteCallback; + } + interface SetEnableDebugOption { + /** 是否打开调试 */ + enableDebug: boolean; + /** 接口调用成功的回调函数 */ + success?: SetEnableDebugSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetEnableDebugFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetEnableDebugCompleteCallback; + } + interface WriteFileOption { + /** 要写入的文件路径 */ + filePath: string; + /** 要写入的文本或二进制数据 */ + data: string | ArrayBuffer; + /** 指定写入文件的字符编码 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2/ucs-2/utf16le/utf-16le': 以小端序读取; + * - 'utf-8/utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2/ucs-2/utf16le/utf-16le' + | 'utf-8/utf8' + | 'latin1'; + /** 接口调用成功的回调函数 */ + success?: WriteFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: WriteFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WriteFileCompleteCallback; + } + interface StopAccelerometerOption { + /** 接口调用成功的回调函数 */ + success?: StopAccelerometerSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopAccelerometerFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopAccelerometerCompleteCallback; + } + interface ConnectWifiOption { + /** Wi-Fi 设备 SSID */ + SSID: string; + /** Wi-Fi 设备 BSSID */ + BSSID: string; + /** Wi-Fi 设备密码 */ + password?: string; + /** 接口调用成功的回调函数 */ + success?: ConnectWifiSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ConnectWifiFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ConnectWifiCompleteCallback; + } + interface RedirectToOption { + /** 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */ + url: string; + /** 接口调用成功的回调函数 */ + success?: RedirectToSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: RedirectToFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RedirectToCompleteCallback; + } + interface GetLocationOption { + /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */ + type?: string; + /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 + * + * 最低基础库: `1.6.0` */ + altitude?: string; + /** 接口调用成功的回调函数 */ + success?: GetLocationSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetLocationFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetLocationCompleteCallback; + } + interface ExitFullScreenOption { + /** 接口调用成功的回调函数 */ + success?: ExitFullScreenSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ExitFullScreenFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ExitFullScreenCompleteCallback; + } + interface OpenLocationOption { + /** 纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */ + latitude: number; + /** 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */ + longitude: number; + /** 缩放比例,范围5~18 */ + scale?: number; + /** 位置名 */ + name?: string; + /** 地址的详细说明 */ + address?: string; + /** 接口调用成功的回调函数 */ + success?: OpenLocationSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: OpenLocationFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenLocationCompleteCallback; + } + interface GetClipboardDataOption { + /** 接口调用成功的回调函数 */ + success?: GetClipboardDataSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetClipboardDataFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetClipboardDataCompleteCallback; + } + interface SetScreenBrightnessOption { + /** 屏幕亮度值,范围 0 ~ 1。0 最暗,1 最亮 */ + value: number; + /** 接口调用成功的回调函数 */ + success?: SetScreenBrightnessSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetScreenBrightnessFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetScreenBrightnessCompleteCallback; + } + interface StartCompassOption { + /** 接口调用成功的回调函数 */ + success?: StartCompassSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartCompassFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartCompassCompleteCallback; + } + interface ChooseLocationOption { + /** 接口调用成功的回调函数 */ + success?: ChooseLocationSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ChooseLocationFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseLocationCompleteCallback; + } + interface SetNavigationBarColorOption { + /** 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 */ + frontColor: string; + /** 背景颜色值,有效值为十六进制颜色 */ + backgroundColor: string; + /** 动画效果 */ + animation: AnimationOption; + /** 接口调用成功的回调函数 */ + success?: SetNavigationBarColorSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetNavigationBarColorFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetNavigationBarColorCompleteCallback; + } + interface StopRecordOption { + /** 接口调用成功的回调函数 */ + success?: StopRecordSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopRecordFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopRecordCompleteCallback; + } + interface StartGyroscopeOption { + /** 监听陀螺仪数据回调函数的执行频率 + * + * 可选值: + * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右; + * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右; + * - 'normal': 普通的回调频率,在 200ms/次 左右; */ + interval?: 'game' | 'ui' | 'normal'; + /** 接口调用成功的回调函数 */ + success?: StartGyroscopeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartGyroscopeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartGyroscopeCompleteCallback; + } + interface LoadFontFaceOption { + /** 定义的字体名称 */ + family: string; + /** 字体资源的地址。建议格式为 TTF 和 WOFF,WOFF2 在低版本的iOS上会不兼容。 */ + source: string; + /** 可选的字体描述符 */ + desc?: DescOption; + /** 接口调用成功的回调函数 */ + success?: LoadFontFaceSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: LoadFontFaceFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LoadFontFaceCompleteCallback; + } + interface HideNavigationBarLoadingOption { + /** 接口调用成功的回调函数 */ + success?: HideNavigationBarLoadingSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: HideNavigationBarLoadingFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideNavigationBarLoadingCompleteCallback; + } + interface SetKeepScreenOnOption { + /** 是否保持屏幕常亮 */ + keepScreenOn: boolean; + /** 接口调用成功的回调函数 */ + success?: SetKeepScreenOnSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetKeepScreenOnFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetKeepScreenOnCompleteCallback; + } + interface StartBeaconDiscoveryOption { + /** iBeacon 设备广播的 uuid 列表 */ + uuids: Array; + /** 是否校验蓝牙开关,仅在 iOS 下有效 */ + ignoreBluetoothAvailable?: boolean; + /** 接口调用成功的回调函数 */ + success?: StartBeaconDiscoverySuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartBeaconDiscoveryFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartBeaconDiscoveryCompleteCallback; + } + interface GetScreenBrightnessOption { + /** 接口调用成功的回调函数 */ + success?: GetScreenBrightnessSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetScreenBrightnessFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetScreenBrightnessCompleteCallback; + } + interface SetNavigationBarTitleOption { + /** 页面标题 */ + title: string; + /** 接口调用成功的回调函数 */ + success?: SetNavigationBarTitleSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetNavigationBarTitleFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetNavigationBarTitleCompleteCallback; + } + interface ChooseImageOption { + /** 最多可以选择的图片张数 */ + count?: number; + /** 所选的图片的尺寸 + * + * 可选值: + * - 'original': 原图; + * - 'compressed': 压缩图; */ + sizeType?: 'original' | 'compressed'; + /** 选择图片的来源 + * + * 可选值: + * - 'album': 从相册选图; + * - 'camera': 使用相机; */ + sourceType?: 'album' | 'camera'; + /** 接口调用成功的回调函数 */ + success?: ChooseImageSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ChooseImageFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseImageCompleteCallback; + } + interface LivePlayerContextRequestFullScreenOption { + /** 设置全屏时的方向 + * + * 可选值: + * - 0: 正常竖向; + * - 90: 屏幕逆时针90度; + * - -90: 屏幕顺时针90度; */ + direction?: 0 | 90 | -90; + /** 接口调用成功的回调函数 */ + success?: RequestFullScreenSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: RequestFullScreenFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RequestFullScreenCompleteCallback; + } + interface PreviewImageOption { + /** 需要预览的图片链接列表。{% version('2.2.3') %} 起支持云文件ID。 */ + urls: Array; + /** 当前显示图片的链接 */ + current?: string; + /** 接口调用成功的回调函数 */ + success?: PreviewImageSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: PreviewImageFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PreviewImageCompleteCallback; + } + interface NavigateBackMiniProgramOption { + /** 需要返回给上一个小程序的数据,上一个小程序可在 `App.onShow` 中获取到这份数据。 [详情]((小程序 App))。 */ + extraData?: IAnyObject; + /** 接口调用成功的回调函数 */ + success?: NavigateBackMiniProgramSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: NavigateBackMiniProgramFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NavigateBackMiniProgramCompleteCallback; + } + interface GetScreenBrightnessSuccessCallbackOption { + /** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮 */ + value: number; + } + interface StopDeviceMotionListeningOption { + /** 接口调用成功的回调函数 */ + success?: StopDeviceMotionListeningSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopDeviceMotionListeningFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopDeviceMotionListeningCompleteCallback; + } + interface GetImageInfoOption { + /** 图片的路径,可以是相对路径、临时文件路径、存储文件路径、网络图片路径 */ + src: string; + /** 接口调用成功的回调函数 */ + success?: GetImageInfoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetImageInfoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetImageInfoCompleteCallback; + } + interface CheckIsSupportSoterAuthenticationOption { + /** 接口调用成功的回调函数 */ + success?: CheckIsSupportSoterAuthenticationSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CheckIsSupportSoterAuthenticationFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CheckIsSupportSoterAuthenticationCompleteCallback; + } + interface SaveImageToPhotosAlbumOption { + /** 图片文件路径,可以是临时文件路径或永久文件路径,不支持网络图片路径 */ + filePath: string; + /** 接口调用成功的回调函数 */ + success?: SaveImageToPhotosAlbumSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SaveImageToPhotosAlbumFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SaveImageToPhotosAlbumCompleteCallback; + } + interface CheckIsSoterEnrolledInDeviceOption { + /** 认证方式 + * + * 可选值: + * - 'fingerPrint': 指纹识别; + * - 'facial': 人脸识别(暂未支持); + * - 'speech': 声纹识别(暂未支持); */ + checkAuthMode: 'fingerPrint' | 'facial' | 'speech'; + /** 接口调用成功的回调函数 */ + success?: CheckIsSoterEnrolledInDeviceSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CheckIsSoterEnrolledInDeviceFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CheckIsSoterEnrolledInDeviceCompleteCallback; + } + interface StopHCEOption { + /** 接口调用成功的回调函数 */ + success?: StopHCESuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopHCEFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopHCECompleteCallback; + } + interface UpdateShareMenuOption { + /** 是否使用带 shareTicket 的转发[详情]((转发#获取更多转发信息)) */ + withShareTicket: boolean; + /** 接口调用成功的回调函数 */ + success?: UpdateShareMenuSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: UpdateShareMenuFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UpdateShareMenuCompleteCallback; + } + interface ChooseVideoOption { + /** 视频选择的来源 + * + * 可选值: + * - 'album': 从相册选择视频; + * - 'camera': 使用相机拍摄视频; */ + sourceType?: 'album' | 'camera'; + /** 是否压缩所选择的视频文件 + * + * 最低基础库: `1.6.0` */ + compressed?: boolean; + /** 拍摄视频最长拍摄时间,单位秒 */ + maxDuration?: number; + /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效 + * + * 可选值: + * - 'back': 默认拉起后置摄像头; + * - 'front': 默认拉起前置摄像头; */ + camera?: 'back' | 'front'; + /** 接口调用成功的回调函数 */ + success?: ChooseVideoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ChooseVideoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseVideoCompleteCallback; + } + interface ShowShareMenuOption { + /** 是否使用带 shareTicket 的转发[详情]((转发#获取更多转发信息)) */ + withShareTicket?: boolean; + /** 接口调用成功的回调函数 */ + success?: ShowShareMenuSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ShowShareMenuFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowShareMenuCompleteCallback; + } + interface SaveVideoToPhotosAlbumOption { + /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */ + filePath: string; + /** 接口调用成功的回调函数 */ + success?: SaveVideoToPhotosAlbumSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SaveVideoToPhotosAlbumFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SaveVideoToPhotosAlbumCompleteCallback; + } + interface LivePlayerContextResumeOption { + /** 接口调用成功的回调函数 */ + success?: LivePlayerContextResumeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: LivePlayerContextResumeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LivePlayerContextResumeCompleteCallback; + } + interface StartHCEOption { + /** 需要注册到系统的 AID 列表 */ + aid_list: Array; + /** 接口调用成功的回调函数 */ + success?: StartHCESuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartHCEFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartHCECompleteCallback; + } + interface VibrateLongOption { + /** 接口调用成功的回调函数 */ + success?: VibrateLongSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: VibrateLongFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: VibrateLongCompleteCallback; + } + interface DownloadFileOption { + /** 下载资源的 url */ + url: string; + /** HTTP 请求的 Header,Header 中不能设置 Referer */ + header?: IAnyObject; + /** 指定文件下载后存储的路径 + * + * 最低基础库: `1.8.0` */ + filePath?: string; + /** 接口调用成功的回调函数 */ + success?: DownloadFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: DownloadFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: DownloadFileCompleteCallback; + } + interface GetExtConfigOption { + /** 接口调用成功的回调函数 */ + success?: GetExtConfigSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetExtConfigFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetExtConfigCompleteCallback; + } + interface SendHCEMessageOption { + /** 二进制数据 */ + data: ArrayBuffer; + /** 接口调用成功的回调函数 */ + success?: SendHCEMessageSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SendHCEMessageFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SendHCEMessageCompleteCallback; + } + interface GetShareInfoOption { + /** shareTicket */ + shareTicket: string; + /** 超时时间,单位 ms + * + * 最低基础库: `1.9.90` */ + timeout?: number; + /** 接口调用成功的回调函数 */ + success?: GetShareInfoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetShareInfoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetShareInfoCompleteCallback; + } + interface RequestOption { + /** 开发者服务器接口地址 */ + url: string; + /** 请求的参数 */ + data?: string | IAnyObject | ArrayBuffer; + /** 设置请求的 header,header 中不能设置 Referer。 + * + * `content-type` 默认为 `application/json` */ + header?: IAnyObject; + /** HTTP 请求方法 + * + * 可选值: + * - 'OPTIONS': HTTP 请求 OPTIONS; + * - 'GET': HTTP 请求 GET; + * - 'HEAD': HTTP 请求 HEAD; + * - 'POST': HTTP 请求 POST; + * - 'PUT': HTTP 请求 PUT; + * - 'DELETE': HTTP 请求 DELETE; + * - 'TRACE': HTTP 请求 TRACE; + * - 'CONNECT': HTTP 请求 CONNECT; */ + method?: 'OPTIONS' + | 'GET' + | 'HEAD' + | 'POST' + | 'PUT' + | 'DELETE' + | 'TRACE' + | 'CONNECT' | 'string' + /** 返回的数据格式 + * + * 可选值: + * - 'json': 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse; + * - '其他': 不对返回的内容进行 JSON.parse; */ + dataType?: 'json' | string; + /** 响应的数据类型 + * + * 可选值: + * - 'text': 响应的数据为文本; + * - 'arraybuffer': 响应的数据为 ArrayBuffer; + * + * 最低基础库: `1.7.0` */ + responseType?: 'text' | 'arraybuffer' | string; + /** 接口调用成功的回调函数 */ + success?: RequestSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: RequestFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RequestCompleteCallback; + } + interface OpenSettingOption { + /** 接口调用成功的回调函数 */ + success?: OpenSettingSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: OpenSettingFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenSettingCompleteCallback; + } + interface ConnectSocketOption { + /** 开发者服务器 wss 接口地址 */ + url: string; + /** HTTP Header,Header 中不能设置 Referer */ + header?: IAnyObject; + /** 子协议数组 + * + * 最低基础库: `1.4.0` */ + protocols?: Array; + /** 接口调用成功的回调函数 */ + success?: ConnectSocketSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ConnectSocketFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ConnectSocketCompleteCallback; + } + interface GetSettingOption { + /** 接口调用成功的回调函数 */ + success?: GetSettingSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetSettingFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSettingCompleteCallback; + } + interface CloseSocketOption { + /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ + code?: number; + /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ + reason?: string; + /** 接口调用成功的回调函数 */ + success?: CloseSocketSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CloseSocketFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CloseSocketCompleteCallback; + } + interface FileSystemManagerSaveFileOption { + /** 临时存储文件路径 */ + tempFilePath: string; + /** 要存储的文件路径 */ + filePath?: string; + /** 接口调用成功的回调函数 */ + success?: FileSystemManagerSaveFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: FileSystemManagerSaveFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: FileSystemManagerSaveFileCompleteCallback; + } + interface WxSaveFileOption { + /** 需要保存的文件的临时路径 */ + tempFilePath: string; + /** 接口调用成功的回调函数 */ + success?: WxSaveFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: WxSaveFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WxSaveFileCompleteCallback; + } + interface MuteOption { + /** 接口调用成功的回调函数 */ + success?: MuteSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: MuteFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MuteCompleteCallback; + } + interface GetHCEStateOption { + /** 接口调用成功的回调函数 */ + success?: GetHCEStateSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetHCEStateFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetHCEStateCompleteCallback; + } + interface FileSystemManagerGetSavedFileListOption { + /** 接口调用成功的回调函数 */ + success?: FileSystemManagerGetSavedFileListSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: FileSystemManagerGetSavedFileListFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: FileSystemManagerGetSavedFileListCompleteCallback; + } + interface SendOption { + /** 需要发送的内容 */ + data: string | ArrayBuffer; + /** 接口调用成功的回调函数 */ + success?: SendSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SendFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SendCompleteCallback; + } + interface HideTabBarRedDotOption { + /** tabBar 的哪一项,从左边算起 */ + index: number; + /** 接口调用成功的回调函数 */ + success?: HideTabBarRedDotSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: HideTabBarRedDotFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideTabBarRedDotCompleteCallback; + } + interface LivePlayerContextStopOption { + /** 接口调用成功的回调函数 */ + success?: LivePlayerContextStopSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: LivePlayerContextStopFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LivePlayerContextStopCompleteCallback; + } + interface WriteBLECharacteristicValueOption { + /** 蓝牙设备 id */ + deviceId: string; + /** 蓝牙特征值对应服务的 uuid */ + serviceId: string; + /** 蓝牙特征值的 uuid */ + characteristicId: string; + /** 蓝牙设备特征值对应的二进制值 */ + value: ArrayBuffer; + /** 接口调用成功的回调函数 */ + success?: WriteBLECharacteristicValueSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: WriteBLECharacteristicValueFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WriteBLECharacteristicValueCompleteCallback; + } + interface WxGetSavedFileListOption { + /** 接口调用成功的回调函数 */ + success?: WxGetSavedFileListSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: WxGetSavedFileListFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WxGetSavedFileListCompleteCallback; + } + interface GetSavedFileInfoOption { + /** 文件路径 */ + filePath: string; + /** 接口调用成功的回调函数 */ + success?: GetSavedFileInfoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetSavedFileInfoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSavedFileInfoCompleteCallback; + } + interface StopBluetoothDevicesDiscoveryOption { + /** 接口调用成功的回调函数 */ + success?: StopBluetoothDevicesDiscoverySuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopBluetoothDevicesDiscoveryFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopBluetoothDevicesDiscoveryCompleteCallback; + } + interface FileSystemManagerRemoveSavedFileOption { + /** 需要删除的文件路径 */ + filePath: string; + /** 接口调用成功的回调函数 */ + success?: FileSystemManagerRemoveSavedFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: FileSystemManagerRemoveSavedFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: FileSystemManagerRemoveSavedFileCompleteCallback; + } + interface UploadFileOption { + /** 开发者服务器地址 */ + url: string; + /** 要上传文件资源的路径 */ + filePath: string; + /** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */ + name: string; + /** HTTP 请求 Header,Header 中不能设置 Referer */ + header?: IAnyObject; + /** HTTP 请求中其他额外的 form data */ + formData?: IAnyObject; + /** 接口调用成功的回调函数 */ + success?: UploadFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: UploadFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: UploadFileCompleteCallback; + } + interface PauseVoiceOption { + /** 接口调用成功的回调函数 */ + success?: PauseVoiceSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: PauseVoiceFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PauseVoiceCompleteCallback; + } + interface StartBluetoothDevicesDiscoveryOption { + /** 要搜索但蓝牙设备主 service 的 uuid 列表。某些蓝牙设备会广播自己的主 service 的 uuid。如果设置此参数,则只搜索广播包有对应 uuid 的主服务的蓝牙设备。建议主要通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */ + services?: Array; + /** 是否允许重复上报同一设备。如果允许重复上报,则 `wx.onBlueToothDeviceFound` 方法会多次上报同一设备,但是 RSSI 值会有不同。 */ + allowDuplicatesKey?: boolean; + /** 上报设备的间隔。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */ + interval?: number; + /** 接口调用成功的回调函数 */ + success?: StartBluetoothDevicesDiscoverySuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartBluetoothDevicesDiscoveryFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartBluetoothDevicesDiscoveryCompleteCallback; + } + interface PlayVoiceOption { + /** 需要播放的语音文件的文件路径 */ + filePath: string; + /** 指定录音时长,到达指定的录音时长后会自动停止录音,单位:秒 + * + * 最低基础库: `1.6.0` */ + duration?: number; + /** 接口调用成功的回调函数 */ + success?: PlayVoiceSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: PlayVoiceFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PlayVoiceCompleteCallback; + } + interface LoginOption { + /** 超时时间,单位ms + * + * 最低基础库: `1.9.90` */ + timeout?: number; + /** 接口调用成功的回调函数 */ + success?: LoginSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: LoginFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LoginCompleteCallback; + } + interface FileSystemManagerGetFileInfoOption { + /** 要读取的文件路径 */ + filePath: string; + /** 接口调用成功的回调函数 */ + success?: FileSystemManagerGetFileInfoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: FileSystemManagerGetFileInfoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: FileSystemManagerGetFileInfoCompleteCallback; + } + interface CheckSessionOption { + /** 接口调用成功的回调函数 */ + success?: CheckSessionSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CheckSessionFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CheckSessionCompleteCallback; + } + interface WxGetFileInfoOption { + /** 本地文件路径 */ + filePath: string; + /** 计算文件摘要的算法 + * + * 可选值: + * - 'md5': md5 算法; + * - 'sha1': sha1 算法; */ + digestAlgorithm?: 'md5' | 'sha1'; + /** 接口调用成功的回调函数 */ + success?: WxGetFileInfoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: WxGetFileInfoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WxGetFileInfoCompleteCallback; + } + interface ReadBLECharacteristicValueOption { + /** 蓝牙设备 id */ + deviceId: string; + /** 蓝牙特征值对应服务的 uuid */ + serviceId: string; + /** 蓝牙特征值的 uuid */ + characteristicId: string; + /** 接口调用成功的回调函数 */ + success?: ReadBLECharacteristicValueSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ReadBLECharacteristicValueFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReadBLECharacteristicValueCompleteCallback; + } + interface RemoveTabBarBadgeOption { + /** tabBar 的哪一项,从左边算起 */ + index: number; + /** 接口调用成功的回调函数 */ + success?: RemoveTabBarBadgeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: RemoveTabBarBadgeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveTabBarBadgeCompleteCallback; + } + interface ChooseAddressOption { + /** 接口调用成功的回调函数 */ + success?: ChooseAddressSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ChooseAddressFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseAddressCompleteCallback; + } + interface WxStartRecordOption { + /** 接口调用成功的回调函数 */ + success?: WxStartRecordSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: WxStartRecordFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WxStartRecordCompleteCallback; + } + interface AuthorizeOption { + /** 需要获取权限的 scope,详见 [scope 列表]((授权#scope-列表)) */ + scope: string; + /** 接口调用成功的回调函数 */ + success?: AuthorizeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: AuthorizeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AuthorizeCompleteCallback; + } + interface ReaddirOption { + /** 要读取的目录路径 */ + dirPath: string; + /** 接口调用成功的回调函数 */ + success?: ReaddirSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ReaddirFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReaddirCompleteCallback; + } + interface CameraContextStartRecordOption { + /** 超过30s或页面 `onHide` 时会结束录像 */ + timeoutCallback?: StartRecordTimeoutCallback; + /** 接口调用成功的回调函数 */ + success?: CameraContextStartRecordSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CameraContextStartRecordFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CameraContextStartRecordCompleteCallback; + } + interface SeekBackgroundAudioOption { + /** 音乐位置,单位:秒 */ + position: number; + /** 接口调用成功的回调函数 */ + success?: SeekBackgroundAudioSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SeekBackgroundAudioFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SeekBackgroundAudioCompleteCallback; + } + interface OpenBluetoothAdapterOption { + /** 接口调用成功的回调函数 */ + success?: OpenBluetoothAdapterSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: OpenBluetoothAdapterFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenBluetoothAdapterCompleteCallback; + } + interface PauseBackgroundAudioOption { + /** 接口调用成功的回调函数 */ + success?: PauseBackgroundAudioSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: PauseBackgroundAudioFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PauseBackgroundAudioCompleteCallback; + } + interface TakePhotoOption { + /** 成像质量 + * + * 可选值: + * - 'high': 高质量; + * - 'normal': 普通质量; + * - 'low': 低质量; */ + quality?: 'high' | 'normal' | 'low'; + /** 接口调用成功的回调函数 */ + success?: TakePhotoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: TakePhotoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: TakePhotoCompleteCallback; + } + interface PlayBackgroundAudioOption { + /** 音乐链接,目前支持的格式有 m4a, aac, mp3, wav */ + dataUrl: string; + /** 音乐标题 */ + title?: string; + /** 封面URL */ + coverImgUrl?: string; + /** 接口调用成功的回调函数 */ + success?: PlayBackgroundAudioSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: PlayBackgroundAudioFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PlayBackgroundAudioCompleteCallback; + } + interface CanvasToTempFilePathOption { + /** 指定的画布区域的左上角横坐标 + * + * 最低基础库: `1.2.0` */ + x?: number; + /** 指定的画布区域的左上角纵坐标 + * + * 最低基础库: `1.2.0` */ + y?: number; + /** 指定的画布区域的宽度 + * + * 最低基础库: `1.2.0` */ + width?: number; + /** 指定的画布区域的高度 + * + * 最低基础库: `1.2.0` */ + height?: number; + /** 输出的图片的宽度 + * + * 最低基础库: `1.2.0` */ + destWidth?: number; + /** 输出的图片的高度 + * + * 最低基础库: `1.2.0` */ + destHeight?: number; + /** 画布标识,传入 `` 组件的 canvas-id */ + canvasId: string; + /** 目标文件的类型 + * + * 可选值: + * - 'jpg': jpg 图片; + * - 'png': png 图片; + * + * 最低基础库: `1.7.0` */ + fileType?: 'jpg' | 'png'; + /** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 + * + * 最低基础库: `1.7.0` */ + quality: number; + /** 接口调用成功的回调函数 */ + success?: CanvasToTempFilePathSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CanvasToTempFilePathFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CanvasToTempFilePathCompleteCallback; + } + interface GetCenterLocationOption { + /** 接口调用成功的回调函数 */ + success?: GetCenterLocationSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetCenterLocationFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetCenterLocationCompleteCallback; + } + interface AddCardOption { + /** 需要添加的卡券列表 */ + cardList: AddCardRequestInfo; + /** 接口调用成功的回调函数 */ + success?: AddCardSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: AddCardFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddCardCompleteCallback; + } + interface IncludePointsOption { + /** 要显示在可视区域内的坐标点列表 */ + points: MapPostion; + /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左],安卓上只能识别数组第一项,上下左右的padding一致。开发者工具暂不支持padding参数。 */ + padding?: Array; + /** 接口调用成功的回调函数 */ + success?: IncludePointsSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: IncludePointsFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: IncludePointsCompleteCallback; + } + interface NotifyBLECharacteristicValueChangeOption { + /** 蓝牙设备 id */ + deviceId: string; + /** 蓝牙特征值对应服务的 uuid */ + serviceId: string; + /** 蓝牙特征值的 uuid */ + characteristicId: string; + /** 是否启用 notify */ + state: boolean; + /** 接口调用成功的回调函数 */ + success?: NotifyBLECharacteristicValueChangeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: NotifyBLECharacteristicValueChangeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NotifyBLECharacteristicValueChangeCompleteCallback; + } + interface GetScaleOption { + /** 接口调用成功的回调函数 */ + success?: GetScaleSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetScaleFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetScaleCompleteCallback; + } + interface OpenCardOption { + /** 需要打开的卡券列表 */ + cardList: OpenCardRequestInfo; + /** 接口调用成功的回调函数 */ + success?: OpenCardSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: OpenCardFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenCardCompleteCallback; + } + interface LivePusherContextStartOption { + /** 接口调用成功的回调函数 */ + success?: StartSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartCompleteCallback; + } + interface GetConnectedBluetoothDevicesOption { + /** 蓝牙设备主 service 的 uuid 列表 */ + services: Array; + /** 接口调用成功的回调函数 */ + success?: GetConnectedBluetoothDevicesSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetConnectedBluetoothDevicesFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetConnectedBluetoothDevicesCompleteCallback; + } + interface ReLaunchOption { + /** 需要跳转的应用内页面路径,路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2',如果跳转的页面路径是 tabBar 页面则不能带参数 */ + url: string; + /** 接口调用成功的回调函数 */ + success?: ReLaunchSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ReLaunchFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReLaunchCompleteCallback; + } + interface GetBluetoothDevicesOption { + /** 接口调用成功的回调函数 */ + success?: GetBluetoothDevicesSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetBluetoothDevicesFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBluetoothDevicesCompleteCallback; + } + interface GetClipboardDataSuccessCallbackOption { + /** 剪贴板的内容 */ + data: string; + } + interface ChooseInvoiceOption { + /** 接口调用成功的回调函数 */ + success?: ChooseInvoiceSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ChooseInvoiceFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseInvoiceCompleteCallback; + } + interface StopCompassOption { + /** 接口调用成功的回调函数 */ + success?: StopCompassSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopCompassFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopCompassCompleteCallback; + } + /** 选项 */ + interface CreateIntersectionObserverOption { + /** 一个数值数组,包含所有阈值。 */ + thresholds?: Array; + /** 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。 */ + initialRatio?: number; + /** 是否同时观测多个目标节点(而非一个),如果设为 true ,observe 的 targetSelector 将选中多个节点(注意:同时选中过多节点将影响渲染性能) + * + * 最低基础库: `2.0.0` */ + observeAll?: boolean; + } + interface StopGyroscopeOption { + /** 接口调用成功的回调函数 */ + success?: StopGyroscopeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopGyroscopeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopGyroscopeCompleteCallback; + } + interface ChooseInvoiceTitleOption { + /** 接口调用成功的回调函数 */ + success?: ChooseInvoiceTitleSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ChooseInvoiceTitleFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ChooseInvoiceTitleCompleteCallback; + } + interface StopBeaconDiscoveryOption { + /** 接口调用成功的回调函数 */ + success?: StopBeaconDiscoverySuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopBeaconDiscoveryFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopBeaconDiscoveryCompleteCallback; + } + interface GetBluetoothAdapterStateOption { + /** 接口调用成功的回调函数 */ + success?: GetBluetoothAdapterStateSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetBluetoothAdapterStateFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBluetoothAdapterStateCompleteCallback; + } + interface NavigateToMiniProgramOption { + /** 要打开的小程序 appId */ + appId: string; + /** 打开的页面路径,如果为空则打开首页 */ + path?: string; + /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。 */ + extraData?: IAnyObject; + /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。 + * + * 可选值: + * - 'develop': 开发版; + * - 'trial': 体验版; + * - 'release': 正式版; */ + envVersion?: 'develop' | 'trial' | 'release'; + /** 接口调用成功的回调函数 */ + success?: NavigateToMiniProgramSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: NavigateToMiniProgramFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: NavigateToMiniProgramCompleteCallback; + } + interface GetBLEDeviceServicesOption { + /** 蓝牙设备 id */ + deviceId: string; + /** 接口调用成功的回调函数 */ + success?: GetBLEDeviceServicesSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetBLEDeviceServicesFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBLEDeviceServicesCompleteCallback; + } + interface StartSoterAuthenticationOption { + /** 请求使用的可接受的生物认证方式 + * + * 可选值: + * - 'fingerPrint': 指纹识别; + * - 'facial': 人脸识别(暂未支持); + * - 'speech': 声纹识别(暂未支持); */ + requestAuthModes: 'fingerPrint' | 'facial' | 'speech'; + /** 挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 `resultJSON` 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。 */ + challenge: string; + /** 验证描述,即识别过程中显示在界面上的对话框提示内容 */ + authContent?: string; + /** 接口调用成功的回调函数 */ + success?: StartSoterAuthenticationSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartSoterAuthenticationFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartSoterAuthenticationCompleteCallback; + } + interface ToggleTorchOption { + /** 接口调用成功的回调函数 */ + success?: ToggleTorchSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ToggleTorchFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ToggleTorchCompleteCallback; + } + interface MakePhoneCallOption { + /** 需要拨打的电话号码 */ + phoneNumber: string; + /** 接口调用成功的回调函数 */ + success?: MakePhoneCallSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: MakePhoneCallFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MakePhoneCallCompleteCallback; + } + interface SetTabBarBadgeOption { + /** tabBar 的哪一项,从左边算起 */ + index: number; + /** 显示的文本,超过 4 个字符则显示成 ... */ + text: string; + /** 接口调用成功的回调函数 */ + success?: SetTabBarBadgeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetTabBarBadgeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTabBarBadgeCompleteCallback; + } + interface GetSystemInfoOption { + /** 接口调用成功的回调函数 */ + success?: GetSystemInfoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetSystemInfoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetSystemInfoCompleteCallback; + } + interface GetUserInfoOption { + /** 是否带上登录态信息。当 withCredentials 为 true 时,要求此前有调用过 wx.login 且登录态尚未过期,此时返回的数据会包含 encryptedData, iv 等敏感信息;当 withCredentials 为 false 时,不要求有登录态,返回的数据不包含 encryptedData, iv 等敏感信息。 */ + withCredentials?: boolean; + /** 显示用户信息的语言 + * + * 可选值: + * - 'en': 英文; + * - 'zh_CN': 简体中文; + * - 'zh_TW': 繁体中文; */ + lang?: 'en' | 'zh_CN' | 'zh_TW'; + /** 接口调用成功的回调函数 */ + success?: GetUserInfoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetUserInfoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetUserInfoCompleteCallback; + } + interface HideShareMenuOption { + /** 接口调用成功的回调函数 */ + success?: HideShareMenuSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: HideShareMenuFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideShareMenuCompleteCallback; + } + interface GetBLEDeviceCharacteristicsOption { + /** 蓝牙设备 id */ + deviceId: string; + /** 蓝牙服务 uuid,需要使用 `getBLEDeviceServices` 获取 */ + serviceId: string; + /** 接口调用成功的回调函数 */ + success?: GetBLEDeviceCharacteristicsSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetBLEDeviceCharacteristicsFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBLEDeviceCharacteristicsCompleteCallback; + } + interface AccessOption { + /** 要判断是否存在的文件/目录路径 */ + path: string; + /** 接口调用成功的回调函数 */ + success?: AccessSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: AccessFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AccessCompleteCallback; + } + interface RequestPaymentOption { + /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */ + timeStamp: string; + /** 随机字符串,长度为32个字符以下 */ + nonceStr: string; + /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */ + package: string; + /** 签名算法 + * + * 可选值: + * - 'MD5': MD5; + * - 'HMAC-SHA256': HMAC-SHA256; */ + signType?: 'MD5' | 'HMAC-SHA256'; + /** 签名,具体签名方案参见 [小程序支付接口文档](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3) */ + paySign: string; + /** 接口调用成功的回调函数 */ + success?: RequestPaymentSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: RequestPaymentFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RequestPaymentCompleteCallback; + } + interface CanvasGetImageDataOption { + /** 画布标识,传入 `` 组件的 `canvas-id` 属性。 */ + canvasId: string; + /** 将要被提取的图像数据矩形区域的左上角横坐标 */ + x: number; + /** 将要被提取的图像数据矩形区域的左上角纵坐标 */ + y: number; + /** 将要被提取的图像数据矩形区域的宽度 */ + width: number; + /** 将要被提取的图像数据矩形区域的高度 */ + height: number; + /** 接口调用成功的回调函数 */ + success?: CanvasGetImageDataSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CanvasGetImageDataFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CanvasGetImageDataCompleteCallback; + } + interface SetBackgroundTextStyleOption { + /** 下拉背景字体、loading 图的样式。 + * + * 可选值: + * - 'dark': dark 样式; + * - 'light': light 样式; */ + textStyle: 'dark' | 'light'; + /** 接口调用成功的回调函数 */ + success?: SetBackgroundTextStyleSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetBackgroundTextStyleFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetBackgroundTextStyleCompleteCallback; + } + interface OpenDocumentOption { + /** 文件路径,可通过 downloadFile 获得 */ + filePath: string; + /** 文件类型,指定文件类型打开文件 + * + * 可选值: + * - 'doc': doc 格式; + * - 'docx': docx 格式; + * - 'xls': xls 格式; + * - 'xlsx': xlsx 格式; + * - 'ppt': ppt 格式; + * - 'pptx': pptx 格式; + * - 'pdf': pdf 格式; + * + * 最低基础库: `1.4.0` */ + fileType?: 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx' | 'pdf'; + /** 接口调用成功的回调函数 */ + success?: OpenDocumentSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: OpenDocumentFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: OpenDocumentCompleteCallback; + } + interface GetWeRunDataOption { + /** 接口调用成功的回调函数 */ + success?: GetWeRunDataSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetWeRunDataFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetWeRunDataCompleteCallback; + } + interface StopVoiceOption { + /** 接口调用成功的回调函数 */ + success?: StopVoiceSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopVoiceFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopVoiceCompleteCallback; + } + interface CreateBLEConnectionOption { + /** 用于区分设备的 id */ + deviceId: string; + /** 超时时间,单位ms,不填表示不会超时 */ + timeout?: number; + /** 接口调用成功的回调函数 */ + success?: CreateBLEConnectionSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CreateBLEConnectionFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CreateBLEConnectionCompleteCallback; + } + interface CopyFileOption { + /** 源文件路径,只可以是普通文件 */ + srcPath: string; + /** 目标文件路径 */ + destPath: string; + /** 接口调用成功的回调函数 */ + success?: CopyFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CopyFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CopyFileCompleteCallback; + } + interface CloseBluetoothAdapterOption { + /** 接口调用成功的回调函数 */ + success?: CloseBluetoothAdapterSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CloseBluetoothAdapterFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CloseBluetoothAdapterCompleteCallback; + } + interface RecorderManagerStartOption { + /** 录音的时长,单位 ms,最大值 600000(10 分钟) */ + duration?: number; + /** 采样率 + * + * 可选值: + * - 8000: 8000 采样率; + * - 11025: 11025 采样率; + * - 12000: 12000 采样率; + * - 16000: 16000 采样率; + * - 22050: 22050 采样率; + * - 24000: 24000 采样率; + * - 32000: 32000 采样率; + * - 44100: 44100 采样率; + * - 48000: 48000 采样率; */ + sampleRate?: + | 8000 + | 11025 + | 12000 + | 16000 + | 22050 + | 24000 + | 32000 + | 44100 + | 48000; + /** 录音通道数 + * + * 可选值: + * - 1: 1 个通道; + * - 2: 2 个通道; */ + numberOfChannels?: 1 | 2; + /** 编码码率,有效值见下表格 */ + encodeBitRate?: number; + /** 音频格式 + * + * 可选值: + * - 'mp3': mp3 格式; + * - 'aac': aac 格式; */ + format?: 'mp3' | 'aac'; + /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3 格式。 */ + frameSize?: number; + /** 指定录音的音频输入源,可通过 [wx.getAvailableAudioSources()]((wx.getAvailableAudioSources)) 获取当前可用的音频源 + * + * 可选值: + * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用; + * - 'buildInMic': 手机麦克风,仅限 iOS; + * - 'headsetMic': 耳机麦克风,仅限 iOS; + * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android; + * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android; + * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android; + * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; + * + * 最低基础库: `2.1.0` */ + audioSource?: + | 'auto' + | 'buildInMic' + | 'headsetMic' + | 'mic' + | 'camcorder' + | 'voice_communication' + | 'voice_recognition'; + } + interface CloseBLEConnectionOption { + /** 用于区分设备的 id */ + deviceId: string; + /** 接口调用成功的回调函数 */ + success?: CloseBLEConnectionSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CloseBLEConnectionFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CloseBLEConnectionCompleteCallback; + } + interface MkdirOption { + /** 创建的目录路径 */ + dirPath: string; + /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 + * + * 最低基础库: `2.3.0` */ + recursive?: boolean; + /** 接口调用成功的回调函数 */ + success?: MkdirSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: MkdirFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: MkdirCompleteCallback; + } + interface GetStorageOption { + /** 本地缓存中指定的 key */ + key: string; + /** 接口调用成功的回调函数 */ + success?: GetStorageSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetStorageFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetStorageCompleteCallback; + } + interface StopBackgroundAudioOption { + /** 接口调用成功的回调函数 */ + success?: StopBackgroundAudioSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopBackgroundAudioFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopBackgroundAudioCompleteCallback; + } + interface SetStorageOption { + /** 本地缓存中指定的 key */ + key: string; + /** 需要存储的内容 */ + data: IAnyObject | string; + /** 接口调用成功的回调函数 */ + success?: SetStorageSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetStorageFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetStorageCompleteCallback; + } + interface RenameOption { + /** 源文件路径,可以是普通文件或目录 */ + oldPath: string; + /** 新文件路径 */ + newPath: string; + /** 接口调用成功的回调函数 */ + success?: RenameSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: RenameFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RenameCompleteCallback; + } + interface RemoveStorageOption { + /** 本地缓存中指定的 key */ + key: string; + /** 接口调用成功的回调函数 */ + success?: RemoveStorageSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: RemoveStorageFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RemoveStorageCompleteCallback; + } + interface TranslateMarkerOption { + /** 指定 marker */ + markerId: number; + /** 指定 marker 移动到的目标点 */ + destination: DestinationOption; + /** 移动过程中是否自动旋转 marker */ + autoRotate: boolean; + /** marker 的旋转角度 */ + rotate: number; + /** 动画持续时长,平移与旋转分别计算 */ + duration?: number; + /** 动画结束回调函数 */ + animationEnd?: Function; + /** 接口调用成功的回调函数 */ + success?: TranslateMarkerSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: TranslateMarkerFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: TranslateMarkerCompleteCallback; + } + interface ClearStorageOption { + /** 接口调用成功的回调函数 */ + success?: ClearStorageSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ClearStorageFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ClearStorageCompleteCallback; + } + interface LivePusherContextStopOption { + /** 接口调用成功的回调函数 */ + success?: LivePusherContextStopSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: LivePusherContextStopFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LivePusherContextStopCompleteCallback; + } + interface GetStorageInfoSuccessCallbackOption { + /** 当前 storage 中所有的 key */ + keys: Array; + /** 当前占用的空间大小, 单位 KB */ + currentSize: number; + /** 限制的空间大小,单位 KB */ + limitSize: number; + } + interface GetBatteryInfoOption { + /** 接口调用成功的回调函数 */ + success?: GetBatteryInfoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetBatteryInfoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBatteryInfoCompleteCallback; + } + interface GetStorageInfoOption { + /** 接口调用成功的回调函数 */ + success?: GetStorageInfoSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetStorageInfoFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetStorageInfoCompleteCallback; + } + interface AddPhoneContactOption { + /** 名字 */ + firstName: string; + /** 头像本地文件路径 */ + photoFilePath?: string; + /** 昵称 */ + nickName?: string; + /** 姓氏 */ + lastName?: string; + /** 中间名 */ + middleName?: string; + /** 备注 */ + remark?: string; + /** 手机号 */ + mobilePhoneNumber?: string; + /** 微信号 */ + weChatNumber?: string; + /** 联系地址国家 */ + addressCountry?: string; + /** 联系地址省份 */ + addressState?: string; + /** 联系地址城市 */ + addressCity?: string; + /** 联系地址街道 */ + addressStreet?: string; + /** 联系地址邮政编码 */ + addressPostalCode?: string; + /** 公司 */ + organization?: string; + /** 职位 */ + title?: string; + /** 工作传真 */ + workFaxNumber?: string; + /** 工作电话 */ + workPhoneNumber?: string; + /** 公司电话 */ + hostNumber?: string; + /** 电子邮件 */ + email?: string; + /** 网站 */ + url?: string; + /** 工作地址国家 */ + workAddressCountry?: string; + /** 工作地址省份 */ + workAddressState?: string; + /** 工作地址城市 */ + workAddressCity?: string; + /** 工作地址街道 */ + workAddressStreet?: string; + /** 工作地址邮政编码 */ + workAddressPostalCode?: string; + /** 住宅传真 */ + homeFaxNumber?: string; + /** 住宅电话 */ + homePhoneNumber?: string; + /** 住宅地址国家 */ + homeAddressCountry?: string; + /** 住宅地址省份 */ + homeAddressState?: string; + /** 住宅地址城市 */ + homeAddressCity?: string; + /** 住宅地址街道 */ + homeAddressStreet?: string; + /** 住宅地址邮政编码 */ + homeAddressPostalCode?: string; + /** 接口调用成功的回调函数 */ + success?: AddPhoneContactSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: AddPhoneContactFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AddPhoneContactCompleteCallback; + } + interface SetTopBarTextOption { + /** 置顶栏文字 */ + text: string; + /** 接口调用成功的回调函数 */ + success?: SetTopBarTextSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetTopBarTextFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTopBarTextCompleteCallback; + } + interface GetBeaconsOption { + /** 接口调用成功的回调函数 */ + success?: GetBeaconsSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetBeaconsFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetBeaconsCompleteCallback; + } + interface SetTabBarItemOption { + /** tabBar 的哪一项,从左边算起 */ + index: number; + /** tab 上的按钮文字 */ + text?: string; + /** 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效,不支持网络图片 */ + iconPath?: string; + /** 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效 */ + selectedIconPath?: string; + /** 接口调用成功的回调函数 */ + success?: SetTabBarItemSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetTabBarItemFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTabBarItemCompleteCallback; + } + interface GetNetworkTypeOption { + /** 接口调用成功的回调函数 */ + success?: GetNetworkTypeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetNetworkTypeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetNetworkTypeCompleteCallback; + } + interface StepOption { + /** 动画持续时间,单位 ms */ + duration?: number; + /** 动画的效果 + * + * 可选值: + * - 'linear': 动画从头到尾的速度是相同的; + * - 'ease': 动画以低速开始,然后加快,在结束前变慢; + * - 'ease-in': 动画以低速开始; + * - 'ease-in-out': 动画以低速开始和结束; + * - 'ease-out': 动画以低速结束; + * - 'step-start': 动画第一帧就跳至结束状态直到结束; + * - 'step-end': 动画一直保持开始状态,最后一帧跳到结束状态; */ + timingFunction?: + | 'linear' + | 'ease' + | 'ease-in' + | 'ease-in-out' + | 'ease-out' + | 'step-start' + | 'step-end'; + /** 动画延迟时间,单位 ms */ + delay?: number; + transformOrigin?: string; + } + interface VibrateShortOption { + /** 接口调用成功的回调函数 */ + success?: VibrateShortSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: VibrateShortFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: VibrateShortCompleteCallback; + } + interface CreateAnimationOption { + /** 动画持续时间,单位 ms */ + duration?: number; + /** 动画的效果 + * + * 可选值: + * - 'linear': 动画从头到尾的速度是相同的; + * - 'ease': 动画以低速开始,然后加快,在结束前变慢; + * - 'ease-in': 动画以低速开始; + * - 'ease-in-out': 动画以低速开始和结束; + * - 'ease-out': 动画以低速结束; + * - 'step-start': 动画第一帧就跳至结束状态直到结束; + * - 'step-end': 动画一直保持开始状态,最后一帧跳到结束状态; */ + timingFunction?: + | 'linear' + | 'ease' + | 'ease-in' + | 'ease-in-out' + | 'ease-out' + | 'step-start' + | 'step-end'; + /** 动画延迟时间,单位 ms */ + delay?: number; + transformOrigin?: string; + } + interface AppendFileOption { + /** 要追加内容的文件路径 */ + filePath: string; + /** 要追加的文本或二进制数据 */ + data: string | ArrayBuffer; + /** 指定写入文件的字符编码 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2/ucs-2/utf16le/utf-16le': 以小端序读取; + * - 'utf-8/utf8': ; + * - 'latin1': ; */ + encoding?: + | 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2/ucs-2/utf16le/utf-16le' + | 'utf-8/utf8' + | 'latin1'; + /** 接口调用成功的回调函数 */ + success?: AppendFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: AppendFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: AppendFileCompleteCallback; + } + interface SetBackgroundColorOption { + /** 窗口的背景色,必须为十六进制颜色值 */ + backgroundColor?: string; + /** 顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */ + backgroundColorTop?: string; + /** 底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */ + backgroundColorBottom?: string; + /** 接口调用成功的回调函数 */ + success?: SetBackgroundColorSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetBackgroundColorFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetBackgroundColorCompleteCallback; + } + interface CanvasPutImageDataOption { + /** 画布标识,传入 `` 组件的 canvas-id 属性。 */ + canvasId: string; + /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */ + data: Uint8ClampedArray; + /** 源图像数据在目标画布中的位置偏移量(x 轴方向的偏移量) */ + x: number; + /** 源图像数据在目标画布中的位置偏移量(y 轴方向的偏移量) */ + y: number; + /** 源图像数据矩形区域的宽度 */ + width: number; + /** 源图像数据矩形区域的高度 */ + height: number; + /** 接口调用成功的回调函数 */ + success?: CanvasPutImageDataSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CanvasPutImageDataFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CanvasPutImageDataCompleteCallback; + } + interface SetTabBarStyleOption { + /** tab 上的文字默认颜色,HexColor */ + color: string; + /** tab 上的文字选中时的颜色,HexColor */ + selectedColor: string; + /** tab 的背景色,HexColor */ + backgroundColor: string; + /** tabBar上边框的颜色, 仅支持 black/white */ + borderStyle: string; + /** 接口调用成功的回调函数 */ + success?: SetTabBarStyleSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetTabBarStyleFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetTabBarStyleCompleteCallback; + } + interface SetInnerAudioOption { + /** 是否与其他音频混播,设置为 true 之后,不会终止其他应用或微信内的音乐 */ + mixWithOther?: boolean; + /** (仅在 iOS 生效)是否遵循静音开关,设置为 false 之后,即使是在静音模式下,也能播放声音 */ + obeyMuteSwitch?: boolean; + /** 接口调用成功的回调函数 */ + success?: SetInnerAudioOptionSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetInnerAudioOptionFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetInnerAudioOptionCompleteCallback; + } + interface ShowModalOption { + /** 提示的标题 */ + title: string; + /** 提示的内容 */ + content: string; + /** 是否显示取消按钮 */ + showCancel?: boolean; + /** 取消按钮的文字,最多 4 个字符 */ + cancelText?: string; + /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */ + cancelColor?: string; + /** 确认按钮的文字,最多 4 个字符 */ + confirmText?: string; + /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */ + confirmColor?: string; + /** 接口调用成功的回调函数 */ + success?: ShowModalSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ShowModalFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowModalCompleteCallback; + } + interface GetAvailableAudioSourcesOption { + /** 接口调用成功的回调函数 */ + success?: GetAvailableAudioSourcesSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetAvailableAudioSourcesFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetAvailableAudioSourcesCompleteCallback; + } + interface ShowToastOption { + /** 提示的内容 */ + title: string; + /** 图标 + * + * 可选值: + * - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度; + * - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度; + * - 'none': 不显示图标,此时 title 文本最多可显示两行,{% version('1.9.0') %}及以上版本支持; */ + icon?: 'success' | 'loading' | 'none'; + /** 自定义图标的本地路径,image 的优先级高于 icon + * + * 最低基础库: `1.1.0` */ + image?: string; + /** 提示的延迟时间 */ + duration?: number; + /** 是否显示透明蒙层,防止触摸穿透 */ + mask?: boolean; + /** 接口调用成功的回调函数 */ + success?: ShowToastSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ShowToastFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowToastCompleteCallback; + } + interface RmdirOption { + /** 要删除的目录路径 */ + dirPath: string; + /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 + * + * 最低基础库: `2.3.0` */ + recursive?: boolean; + /** 接口调用成功的回调函数 */ + success?: RmdirSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: RmdirFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: RmdirCompleteCallback; + } + interface HideToastOption { + /** 接口调用成功的回调函数 */ + success?: HideToastSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: HideToastFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideToastCompleteCallback; + } + interface StartAccelerometerOption { + /** 监听加速度数据回调函数的执行频率 + * + * 可选值: + * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右; + * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右; + * - 'normal': 普通的回调频率,在 200ms/次 左右; + * + * 最低基础库: `2.1.0` */ + interval?: 'game' | 'ui' | 'normal'; + /** 接口调用成功的回调函数 */ + success?: StartAccelerometerSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartAccelerometerFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartAccelerometerCompleteCallback; + } + interface ShowLoadingOption { + /** 提示的内容 */ + title: string; + /** 是否显示透明蒙层,防止触摸穿透 */ + mask?: boolean; + /** 接口调用成功的回调函数 */ + success?: ShowLoadingSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ShowLoadingFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowLoadingCompleteCallback; + } + interface ShowNavigationBarLoadingOption { + /** 接口调用成功的回调函数 */ + success?: ShowNavigationBarLoadingSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ShowNavigationBarLoadingFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowNavigationBarLoadingCompleteCallback; + } + interface HideLoadingOption { + /** 接口调用成功的回调函数 */ + success?: HideLoadingSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: HideLoadingFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideLoadingCompleteCallback; + } + interface ScanCodeOption { + /** 是否只能从相机扫码,不允许从相册选择图片 + * + * 最低基础库: `1.2.0` */ + onlyFromCamera?: boolean; + /** 扫码类型 + * + * 可选值: + * - 'barCode': 一维码; + * - 'qrCode': 二维码; + * - 'datamatrix': Data Matrix 码; + * - 'pdf417': PDF417 条码; + * + * 最低基础库: `1.7.0` */ + scanType?: 'barCode' | 'qrCode' | 'datamatrix' | 'pdf417'; + /** 接口调用成功的回调函数 */ + success?: ScanCodeSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ScanCodeFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ScanCodeCompleteCallback; + } + interface HideTabBarOption { + /** 是否需要动画效果 */ + animation?: boolean; + /** 接口调用成功的回调函数 */ + success?: HideTabBarSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: HideTabBarFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: HideTabBarCompleteCallback; + } + interface CloseOption { + /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ + code?: number; + /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ + reason?: string; + /** 接口调用成功的回调函数 */ + success?: CloseSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: CloseFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: CloseCompleteCallback; + } + interface ShowActionSheetOption { + /** 按钮的文字数组,数组长度最大为 6 */ + itemList: Array; + /** 按钮的文字颜色 */ + itemColor?: string; + /** 接口调用成功的回调函数 */ + success?: ShowActionSheetSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ShowActionSheetFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowActionSheetCompleteCallback; + } + interface PlayOption { + /** 接口调用成功的回调函数 */ + success?: PlaySuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: PlayFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PlayCompleteCallback; + } + interface GetRegionOption { + /** 接口调用成功的回调函数 */ + success?: GetRegionSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: GetRegionFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: GetRegionCompleteCallback; + } + interface ShowTabBarOption { + /** 是否需要动画效果 */ + animation?: boolean; + /** 接口调用成功的回调函数 */ + success?: ShowTabBarSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ShowTabBarFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ShowTabBarCompleteCallback; + } + interface StopPullDownRefreshOption { + /** 接口调用成功的回调函数 */ + success?: StopPullDownRefreshSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StopPullDownRefreshFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StopPullDownRefreshCompleteCallback; + } + interface StartPullDownRefreshOption { + /** 接口调用成功的回调函数 */ + success?: StartPullDownRefreshSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartPullDownRefreshFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartPullDownRefreshCompleteCallback; + } + interface PageScrollToOption { + /** 滚动到页面的目标位置,单位 px */ + scrollTop: number; + /** 滚动动画的时长,单位 ms */ + duration?: number; + /** 接口调用成功的回调函数 */ + success?: PageScrollToSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: PageScrollToFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: PageScrollToCompleteCallback; + } + interface SetClipboardDataOption { + /** 剪贴板的内容 */ + data: string; + /** 接口调用成功的回调函数 */ + success?: SetClipboardDataSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: SetClipboardDataFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: SetClipboardDataCompleteCallback; + } + interface ReadFileOption { + /** 要读取的文件的路径 */ + filePath: string; + /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 + * + * 可选值: + * - 'ascii': ; + * - 'base64': ; + * - 'binary': ; + * - 'hex': ; + * - 'ucs2/ucs-2/utf16le/utf-16le': 以小端序读取; + * - 'utf-8/utf8': ; + * - 'latin1': ; */ + encoding?: 'ascii' + | 'base64' + | 'binary' + | 'hex' + | 'ucs2' | 'ucs-2' | 'utf16le' | 'utf-16le' + | 'utf-8' | 'utf8' + | 'latin1' | string + /** 接口调用成功的回调函数 */ + success?: ReadFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: ReadFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: ReadFileCompleteCallback; + } + interface WxRemoveSavedFileOption { + /** 需要删除的文件路径 */ + filePath: string; + /** 接口调用成功的回调函数 */ + success?: WxRemoveSavedFileSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: WxRemoveSavedFileFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: WxRemoveSavedFileCompleteCallback; + } + interface LivePlayerContextPauseOption { + /** 接口调用成功的回调函数 */ + success?: LivePlayerContextPauseSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: LivePlayerContextPauseFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: LivePlayerContextPauseCompleteCallback; + } + interface StartDeviceMotionListeningOption { + /** 监听设备方向的变化回调函数的执行频率 + * + * 可选值: + * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右; + * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右; + * - 'normal': 普通的回调频率,在 200ms/次 左右; */ + interval?: 'game' | 'ui' | 'normal'; + /** 接口调用成功的回调函数 */ + success?: StartDeviceMotionListeningSuccessCallback; + /** 接口调用失败的回调函数 */ + fail?: StartDeviceMotionListeningFailCallback; + /** 接口调用结束的回调函数(调用成功、失败都会执行) */ + complete?: StartDeviceMotionListeningCompleteCallback; + } + /** 插件账号信息(仅在插件中调用时包含这一项) */ + interface Plugin { + /** 插件 appId */ + appId: string; + /** 插件版本号 */ + version: string; + } + /** 该特征值支持的操作类型 */ + interface Properties { + /** 该特征值是否支持 read 操作 */ + read: boolean; + /** 该特征值是否支持 write 操作 */ + write: boolean; + /** 该特征值是否支持 notify 操作 */ + notify: boolean; + /** 该特征值是否支持 indicate 操作 */ + indicate: boolean; + } + /** 菜单按钮的布局位置信息 */ + interface Rect { + /** 宽度 */ + width: number; + /** 高度 */ + height: number; + /** 上边界坐标 */ + top: number; + /** 右边界坐标 */ + right: number; + /** 下边界坐标 */ + bottom: number; + /** 左边界坐标 */ + left: number; + } + /** 参照区域的边界 */ + interface RelativeRectResult { + /** 左边界 */ + left: number; + /** 右边界 */ + right: number; + /** 上边界 */ + top: number; + /** 下边界 */ + bottom: number; + } + interface GetUserInfoSuccessCallbackResult { + /** [UserInfo]((UserInfo)) + * + * 用户信息对象,不包含 openid 等敏感信息 */ + userInfo: UserInfo; + /** 不包括敏感信息的原始数据字符串,用于计算签名 */ + rawData: string; + /** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密]((signature)) */ + signature: string; + /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */ + encryptedData: string; + /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */ + iv: string; + } + interface GetBackgroundAudioPlayerStateSuccessCallbackResult { + /** 选定音频的长度(单位:s),只有在音乐播放中时返回 */ + duration: number; + /** 选定音频的播放位置(单位:s),只有在音乐播放中时返回 */ + currentPosition: number; + /** 播放状态 + * + * 可选值: + * - 0: 暂停中; + * - 1: 播放中; + * - 2: 没有音乐播放; */ + status: 0 | 1 | 2; + /** 音频的下载进度百分比,只有在音乐播放中时返回 */ + downloadPercent: number; + /** 歌曲数据链接,只有在音乐播放中时返回 */ + dataUrl: string; + } + interface OnWindowResizeCallbackResult { + size: Size; + } + interface UnlinkFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限; + * - 'fail no such file or directory ${path}': 文件不存在; + * - 'fail operation not permitted, unlink ${filePath}': 传入的 filePath 是一个目录; */ + errMsg: string; + } + interface OnGyroscopeChangeCallbackResult { + res: Result; + } + interface StatFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限; + * - 'fail no such file or directory ${path}': 文件不存在; */ + errMsg: string; + } + interface ShowActionSheetSuccessCallbackResult { + /** 用户点击的按钮序号,从上到下的顺序,从0开始 */ + tapIndex: number; + } + interface StatSuccessCallbackResult { + /** [Stats]((Stats))|Object + * + * 当 recursive 为 false 时,res.stats 是一个 Stats 对象。当 recursive 为 true 且 path 是一个目录的路径时,res.stats 是一个 Object,key 以 path 为根路径的相对路径,value 是该路径对应的 Stats 对象。 */ + stats: Stats | IAnyObject; + } + interface ScrollOffsetCallbackResult { + /** 节点的 ID */ + id: string; + /** 节点的 dataset */ + dataset: IAnyObject; + /** 节点的水平滚动位置 */ + scrollLeft: number; + /** 节点的竖直滚动位置 */ + scrollTop: number; + } + interface OnCheckForUpdateCallbackResult { + /** 是否有新版本 */ + hasUpdate: boolean; + } + interface WorkerOnMessageCallbackResult { + /** 主线程/Worker 线程向当前线程发送的消息 */ + message: any; + } + interface OnMemoryWarningCallbackResult { + /** 内存告警等级,只有 Android 才有,对应系统宏定义 + * + * 可选值: + * - 5: TRIM_MEMORY_RUNNING_MODERATE; + * - 10: TRIM_MEMORY_RUNNING_LOW; + * - 15: TRIM_MEMORY_RUNNING_CRITICAL; */ + level: 5 | 10 | 15; + } + interface OnBeaconUpdateCallbackResult { + /** 当前搜寻到的所有 iBeacon 设备列表 */ + beacons: Array; + } + interface RmdirFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory ${dirPath}': 目录不存在; + * - 'fail directory not empty': 目录不为空; + * - 'fail permission denied, open ${dirPath}': 指定的 dirPath 路径没有写权限; */ + errMsg: string; + } + interface ShowModalSuccessCallbackResult { + /** 为 true 时,表示用户点击了确定按钮 */ + confirm: boolean; + /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) + * + * 最低基础库: `1.1.0` */ + cancel: boolean; + } + interface RenameFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, rename ${oldPath} -> ${newPath}': 指定源文件或目标文件没有写权限; + * - 'fail no such file or directory, rename ${oldPath} -> ${newPath}': 源文件不存在,或目标文件路径的上层目录不存在; */ + errMsg: string; + } + interface ObserveCallbackResult { + /** 相交比例 */ + intersectionRatio: number; + /** 相交区域的边界 */ + intersectionRect: IntersectionRectResult; + /** 目标边界 */ + boundingClientRect: BoundingClientRectResult; + /** 参照区域的边界 */ + relativeRect: RelativeRectResult; + /** 相交检测时的时间戳 */ + time: number; + } + interface ReadFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限; */ + errMsg: string; + } + interface OnAccelerometerChangeCallbackResult { + /** X 轴 */ + x: number; + /** Y 轴 */ + y: number; + /** Z 轴 */ + z: number; + } + interface ReadFileSuccessCallbackResult { + /** 文件内容 */ + data: string | ArrayBuffer; + } + interface GetBLEDeviceServicesSuccessCallbackResult { + /** 设备服务列表 */ + services: BLEService; + } + interface CanvasToTempFilePathSuccessCallbackResult { + /** 生成文件的临时路径 */ + tempFilePath: string; + } + interface GetBluetoothAdapterStateSuccessCallbackResult { + /** 是否正在搜索设备 */ + discovering: boolean; + /** 蓝牙适配器是否可用 */ + available: boolean; + } + interface GetAvailableAudioSourcesSuccessCallbackResult { + /** 支持的音频输入源列表,可在 [RecorderManager.start()]((RecorderManager.start)) 接口中使用。返回值定义参考 https://developer.android.com/reference/kotlin/android/media/MediaRecorder.AudioSource + * + * 可选值: + * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用; + * - 'buildInMic': 手机麦克风,仅限 iOS; + * - 'headsetMic': 耳机麦克风,仅限 iOS; + * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android; + * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android; + * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android; + * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; */ + audioSources: + | 'auto' + | 'buildInMic' + | 'headsetMic' + | 'mic' + | 'camcorder' + | 'voice_communication' + | 'voice_recognition'; + } + interface ChooseInvoiceTitleSuccessCallbackResult { + /** 抬头类型 + * + * 可选值: + * - 0: 单位; + * - 1: 个人; */ + type: 0 | 1; + /** 抬头名称 */ + title: string; + /** 抬头税号 */ + taxNumber: string; + /** 单位地址 */ + companyAddress: string; + /** 手机号码 */ + telephone: string; + /** 银行名称 */ + bankName: string; + /** 银行账号 */ + bankAccount: string; + /** 错误信息 */ + errMsg: string; + } + interface ReaddirFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory ${dirPath}': 目录不存在; + * - 'fail not a directory ${dirPath}': dirPath 不是目录; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限; */ + errMsg: string; + } + interface ChooseInvoiceSuccessCallbackResult { + /** 用户选中的发票列表 */ + invoiceInfo: InvoiceInfo; + } + interface StartRecordSuccessCallbackResult { + /** 录音文件的临时路径 */ + tempFilePath: string; + } + interface GetConnectedBluetoothDevicesSuccessCallbackResult { + /** 搜索到的设备列表 */ + devices: BluetoothDeviceInfo; + } + interface ReaddirSuccessCallbackResult { + /** 指定目录下的文件名数组。 */ + files: Array; + } + interface TakePhotoSuccessCallbackResult { + /** 照片文件的临时路径 */ + tempImagePath: string; + } + interface MkdirFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory ${dirPath}': 上级目录不存在; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限; + * - 'fail file already exists ${dirPath}': 有同名文件或目录; */ + errMsg: string; + } + interface OnBLEConnectionStateChangeCallbackResult { + /** 蓝牙设备ID */ + deviceId: string; + /** 是否处于已连接状态 */ + connected: boolean; + } + interface WxGetFileInfoSuccessCallbackResult { + /** 文件大小,以字节为单位 */ + size: number; + /** 按照传入的 digestAlgorithm 计算得出的的文件摘要 */ + digest: string; + } + interface AddCardSuccessCallbackResult { + /** 卡券添加结果列表 */ + cardList: AddCardResponseInfo; + } + interface OnStopCallbackResult { + /** 录音文件的临时路径 */ + tempFilePath: string; + } + interface StartRecordTimeoutCallbackResult { + /** 封面图片文件的临时路径 */ + tempThumbPath: string; + /** 视频的文件的临时路径 */ + tempVideoPath: string; + } + interface OnFrameRecordedCallbackResult { + /** 录音分片数据 */ + frameBuffer: ArrayBuffer; + /** 当前帧是否正常录音结束前的最后一帧 */ + isLastFrame: boolean; + } + interface LoginSuccessCallbackResult { + /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [code2Session]((code2Session)),使用 code 换取 openid 和 session_key 等信息 */ + code: string; + } + interface RecorderManagerOnErrorCallbackResult { + /** 错误信息 */ + errMsg: string; + } + interface OnSocketMessageCallbackResult { + /** 服务器返回的消息 */ + data: string | ArrayBuffer; + } + interface GetFileInfoFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail file not exist': 指定的 filePath 找不到文件; */ + errMsg: string; + } + interface OnHCEMessageCallbackResult { + /** 消息类型 + * + * 可选值: + * - 1: HCE APDU Command类型,小程序需对此指令进行处理,并调用 sendHCEMessage 接口返回处理指令; + * - 2: 设备离场事件类型; */ + messageType: 1 | 2; + /** `messageType=1` 时 ,客户端接收到 NFC 设备的指令 */ + data: ArrayBuffer; + /** `messageType=2` 时,原因 */ + reason: number; + } + interface FileSystemManagerGetFileInfoSuccessCallbackResult { + /** 文件大小,以字节为单位 */ + size: number; + } + interface DownloadFileSuccessCallbackResult { + /** 临时文件路径。如果没传入 filePath 指定文件存储路径,则下载后的文件会存储到一个临时文件 */ + tempFilePath: string; + /** 开发者服务器返回的 HTTP 状态码 */ + statusCode: number; + } + interface CopyFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, copyFile ${srcPath} -> ${destPath}': 指定目标文件路径没有写权限; + * - 'fail no such file or directory, copyFile ${srcPath} -> ${destPath}': 源文件不存在,或目标文件路径的上层目录不存在; */ + errMsg: string; + } + interface GetImageInfoSuccessCallbackResult { + /** 图片原始宽度,单位px。不考虑旋转。 */ + width: number; + /** 图片原始高度,单位px。不考虑旋转。 */ + height: number; + /** 图片的本地路径 */ + path: string; + /** [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html) + * + * 可选值: + * - 'up': 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。; + * - 'up-mirrored': 同 up,但镜像翻转,对应 Exif 中的 2; + * - 'down': 旋转180度,对应 Exif 中的 3; + * - 'down-mirrored': 同 down,但镜像翻转,对应 Exif 中的 4; + * - 'left-mirrored': 同 left,但镜像翻转,对应 Exif 中的 5; + * - 'right': 顺时针旋转90度,对应 Exif 中的 6; + * - 'right-mirrored': 同 right,但镜像翻转,对应 Exif 中的 7; + * - 'left': 逆时针旋转90度,对应 Exif 中的 8; + * + * 最低基础库: `1.9.90` */ + orientation: + | 'up' + | 'up-mirrored' + | 'down' + | 'down-mirrored' + | 'left-mirrored' + | 'right' + | 'right-mirrored' + | 'left'; + /** 图片格式 + * + * 最低基础库: `1.9.90` */ + type: string; + } + interface RemoveSavedFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail file not exist': 指定的 tempFilePath 找不到文件; */ + errMsg: string; + } + interface StopRecordSuccessCallbackResult { + /** 封面图片文件的临时路径 */ + tempThumbPath: string; + /** 视频的文件的临时路径 */ + tempVideoPath: string; + } + interface GetSavedFileInfoSuccessCallbackResult { + /** 文件大小,单位 B */ + size: number; + /** 文件保存时的时间戳,从1970/01/01 08:00:00 到该时刻的秒数 */ + createTime: number; + } + interface GetLocationSuccessCallbackResult { + /** 纬度,范围为 -90~90,负数表示南纬 */ + latitude: number; + /** 经度,范围为 -180~180,负数表示西经 */ + longitude: number; + /** 速度,单位 m/s */ + speed: number; + /** 位置的精确度 */ + accuracy: number; + /** 高度,单位 m + * + * 最低基础库: `1.2.0` */ + altitude: number; + /** 垂直精度,单位 m(Android 无法获取,返回 0) + * + * 最低基础库: `1.2.0` */ + verticalAccuracy: number; + /** 水平精度,单位 m + * + * 最低基础库: `1.2.0` */ + horizontalAccuracy: number; + } + interface DownloadTaskOnProgressUpdateCallbackResult { + /** 下载进度百分比 */ + progress: number; + /** 已经下载的数据长度,单位 Bytes */ + totalBytesWritten: number; + /** 预期需要下载的数据总长度,单位 Bytes */ + totalBytesExpectedToWrite: number; + } + interface WriteFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限; */ + errMsg: string; + } + interface WxGetSavedFileListSuccessCallbackResult { + /** 文件数组,每一项是一个 FileItem */ + fileList: WxGetSavedFileListSuccessCallbackResultFileItem; + } + interface OnGetWifiListCallbackResult { + /** Wi-Fi 列表数据 */ + wifiList: Array; + } + interface GetBeaconsSuccessCallbackResult { + /** iBeacon 设备列表 */ + beacons: Array; + } + interface OnWifiConnectedCallbackResult { + /** [WifiInfo]((WifiInfo)) + * + * Wi-Fi 信息 */ + wifi: WifiInfo; + } + interface FileSystemManagerGetSavedFileListSuccessCallbackResult { + /** 文件数组 */ + fileList: FileSystemManagerGetSavedFileListSuccessCallbackResultFileItem; + } + interface BoundingClientRectCallbackResult { + /** 节点的 ID */ + id: string; + /** 节点的 dataset */ + dataset: IAnyObject; + /** 节点的左边界坐标 */ + left: number; + /** 节点的右边界坐标 */ + right: number; + /** 节点的上边界坐标 */ + top: number; + /** 节点的下边界坐标 */ + bottom: number; + /** 节点的宽度 */ + width: number; + /** 节点的高度 */ + height: number; + } + interface WxSaveFileSuccessCallbackResult { + /** 存储后的文件路径 */ + savedFilePath: number; + } + interface GetScaleSuccessCallbackResult { + /** 缩放值 */ + scale: number; + } + interface OnOpenCallbackResult { + /** 连接成功的 HTTP 响应 Header + * + * 最低基础库: `2.0.0` */ + header: IAnyObject; + } + interface GetWeRunDataSuccessCallbackResult { + /** 包括敏感数据在内的完整用户信息的加密数据,详细见[加密数据解密算法]((signature))。解密后得到的数据结构见后文 */ + encryptedData: string; + /** 加密算法的初始向量,详细见[加密数据解密算法]((signature)) */ + iv: string; + } + interface SocketTaskOnErrorCallbackResult { + /** 错误信息 */ + errMsg: string; + } + interface GetCenterLocationSuccessCallbackResult { + /** 经度 */ + longitude: number; + /** 纬度 */ + latitude: number; + } + interface SocketTaskOnMessageCallbackResult { + /** 服务器返回的消息 */ + data: string | ArrayBuffer; + } + interface FaceVerifyForPaySuccessCallbackResult { + /** 本次认证结果凭据 */ + token: string; + /** 用户是否点了别的验证方式 */ + clickOtherVerifyBtn: boolean; + } + interface Result { + /** x 轴的角速度 */ + x: number; + /** y 轴的角速度 */ + y: number; + /** z 轴的角速度 */ + z: number; + } + interface GetBatteryInfoSuccessCallbackResult { + /** 设备电量,范围 1 - 100 */ + level: string; + /** 是否正在充电中 */ + isCharging: boolean; + } + interface UploadTaskOnProgressUpdateCallbackResult { + /** 上传进度百分比 */ + progress: number; + /** 已经上传的数据长度,单位 Bytes */ + totalBytesSent: number; + /** 预期需要上传的数据总长度,单位 Bytes */ + totalBytesExpectedToSend: number; + } + interface OnBLECharacteristicValueChangeCallbackResult { + /** 蓝牙设备 id */ + deviceId: string; + /** 蓝牙特征值对应服务的 uuid */ + serviceId: string; + /** 蓝牙特征值的 uuid */ + characteristicId: string; + /** 特征值最新的值 */ + value: ArrayBuffer; + } + interface SaveFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail tempFilePath file not exist': 指定的 tempFilePath 找不到文件; + * - 'fail permission denied, open "${filePath}"': 指定的 filePath 路径没有写权限; + * - 'fail no such file or directory "${dirPath}"': 上级目录不存在; */ + errMsg: string; + } + interface OnBluetoothDeviceFoundCallbackResult { + /** 新搜索到的设备列表 */ + devices: CallbackResultBlueToothDevice; + } + interface GetSettingSuccessCallbackResult { + /** [AuthSetting]((AuthSetting)) + * + * 用户授权结果 */ + authSetting: AuthSetting; + } + interface UploadFileSuccessCallbackResult { + /** 开发者服务器返回的数据 */ + data: string; + /** 开发者服务器返回的 HTTP 状态码 */ + statusCode: number; + } + interface FileSystemManagerSaveFileSuccessCallbackResult { + /** 存储后的文件路径 */ + savedFilePath: number; + } + interface RequestSuccessCallbackResult { + /** 开发者服务器返回的数据 */ + data: string | IAnyObject | ArrayBuffer; + /** 开发者服务器返回的 HTTP 状态码 */ + statusCode: number; + /** 开发者服务器返回的 HTTP Response Header + * + * 最低基础库: `1.2.0` */ + header: IAnyObject; + } + interface OpenSettingSuccessCallbackResult { + /** [AuthSetting]((AuthSetting)) + * + * 用户授权结果 */ + authSetting: AuthSetting; + } + interface ChooseImageSuccessCallbackResult { + /** 图片的本地临时文件路径列表 */ + tempFilePaths: Array; + /** 图片的本地临时文件列表 + * + * 最低基础库: `1.2.0` + * + * 最低基础库: `1.2.0` */ + tempFiles: ImageFile; + } + interface AppendFileFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 文件不存在; + * - 'fail illegal operation on a directory, open "${filePath}" ': 指定的 filePath 是一个已经存在的目录; + * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限; + * - 'fail sdcard not mounted ': 指定的 filePath 是一个已经存在的目录; */ + errMsg: string; + } + interface GetConnectedWifiSuccessCallbackResult { + /** [WifiInfo]((WifiInfo)) + * + * Wi-Fi 信息 */ + wifi: WifiInfo; + } + interface GetShareInfoSuccessCallbackResult { + /** 错误信息 */ + errMsg: string; + /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法]((开放数据校验与解密)) */ + encryptedData: string; + /** 加密算法的初始向量,详细见[加密数据解密算法]((开放数据校验与解密)) */ + iv: string; + } + interface OnCompassChangeCallbackResult { + /** 面对的方向度数 */ + direction: number; + } + interface AccessFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail no such file or directory ${path}': 文件/目录不存在; */ + errMsg: string; + } + interface GetRegionSuccessCallbackResult { + /** 西南角经纬度 */ + southwest: number; + /** 东北角经纬度 */ + northeast: number; + } + interface GetExtConfigSuccessCallbackResult { + /** 第三方平台自定义的数据 */ + extConfig: IAnyObject; + } + interface GetBLEDeviceCharacteristicsSuccessCallbackResult { + /** 设备服务列表 */ + characteristics: BLECharacteristic; + } + interface GetSystemInfoSuccessCallbackResult { + /** 手机品牌 + * + * 最低基础库: `1.5.0` */ + brand: string; + /** 手机型号 */ + model: string; + /** 设备像素比 */ + pixelRatio: number; + /** 屏幕宽度 + * + * 最低基础库: `1.1.0` */ + screenWidth: number; + /** 屏幕高度 + * + * 最低基础库: `1.1.0` */ + screenHeight: number; + /** 可使用窗口宽度 */ + windowWidth: number; + /** 可使用窗口高度 */ + windowHeight: number; + /** 状态栏的高度 + * + * 最低基础库: `1.9.0` */ + statusBarHeight: number; + /** 微信设置的语言 */ + language: string; + /** 微信版本号 */ + version: string; + /** 操作系统版本 */ + system: string; + /** 客户端平台 */ + platform: string; + /** 用户字体大小设置。以“我-设置-通用-字体大小”中的设置为准,单位 px。 + * + * 最低基础库: `1.5.0` */ + fontSizeSetting: number; + /** 客户端基础库版本 + * + * 最低基础库: `1.1.0` */ + SDKVersion: string; + /** (仅Android小游戏) 性能等级,-2 或 0:该设备无法运行小游戏,-1:性能未知,>=1 设备性能值,该值越高,设备性能越好 (目前设备最高不到50) + * + * 最低基础库: `1.8.0` */ + benchmarkLevel: number; + } + interface GetBluetoothDevicesSuccessCallbackResult { + /** uuid 对应的的已连接设备列表 */ + devices: GetBluetoothDevicesSuccessCallbackResultBlueToothDevice; + } + interface ScanCodeSuccessCallbackResult { + /** 所扫码的内容 */ + result: string; + /** 所扫码的类型 + * + * 可选值: + * - 'QR_CODE': 二维码; + * - 'AZTEC': 一维码; + * - 'CODABAR': 一维码; + * - 'CODE_39': 一维码; + * - 'CODE_93': 一维码; + * - 'CODE_128': 一维码; + * - 'DATA_MATRIX': 二维码; + * - 'EAN_8': 一维码; + * - 'EAN_13': 一维码; + * - 'ITF': 一维码; + * - 'MAXICODE': 一维码; + * - 'PDF_417': 二维码; + * - 'RSS_14': 一维码; + * - 'RSS_EXPANDED': 一维码; + * - 'UPC_A': 一维码; + * - 'UPC_E': 一维码; + * - 'UPC_EAN_EXTENSION': 一维码; + * - 'WX_CODE': 二维码; + * - 'CODE_25': 一维码; */ + scanType: + | 'QR_CODE' + | 'AZTEC' + | 'CODABAR' + | 'CODE_39' + | 'CODE_93' + | 'CODE_128' + | 'DATA_MATRIX' + | 'EAN_8' + | 'EAN_13' + | 'ITF' + | 'MAXICODE' + | 'PDF_417' + | 'RSS_14' + | 'RSS_EXPANDED' + | 'UPC_A' + | 'UPC_E' + | 'UPC_EAN_EXTENSION' + | 'WX_CODE' + | 'CODE_25'; + /** 所扫码的字符集 */ + charSet: string; + /** 当所扫的码为当前小程序的合法二维码时,会返回此字段,内容为二维码携带的 path */ + path: string; + /** 原始数据,base64编码 */ + rawData: string; + } + interface OnBluetoothAdapterStateChangeCallbackResult { + /** 蓝牙适配器是否可用 */ + available: boolean; + /** 蓝牙适配器是否处于搜索状态 */ + discovering: boolean; + } + interface CheckIsSoterEnrolledInDeviceSuccessCallbackResult { + /** 是否已录入信息 */ + isEnrolled: boolean; + /** 错误信息 */ + errMs: string; + } + interface OnSocketOpenCallbackResult { + /** 连接成功的 HTTP 响应 Header + * + * 最低基础库: `2.0.0` */ + header: IAnyObject; + } + interface OnNetworkStatusChangeCallbackResult { + /** 当前是否有网络链接 */ + isConnected: boolean; + /** 网络类型 + * + * 可选值: + * - 'wifi': wifi 网络; + * - '2g': 2g 网络; + * - '3g': 3g 网络; + * - '4g': 4g 网络; + * - 'unknown': Android 下不常见的网络类型; + * - 'none': 无网络; */ + networkType: 'wifi' | '2g' | '3g' | '4g' | 'unknown' | 'none'; + } + interface ChooseLocationSuccessCallbackResult { + /** 位置名称 */ + name: string; + /** 详细地址 */ + address: string; + /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */ + latitude: string; + /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */ + longitude: string; + } + interface CheckIsSupportSoterAuthenticationSuccessCallbackResult { + /** 该设备支持的可被SOTER识别的生物识别方式 + * + * 可选值: + * - 'fingerPrint': 指纹识别; + * - 'facial': 人脸识别(暂未支持); + * - 'speech': 声纹识别(暂未支持); */ + supportMode: 'fingerPrint' | 'facial' | 'speech'; + } + interface CanvasGetImageDataSuccessCallbackResult { + /** 图像数据矩形的宽度 */ + width: number; + /** 图像数据矩形的高度 */ + height: number; + } + interface FaceVerifyForPayFailCallbackResult { + /** 错误信息 */ + errMsg: string; + /** 错误码 */ + number: number; + } + interface OnBeaconServiceChangeCallbackResult { + /** 服务目前是否可用 */ + available: boolean; + /** 目前是否处于搜索状态 */ + discovering: boolean; + } + interface OnDeviceMotionChangeCallbackResult { + /** 当 手机坐标 X/Y 和 地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha,范围值为 [0, 2*PI)。逆时针转动为正。 */ + alpha: number; + /** 当手机坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。范围值为 [-1*PI, PI) 。顶部朝着地球表面转动为正。也有可能朝着用户为正。 */ + beta: number; + /** 当手机 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。范围值为 [-1*PI/2, PI/2)。右边朝着地球表面转动为正。 */ + gamma: number; + } + interface StartSoterAuthenticationSuccessCallbackResult { + /** 生物认证方式 */ + authMode: string; + /** 在设备安全区域(TEE)内获得的本机安全信息(如TEE名称版本号等以及防重放参数)以及本次认证信息(仅Android支持,本次认证的指纹ID)。具体说明见下文 */ + resultJSON: string; + /** 用SOTER安全密钥对 `resultJSON` 的签名(SHA256 with RSA/PSS, saltlen=20) */ + resultJSONSignature: string; + /** 错误码 */ + errCode: number; + /** 错误信息 */ + errMsg: string; + } + interface GetNetworkTypeSuccessCallbackResult { + /** 网络类型 + * + * 可选值: + * - 'wifi': wifi 网络; + * - '2g': 2g 网络; + * - '3g': 3g 网络; + * - '4g': 4g 网络; + * - 'unknown': Android 下不常见的网络类型; + * - 'none': 无网络; */ + networkType: 'wifi' | '2g' | '3g' | '4g' | 'unknown' | 'none'; + } + interface InnerAudioContextOnErrorCallbackResult { + /** 可选值: + * - 10001: 系统错误; + * - 10002: 网络错误; + * - 10003: 文件错误; + * - 10004: 格式错误; + * - -1: 未知错误; */ + errCode: 10001 | 10002 | 10003 | 10004 | -1; + } + interface GetStorageSuccessCallbackResult { + /** key对应的内容 */ + data: IAnyObject | string; + } + interface UnzipFailCallbackResult { + /** 错误信息 + * + * 可选值: + * - 'fail permission denied, unzip ${zipFilePath} -> ${destPath}': 指定目标文件路径没有写权限; + * - 'fail no such file or directory, unzip ${zipFilePath} -> "${destPath}': 源文件不存在,或目标文件路径的上层目录不存在; */ + errMsg: string; + } + interface ChooseVideoSuccessCallbackResult { + /** 选定视频的临时文件路径 */ + tempFilePath: string; + /** 选定视频的时间长度 */ + duration: number; + /** 选定视频的数据量大小 */ + size: number; + /** 返回选定视频的高度 */ + height: number; + /** 返回选定视频的宽度 */ + width: number; + } + interface ChooseAddressSuccessCallbackResult { + /** 收货人姓名 */ + userName: string; + /** 邮编 */ + postalCode: string; + /** 国标收货地址第一级地址 */ + provinceName: string; + /** 国标收货地址第一级地址 */ + cityName: string; + /** 国标收货地址第一级地址 */ + countyName: string; + /** 详细收货地址信息 */ + detailInfo: string; + /** 收货地址国家码 */ + nationalCode: string; + /** 收货人手机号码 */ + telNumber: string; + /** 错误信息 */ + errMsg: string; + } + interface Size { + /** 变化后的窗口宽度,单位 px */ + windowWidth: number; + /** 变化后的窗口高度,单位 px */ + windowHeight: number; + } + /** 描述文件状态的对象 */ + interface Stats { + /** 文件的类型和存取的权限,对应 POSIX stat.st_mode */ + mode: string; + /** 文件大小,单位:B,对应 POSIX stat.st_size */ + size: number; + /** 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime */ + lastAccessedTime: number; + /** 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime */ + lastModifiedTime: number; + } + interface TextMetrics { + /** 文本的宽度 */ + width: number; + } + /** 用户信息 */ + interface UserInfo { + /** 用户昵称 */ + nickName: string; + /** 用户头像图片的 URL。URL 最后一个数值代表正方形头像大小(有 0、46、64、96、132 数值可选,0 代表 640x640 的正方形头像,46 表示 46x46 的正方形头像,剩余数值以此类推。默认132),用户没有头像时该项为空。若用户更换头像,原有头像 URL 将失效。 */ + avatarUrl: string; + /** 用户性别 + * + * 可选值: + * - 0: 未知; + * - 1: 男性; + * - 2: 女性; */ + gender: 0 | 1 | 2; + /** 用户所在国家 */ + country: string; + /** 用户所在省份 */ + province: string; + /** 用户所在城市 */ + city: string; + /** 显示 country,province,city 所用的语言 + * + * 可选值: + * - 'en': 英文; + * - 'zh_CN': 简体中文; + * - 'zh_TW': 繁体中文; */ + language: 'en' | 'zh_CN' | 'zh_TW'; + } + /** 提供预设的 Wi-Fi 信息列表 */ + interface WifiData { + /** Wi-Fi 的 SSID */ + SSID?: string; + /** Wi-Fi 的 BSSID */ + BSSID?: string; + /** Wi-Fi 设备密码 */ + password?: string; + } + /** Wifi 信息 */ + interface WifiInfo { + /** Wi-Fi 的 SSID */ + SSID: string; + /** Wi-Fi 的 BSSID */ + BSSID: string; + /** Wi-Fi 是否安全 */ + secure: boolean; + /** Wi-Fi 信号强度 */ + signalStrength: number; + } + interface WxComponent { + /** [wx.canvasGetImageData(Object object, Object this)](wx.canvasGetImageData.md) + * + * 获取 canvas 区域隐含的像素数据。 + * + * **示例代码** + * + * {% minicode('GlCRTlmS7n27') %} + * + * ```js + wx.canvasGetImageData({ + canvasId: 'myCanvas', + x: 0, + y: 0, + width: 100, + height: 100, + success(res) { + console.log(res.width) // 100 + console.log(res.height) // 100 + console.log(res.data instanceof Uint8ClampedArray) // true + console.log(res.data.length) // 100 100 4 + } + }) + ``` + * + * 最低基础库: `1.9.0` */ + canvasGetImageData(option: CanvasGetImageDataOption): void; + /** [wx.canvasPutImageData(Object object, Object this)](wx.canvasPutImageData.md) + * + * 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 组件 + * + * 最低基础库: `1.9.0` */ + canvasPutImageData(option: CanvasPutImageDataOption): void; + /** [wx.canvasToTempFilePath(Object object, Object this)](wx.canvasToTempFilePath.md) + * + * 把当前画布指定区域的内容导出生成指定大小的图片。在 `draw()` 回调里调用该方法才能保证图片导出成功。 */ + canvasToTempFilePath(option: CanvasToTempFilePathOption): void; + /** [[CanvasContext]((CanvasContext)) wx.createCanvasContext(string canvasId, Object this)](wx.createCanvasContext.md) + * + * 创建 canvas 的绘图上下文 `CanvasContext` 对象 */ + createCanvasContext( + /** 要获取上下文的 `` 组件 canvas-id 属性 */ + canvasId: string, + ): CanvasContext; + /** [[IntersectionObserver]((IntersectionObserver)) wx.createIntersectionObserver(Object this, Object options)](wx.createIntersectionObserver.md) + * + * 创建并返回一个 IntersectionObserver 对象实例。在自定义组件中,可以使用 `this.createIntersectionObserver([options])` 来代替。 + * + * **示例代码** + * + * {% minicode('LAbMxkmI7F2A') %} + * + * 最低基础库: `1.9.3` */ + createIntersectionObserver( + /** 选项 */ + options: CreateIntersectionObserverOption, + ): IntersectionObserver; + /** [[AudioContext]((AudioContext)) wx.createAudioContext(string id, Object this)](wx.createAudioContext.md) + * + * 创建 `audio` 上下文 `AudioContext` 对象。 */ + createAudioContext( + /** `