diff --git a/types/minapp-env/.npmignore b/types/minapp-env/.npmignore deleted file mode 100644 index 93e307400a5456b..000000000000000 --- a/types/minapp-env/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!**/*.d.ts -!**/*.d.cts -!**/*.d.mts -!**/*.d.*.ts diff --git a/types/minapp-env/index.d.ts b/types/minapp-env/index.d.ts deleted file mode 100644 index 13e4463107b908a..000000000000000 --- a/types/minapp-env/index.d.ts +++ /dev/null @@ -1,20785 +0,0 @@ -/// - -///////////////////////////// -/// 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[]): readonly 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(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: readonly string[]; -} - -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?: Array | 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: Array): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: Array): 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: readonly 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: readonly 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: readonly 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: readonly 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: readonly 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: readonly 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: readonly 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: readonly 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: readonly 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: readonly T[]) => 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: Array): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: Array): 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 any[]; - readonly prototype: any[]; -} - -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: readonly 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: readonly T[]) => 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?: Array<[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?: Array<[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: Array>): 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: Array>): 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; - -interface CallableFunction extends Function { - /** - * Calls the function with the specified object as the this value and the elements of specified array as the arguments. - * @param thisArg The object to be used as the this object. - * @param args An array of argument values to be passed to the function. - */ - apply(this: (this: T) => R, thisArg: T): R; - apply(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; - - /** - * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. - * @param thisArg The object to be used as the this object. - * @param args Argument values to be passed to the function. - */ - call(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; - - /** - * 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 The object to be used as the this object. - * @param args Arguments to bind to the parameters of the function. - */ - bind(this: (this: T, ...args: A) => R, thisArg: T): (...args: A) => R; - bind( - this: (this: T, arg0: A0, ...args: A) => R, - thisArg: T, - arg0: A0, - ): (...args: A) => R; - bind( - this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, - thisArg: T, - arg0: A0, - arg1: A1, - ): (...args: A) => R; - bind( - this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, - thisArg: T, - arg0: A0, - arg1: A1, - arg2: A2, - ): (...args: A) => R; - bind( - this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, - thisArg: T, - arg0: A0, - arg1: A1, - arg2: A2, - arg3: A3, - ): (...args: A) => R; - bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; -} - -interface NewableFunction extends Function { - /** - * Calls the function with the specified object as the this value and the elements of specified array as the arguments. - * @param thisArg The object to be used as the this object. - * @param args An array of argument values to be passed to the function. - */ - apply(this: new() => T, thisArg: T): void; - apply(this: new(...args: A) => T, thisArg: T, args: A): void; - - /** - * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. - * @param thisArg The object to be used as the this object. - * @param args Argument values to be passed to the function. - */ - call(this: new(...args: A) => T, thisArg: T, ...args: A): void; - - /** - * 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 The object to be used as the this object. - * @param args Arguments to bind to the parameters of the function. - */ - bind(this: new(...args: A) => R, thisArg: any): new(...args: A) => R; - bind(this: new(arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new(...args: A) => R; - bind( - this: new(arg0: A0, arg1: A1, ...args: A) => R, - thisArg: any, - arg0: A0, - arg1: A1, - ): new(...args: A) => R; - bind( - this: new(arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, - thisArg: any, - arg0: A0, - arg1: A1, - arg2: A2, - ): new(...args: A) => R; - bind( - this: new(arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, - thisArg: any, - arg0: A0, - arg1: A1, - arg2: A2, - arg3: A3, - ): new(...args: A) => R; - bind(this: new(...args: AX[]) => R, thisArg: any, ...args: AX[]): new(...args: AX[]) => R; -} - -declare namespace wx { - interface AccessFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail no such file or directory ${path}': 文件/目录不存在; */ - errMsg: string; - } - interface AccessOption { - /** 要判断是否存在的文件/目录路径 */ - path: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: AccessCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: AccessFailCallback; - /** 接口调用成功的回调函数 */ - success?: AccessSuccessCallback; - } - /** 帐号信息 */ - interface AccountInfo { - /** 小程序帐号信息 */ - miniProgram: MiniProgram; - /** 插件帐号信息(仅在插件中调用时包含这一项) */ - plugin: Plugin; - } - interface AddCardOption { - /** 需要添加的卡券列表 */ - cardList: AddCardRequestInfo; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: AddCardCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: AddCardFailCallback; - /** 接口调用成功的回调函数 */ - success?: AddCardSuccessCallback; - } - /** 需要添加的卡券列表 */ - interface AddCardRequestInfo { - /** 卡券的扩展参数。需进行 JSON 序列化为**字符串**传入 */ - cardExt: CardExt; - /** 卡券 ID */ - cardId: string; - } - /** 卡券添加结果列表 */ - interface AddCardResponseInfo { - /** 卡券的扩展参数,结构请参考前文 */ - cardExt: string; - /** 用户领取到卡券的 ID */ - cardId: string; - /** 加密 code,为用户领取到卡券的code加密后的字符串,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */ - code: string; - /** 是否成功 */ - isSuccess: boolean; - } - interface AddCardSuccessCallbackResult { - /** 卡券添加结果列表 */ - cardList: AddCardResponseInfo; - } - interface AddPhoneContactOption { - /** 名字 */ - firstName: string; - /** 联系地址城市 */ - addressCity?: string; - /** 联系地址国家 */ - addressCountry?: string; - /** 联系地址邮政编码 */ - addressPostalCode?: string; - /** 联系地址省份 */ - addressState?: string; - /** 联系地址街道 */ - addressStreet?: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: AddPhoneContactCompleteCallback; - /** 电子邮件 */ - email?: string; - /** 接口调用失败的回调函数 */ - fail?: AddPhoneContactFailCallback; - /** 住宅地址城市 */ - homeAddressCity?: string; - /** 住宅地址国家 */ - homeAddressCountry?: string; - /** 住宅地址邮政编码 */ - homeAddressPostalCode?: string; - /** 住宅地址省份 */ - homeAddressState?: string; - /** 住宅地址街道 */ - homeAddressStreet?: string; - /** 住宅传真 */ - homeFaxNumber?: string; - /** 住宅电话 */ - homePhoneNumber?: string; - /** 公司电话 */ - hostNumber?: string; - /** 姓氏 */ - lastName?: string; - /** 中间名 */ - middleName?: string; - /** 手机号 */ - mobilePhoneNumber?: string; - /** 昵称 */ - nickName?: string; - /** 公司 */ - organization?: string; - /** 头像本地文件路径 */ - photoFilePath?: string; - /** 备注 */ - remark?: string; - /** 接口调用成功的回调函数 */ - success?: AddPhoneContactSuccessCallback; - /** 职位 */ - title?: string; - /** 网站 */ - url?: string; - /** 微信号 */ - weChatNumber?: string; - /** 工作地址城市 */ - workAddressCity?: string; - /** 工作地址国家 */ - workAddressCountry?: string; - /** 工作地址邮政编码 */ - workAddressPostalCode?: string; - /** 工作地址省份 */ - workAddressState?: string; - /** 工作地址街道 */ - workAddressStreet?: string; - /** 工作传真 */ - workFaxNumber?: string; - /** 工作电话 */ - workPhoneNumber?: string; - } - /** 动画效果 */ - interface AnimationOption { - /** 动画变化时间,单位 ms */ - duration?: number; - /** 动画变化方式 - * - * 可选值: - * - 'linear': 动画从头到尾的速度是相同的; - * - 'easeIn': 动画以低速开始; - * - 'easeOut': 动画以低速结束; - * - 'easeInOut': 动画以低速开始和结束; */ - timingFunc?: "linear" | "easeIn" | "easeOut" | "easeInOut"; - } - 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 AppendFileOption { - /** 要追加的文本或二进制数据 */ - data: string | ArrayBuffer; - /** 要追加内容的文件路径 */ - filePath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: AppendFileCompleteCallback; - /** 指定写入文件的字符编码 - * - * 可选值: - * - '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"; - /** 接口调用失败的回调函数 */ - fail?: AppendFileFailCallback; - /** 接口调用成功的回调函数 */ - success?: AppendFileSuccessCallback; - } - /** 用户授权设置信息,详情参考[权限](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html) */ - interface AuthSetting { - /** 是否授权通讯地址,对应接口 [wx.chooseAddress](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/address/wx.chooseAddress.html) */ - "scope.address": boolean; - /** 是否授权摄像头,对应[``]((camera)) 组件 */ - "scope.camera": boolean; - /** 是否授权获取发票,对应接口 [wx.chooseInvoice](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html) */ - "scope.invoice": boolean; - /** 是否授权发票抬头,对应接口 [wx.chooseInvoiceTitle](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoiceTitle.html) */ - "scope.invoiceTitle": boolean; - /** 是否授权录音功能,对应接口 [wx.startRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) */ - "scope.record": boolean; - /** 是否授权用户信息,对应接口 [wx.getUserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) */ - "scope.userInfo": boolean; - /** 是否授权地理位置,对应接口 [wx.getLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html), [wx.chooseLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) */ - "scope.userLocation": boolean; - /** 是否授权微信运动步数,对应接口 [wx.getWeRunData](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html) */ - "scope.werun": boolean; - /** 是否授权保存到相册 [wx.saveImageToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html), [wx.saveVideoToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html) */ - "scope.writePhotosAlbum": boolean; - } - interface AuthorizeOption { - /** 需要获取权限的 scope,详见 [scope 列表]((授权#scope-列表)) */ - scope: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: AuthorizeCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: AuthorizeFailCallback; - /** 接口调用成功的回调函数 */ - success?: AuthorizeSuccessCallback; - } - /** 设备服务列表 */ - interface BLECharacteristic { - /** 该特征值支持的操作类型 */ - properties: Properties; - /** 蓝牙设备特征值的 uuid */ - uuid: string; - } - /** 设备服务列表 */ - interface BLEService { - /** 该服务是否为主服务 */ - isPrimary: boolean; - /** 蓝牙设备服务的 uuid */ - uuid: string; - } - /** BackgroundAudioManager 实例,可通过 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 获取。 -* -* **示例代码** -* -* -* ```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 { - /** 音频已缓冲的时间,仅保证当前播放时间点到此时间点内容已缓冲。(只读) */ - buffered: number; - /** 封面图 URL,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图。 */ - coverImgUrl: string; - /** 当前音频的播放位置(单位:s),只有在有合法 src 时返回。(只读) */ - currentTime: number; - /** 当前音频的长度(单位:s),只有在有合法 src 时返回。(只读) */ - duration: number; - /** 专辑名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ - epname: string; - /** 当前是否暂停或停止。(只读) */ - paused: boolean; - /** 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。 - * - * 最低基础库: `1.9.94` */ - protocol: string; - /** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ - singer: string; - /** 音频的数据源({% version('2.2.3') %} 开始支持云文件ID)。默认为空字符串,**当设置了新的 src 时,会自动开始播放**,目前支持的格式有 m4a, aac, mp3, wav。 */ - src: string; - /** 音频开始播放的位置(单位:s)。 */ - startTime: number; - /** 音频标题,用于原生音频播放器音频标题(必填)。原生音频播放器中的分享功能,分享出去的卡片标题,也将使用该值。 */ - title: string; - /** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */ - webUrl: string; - } - /** 搜索到的设备列表 */ - interface BluetoothDeviceInfo { - /** 用于区分设备的 id */ - deviceId: string; - /** 蓝牙设备名称,某些设备可能没有 */ - name: string; - } - interface BoundingClientRectCallbackResult { - /** 节点的下边界坐标 */ - bottom: number; - /** 节点的 dataset */ - dataset: object; - /** 节点的高度 */ - height: number; - /** 节点的 ID */ - id: string; - /** 节点的左边界坐标 */ - left: number; - /** 节点的右边界坐标 */ - right: number; - /** 节点的上边界坐标 */ - top: number; - /** 节点的宽度 */ - width: number; - } - /** 目标边界 */ - interface BoundingClientRectResult { - /** 下边界 */ - bottom: number; - /** 左边界 */ - left: number; - /** 右边界 */ - right: number; - /** 上边界 */ - top: number; - } - /** 新搜索到的设备列表 */ - interface CallbackResultBlueToothDevice { - /** 当前蓝牙设备的信号强度 */ - RSSI: number; - /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */ - advertisData: ArrayBuffer; - /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */ - advertisServiceUUIDs: string[]; - /** 用于区分设备的 id */ - deviceId: string; - /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */ - localName: string; - /** 蓝牙设备名称,某些设备可能没有 */ - name: string; - /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */ - serviceData: object; - } - interface CameraContextStartRecordOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CameraContextStartRecordCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: CameraContextStartRecordFailCallback; - /** 接口调用成功的回调函数 */ - success?: CameraContextStartRecordSuccessCallback; - /** 超过30s或页面 `onHide` 时会结束录像 */ - timeoutCallback?: StartRecordTimeoutCallback; - } - /** canvas 组件的绘图上下文 */ - interface CanvasContext { - /** 填充颜色。用法同 [CanvasContext.setFillStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)。 - * - * 最低基础库: `1.9.90` */ - fillStyle: string; - /** 当前字体样式的属性。符合 [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; - /** 线条的端点样式。用法同 [CanvasContext.setLineCap()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)。 - * - * 最低基础库: `1.9.90` */ - lineCap: number; - /** 虚线偏移量,初始值为0 - * - * 最低基础库: `1.9.90` */ - lineDashOffset: number; - /** 线条的交点样式。用法同 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)。 - * - * 最低基础库: `1.9.90` */ - lineJoin: number; - /** 线条的宽度。用法同 [CanvasContext.setLineWidth()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)。 - * - * 最低基础库: `1.9.90` */ - lineWidth: number; - /** 最大斜接长度。用法同 [CanvasContext.setMiterLimit()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)。 - * - * 最低基础库: `1.9.90` */ - miterLimit: number; - /** 阴影的模糊级别 - * - * 最低基础库: `1.9.90` */ - shadowBlur: number; - /** 阴影的颜色 - * - * 最低基础库: `1.9.90` */ - shadowColor: number; - /** 阴影相对于形状在水平方向的偏移 - * - * 最低基础库: `1.9.90` */ - shadowOffsetX: number; - /** 阴影相对于形状在竖直方向的偏移 - * - * 最低基础库: `1.9.90` */ - shadowOffsetY: number; - /** 边框颜色。用法同 [CanvasContext.setFillStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)。 - * - * 最低基础库: `1.9.90` */ - strokeStyle: string; - } - interface CanvasGetImageDataOption { - /** 画布标识,传入 `` 组件的 `canvas-id` 属性。 */ - canvasId: string; - /** 将要被提取的图像数据矩形区域的高度 */ - height: number; - /** 将要被提取的图像数据矩形区域的宽度 */ - width: number; - /** 将要被提取的图像数据矩形区域的左上角横坐标 */ - x: number; - /** 将要被提取的图像数据矩形区域的左上角纵坐标 */ - y: number; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CanvasGetImageDataCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: CanvasGetImageDataFailCallback; - /** 接口调用成功的回调函数 */ - success?: CanvasGetImageDataSuccessCallback; - } - interface CanvasGetImageDataSuccessCallbackResult { - /** 图像数据矩形的高度 */ - height: number; - /** 图像数据矩形的宽度 */ - width: number; - } - interface CanvasPutImageDataOption { - /** 画布标识,传入 `` 组件的 canvas-id 属性。 */ - canvasId: string; - /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */ - data: Uint8ClampedArray; - /** 源图像数据矩形区域的高度 */ - height: number; - /** 源图像数据矩形区域的宽度 */ - width: number; - /** 源图像数据在目标画布中的位置偏移量(x 轴方向的偏移量) */ - x: number; - /** 源图像数据在目标画布中的位置偏移量(y 轴方向的偏移量) */ - y: number; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CanvasPutImageDataCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: CanvasPutImageDataFailCallback; - /** 接口调用成功的回调函数 */ - success?: CanvasPutImageDataSuccessCallback; - } - interface CanvasToTempFilePathOption { - /** 画布标识,传入 `` 组件的 canvas-id */ - canvasId: string; - /** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 - * - * 最低基础库: `1.7.0` */ - quality: number; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CanvasToTempFilePathCompleteCallback; - /** 输出的图片的高度 - * - * 最低基础库: `1.2.0` */ - destHeight?: number; - /** 输出的图片的宽度 - * - * 最低基础库: `1.2.0` */ - destWidth?: number; - /** 接口调用失败的回调函数 */ - fail?: CanvasToTempFilePathFailCallback; - /** 目标文件的类型 - * - * 可选值: - * - 'jpg': jpg 图片; - * - 'png': png 图片; - * - * 最低基础库: `1.7.0` */ - fileType?: "jpg" | "png"; - /** 指定的画布区域的高度 - * - * 最低基础库: `1.2.0` */ - height?: number; - /** 接口调用成功的回调函数 */ - success?: CanvasToTempFilePathSuccessCallback; - /** 指定的画布区域的宽度 - * - * 最低基础库: `1.2.0` */ - width?: number; - /** 指定的画布区域的左上角横坐标 - * - * 最低基础库: `1.2.0` */ - x?: number; - /** 指定的画布区域的左上角纵坐标 - * - * 最低基础库: `1.2.0` */ - y?: number; - } - interface CanvasToTempFilePathSuccessCallbackResult { - /** 生成文件的临时路径 */ - tempFilePath: string; - } - /** 卡券的扩展参数。需进行 JSON 序列化为**字符串**传入 */ - interface CardExt { - /** 签名,商户将接口列表中的参数按照指定方式进行签名,签名方式使用 SHA1,具体签名方案参见:[卡券签名](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */ - signature: string; - /** 时间戳,东八区时间,UTC+8,单位为秒 */ - timestamp: number; - /** 用户领取的 code,仅自定义 code 模式的卡券须填写,非自定义 code 模式卡券不可填写,[详情](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025056) */ - code?: string; - /** 卡券在第三方系统的实际领取时间,为东八区时间戳(UTC+8,精确到秒)。当卡券的有效期类为 DATE_TYPE_FIX_TERM 时专用,标识卡券的实际生效时间,用于解决商户系统内起始时间和领取微信卡券时间不同步的问题。 */ - fixed_begintimestamp?: number; - /** 随机字符串,由开发者设置传入,加强安全性(若不填写可能被重放请求)。随机字符串,不长于 32 位。推荐使用大小写字母和数字,不同添加请求的 nonce_str 须动态生成,若重复将会导致领取失败。 */ - nonce_str?: string; - /** 指定领取者的 openid,只有该用户能领取。 bind_openid 字段为 true 的卡券必须填写,bind_openid 字段为 false 不可填写。 */ - openid?: string; - /** 领取渠道参数,用于标识本次领取的渠道值。 */ - outer_str?: string; - } - interface CheckIsSoterEnrolledInDeviceOption { - /** 认证方式 - * - * 可选值: - * - 'fingerPrint': 指纹识别; - * - 'facial': 人脸识别(暂未支持); - * - 'speech': 声纹识别(暂未支持); */ - checkAuthMode: Array<"fingerPrint" | "facial" | "speech">; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: CheckIsSoterEnrolledInDeviceCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: CheckIsSoterEnrolledInDeviceFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: CheckIsSoterEnrolledInDeviceSuccessCallback; - } - interface CheckIsSoterEnrolledInDeviceSuccessCallbackResult { - /** 错误信息 */ - errMs: string; - /** 是否已录入信息 */ - isEnrolled: boolean; - } - interface CheckIsSupportSoterAuthenticationOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: CheckIsSupportSoterAuthenticationCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: CheckIsSupportSoterAuthenticationFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: CheckIsSupportSoterAuthenticationSuccessCallback; - } - interface CheckIsSupportSoterAuthenticationSuccessCallbackResult { - /** 该设备支持的可被SOTER识别的生物识别方式 - * - * 可选值: - * - 'fingerPrint': 指纹识别; - * - 'facial': 人脸识别(暂未支持); - * - 'speech': 声纹识别(暂未支持); */ - supportMode: Array<"fingerPrint" | "facial" | "speech">; - } - interface CheckSessionOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: CheckSessionCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: CheckSessionFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: CheckSessionSuccessCallback; - } - interface ChooseAddressOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ChooseAddressCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ChooseAddressFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ChooseAddressSuccessCallback; - } - interface ChooseAddressSuccessCallbackResult { - /** 国标收货地址第一级地址 */ - cityName: string; - /** 国标收货地址第一级地址 */ - countyName: string; - /** 详细收货地址信息 */ - detailInfo: string; - /** 错误信息 */ - errMsg: string; - /** 收货地址国家码 */ - nationalCode: string; - /** 邮编 */ - postalCode: string; - /** 国标收货地址第一级地址 */ - provinceName: string; - /** 收货人手机号码 */ - telNumber: string; - /** 收货人姓名 */ - userName: string; - } - interface ChooseImageOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ChooseImageCompleteCallback; - /** 最多可以选择的图片张数 */ - count?: number; - - /** 接口调用失败的回调函数 */ - - fail?: ChooseImageFailCallback; - /** 所选的图片的尺寸 - * - * 可选值: - * - 'original': 原图; - * - 'compressed': 压缩图; */ - sizeType?: Array<"original" | "compressed">; - /** 选择图片的来源 - * - * 可选值: - * - 'album': 从相册选图; - * - 'camera': 使用相机; */ - sourceType?: Array<"album" | "camera">; - - /** 接口调用成功的回调函数 */ - - success?: ChooseImageSuccessCallback; - } - interface ChooseImageSuccessCallbackResult { - /** 图片的本地临时文件路径列表 */ - tempFilePaths: string[]; - /** 图片的本地临时文件列表 - * - * 最低基础库: `1.2.0` */ - tempFiles: ImageFile[]; - } - interface ChooseInvoiceOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ChooseInvoiceCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ChooseInvoiceFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ChooseInvoiceSuccessCallback; - } - interface ChooseInvoiceSuccessCallbackResult { - /** 用户选中的发票列表 */ - invoiceInfo: InvoiceInfo; - } - interface ChooseInvoiceTitleOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ChooseInvoiceTitleCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ChooseInvoiceTitleFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ChooseInvoiceTitleSuccessCallback; - } - interface ChooseInvoiceTitleSuccessCallbackResult { - /** 银行账号 */ - bankAccount: string; - /** 银行名称 */ - bankName: string; - /** 单位地址 */ - companyAddress: string; - /** 错误信息 */ - errMsg: string; - /** 抬头税号 */ - taxNumber: string; - /** 手机号码 */ - telephone: string; - /** 抬头名称 */ - title: string; - /** 抬头类型 - * - * 可选值: - * - 0: 单位; - * - 1: 个人; */ - type: 0 | 1; - } - interface ChooseLocationOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ChooseLocationCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ChooseLocationFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ChooseLocationSuccessCallback; - } - interface ChooseLocationSuccessCallbackResult { - /** 详细地址 */ - address: string; - /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */ - latitude: string; - /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */ - longitude: string; - /** 位置名称 */ - name: string; - } - interface ChooseVideoOption { - /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效 - * - * 可选值: - * - 'back': 默认拉起后置摄像头; - * - 'front': 默认拉起前置摄像头; */ - camera?: "back" | "front"; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ChooseVideoCompleteCallback; - /** 是否压缩所选择的视频文件 - * - * 最低基础库: `1.6.0` */ - compressed?: boolean; - - /** 接口调用失败的回调函数 */ - - fail?: ChooseVideoFailCallback; - /** 拍摄视频最长拍摄时间,单位秒 */ - maxDuration?: number; - /** 视频选择的来源 - * - * 可选值: - * - 'album': 从相册选择视频; - * - 'camera': 使用相机拍摄视频; */ - sourceType?: Array<"album" | "camera">; - - /** 接口调用成功的回调函数 */ - - success?: ChooseVideoSuccessCallback; - } - interface ChooseVideoSuccessCallbackResult { - /** 选定视频的时间长度 */ - duration: number; - /** 返回选定视频的高度 */ - height: number; - /** 选定视频的数据量大小 */ - size: number; - /** 选定视频的临时文件路径 */ - tempFilePath: string; - /** 返回选定视频的宽度 */ - width: number; - } - interface ClearStorageOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ClearStorageCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ClearStorageFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ClearStorageSuccessCallback; - } - interface CloseBLEConnectionOption { - /** 用于区分设备的 id */ - deviceId: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CloseBLEConnectionCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: CloseBLEConnectionFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: CloseBLEConnectionSuccessCallback; - } - interface CloseBluetoothAdapterOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: CloseBluetoothAdapterCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: CloseBluetoothAdapterFailCallback; - /** 接口调用成功的回调函数 */ - success?: CloseBluetoothAdapterSuccessCallback; - } - interface CloseOption { - /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ - code?: number; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: CloseCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: CloseFailCallback; - /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ - reason?: string; - - /** 接口调用成功的回调函数 */ - - success?: CloseSuccessCallback; - } - interface CloseSocketOption { - /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */ - code?: number; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: CloseSocketCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: CloseSocketFailCallback; - /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */ - reason?: string; - /** 接口调用成功的回调函数 */ - success?: CloseSocketSuccessCallback; - } - /** 颜色。可以用以下几种方式来表示 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 CompressImageOption { - /** 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径 */ - src: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: CompressImageCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: CompressImageFailCallback; - /** 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 */ - quality?: number; - - /** 接口调用成功的回调函数 */ - - success?: CompressImageSuccessCallback; - } - interface ConnectSocketOption { - /** 开发者服务器 wss 接口地址 */ - url: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ConnectSocketCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ConnectSocketFailCallback; - /** HTTP Header,Header 中不能设置 Referer */ - header?: object; - /** 子协议数组 - * - * 最低基础库: `1.4.0` */ - protocols?: string[]; - - /** 接口调用成功的回调函数 */ - - success?: ConnectSocketSuccessCallback; - } - interface ConnectWifiOption { - /** Wi-Fi 设备 BSSID */ - BSSID: string; - /** Wi-Fi 设备 SSID */ - SSID: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: ConnectWifiCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: ConnectWifiFailCallback; - /** Wi-Fi 设备密码 */ - password?: string; - /** 接口调用成功的回调函数 */ - - success?: ConnectWifiSuccessCallback; - } - interface ContextCallbackResult { - /** 节点对应的 Context 对象 */ - context: object; - } - interface CopyFileFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail permission denied, copyFile ${srcPath} -> ${destPath}': 指定目标文件路径没有写权限; - * - 'fail no such file or directory, copyFile ${srcPath} -> ${destPath}': 源文件不存在,或目标文件路径的上层目录不存在; */ - errMsg: string; - } - interface CopyFileOption { - /** 目标文件路径 */ - destPath: string; - /** 源文件路径,只可以是普通文件 */ - srcPath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: CopyFileCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: CopyFileFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: CopyFileSuccessCallback; - } - interface CreateAnimationOption { - /** 动画延迟时间,单位 ms */ - delay?: number; - /** 动画持续时间,单位 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"; - transformOrigin?: string; - } - interface CreateBLEConnectionOption { - /** 用于区分设备的 id */ - deviceId: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: CreateBLEConnectionCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: CreateBLEConnectionFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: CreateBLEConnectionSuccessCallback; - /** 超时时间,单位ms,不填表示不会超时 */ - timeout?: number; - } - /** 选项 */ - interface CreateIntersectionObserverOption { - /** 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。 */ - initialRatio?: number; - /** 是否同时观测多个目标节点(而非一个),如果设为 true ,observe 的 targetSelector 将选中多个节点(注意:同时选中过多节点将影响渲染性能) - * - * 最低基础库: `2.0.0` */ - observeAll?: boolean; - /** 一个数值数组,包含所有阈值。 */ - thresholds?: number[]; - } - /** 弹幕内容 */ - interface Danmu { - /** 弹幕文字 */ - text: string; - /** 弹幕颜色 */ - color?: string; - } - /** 上报的自定义数据。 */ - interface Data { - /** 配置中的字段名 */ - key: string; - /** 上报的数据 */ - value: any; - } - /** 可选的字体描述符 */ - interface DescOption { - /** 字体样式,可选值为 normal / italic / oblique */ - style?: string; - /** 设置小型大写字母的字体显示文本,可选值为 normal / small-caps / inherit */ - variant?: string; - /** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */ - weight?: string; - } - /** 指定 marker 移动到的目标点 */ - interface DestinationOption { - /** 纬度 */ - latitude: number; - /** 经度 */ - longitude: number; - } - interface DownloadFileOption { - /** 下载资源的 url */ - url: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: DownloadFileCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: DownloadFileFailCallback; - /** 指定文件下载后存储的路径 - * - * 最低基础库: `1.8.0` */ - filePath?: string; - /** HTTP 请求的 Header,Header 中不能设置 Referer */ - header?: object; - - /** 接口调用成功的回调函数 */ - - success?: DownloadFileSuccessCallback; - } - interface DownloadFileSuccessCallbackResult { - /** 开发者服务器返回的 HTTP 状态码 */ - statusCode: number; - /** 临时文件路径。如果没传入 filePath 指定文件存储路径,则下载后的文件会存储到一个临时文件 */ - tempFilePath: string; - } - interface DownloadTaskOnHeadersReceivedCallbackResult { - /** 开发者服务器返回的 HTTP Response Header */ - header: object; - } - interface DownloadTaskOnProgressUpdateCallbackResult { - /** 下载进度百分比 */ - progress: number; - /** 预期需要下载的数据总长度,单位 Bytes */ - totalBytesExpectedToWrite: number; - /** 已经下载的数据长度,单位 Bytes */ - totalBytesWritten: number; - } - interface ExitFullScreenOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ExitFullScreenCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ExitFullScreenFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ExitFullScreenSuccessCallback; - } - interface ExtInfo { - /** 第三方平台自定义的数据 */ - extConfig: object; - } - interface Fields { - /** 指定样式名列表,返回节点对应样式名的当前值 - * - * 最低基础库: `2.1.0` */ - computedStyle?: string[]; - /** 是否返回节点对应的 Context 对象 - * - * 最低基础库: `2.4.2` */ - context?: boolean; - /** 是否返回节点 dataset */ - dataset?: boolean; - /** 是否返回节点 id */ - id?: boolean; - /** 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) */ - properties?: string[]; - /** 是否返回节点布局位置(`left` `right` `top` `bottom`) */ - rect?: boolean; - /** 否 是否返回节点的 `scrollLeft` `scrollTop`,节点必须是 `scroll-view` 或者 `viewport` */ - scrollOffset?: boolean; - /** 是否返回节点尺寸(`width` `height`) */ - size?: boolean; - } - interface FileSystemManagerGetFileInfoOption { - /** 要读取的文件路径 */ - filePath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: FileSystemManagerGetFileInfoCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: FileSystemManagerGetFileInfoFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: FileSystemManagerGetFileInfoSuccessCallback; - } - interface FileSystemManagerGetFileInfoSuccessCallbackResult { - /** 文件大小,以字节为单位 */ - size: number; - } - interface FileSystemManagerGetSavedFileListOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: FileSystemManagerGetSavedFileListCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: FileSystemManagerGetSavedFileListFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: FileSystemManagerGetSavedFileListSuccessCallback; - } - interface FileSystemManagerGetSavedFileListSuccessCallbackResult { - /** 文件数组 */ - fileList: FileSystemManagerGetSavedFileListSuccessCallbackResultFileItem; - } - /** 文件数组 */ - interface FileSystemManagerGetSavedFileListSuccessCallbackResultFileItem { - /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */ - createTime: number; - /** 本地路径 */ - filePath: string; - /** 本地文件大小,以字节为单位 */ - size: number; - } - interface FileSystemManagerRemoveSavedFileOption { - /** 需要删除的文件路径 */ - filePath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: FileSystemManagerRemoveSavedFileCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: FileSystemManagerRemoveSavedFileFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: FileSystemManagerRemoveSavedFileSuccessCallback; - } - interface FileSystemManagerSaveFileOption { - /** 临时存储文件路径 */ - tempFilePath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: FileSystemManagerSaveFileCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: FileSystemManagerSaveFileFailCallback; - /** 要存储的文件路径 */ - filePath?: string; - /** 接口调用成功的回调函数 */ - success?: FileSystemManagerSaveFileSuccessCallback; - } - interface FileSystemManagerSaveFileSuccessCallbackResult { - /** 存储后的文件路径 */ - savedFilePath: number; - } - interface GetAvailableAudioSourcesOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetAvailableAudioSourcesCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: GetAvailableAudioSourcesFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetAvailableAudioSourcesSuccessCallback; - } - interface GetAvailableAudioSourcesSuccessCallbackResult { - /** 支持的音频输入源列表,可在 [RecorderManager.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.start.html) 接口中使用。返回值定义参考 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: Array< - | "auto" - | "buildInMic" - | "headsetMic" - | "mic" - | "camcorder" - | "voice_communication" - | "voice_recognition" - >; - } - interface GetBLEDeviceCharacteristicsOption { - /** 蓝牙设备 id */ - deviceId: string; - /** 蓝牙服务 uuid,需要使用 `getBLEDeviceServices` 获取 */ - serviceId: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetBLEDeviceCharacteristicsCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetBLEDeviceCharacteristicsFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetBLEDeviceCharacteristicsSuccessCallback; - } - interface GetBLEDeviceCharacteristicsSuccessCallbackResult { - /** 设备服务列表 */ - characteristics: BLECharacteristic; - } - interface GetBLEDeviceServicesOption { - /** 蓝牙设备 id */ - deviceId: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetBLEDeviceServicesCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetBLEDeviceServicesFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetBLEDeviceServicesSuccessCallback; - } - interface GetBLEDeviceServicesSuccessCallbackResult { - /** 设备服务列表 */ - services: BLEService; - } - interface GetBackgroundAudioPlayerStateOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetBackgroundAudioPlayerStateCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetBackgroundAudioPlayerStateFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetBackgroundAudioPlayerStateSuccessCallback; - } - interface GetBackgroundAudioPlayerStateSuccessCallbackResult { - /** 选定音频的播放位置(单位:s),只有在音乐播放中时返回 */ - currentPosition: number; - /** 歌曲数据链接,只有在音乐播放中时返回 */ - dataUrl: string; - /** 音频的下载进度百分比,只有在音乐播放中时返回 */ - downloadPercent: number; - /** 选定音频的长度(单位:s),只有在音乐播放中时返回 */ - duration: number; - /** 播放状态 - * - * 可选值: - * - 0: 暂停中; - * - 1: 播放中; - * - 2: 没有音乐播放; */ - status: 0 | 1 | 2; - } - interface GetBatteryInfoOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetBatteryInfoCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetBatteryInfoFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetBatteryInfoSuccessCallback; - } - interface GetBatteryInfoSuccessCallbackResult { - /** 是否正在充电中 */ - isCharging: boolean; - /** 设备电量,范围 1 - 100 */ - level: string; - } - interface GetBatteryInfoSyncResult { - /** 是否正在充电中 */ - isCharging: boolean; - /** 设备电量,范围 1 - 100 */ - level: string; - } - interface GetBeaconsOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetBeaconsCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetBeaconsFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetBeaconsSuccessCallback; - } - interface GetBeaconsSuccessCallbackResult { - /** iBeacon 设备列表 */ - beacons: IBeaconInfo[]; - } - interface GetBluetoothAdapterStateOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetBluetoothAdapterStateCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetBluetoothAdapterStateFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetBluetoothAdapterStateSuccessCallback; - } - interface GetBluetoothAdapterStateSuccessCallbackResult { - /** 蓝牙适配器是否可用 */ - available: boolean; - /** 是否正在搜索设备 */ - discovering: boolean; - } - interface GetBluetoothDevicesOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetBluetoothDevicesCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetBluetoothDevicesFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetBluetoothDevicesSuccessCallback; - } - interface GetBluetoothDevicesSuccessCallbackResult { - /** uuid 对应的的已连接设备列表 */ - devices: GetBluetoothDevicesSuccessCallbackResultBlueToothDevice; - } - /** uuid 对应的的已连接设备列表 */ - interface GetBluetoothDevicesSuccessCallbackResultBlueToothDevice { - /** 当前蓝牙设备的信号强度 */ - RSSI: number; - /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */ - advertisData: ArrayBuffer; - /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */ - advertisServiceUUIDs: string[]; - /** 用于区分设备的 id */ - deviceId: string; - /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */ - localName: string; - /** 蓝牙设备名称,某些设备可能没有 */ - name: string; - /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */ - serviceData: object; - } - interface GetCenterLocationOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetCenterLocationCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetCenterLocationFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetCenterLocationSuccessCallback; - } - interface GetCenterLocationSuccessCallbackResult { - /** 纬度 */ - latitude: number; - /** 经度 */ - longitude: number; - } - interface GetClipboardDataOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetClipboardDataCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetClipboardDataFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetClipboardDataSuccessCallback; - } - interface GetClipboardDataSuccessCallbackOption { - /** 剪贴板的内容 */ - data: string; - } - interface GetConnectedBluetoothDevicesOption { - /** 蓝牙设备主 service 的 uuid 列表 */ - services: string[]; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetConnectedBluetoothDevicesCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetConnectedBluetoothDevicesFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetConnectedBluetoothDevicesSuccessCallback; - } - interface GetConnectedBluetoothDevicesSuccessCallbackResult { - /** 搜索到的设备列表 */ - devices: BluetoothDeviceInfo; - } - interface GetConnectedWifiOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetConnectedWifiCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetConnectedWifiFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetConnectedWifiSuccessCallback; - } - interface GetConnectedWifiSuccessCallbackResult { - /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html) - * - * Wi-Fi 信息 */ - wifi: WifiInfo; - } - interface GetExtConfigOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetExtConfigCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetExtConfigFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetExtConfigSuccessCallback; - } - interface GetExtConfigSuccessCallbackResult { - /** 第三方平台自定义的数据 */ - extConfig: object; - } - interface GetFileInfoFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail file not exist': 指定的 filePath 找不到文件; */ - errMsg: string; - } - interface GetHCEStateOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetHCEStateCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: GetHCEStateFailCallback; - /** 接口调用成功的回调函数 */ - success?: GetHCEStateSuccessCallback; - } - interface GetImageInfoOption { - /** 图片的路径,可以是相对路径、临时文件路径、存储文件路径、网络图片路径 */ - src: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: GetImageInfoCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: GetImageInfoFailCallback; - /** 接口调用成功的回调函数 */ - success?: GetImageInfoSuccessCallback; - } - interface GetImageInfoSuccessCallbackResult { - /** 图片原始高度,单位px。不考虑旋转。 */ - height: number; - /** [拍照时设备方向](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"; - /** 图片的本地路径 */ - path: string; - /** 图片格式 - * - * 最低基础库: `1.9.90` */ - type: string; - /** 图片原始宽度,单位px。不考虑旋转。 */ - width: number; - } - interface GetLocationOption { - /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 - * - * 最低基础库: `1.6.0` */ - altitude?: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetLocationCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetLocationFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetLocationSuccessCallback; - /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */ - type?: string; - } - interface GetLocationSuccessCallbackResult { - /** 位置的精确度 */ - accuracy: number; - /** 高度,单位 m - * - * 最低基础库: `1.2.0` */ - altitude: number; - /** 水平精度,单位 m - * - * 最低基础库: `1.2.0` */ - horizontalAccuracy: number; - /** 纬度,范围为 -90~90,负数表示南纬 */ - latitude: number; - /** 经度,范围为 -180~180,负数表示西经 */ - longitude: number; - /** 速度,单位 m/s */ - speed: number; - /** 垂直精度,单位 m(Android 无法获取,返回 0) - * - * 最低基础库: `1.2.0` */ - verticalAccuracy: number; - } - interface GetNetworkTypeOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetNetworkTypeCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetNetworkTypeFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetNetworkTypeSuccessCallback; - } - interface GetNetworkTypeSuccessCallbackResult { - /** 网络类型 - * - * 可选值: - * - 'wifi': wifi 网络; - * - '2g': 2g 网络; - * - '3g': 3g 网络; - * - '4g': 4g 网络; - * - 'unknown': Android 下不常见的网络类型; - * - 'none': 无网络; */ - networkType: "wifi" | "2g" | "3g" | "4g" | "unknown" | "none"; - } - interface GetRegionOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetRegionCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetRegionFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetRegionSuccessCallback; - } - interface GetRegionSuccessCallbackResult { - /** 东北角经纬度 */ - northeast: number; - /** 西南角经纬度 */ - southwest: number; - } - interface GetSavedFileInfoOption { - /** 文件路径 */ - filePath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetSavedFileInfoCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetSavedFileInfoFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetSavedFileInfoSuccessCallback; - } - interface GetSavedFileInfoSuccessCallbackResult { - /** 文件保存时的时间戳,从1970/01/01 08:00:00 到该时刻的秒数 */ - createTime: number; - /** 文件大小,单位 B */ - size: number; - } - interface GetScaleOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetScaleCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetScaleFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetScaleSuccessCallback; - } - interface GetScaleSuccessCallbackResult { - /** 缩放值 */ - scale: number; - } - interface GetScreenBrightnessOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetScreenBrightnessCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetScreenBrightnessFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetScreenBrightnessSuccessCallback; - } - interface GetScreenBrightnessSuccessCallbackOption { - /** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮 */ - value: number; - } - interface GetSettingOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetSettingCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetSettingFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetSettingSuccessCallback; - } - interface GetSettingSuccessCallbackResult { - /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html) - * - * 用户授权结果 */ - authSetting: AuthSetting; - } - interface GetShareInfoOption { - /** shareTicket */ - shareTicket: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetShareInfoCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetShareInfoFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetShareInfoSuccessCallback; - /** 超时时间,单位 ms - * - * 最低基础库: `1.9.90` */ - timeout?: number; - } - interface GetShareInfoSuccessCallbackResult { - /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法]((开放数据校验与解密)) */ - encryptedData: string; - /** 错误信息 */ - errMsg: string; - /** 加密算法的初始向量,详细见[加密数据解密算法]((开放数据校验与解密)) */ - iv: string; - } - interface GetStorageInfoOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetStorageInfoCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetStorageInfoFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetStorageInfoSuccessCallback; - } - interface GetStorageInfoSuccessCallbackOption { - /** 当前占用的空间大小, 单位 KB */ - currentSize: number; - /** 当前 storage 中所有的 key */ - keys: string[]; - /** 限制的空间大小,单位 KB */ - limitSize: number; - } - interface GetStorageInfoSyncOption { - /** 当前占用的空间大小, 单位 KB */ - currentSize: number; - /** 当前 storage 中所有的 key */ - keys: string[]; - /** 限制的空间大小,单位 KB */ - limitSize: number; - } - interface GetStorageOption { - /** 本地缓存中指定的 key */ - key: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetStorageCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: GetStorageFailCallback; - /** 接口调用成功的回调函数 */ - success?: GetStorageSuccessCallback; - } - interface GetStorageSuccessCallbackResult { - /** key对应的内容 */ - data: any; - } - interface GetSystemInfoOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: GetSystemInfoCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: GetSystemInfoFailCallback; - /** 接口调用成功的回调函数 */ - success?: GetSystemInfoSuccessCallback; - } - interface GetSystemInfoSuccessCallbackResult { - /** 客户端基础库版本 - * - * 最低基础库: `1.1.0` */ - SDKVersion: string; - /** (仅Android小游戏) 性能等级,-2 或 0:该设备无法运行小游戏,-1:性能未知,>=1 设备性能值,该值越高,设备性能越好 (目前设备最高不到50) - * - * 最低基础库: `1.8.0` */ - benchmarkLevel: number; - /** 手机品牌 - * - * 最低基础库: `1.5.0` */ - brand: string; - /** 用户字体大小设置。以“我-设置-通用-字体大小”中的设置为准,单位 px。 - * - * 最低基础库: `1.5.0` */ - fontSizeSetting: number; - /** 微信设置的语言 */ - language: string; - /** 手机型号 */ - model: string; - /** 设备像素比 */ - pixelRatio: number; - /** 客户端平台 */ - platform: string; - /** 屏幕高度 - * - * 最低基础库: `1.1.0` */ - screenHeight: number; - /** 屏幕宽度 - * - * 最低基础库: `1.1.0` */ - screenWidth: number; - /** 状态栏的高度 - * - * 最低基础库: `1.9.0` */ - statusBarHeight: number; - /** 操作系统版本 */ - system: string; - /** 微信版本号 */ - version: string; - /** 可使用窗口高度 */ - windowHeight: number; - /** 可使用窗口宽度 */ - windowWidth: number; - } - interface GetSystemInfoSyncResult { - /** 客户端基础库版本 - * - * 最低基础库: `1.1.0` */ - SDKVersion: string; - /** (仅Android小游戏) 性能等级,-2 或 0:该设备无法运行小游戏,-1:性能未知,>=1 设备性能值,该值越高,设备性能越好 (目前设备最高不到50) - * - * 最低基础库: `1.8.0` */ - benchmarkLevel: number; - /** 手机品牌 - * - * 最低基础库: `1.5.0` */ - brand: string; - /** 用户字体大小设置。以“我-设置-通用-字体大小”中的设置为准,单位 px。 - * - * 最低基础库: `1.5.0` */ - fontSizeSetting: number; - /** 微信设置的语言 */ - language: string; - /** 手机型号 */ - model: string; - /** 设备像素比 */ - pixelRatio: number; - /** 客户端平台 */ - platform: string; - /** 屏幕高度 - * - * 最低基础库: `1.1.0` */ - screenHeight: number; - /** 屏幕宽度 - * - * 最低基础库: `1.1.0` */ - screenWidth: number; - /** 状态栏的高度 - * - * 最低基础库: `1.9.0` */ - statusBarHeight: number; - /** 操作系统版本 */ - system: string; - /** 微信版本号 */ - version: string; - /** 可使用窗口高度 */ - windowHeight: number; - /** 可使用窗口宽度 */ - windowWidth: number; - } - interface GetUserInfoOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetUserInfoCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetUserInfoFailCallback; - /** 显示用户信息的语言 - * - * 可选值: - * - 'en': 英文; - * - 'zh_CN': 简体中文; - * - 'zh_TW': 繁体中文; */ - lang?: "en" | "zh_CN" | "zh_TW"; - /** 接口调用成功的回调函数 */ - - success?: GetUserInfoSuccessCallback; - - /** 是否带上登录态信息。当 withCredentials 为 true 时,要求此前有调用过 wx.login 且登录态尚未过期,此时返回的数据会包含 encryptedData, iv 等敏感信息;当 withCredentials 为 false 时,不要求有登录态,返回的数据不包含 encryptedData, iv 等敏感信息。 */ - withCredentials?: boolean; - } - interface GetUserInfoSuccessCallbackResult { - /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */ - encryptedData: string; - /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */ - iv: string; - /** 不包括敏感信息的原始数据字符串,用于计算签名 */ - rawData: string; - /** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密]((signature)) */ - signature: string; - /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html) - * - * 用户信息对象,不包含 openid 等敏感信息 */ - userInfo: UserInfo; - } - interface GetWeRunDataOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetWeRunDataCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetWeRunDataFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetWeRunDataSuccessCallback; - } - interface GetWeRunDataSuccessCallbackResult { - /** 包括敏感数据在内的完整用户信息的加密数据,详细见[加密数据解密算法]((signature))。解密后得到的数据结构见后文 */ - encryptedData: string; - /** 加密算法的初始向量,详细见[加密数据解密算法]((signature)) */ - iv: string; - } - interface GetWifiListOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: GetWifiListCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: GetWifiListFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: GetWifiListSuccessCallback; - } - interface HideLoadingOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: HideLoadingCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: HideLoadingFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: HideLoadingSuccessCallback; - } - interface HideNavigationBarLoadingOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: HideNavigationBarLoadingCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: HideNavigationBarLoadingFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: HideNavigationBarLoadingSuccessCallback; - } - interface HideShareMenuOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: HideShareMenuCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: HideShareMenuFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: HideShareMenuSuccessCallback; - } - interface HideTabBarOption { - /** 是否需要动画效果 */ - animation?: boolean; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: HideTabBarCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: HideTabBarFailCallback; - /** 接口调用成功的回调函数 */ - success?: HideTabBarSuccessCallback; - } - interface HideTabBarRedDotOption { - /** tabBar 的哪一项,从左边算起 */ - index: number; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: HideTabBarRedDotCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: HideTabBarRedDotFailCallback; - /** 接口调用成功的回调函数 */ - success?: HideTabBarRedDotSuccessCallback; - } - interface HideToastOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: HideToastCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: HideToastFailCallback; - /** 接口调用成功的回调函数 */ - - success?: HideToastSuccessCallback; - } - interface IBeaconInfo { - /** iBeacon 设备的距离 */ - accuracy: number; - - /** iBeacon 设备的主 id */ - major: string; - /** iBeacon 设备的次 id */ - minor: string; - /** 表示设备距离的枚举值 */ - proximity: number; - /** 表示设备的信号强度 */ - rssi: number; - /** iBeacon 设备广播的 uuid */ - uuid: string; - } - /** 图片的本地临时文件列表 - * - * 最低基础库: `1.2.0` */ - interface ImageFile { - /** 本地临时文件路径 */ - path: string; - /** 本地临时文件大小,单位 B */ - size: number; - } - interface IncludePointsOption { - /** 要显示在可视区域内的坐标点列表 */ - points: MapPostion; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: IncludePointsCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: IncludePointsFailCallback; - /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左],安卓上只能识别数组第一项,上下左右的padding一致。开发者工具暂不支持padding参数。 */ - padding?: number[]; - /** 接口调用成功的回调函数 */ - success?: IncludePointsSuccessCallback; - } - /** InnerAudioContext 实例,可通过 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 接口获取实例。 -* -* **支持格式** -* -* -* | 格式 | iOS | Android | -* | ---- | ---- | ------- | -* | flac | x | √ | -* | m4a | x | √ | -* | ogg | x | √ | -* | ape | x | √ | -* | amr | x | √ | -* | wma | x | √ | -* | wav | √ | √ | -* | mp3 | √ | √ | -* | mp4 | x | √ | -* | aac | √ | √ | -* | aiff | √ | x | -* | caf | √ | x | -* -* **示例代码** -* -* -* ```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 { - /** 是否自动开始播放,默认为 `false` */ - autoplay: boolean; - /** 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲(只读) */ - buffered: number; - /** 当前音频的播放位置(单位 s)。只有在当前有合法的 src 时返回,时间保留小数点后 6 位(只读) */ - currentTime: number; - /** 当前音频的长度(单位 s)。只有在当前有合法的 src 时返回(只读) */ - duration: number; - /** 是否循环播放,默认为 `false` */ - loop: boolean; - /** 是否遵循系统静音开关,默认为 `true`。当此参数为 `false` 时,即使用户打开了静音开关,也能继续发出声音 */ - obeyMuteSwitch: boolean; - /** 当前是是否暂停或停止状态(只读) */ - paused: boolean; - /** 音频资源的地址,用于直接播放。{% version('2.2.3') %} 开始支持云文件ID */ - src: string; - /** 开始播放的位置(单位:s),默认为 0 */ - startTime: number; - /** 音量。范围 0~1。默认为 1 - * - * 最低基础库: `1.9.90` */ - volume: number; - } - interface InnerAudioContextOnErrorCallbackResult { - /** - * 可选值: - * - 10001: 系统错误; - * - 10002: 网络错误; - * - 10003: 文件错误; - * - 10004: 格式错误; - * - -1: 未知错误; */ - errCode: 10001 | 10002 | 10003 | 10004 | -1; - } - /** 相交区域的边界 */ - interface IntersectionRectResult { - /** 下边界 */ - bottom: number; - /** 左边界 */ - left: number; - /** 右边界 */ - right: number; - /** 上边界 */ - top: number; - } - /** 用户选中的发票列表 */ - interface InvoiceInfo { - /** 所选发票卡券的 cardId */ - cardId: string; - /** 所选发票卡券的加密 code,报销方可以通过 cardId 和 encryptCode 获得报销发票的信息。 */ - encryptCode: string; - /** 发票方的 appId */ - publisherAppId: string; - } - /** 启动参数 */ - interface LaunchOptionsApp { - /** 启动小程序的路径 */ - path: string; - /** 启动小程序的 query 参数 */ - query: object; - /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ - referrerInfo: ReferrerInfo; - /** 启动小程序的[场景值]((scene)) */ - scene: number; - /** shareTicket,详见[获取更多转发信息]((转发#获取更多转发信息)) */ - shareTicket: string; - } - interface LivePlayerContextPauseOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: LivePlayerContextPauseCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: LivePlayerContextPauseFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: LivePlayerContextPauseSuccessCallback; - } - interface LivePlayerContextRequestFullScreenOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: RequestFullScreenCompleteCallback; - - /** 设置全屏时的方向 - * - * 可选值: - * - 0: 正常竖向; - * - 90: 屏幕逆时针90度; - * - -90: 屏幕顺时针90度; */ - direction?: 0 | 90 | -90; - /** 接口调用失败的回调函数 */ - - fail?: RequestFullScreenFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: RequestFullScreenSuccessCallback; - } - interface LivePlayerContextResumeOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: LivePlayerContextResumeCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: LivePlayerContextResumeFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: LivePlayerContextResumeSuccessCallback; - } - interface LivePlayerContextStopOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: LivePlayerContextStopCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: LivePlayerContextStopFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: LivePlayerContextStopSuccessCallback; - } - interface LivePusherContextPauseOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: LivePusherContextPauseCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: LivePusherContextPauseFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: LivePusherContextPauseSuccessCallback; - } - interface LivePusherContextResumeOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: LivePusherContextResumeCompleteCallback; - /** 接口调用失败的回调函数 */ - - fail?: LivePusherContextResumeFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: LivePusherContextResumeSuccessCallback; - } - interface LivePusherContextStartOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StartSuccessCallback; - } - interface LivePusherContextStopOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: LivePusherContextStopCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: LivePusherContextStopFailCallback; - /** 接口调用成功的回调函数 */ - - success?: LivePusherContextStopSuccessCallback; - } - interface LoadFontFaceOption { - /** 定义的字体名称 */ - family: string; - /** 字体资源的地址。建议格式为 TTF 和 WOFF,WOFF2 在低版本的iOS上会不兼容。 */ - source: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: LoadFontFaceCompleteCallback; - /** 可选的字体描述符 */ - desc?: DescOption; - /** 接口调用失败的回调函数 */ - fail?: LoadFontFaceFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: LoadFontFaceSuccessCallback; - } - interface LoginOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: LoginCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: LoginFailCallback; - - /** 接口调用成功的回调函数 */ - success?: LoginSuccessCallback; - /** 超时时间,单位ms - * - * 最低基础库: `1.9.90` */ - timeout?: number; - } - interface LoginSuccessCallbackResult { - /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [code2Session]((code2Session)),使用 code 换取 openid 和 session_key 等信息 */ - code: string; - } - interface MakePhoneCallOption { - /** 需要拨打的电话号码 */ - phoneNumber: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: MakePhoneCallCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: MakePhoneCallFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: MakePhoneCallSuccessCallback; - } - /** 要显示在可视区域内的坐标点列表 */ - interface MapPostion { - /** 纬度 */ - latitude: number; - /** 经度 */ - longitude: number; - } - /** 小程序帐号信息 */ - interface MiniProgram { - /** 小程序 appId */ - appId: string; - } - interface MkdirFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail no such file or directory ${dirPath}': 上级目录不存在; - * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限; - * - 'fail file already exists ${dirPath}': 有同名文件或目录; */ - errMsg: string; - } - interface MkdirOption { - /** 创建的目录路径 */ - dirPath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: MkdirCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: MkdirFailCallback; - - /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 - * - * 最低基础库: `2.3.0` */ - recursive?: boolean; - /** 接口调用成功的回调函数 */ - - success?: MkdirSuccessCallback; - } - interface MuteOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: MuteCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: MuteFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: MuteSuccessCallback; - } - interface NavigateBackMiniProgramOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: NavigateBackMiniProgramCompleteCallback; - /** 需要返回给上一个小程序的数据,上一个小程序可在 `App.onShow` 中获取到这份数据。 [详情]((小程序 App))。 */ - extraData?: object; - - /** 接口调用失败的回调函数 */ - - fail?: NavigateBackMiniProgramFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: NavigateBackMiniProgramSuccessCallback; - } - interface NavigateBackOption { - /** 返回的页面数,如果 delta 大于现有页面数,则返回到首页。 */ - delta: number; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: NavigateBackCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: NavigateBackFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: NavigateBackSuccessCallback; - } - interface NavigateToMiniProgramOption { - /** 要打开的小程序 appId */ - appId: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: NavigateToMiniProgramCompleteCallback; - - /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。 - * - * 可选值: - * - 'develop': 开发版; - * - 'trial': 体验版; - * - 'release': 正式版; */ - envVersion?: "develop" | "trial" | "release"; - /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。 */ - extraData?: object; - /** 接口调用失败的回调函数 */ - - fail?: NavigateToMiniProgramFailCallback; - - /** 打开的页面路径,如果为空则打开首页 */ - path?: string; - /** 接口调用成功的回调函数 */ - - success?: NavigateToMiniProgramSuccessCallback; - } - interface NavigateToOption { - /** 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */ - url: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: NavigateToCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: NavigateToFailCallback; - /** 接口调用成功的回调函数 */ - success?: NavigateToSuccessCallback; - } - interface NotifyBLECharacteristicValueChangeOption { - /** 蓝牙特征值的 uuid */ - characteristicId: string; - /** 蓝牙设备 id */ - deviceId: string; - /** 蓝牙特征值对应服务的 uuid */ - serviceId: string; - /** 是否启用 notify */ - state: boolean; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: NotifyBLECharacteristicValueChangeCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: NotifyBLECharacteristicValueChangeFailCallback; - /** 接口调用成功的回调函数 */ - success?: NotifyBLECharacteristicValueChangeSuccessCallback; - } - interface ObserveCallbackResult { - /** 目标边界 */ - boundingClientRect: BoundingClientRectResult; - /** 相交比例 */ - intersectionRatio: number; - /** 相交区域的边界 */ - intersectionRect: IntersectionRectResult; - /** 参照区域的边界 */ - relativeRect: RelativeRectResult; - /** 相交检测时的时间戳 */ - time: number; - } - interface OnAccelerometerChangeCallbackResult { - /** X 轴 */ - x: number; - /** Y 轴 */ - y: number; - /** Z 轴 */ - z: number; - } - interface OnAppShowCallbackResult { - object: ResultOption; - } - interface OnBLECharacteristicValueChangeCallbackResult { - /** 蓝牙特征值的 uuid */ - characteristicId: string; - /** 蓝牙设备 id */ - deviceId: string; - /** 蓝牙特征值对应服务的 uuid */ - serviceId: string; - /** 特征值最新的值 */ - value: ArrayBuffer; - } - interface OnBLEConnectionStateChangeCallbackResult { - /** 是否处于已连接状态 */ - connected: boolean; - /** 蓝牙设备ID */ - deviceId: string; - } - interface OnBeaconServiceChangeCallbackResult { - /** 服务目前是否可用 */ - available: boolean; - /** 目前是否处于搜索状态 */ - discovering: boolean; - } - interface OnBeaconUpdateCallbackResult { - /** 当前搜寻到的所有 iBeacon 设备列表 */ - beacons: IBeaconInfo[]; - } - interface OnBluetoothAdapterStateChangeCallbackResult { - /** 蓝牙适配器是否可用 */ - available: boolean; - /** 蓝牙适配器是否处于搜索状态 */ - discovering: boolean; - } - interface OnBluetoothDeviceFoundCallbackResult { - /** 新搜索到的设备列表 */ - devices: CallbackResultBlueToothDevice; - } - interface OnCheckForUpdateCallbackResult { - /** 是否有新版本 */ - hasUpdate: boolean; - } - interface OnCompassChangeCallbackResult { - /** 精度 - * - * 最低基础库: `2.4.0` */ - accuracy: number | string; - /** 面对的方向度数 */ - direction: number; - } - 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 OnFrameRecordedCallbackResult { - /** 录音分片数据 */ - frameBuffer: ArrayBuffer; - /** 当前帧是否正常录音结束前的最后一帧 */ - isLastFrame: boolean; - } - interface OnGetWifiListCallbackResult { - /** Wi-Fi 列表数据 */ - wifiList: WifiInfo[]; - } - interface OnGyroscopeChangeCallbackResult { - res: Result; - } - interface OnHCEMessageCallbackResult { - /** `messageType=1` 时 ,客户端接收到 NFC 设备的指令 */ - data: ArrayBuffer; - /** 消息类型 - * - * 可选值: - * - 1: HCE APDU Command类型,小程序需对此指令进行处理,并调用 sendHCEMessage 接口返回处理指令; - * - 2: 设备离场事件类型; */ - messageType: 1 | 2; - /** `messageType=2` 时,原因 */ - reason: number; - } - interface OnLocalServiceFoundCallbackResult { - /** 服务的 ip 地址 */ - ip: string; - /** 服务的端口 */ - port: number; - /** 服务的名称 */ - serviceName: string; - /** 服务的类型 */ - serviceType: string; - } - interface OnLocalServiceLostCallbackResult { - /** 服务的名称 */ - serviceName: string; - /** 服务的类型 */ - serviceType: string; - } - interface OnLocalServiceResolveFailCallbackResult { - /** 服务的名称 */ - serviceName: string; - /** 服务的类型 */ - serviceType: string; - } - interface OnMemoryWarningCallbackResult { - /** 内存告警等级,只有 Android 才有,对应系统宏定义 - * - * 可选值: - * - 5: TRIM_MEMORY_RUNNING_MODERATE; - * - 10: TRIM_MEMORY_RUNNING_LOW; - * - 15: TRIM_MEMORY_RUNNING_CRITICAL; */ - level: 5 | 10 | 15; - } - interface OnNetworkStatusChangeCallbackResult { - /** 当前是否有网络链接 */ - isConnected: boolean; - /** 网络类型 - * - * 可选值: - * - 'wifi': wifi 网络; - * - '2g': 2g 网络; - * - '3g': 3g 网络; - * - '4g': 4g 网络; - * - 'unknown': Android 下不常见的网络类型; - * - 'none': 无网络; */ - networkType: "wifi" | "2g" | "3g" | "4g" | "unknown" | "none"; - } - interface OnOpenCallbackResult { - /** 连接成功的 HTTP 响应 Header - * - * 最低基础库: `2.0.0` */ - header: object; - } - interface OnSocketMessageCallbackResult { - /** 服务器返回的消息 */ - data: string | ArrayBuffer; - } - interface OnSocketOpenCallbackResult { - /** 连接成功的 HTTP 响应 Header - * - * 最低基础库: `2.0.0` */ - header: object; - } - interface OnStopCallbackResult { - /** 录音文件的临时路径 */ - tempFilePath: string; - } - interface OnWifiConnectedCallbackResult { - /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html) - * - * Wi-Fi 信息 */ - wifi: WifiInfo; - } - interface OnWindowResizeCallbackResult { - size: Size; - } - interface OpenBluetoothAdapterOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: OpenBluetoothAdapterCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: OpenBluetoothAdapterFailCallback; - /** 接口调用成功的回调函数 */ - - success?: OpenBluetoothAdapterSuccessCallback; - } - interface OpenCardOption { - /** 需要打开的卡券列表 */ - cardList: OpenCardRequestInfo; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: OpenCardCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: OpenCardFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: OpenCardSuccessCallback; - } - /** 需要打开的卡券列表 */ - interface OpenCardRequestInfo { - /** 卡券 ID */ - cardId: string; - - /** 由 [wx.addCard](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html) 的返回对象中的加密 code 通过解密后得到,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */ - code: string; - } - interface OpenDocumentOption { - /** 文件路径,可通过 downloadFile 获得 */ - filePath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: OpenDocumentCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: OpenDocumentFailCallback; - - /** 文件类型,指定文件类型打开文件 - * - * 可选值: - * - '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; - } - interface OpenLocationOption { - /** 纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */ - latitude: number; - /** 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */ - longitude: number; - /** 地址的详细说明 */ - address?: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: OpenLocationCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: OpenLocationFailCallback; - - /** 位置名 */ - name?: string; - /** 缩放比例,范围5~18 */ - scale?: number; - - /** 接口调用成功的回调函数 */ - - success?: OpenLocationSuccessCallback; - } - interface OpenSettingOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: OpenSettingCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: OpenSettingFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: OpenSettingSuccessCallback; - } - interface OpenSettingSuccessCallbackResult { - /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html) - * - * 用户授权结果 */ - authSetting: AuthSetting; - } - interface PageScrollToOption { - /** 滚动到页面的目标位置,单位 px */ - scrollTop: number; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: PageScrollToCompleteCallback; - - /** 滚动动画的时长,单位 ms */ - duration?: number; - /** 接口调用失败的回调函数 */ - - fail?: PageScrollToFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: PageScrollToSuccessCallback; - } - interface PauseBGMOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: PauseBGMCompleteCallback; - - /** 接口调用失败的回调函数 */ - fail?: PauseBGMFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: PauseBGMSuccessCallback; - } - interface PauseBackgroundAudioOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: PauseBackgroundAudioCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: PauseBackgroundAudioFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: PauseBackgroundAudioSuccessCallback; - } - interface PauseVoiceOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: PauseVoiceCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: PauseVoiceFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: PauseVoiceSuccessCallback; - } - interface PlayBGMOption { - /** 加入背景混音的资源地址 */ - url: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: PlayBGMCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: PlayBGMFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: PlayBGMSuccessCallback; - } - interface PlayBackgroundAudioOption { - /** 音乐链接,目前支持的格式有 m4a, aac, mp3, wav */ - dataUrl: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: PlayBackgroundAudioCompleteCallback; - /** 封面URL */ - coverImgUrl?: string; - - /** 接口调用失败的回调函数 */ - - fail?: PlayBackgroundAudioFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: PlayBackgroundAudioSuccessCallback; - /** 音乐标题 */ - title?: string; - } - interface PlayOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: PlayCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: PlayFailCallback; - /** 接口调用成功的回调函数 */ - success?: PlaySuccessCallback; - } - interface PlayVoiceOption { - /** 需要播放的语音文件的文件路径 */ - filePath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: PlayVoiceCompleteCallback; - - /** 指定录音时长,到达指定的录音时长后会自动停止录音,单位:秒 - * - * 最低基础库: `1.6.0` */ - duration?: number; - /** 接口调用失败的回调函数 */ - - fail?: PlayVoiceFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: PlayVoiceSuccessCallback; - } - /** 插件帐号信息(仅在插件中调用时包含这一项) */ - interface Plugin { - /** 插件 appId */ - appId: string; - /** 插件版本号 */ - version: string; - } - interface PreviewImageOption { - /** 需要预览的图片链接列表。{% version('2.2.3') %} 起支持云文件ID。 */ - urls: string[]; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: PreviewImageCompleteCallback; - - /** 当前显示图片的链接 */ - current?: string; - - /** 接口调用失败的回调函数 */ - - fail?: PreviewImageFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: PreviewImageSuccessCallback; - } - /** 该特征值支持的操作类型 */ - interface Properties { - /** 该特征值是否支持 indicate 操作 */ - indicate: boolean; - /** 该特征值是否支持 notify 操作 */ - notify: boolean; - /** 该特征值是否支持 read 操作 */ - read: boolean; - /** 该特征值是否支持 write 操作 */ - write: boolean; - } - interface ReLaunchOption { - /** 需要跳转的应用内页面路径,路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2',如果跳转的页面路径是 tabBar 页面则不能带参数 */ - url: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ReLaunchCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: ReLaunchFailCallback; - /** 接口调用成功的回调函数 */ - success?: ReLaunchSuccessCallback; - } - interface ReadBLECharacteristicValueOption { - /** 蓝牙特征值的 uuid */ - characteristicId: string; - /** 蓝牙设备 id */ - deviceId: string; - /** 蓝牙特征值对应服务的 uuid */ - serviceId: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: ReadBLECharacteristicValueCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ReadBLECharacteristicValueFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ReadBLECharacteristicValueSuccessCallback; - } - interface ReadFileFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在; - * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限; */ - errMsg: string; - } - interface ReadFileOption { - /** 要读取的文件的路径 */ - filePath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ReadFileCompleteCallback; - - /** 指定读取文件的字符编码,如果不传 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"; - /** 接口调用失败的回调函数 */ - fail?: ReadFileFailCallback; - /** 接口调用成功的回调函数 */ - success?: ReadFileSuccessCallback; - } - interface ReadFileSuccessCallbackResult { - /** 文件内容 */ - data: string | ArrayBuffer; - } - interface ReaddirFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail no such file or directory ${dirPath}': 目录不存在; - * - 'fail not a directory ${dirPath}': dirPath 不是目录; - * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限; */ - errMsg: string; - } - interface ReaddirOption { - /** 要读取的目录路径 */ - dirPath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: ReaddirCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: ReaddirFailCallback; - /** 接口调用成功的回调函数 */ - success?: ReaddirSuccessCallback; - } - interface ReaddirSuccessCallbackResult { - /** 指定目录下的文件名数组。 */ - files: string[]; - } - interface RecorderManagerOnErrorCallbackResult { - /** 错误信息 */ - errMsg: string; - } - interface RecorderManagerStartOption { - /** 指定录音的音频输入源,可通过 [wx.getAvailableAudioSources()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) 获取当前可用的音频源 - * - * 可选值: - * - '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"; - /** 录音的时长,单位 ms,最大值 600000(10 分钟) */ - duration?: number; - /** 编码码率,有效值见下表格 */ - encodeBitRate?: number; - /** 音频格式 - * - * 可选值: - * - 'mp3': mp3 格式; - * - 'aac': aac 格式; */ - format?: "mp3" | "aac"; - /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3 格式。 */ - frameSize?: number; - /** 录音通道数 - * - * 可选值: - * - 1: 1 个通道; - * - 2: 2 个通道; */ - numberOfChannels?: 1 | 2; - /** 采样率 - * - * 可选值: - * - 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; - } - /** 菜单按钮的布局位置信息 */ - interface Rect { - /** 下边界坐标,单位:px */ - bottom: number; - /** 高度,单位:px */ - height: number; - /** 左边界坐标,单位:px */ - left: number; - /** 右边界坐标,单位:px */ - right: number; - /** 上边界坐标,单位:px */ - top: number; - /** 宽度,单位:px */ - width: number; - } - interface RedirectToOption { - /** 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */ - url: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: RedirectToCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: RedirectToFailCallback; - /** 接口调用成功的回调函数 */ - - success?: RedirectToSuccessCallback; - } - /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ - interface ReferrerInfo { - /** 来源小程序、公众号或 App 的 appId */ - appId: string; - - /** 来源小程序传过来的数据,scene=1037或1038时支持 */ - extraData: object; - } - /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ - interface ReferrerInfoOption { - /** 来源小程序、公众号或 App 的 appId */ - appId: string; - /** 来源小程序传过来的数据,scene=1037或1038时支持 */ - extraData: object; - } - /** 参照区域的边界 */ - interface RelativeRectResult { - /** 下边界 */ - bottom: number; - /** 左边界 */ - left: number; - /** 右边界 */ - right: number; - /** 上边界 */ - top: number; - } - /** 用来扩展(或收缩)参照节点布局区域的边界 */ - interface RelativeToMargins { - /** 节点布局区域的下边界 */ - bottom?: number; - /** 节点布局区域的左边界 */ - left?: number; - /** 节点布局区域的右边界 */ - right?: number; - /** 节点布局区域的上边界 */ - top?: number; - } - /** 用来扩展(或收缩)参照节点布局区域的边界 */ - interface RelativeToViewportMargins { - /** 节点布局区域的下边界 */ - bottom?: number; - /** 节点布局区域的左边界 */ - left?: number; - /** 节点布局区域的右边界 */ - right?: number; - /** 节点布局区域的上边界 */ - top?: number; - } - interface RemoveSavedFileFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail file not exist': 指定的 tempFilePath 找不到文件; */ - errMsg: string; - } - interface RemoveStorageOption { - /** 本地缓存中指定的 key */ - key: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: RemoveStorageCompleteCallback; - /** 接口调用失败的回调函数 */ - - fail?: RemoveStorageFailCallback; - /** 接口调用成功的回调函数 */ - success?: RemoveStorageSuccessCallback; - } - interface RemoveTabBarBadgeOption { - /** tabBar 的哪一项,从左边算起 */ - index: number; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: RemoveTabBarBadgeCompleteCallback; - /** 接口调用失败的回调函数 */ - - fail?: RemoveTabBarBadgeFailCallback; - /** 接口调用成功的回调函数 */ - success?: RemoveTabBarBadgeSuccessCallback; - } - interface RenameFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail permission denied, rename ${oldPath} -> ${newPath}': 指定源文件或目标文件没有写权限; - * - 'fail no such file or directory, rename ${oldPath} -> ${newPath}': 源文件不存在,或目标文件路径的上层目录不存在; */ - errMsg: string; - } - interface RenameOption { - /** 新文件路径 */ - newPath: string; - /** 源文件路径,可以是普通文件或目录 */ - oldPath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: RenameCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: RenameFailCallback; - /** 接口调用成功的回调函数 */ - - success?: RenameSuccessCallback; - } - interface RequestOption { - /** 开发者服务器接口地址 */ - url: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: RequestCompleteCallback; - - /** 请求的参数 */ - data?: string | object | ArrayBuffer; - - /** 返回的数据格式 - * - * 可选值: - * - 'json': 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse; - * - '其他': 不对返回的内容进行 JSON.parse; */ - dataType?: "json" | "其他"; - /** 接口调用失败的回调函数 */ - - fail?: RequestFailCallback; - /** 设置请求的 header,header 中不能设置 Referer。 - * - * `content-type` 默认为 `application/json` */ - header?: object; - /** 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"; - /** 响应的数据类型 - * - * 可选值: - * - 'text': 响应的数据为文本; - * - 'arraybuffer': 响应的数据为 ArrayBuffer; - * - * 最低基础库: `1.7.0` */ - responseType?: "text" | "arraybuffer"; - /** 接口调用成功的回调函数 */ - - success?: RequestSuccessCallback; - } - interface RequestPaymentOption { - /** 随机字符串,长度为32个字符以下 */ - nonceStr: string; - /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */ - package: string; - /** 签名,具体签名方案参见 [小程序支付接口文档](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3) */ - paySign: string; - /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */ - timeStamp: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: RequestPaymentCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: RequestPaymentFailCallback; - - /** 签名算法 - * - * 可选值: - * - 'MD5': MD5; - * - 'HMAC-SHA256': HMAC-SHA256; */ - signType?: "MD5" | "HMAC-SHA256"; - /** 接口调用成功的回调函数 */ - - success?: RequestPaymentSuccessCallback; - } - interface RequestSuccessCallbackResult { - /** 开发者服务器返回的数据 */ - data: string | object | ArrayBuffer; - /** 开发者服务器返回的 HTTP Response Header - * - * 最低基础库: `1.2.0` */ - header: object; - /** 开发者服务器返回的 HTTP 状态码 */ - statusCode: number; - } - interface RequestTaskOnHeadersReceivedCallbackResult { - /** 开发者服务器返回的 HTTP Response Header */ - header: object; - } - interface Result { - /** x 轴的角速度 */ - x: number; - /** y 轴的角速度 */ - y: number; - /** z 轴的角速度 */ - z: number; - } - interface ResultOption { - /** 小程序切前台的路径 */ - path: string; - /** 小程序切前台的 query 参数 */ - query: object; - /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */ - referrerInfo: ReferrerInfoOption; - /** 小程序切前台的[场景值]((scene)) */ - scene: number; - /** shareTicket,详见[获取更多转发信息]((转发#获取更多转发信息)) */ - shareTicket: string; - } - interface ResumeBGMOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ResumeBGMCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ResumeBGMFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ResumeBGMSuccessCallback; - } - interface RmdirFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail no such file or directory ${dirPath}': 目录不存在; - * - 'fail directory not empty': 目录不为空; - * - 'fail permission denied, open ${dirPath}': 指定的 dirPath 路径没有写权限; */ - errMsg: string; - } - interface RmdirOption { - /** 要删除的目录路径 */ - dirPath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: RmdirCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: RmdirFailCallback; - - /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 - * - * 最低基础库: `2.3.0` */ - recursive?: boolean; - /** 接口调用成功的回调函数 */ - - success?: RmdirSuccessCallback; - } - interface SaveFileFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail tempFilePath file not exist': 指定的 tempFilePath 找不到文件; - * - 'fail permission denied, open "${filePath}"': 指定的 filePath 路径没有写权限; - * - 'fail no such file or directory "${dirPath}"': 上级目录不存在; */ - errMsg: string; - } - interface SaveImageToPhotosAlbumOption { - /** 图片文件路径,可以是临时文件路径或永久文件路径,不支持网络图片路径 */ - filePath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SaveImageToPhotosAlbumCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SaveImageToPhotosAlbumFailCallback; - /** 接口调用成功的回调函数 */ - - success?: SaveImageToPhotosAlbumSuccessCallback; - } - interface SaveVideoToPhotosAlbumOption { - /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */ - filePath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: SaveVideoToPhotosAlbumCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: SaveVideoToPhotosAlbumFailCallback; - /** 接口调用成功的回调函数 */ - success?: SaveVideoToPhotosAlbumSuccessCallback; - } - interface ScanCodeOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: ScanCodeCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: ScanCodeFailCallback; - /** 是否只能从相机扫码,不允许从相册选择图片 - * - * 最低基础库: `1.2.0` */ - onlyFromCamera?: boolean; - /** 扫码类型 - * - * 可选值: - * - 'barCode': 一维码; - * - 'qrCode': 二维码; - * - 'datamatrix': Data Matrix 码; - * - 'pdf417': PDF417 条码; - * - * 最低基础库: `1.7.0` */ - scanType?: Array<"barCode" | "qrCode" | "datamatrix" | "pdf417">; - /** 接口调用成功的回调函数 */ - - success?: ScanCodeSuccessCallback; - } - interface ScanCodeSuccessCallbackResult { - /** 所扫码的字符集 */ - charSet: string; - /** 当所扫的码为当前小程序的合法二维码时,会返回此字段,内容为二维码携带的 path */ - path: string; - /** 原始数据,base64编码 */ - rawData: string; - /** 所扫码的内容 */ - 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"; - } - interface ScrollOffsetCallbackResult { - /** 节点的 dataset */ - dataset: object; - /** 节点的 ID */ - id: string; - /** 节点的水平滚动位置 */ - scrollLeft: number; - /** 节点的竖直滚动位置 */ - scrollTop: number; - } - interface SeekBackgroundAudioOption { - /** 音乐位置,单位:秒 */ - position: number; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SeekBackgroundAudioCompleteCallback; - /** 接口调用失败的回调函数 */ - - fail?: SeekBackgroundAudioFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SeekBackgroundAudioSuccessCallback; - } - interface SendHCEMessageOption { - /** 二进制数据 */ - data: ArrayBuffer; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SendHCEMessageCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SendHCEMessageFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SendHCEMessageSuccessCallback; - } - interface SendOption { - /** 需要发送的内容 */ - data: string | ArrayBuffer; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SendCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SendFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SendSuccessCallback; - } - interface SendSocketMessageOption { - /** 需要发送的内容 */ - data: string | ArrayBuffer; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SendSocketMessageCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SendSocketMessageFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SendSocketMessageSuccessCallback; - } - interface SetBGMVolumeOption { - /** 音量大小 */ - volume: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetBGMVolumeCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetBGMVolumeFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetBGMVolumeSuccessCallback; - } - interface SetBackgroundColorOption { - /** 窗口的背景色,必须为十六进制颜色值 */ - backgroundColor?: string; - /** 底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */ - backgroundColorBottom?: string; - /** 顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */ - backgroundColorTop?: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetBackgroundColorCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetBackgroundColorFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetBackgroundColorSuccessCallback; - } - interface SetBackgroundTextStyleOption { - /** 下拉背景字体、loading 图的样式。 - * - * 可选值: - * - 'dark': dark 样式; - * - 'light': light 样式; */ - textStyle: "dark" | "light"; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetBackgroundTextStyleCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetBackgroundTextStyleFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetBackgroundTextStyleSuccessCallback; - } - interface SetClipboardDataOption { - /** 剪贴板的内容 */ - data: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetClipboardDataCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetClipboardDataFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetClipboardDataSuccessCallback; - } - interface SetEnableDebugOption { - /** 是否打开调试 */ - enableDebug: boolean; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: SetEnableDebugCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: SetEnableDebugFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetEnableDebugSuccessCallback; - } - interface SetInnerAudioOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetInnerAudioOptionCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetInnerAudioOptionFailCallback; - /** 是否与其他音频混播,设置为 true 之后,不会终止其他应用或微信内的音乐 */ - mixWithOther?: boolean; - /** (仅在 iOS 生效)是否遵循静音开关,设置为 false 之后,即使是在静音模式下,也能播放声音 */ - obeyMuteSwitch?: boolean; - - /** 接口调用成功的回调函数 */ - - success?: SetInnerAudioOptionSuccessCallback; - } - interface SetKeepScreenOnOption { - /** 是否保持屏幕常亮 */ - keepScreenOn: boolean; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetKeepScreenOnCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetKeepScreenOnFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetKeepScreenOnSuccessCallback; - } - interface SetNavigationBarColorOption { - /** 动画效果 */ - animation: AnimationOption; - /** 背景颜色值,有效值为十六进制颜色 */ - backgroundColor: string; - /** 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 */ - frontColor: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetNavigationBarColorCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetNavigationBarColorFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetNavigationBarColorSuccessCallback; - } - interface SetNavigationBarTitleOption { - /** 页面标题 */ - title: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetNavigationBarTitleCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetNavigationBarTitleFailCallback; - /** 接口调用成功的回调函数 */ - success?: SetNavigationBarTitleSuccessCallback; - } - interface SetScreenBrightnessOption { - /** 屏幕亮度值,范围 0 ~ 1。0 最暗,1 最亮 */ - value: number; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetScreenBrightnessCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: SetScreenBrightnessFailCallback; - /** 接口调用成功的回调函数 */ - - success?: SetScreenBrightnessSuccessCallback; - } - interface SetStorageOption { - /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */ - data: any; - /** 本地缓存中指定的 key */ - key: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetStorageCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetStorageFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetStorageSuccessCallback; - } - interface SetTabBarBadgeOption { - /** tabBar 的哪一项,从左边算起 */ - index: number; - /** 显示的文本,超过 4 个字符则显示成 ... */ - text: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetTabBarBadgeCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetTabBarBadgeFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetTabBarBadgeSuccessCallback; - } - interface SetTabBarItemOption { - /** tabBar 的哪一项,从左边算起 */ - index: number; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetTabBarItemCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetTabBarItemFailCallback; - - /** 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效,不支持网络图片 */ - iconPath?: string; - /** 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效 */ - selectedIconPath?: string; - - /** 接口调用成功的回调函数 */ - - success?: SetTabBarItemSuccessCallback; - /** tab 上的按钮文字 */ - text?: string; - } - interface SetTabBarStyleOption { - /** tab 的背景色,HexColor */ - backgroundColor: string; - /** tabBar上边框的颜色, 仅支持 black/white */ - borderStyle: string; - - /** tab 上的文字默认颜色,HexColor */ - color: string; - /** tab 上的文字选中时的颜色,HexColor */ - selectedColor: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetTabBarStyleCompleteCallback; - - /** 接口调用失败的回调函数 */ - fail?: SetTabBarStyleFailCallback; - /** 接口调用成功的回调函数 */ - - success?: SetTabBarStyleSuccessCallback; - } - interface SetTopBarTextOption { - /** 置顶栏文字 */ - text: object; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetTopBarTextCompleteCallback; - /** 接口调用失败的回调函数 */ - - fail?: SetTopBarTextFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetTopBarTextSuccessCallback; - } - interface SetWifiListOption { - /** 提供预设的 Wi-Fi 信息列表 */ - wifiList: WifiData; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SetWifiListCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SetWifiListFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SetWifiListSuccessCallback; - } - interface ShowActionSheetOption { - /** 按钮的文字数组,数组长度最大为 6 */ - itemList: string[]; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: ShowActionSheetCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ShowActionSheetFailCallback; - /** 按钮的文字颜色 */ - itemColor?: string; - /** 接口调用成功的回调函数 */ - - success?: ShowActionSheetSuccessCallback; - } - interface ShowActionSheetSuccessCallbackResult { - /** 用户点击的按钮序号,从上到下的顺序,从0开始 */ - tapIndex: number; - } - interface ShowLoadingOption { - /** 提示的内容 */ - title: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ShowLoadingCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ShowLoadingFailCallback; - - /** 是否显示透明蒙层,防止触摸穿透 */ - mask?: boolean; - /** 接口调用成功的回调函数 */ - - success?: ShowLoadingSuccessCallback; - } - interface ShowModalOption { - /** 提示的内容 */ - content: string; - /** 提示的标题 */ - title: string; - /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */ - cancelColor?: string; - /** 取消按钮的文字,最多 4 个字符 */ - cancelText?: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ShowModalCompleteCallback; - - /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */ - confirmColor?: string; - /** 确认按钮的文字,最多 4 个字符 */ - confirmText?: string; - /** 接口调用失败的回调函数 */ - - fail?: ShowModalFailCallback; - - /** 是否显示取消按钮 */ - showCancel?: boolean; - - /** 接口调用成功的回调函数 */ - - success?: ShowModalSuccessCallback; - } - interface ShowModalSuccessCallbackResult { - /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) - * - * 最低基础库: `1.1.0` */ - cancel: boolean; - /** 为 true 时,表示用户点击了确定按钮 */ - confirm: boolean; - } - interface ShowNavigationBarLoadingOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ShowNavigationBarLoadingCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ShowNavigationBarLoadingFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ShowNavigationBarLoadingSuccessCallback; - } - interface ShowShareMenuOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ShowShareMenuCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: ShowShareMenuFailCallback; - /** 接口调用成功的回调函数 */ - - success?: ShowShareMenuSuccessCallback; - /** 是否使用带 shareTicket 的转发[详情]((转发#获取更多转发信息)) */ - withShareTicket?: boolean; - } - interface ShowTabBarOption { - /** 是否需要动画效果 */ - animation?: boolean; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ShowTabBarCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ShowTabBarFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ShowTabBarSuccessCallback; - } - interface ShowTabBarRedDotOption { - /** tabBar 的哪一项,从左边算起 */ - index: number; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ShowTabBarRedDotCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ShowTabBarRedDotFailCallback; - /** 接口调用成功的回调函数 */ - - success?: ShowTabBarRedDotSuccessCallback; - } - interface ShowToastOption { - /** 提示的内容 */ - title: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ShowToastCompleteCallback; - - /** 提示的延迟时间 */ - duration?: number; - - /** 接口调用失败的回调函数 */ - - fail?: ShowToastFailCallback; - /** 图标 - * - * 可选值: - * - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度; - * - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度; - * - 'none': 不显示图标,此时 title 文本最多可显示两行,{% version('1.9.0') %}及以上版本支持; */ - icon?: "success" | "loading" | "none"; - /** 自定义图标的本地路径,image 的优先级高于 icon - * - * 最低基础库: `1.1.0` */ - image?: string; - /** 是否显示透明蒙层,防止触摸穿透 */ - mask?: boolean; - - /** 接口调用成功的回调函数 */ - - success?: ShowToastSuccessCallback; - } - interface Size { - /** 变化后的窗口高度,单位 px */ - windowHeight: number; - /** 变化后的窗口宽度,单位 px */ - windowWidth: number; - } - interface SnapshotOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SnapshotCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: SnapshotFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SnapshotSuccessCallback; - } - interface SocketTaskOnErrorCallbackResult { - /** 错误信息 */ - errMsg: string; - } - interface SocketTaskOnMessageCallbackResult { - /** 服务器返回的消息 */ - data: string | ArrayBuffer; - } - interface StartAccelerometerOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartAccelerometerCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartAccelerometerFailCallback; - - /** 监听加速度数据回调函数的执行频率 - * - * 可选值: - * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右; - * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右; - * - 'normal': 普通的回调频率,在 200ms/次 左右; - * - * 最低基础库: `2.1.0` */ - interval?: "game" | "ui" | "normal"; - - /** 接口调用成功的回调函数 */ - - success?: StartAccelerometerSuccessCallback; - } - interface StartBeaconDiscoveryOption { - /** iBeacon 设备广播的 uuid 列表 */ - uuids: string[]; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartBeaconDiscoveryCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartBeaconDiscoveryFailCallback; - - /** 是否校验蓝牙开关,仅在 iOS 下有效 */ - ignoreBluetoothAvailable?: boolean; - - /** 接口调用成功的回调函数 */ - - success?: StartBeaconDiscoverySuccessCallback; - } - interface StartBluetoothDevicesDiscoveryOption { - /** 是否允许重复上报同一设备。如果允许重复上报,则 `wx.onBlueToothDeviceFound` 方法会多次上报同一设备,但是 RSSI 值会有不同。 */ - allowDuplicatesKey?: boolean; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartBluetoothDevicesDiscoveryCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartBluetoothDevicesDiscoveryFailCallback; - /** 上报设备的间隔。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */ - interval?: number; - /** 要搜索但蓝牙设备主 service 的 uuid 列表。某些蓝牙设备会广播自己的主 service 的 uuid。如果设置此参数,则只搜索广播包有对应 uuid 的主服务的蓝牙设备。建议主要通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */ - services?: string[]; - - /** 接口调用成功的回调函数 */ - - success?: StartBluetoothDevicesDiscoverySuccessCallback; - } - interface StartCompassOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartCompassCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartCompassFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StartCompassSuccessCallback; - } - interface StartDeviceMotionListeningOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartDeviceMotionListeningCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartDeviceMotionListeningFailCallback; - - /** 监听设备方向的变化回调函数的执行频率 - * - * 可选值: - * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右; - * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右; - * - 'normal': 普通的回调频率,在 200ms/次 左右; */ - interval?: "game" | "ui" | "normal"; - /** 接口调用成功的回调函数 */ - - success?: StartDeviceMotionListeningSuccessCallback; - } - interface StartGyroscopeOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartGyroscopeCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartGyroscopeFailCallback; - - /** 监听陀螺仪数据回调函数的执行频率 - * - * 可选值: - * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右; - * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右; - * - 'normal': 普通的回调频率,在 200ms/次 左右; */ - interval?: "game" | "ui" | "normal"; - /** 接口调用成功的回调函数 */ - - success?: StartGyroscopeSuccessCallback; - } - interface StartHCEOption { - /** 需要注册到系统的 AID 列表 */ - aid_list: string[]; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartHCECompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartHCEFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StartHCESuccessCallback; - } - interface StartLocalServiceDiscoveryFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'invalid param': serviceType 为空; - * - 'scan task already exist': 在当前 startLocalServiceDiscovery 发起的搜索未停止的情况下,再次调用 startLocalServiceDiscovery; */ - errMsg: string; - } - interface StartLocalServiceDiscoveryOption { - /** 要搜索的服务类型 */ - serviceType: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: StartLocalServiceDiscoveryCompleteCallback; - - /** 接口调用失败的回调函数 */ - fail?: StartLocalServiceDiscoveryFailCallback; - /** 接口调用成功的回调函数 */ - success?: StartLocalServiceDiscoverySuccessCallback; - } - interface StartPullDownRefreshOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartPullDownRefreshCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartPullDownRefreshFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StartPullDownRefreshSuccessCallback; - } - interface StartRecordSuccessCallbackResult { - /** 录音文件的临时路径 */ - tempFilePath: string; - } - interface StartRecordTimeoutCallbackResult { - /** 封面图片文件的临时路径 */ - tempThumbPath: string; - - /** 视频的文件的临时路径 */ - tempVideoPath: string; - } - interface StartSoterAuthenticationOption { - /** 挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 `resultJSON` 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。 */ - challenge: string; - /** 请求使用的可接受的生物认证方式 - * - * 可选值: - * - 'fingerPrint': 指纹识别; - * - 'facial': 人脸识别(暂未支持); - * - 'speech': 声纹识别(暂未支持); */ - requestAuthModes: Array<"fingerPrint" | "facial" | "speech">; - /** 验证描述,即识别过程中显示在界面上的对话框提示内容 */ - authContent?: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartSoterAuthenticationCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartSoterAuthenticationFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StartSoterAuthenticationSuccessCallback; - } - interface StartSoterAuthenticationSuccessCallbackResult { - /** 生物认证方式 */ - authMode: string; - /** 错误码 */ - errCode: number; - /** 错误信息 */ - errMsg: string; - /** 在设备安全区域(TEE)内获得的本机安全信息(如TEE名称版本号等以及防重放参数)以及本次认证信息(仅Android支持,本次认证的指纹ID)。具体说明见下文 */ - resultJSON: string; - /** 用SOTER安全密钥对 `resultJSON` 的签名(SHA256 with RSA/PSS, saltlen=20) */ - resultJSONSignature: string; - } - interface StartWifiOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StartWifiCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StartWifiFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StartWifiSuccessCallback; - } - interface StatFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限; - * - 'fail no such file or directory ${path}': 文件不存在; */ - errMsg: string; - } - interface StatOption { - /** 文件/目录路径 */ - path: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StatCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StatFailCallback; - - /** 是否递归获取目录下的每个文件的 Stats 信息 - * - * 最低基础库: `2.3.0` */ - recursive?: boolean; - /** 接口调用成功的回调函数 */ - - success?: StatSuccessCallback; - } - interface StatSuccessCallbackResult { - /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object - * - * 当 recursive 为 false 时,res.stats 是一个 Stats 对象。当 recursive 为 true 且 path 是一个目录的路径时,res.stats 是一个 Object,key 以 path 为根路径的相对路径,value 是该路径对应的 Stats 对象。 */ - stats: Stats | object; - } - /** 描述文件状态的对象 */ - interface Stats { - /** 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime */ - lastAccessedTime: number; - /** 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime */ - lastModifiedTime: number; - /** 文件的类型和存取的权限,对应 POSIX stat.st_mode */ - mode: string; - /** 文件大小,单位:B,对应 POSIX stat.st_size */ - size: number; - } - interface StepOption { - /** 动画延迟时间,单位 ms */ - delay?: number; - /** 动画持续时间,单位 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"; - transformOrigin?: string; - } - interface StopAccelerometerOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopAccelerometerCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopAccelerometerFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopAccelerometerSuccessCallback; - } - interface StopBGMOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopBGMCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopBGMFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopBGMSuccessCallback; - } - interface StopBackgroundAudioOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopBackgroundAudioCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopBackgroundAudioFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopBackgroundAudioSuccessCallback; - } - interface StopBeaconDiscoveryOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopBeaconDiscoveryCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopBeaconDiscoveryFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopBeaconDiscoverySuccessCallback; - } - interface StopBluetoothDevicesDiscoveryOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopBluetoothDevicesDiscoveryCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopBluetoothDevicesDiscoveryFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopBluetoothDevicesDiscoverySuccessCallback; - } - interface StopCompassOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopCompassCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopCompassFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopCompassSuccessCallback; - } - interface StopDeviceMotionListeningOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopDeviceMotionListeningCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopDeviceMotionListeningFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopDeviceMotionListeningSuccessCallback; - } - interface StopGyroscopeOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopGyroscopeCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopGyroscopeFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopGyroscopeSuccessCallback; - } - interface StopHCEOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopHCECompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopHCEFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopHCESuccessCallback; - } - interface StopLocalServiceDiscoveryFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'task not found': 在当前没有处在搜索服务中的情况下调用 stopLocalServiceDiscovery; */ - errMsg: string; - } - interface StopLocalServiceDiscoveryOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopLocalServiceDiscoveryCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopLocalServiceDiscoveryFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopLocalServiceDiscoverySuccessCallback; - } - interface StopPullDownRefreshOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopPullDownRefreshCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopPullDownRefreshFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopPullDownRefreshSuccessCallback; - } - interface StopRecordOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopRecordCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopRecordFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopRecordSuccessCallback; - } - interface StopRecordSuccessCallbackResult { - /** 封面图片文件的临时路径 */ - tempThumbPath: string; - /** 视频的文件的临时路径 */ - tempVideoPath: string; - } - interface StopVoiceOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopVoiceCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopVoiceFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: StopVoiceSuccessCallback; - } - interface StopWifiOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: StopWifiCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: StopWifiFailCallback; - /** 接口调用成功的回调函数 */ - - success?: StopWifiSuccessCallback; - } - interface SwitchCameraOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: SwitchCameraCompleteCallback; - /** 接口调用失败的回调函数 */ - - fail?: SwitchCameraFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SwitchCameraSuccessCallback; - } - interface SwitchTabOption { - /** 需要跳转的 tabBar 页面的路径(需在 app.json 的 [tabBar]((config#tabbar)) 字段定义的页面),路径后不能带参数。 */ - url: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: SwitchTabCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: SwitchTabFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: SwitchTabSuccessCallback; - } - interface TakePhotoOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: TakePhotoCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: TakePhotoFailCallback; - /** 成像质量 - * - * 可选值: - * - 'high': 高质量; - * - 'normal': 普通质量; - * - 'low': 低质量; */ - quality?: "high" | "normal" | "low"; - /** 接口调用成功的回调函数 */ - success?: TakePhotoSuccessCallback; - } - interface TakePhotoSuccessCallbackResult { - /** 照片文件的临时路径 */ - tempImagePath: string; - } - interface TextMetrics { - /** 文本的宽度 */ - width: number; - } - interface ToggleTorchOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: ToggleTorchCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: ToggleTorchFailCallback; - - /** 接口调用成功的回调函数 */ - - success?: ToggleTorchSuccessCallback; - } - interface TranslateMarkerOption { - /** 移动过程中是否自动旋转 marker */ - autoRotate: boolean; - /** 指定 marker 移动到的目标点 */ - destination: DestinationOption; - /** 指定 marker */ - markerId: number; - /** marker 的旋转角度 */ - rotate: number; - /** 动画结束回调函数 */ - animationEnd?: Function; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: TranslateMarkerCompleteCallback; - - /** 动画持续时长,平移与旋转分别计算 */ - duration?: number; - - /** 接口调用失败的回调函数 */ - - fail?: TranslateMarkerFailCallback; - /** 接口调用成功的回调函数 */ - - success?: TranslateMarkerSuccessCallback; - } - 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 UnlinkOption { - /** 要删除的文件路径 */ - filePath: string; - - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - - complete?: UnlinkCompleteCallback; - - /** 接口调用失败的回调函数 */ - - fail?: UnlinkFailCallback; - /** 接口调用成功的回调函数 */ - - success?: UnlinkSuccessCallback; - } - interface UnzipFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail permission denied, unzip ${zipFilePath} -> ${destPath}': 指定目标文件路径没有写权限; - * - 'fail no such file or directory, unzip ${zipFilePath} -> "${destPath}': 源文件不存在,或目标文件路径的上层目录不存在; */ - errMsg: string; - } - interface UnzipOption { - /** 目标目录路径 */ - targetPath: string; - /** 源文件路径,只可以是 zip 压缩文件 */ - zipFilePath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: UnzipCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: UnzipFailCallback; - /** 接口调用成功的回调函数 */ - success?: UnzipSuccessCallback; - } - /** 参数列表 */ - interface UpdatableMessageFrontEndParameter { - /** 参数名 */ - name: string; - /** 参数值 */ - value: string; - } - /** 动态消息的模板信息 - * - * 最低基础库: `2.4.0` */ - interface UpdatableMessageFrontEndTemplateInfo { - /** 参数列表 */ - parameterList: UpdatableMessageFrontEndParameter; - } - interface UpdateShareMenuOption { - /** 动态消息的 activityId。通过 [createActivityId]((createActivityId)) 接口获取 - * - * 最低基础库: `2.4.0` */ - activityId?: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: UpdateShareMenuCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: UpdateShareMenuFailCallback; - /** 是否是动态消息,详见[动态消息]((updatable-message)) - * - * 最低基础库: `2.4.0` */ - isUpdatableMessage?: boolean; - /** 接口调用成功的回调函数 */ - success?: UpdateShareMenuSuccessCallback; - /** 动态消息的模板信息 - * - * 最低基础库: `2.4.0` */ - templateInfo?: UpdatableMessageFrontEndTemplateInfo; - /** 是否使用带 shareTicket 的转发[详情]((转发#获取更多转发信息)) */ - withShareTicket?: boolean; - } - interface UploadFileOption { - /** 要上传文件资源的路径 */ - filePath: string; - /** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */ - name: string; - /** 开发者服务器地址 */ - url: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: UploadFileCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: UploadFileFailCallback; - /** HTTP 请求中其他额外的 form data */ - formData?: object; - /** HTTP 请求 Header,Header 中不能设置 Referer */ - header?: object; - /** 接口调用成功的回调函数 */ - success?: UploadFileSuccessCallback; - } - interface UploadFileSuccessCallbackResult { - /** 开发者服务器返回的数据 */ - data: string; - /** 开发者服务器返回的 HTTP 状态码 */ - statusCode: number; - } - interface UploadTaskOnHeadersReceivedCallbackResult { - /** 开发者服务器返回的 HTTP Response Header */ - header: object; - } - interface UploadTaskOnProgressUpdateCallbackResult { - /** 上传进度百分比 */ - progress: number; - /** 预期需要上传的数据总长度,单位 Bytes */ - totalBytesExpectedToSend: number; - /** 已经上传的数据长度,单位 Bytes */ - totalBytesSent: number; - } - /** 用户信息 */ - interface UserInfo { - /** 用户头像图片的 URL。URL 最后一个数值代表正方形头像大小(有 0、46、64、96、132 数值可选,0 代表 640x640 的正方形头像,46 表示 46x46 的正方形头像,剩余数值以此类推。默认132),用户没有头像时该项为空。若用户更换头像,原有头像 URL 将失效。 */ - avatarUrl: string; - /** 用户所在城市 */ - city: string; - /** 用户所在国家 */ - country: string; - /** 用户性别 - * - * 可选值: - * - 0: 未知; - * - 1: 男性; - * - 2: 女性; */ - gender: 0 | 1 | 2; - /** 显示 country,province,city 所用的语言 - * - * 可选值: - * - 'en': 英文; - * - 'zh_CN': 简体中文; - * - 'zh_TW': 繁体中文; */ - language: "en" | "zh_CN" | "zh_TW"; - /** 用户昵称 */ - nickName: string; - /** 用户所在省份 */ - province: string; - } - interface VibrateLongOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: VibrateLongCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: VibrateLongFailCallback; - /** 接口调用成功的回调函数 */ - success?: VibrateLongSuccessCallback; - } - interface VibrateShortOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: VibrateShortCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: VibrateShortFailCallback; - /** 接口调用成功的回调函数 */ - success?: VibrateShortSuccessCallback; - } - interface VideoContextRequestFullScreenOption { - /** 设置全屏时视频的方向,不指定则根据宽高比自动判断。 - * - * 可选值: - * - 0: 正常竖向; - * - 90: 屏幕逆时针90度; - * - -90: 屏幕顺时针90度; - * - * 最低基础库: `1.7.0` */ - direction?: 0 | 90 | -90; - } - /** 提供预设的 Wi-Fi 信息列表 */ - interface WifiData { - /** Wi-Fi 的 BSSID */ - BSSID?: string; - /** Wi-Fi 的 SSID */ - SSID?: string; - /** Wi-Fi 设备密码 */ - password?: string; - } - /** Wifi 信息 */ - interface WifiInfo { - /** Wi-Fi 的 BSSID */ - BSSID: string; - /** Wi-Fi 的 SSID */ - SSID: string; - /** Wi-Fi 是否安全 */ - secure: boolean; - /** Wi-Fi 信号强度 */ - signalStrength: number; - } - interface WorkerOnMessageCallbackResult { - /** 主线程/Worker 线程向当前线程发送的消息 */ - message: object; - } - interface WriteBLECharacteristicValueOption { - /** 蓝牙特征值的 uuid */ - characteristicId: string; - /** 蓝牙设备 id */ - deviceId: string; - /** 蓝牙特征值对应服务的 uuid */ - serviceId: string; - /** 蓝牙设备特征值对应的二进制值 */ - value: ArrayBuffer; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WriteBLECharacteristicValueCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: WriteBLECharacteristicValueFailCallback; - /** 接口调用成功的回调函数 */ - success?: WriteBLECharacteristicValueSuccessCallback; - } - interface WriteFileFailCallbackResult { - /** 错误信息 - * - * 可选值: - * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在; - * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限; */ - errMsg: string; - } - interface WriteFileOption { - /** 要写入的文本或二进制数据 */ - data: string | ArrayBuffer; - /** 要写入的文件路径 */ - filePath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WriteFileCompleteCallback; - /** 指定写入文件的字符编码 - * - * 可选值: - * - '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"; - /** 接口调用失败的回调函数 */ - fail?: WriteFileFailCallback; - /** 接口调用成功的回调函数 */ - success?: WriteFileSuccessCallback; - } - interface WxGetFileInfoOption { - /** 本地文件路径 */ - filePath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxGetFileInfoCompleteCallback; - /** 计算文件摘要的算法 - * - * 可选值: - * - 'md5': md5 算法; - * - 'sha1': sha1 算法; */ - digestAlgorithm?: "md5" | "sha1"; - /** 接口调用失败的回调函数 */ - fail?: WxGetFileInfoFailCallback; - /** 接口调用成功的回调函数 */ - success?: WxGetFileInfoSuccessCallback; - } - interface WxGetFileInfoSuccessCallbackResult { - /** 按照传入的 digestAlgorithm 计算得出的的文件摘要 */ - digest: string; - /** 文件大小,以字节为单位 */ - size: number; - } - interface WxGetSavedFileListOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxGetSavedFileListCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: WxGetSavedFileListFailCallback; - /** 接口调用成功的回调函数 */ - success?: WxGetSavedFileListSuccessCallback; - } - interface WxGetSavedFileListSuccessCallbackResult { - /** 文件数组,每一项是一个 FileItem */ - fileList: WxGetSavedFileListSuccessCallbackResultFileItem; - } - /** 文件数组,每一项是一个 FileItem */ - interface WxGetSavedFileListSuccessCallbackResultFileItem { - /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */ - createTime: number; - /** 本地路径 */ - filePath: string; - /** 本地文件大小,以字节为单位 */ - size: number; - } - interface WxRemoveSavedFileOption { - /** 需要删除的文件路径 */ - filePath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxRemoveSavedFileCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: WxRemoveSavedFileFailCallback; - /** 接口调用成功的回调函数 */ - success?: WxRemoveSavedFileSuccessCallback; - } - interface WxSaveFileOption { - /** 需要保存的文件的临时路径 */ - tempFilePath: string; - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxSaveFileCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: WxSaveFileFailCallback; - /** 接口调用成功的回调函数 */ - success?: WxSaveFileSuccessCallback; - } - interface WxSaveFileSuccessCallbackResult { - /** 存储后的文件路径 */ - savedFilePath: number; - } - interface WxStartRecordOption { - /** 接口调用结束的回调函数(调用成功、失败都会执行) */ - complete?: WxStartRecordCompleteCallback; - /** 接口调用失败的回调函数 */ - fail?: WxStartRecordFailCallback; - /** 接口调用成功的回调函数 */ - success?: WxStartRecordSuccessCallback; - } - interface Animation { - /** [Array. Animation.export()](Animation.export.md) - * - * 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。** */ - export(): Object[]; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.backgroundColor(string value)](Animation.backgroundColor.md) - * - * 设置背景色 */ - backgroundColor( - /** 颜色值 */ - value: string, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.bottom(number|string value)](Animation.bottom.md) - * - * 设置 bottom 值 */ - bottom( - /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.height(number|string value)](Animation.height.md) - * - * 设置高度 */ - height( - /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.left(number|string value)](Animation.left.md) - * - * 设置 left 值 */ - left( - /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix()](Animation.matrix.md) - * - * 同 [transform-function matrix](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix) */ - matrix(): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix3d()](Animation.matrix3d.md) - * - * 同 [transform-function matrix3d](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d) */ - matrix3d(): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.opacity(number value)](Animation.opacity.md) - * - * 设置透明度 */ - opacity( - /** 透明度,范围 0-1 */ - value: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.right(number|string value)](Animation.right.md) - * - * 设置 right 值 */ - right( - /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate(number angle)](Animation.rotate.md) - * - * 从原点顺时针旋转一个角度 */ - rotate( - /** 旋转的角度。范围 [-180, 180] */ - angle: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate3d(number x, number y, number z, number angle)](Animation.rotate3d.md) - * - * 从 X 轴顺时针旋转一个角度 */ - rotate3d( - /** 旋转轴的 x 坐标 */ - x: number, - /** 旋转轴的 y 坐标 */ - y: number, - /** 旋转轴的 z 坐标 */ - z: number, - /** 旋转的角度。范围 [-180, 180] */ - angle: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateX(number angle)](Animation.rotateX.md) - * - * 从 X 轴顺时针旋转一个角度 */ - rotateX( - /** 旋转的角度。范围 [-180, 180] */ - angle: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateY(number angle)](Animation.rotateY.md) - * - * 从 Y 轴顺时针旋转一个角度 */ - rotateY( - /** 旋转的角度。范围 [-180, 180] */ - angle: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateZ(number angle)](Animation.rotateZ.md) - * - * 从 Z 轴顺时针旋转一个角度 */ - rotateZ( - /** 旋转的角度。范围 [-180, 180] */ - angle: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale(number sx, number sy)](Animation.scale.md) - * - * 缩放 */ - scale( - /** 当仅有 sx 参数时,表示在 X 轴、Y 轴同时缩放sx倍数 */ - sx: number, - /** 在 Y 轴缩放 sy 倍数 */ - sy?: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale3d(number sx, number sy, number sz)](Animation.scale3d.md) - * - * 缩放 */ - scale3d( - /** x 轴的缩放倍数 */ - sx: number, - /** y 轴的缩放倍数 */ - sy: number, - /** z 轴的缩放倍数 */ - sz: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleX(number scale)](Animation.scaleX.md) - * - * 缩放 X 轴 */ - scaleX( - /** X 轴的缩放倍数 */ - scale: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleY(number scale)](Animation.scaleY.md) - * - * 缩放 Y 轴 */ - scaleY( - /** Y 轴的缩放倍数 */ - scale: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleZ(number scale)](Animation.scaleZ.md) - * - * 缩放 Z 轴 */ - scaleZ( - /** Z 轴的缩放倍数 */ - scale: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skew(number ax, number ay)](Animation.skew.md) - * - * 对 X、Y 轴坐标进行倾斜 */ - skew( - /** 对 X 轴坐标倾斜的角度,范围 [-180, 180] */ - ax: number, - /** 对 Y 轴坐标倾斜的角度,范围 [-180, 180] */ - ay: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewX(number angle)](Animation.skewX.md) - * - * 对 X 轴坐标进行倾斜 */ - skewX( - /** 倾斜的角度,范围 [-180, 180] */ - angle: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewY(number angle)](Animation.skewY.md) - * - * 对 Y 轴坐标进行倾斜 */ - skewY( - /** 倾斜的角度,范围 [-180, 180] */ - angle: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.step(Object object)](Animation.step.md) - * - * 表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。 */ - step(option?: StepOption): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.top(number|string value)](Animation.top.md) - * - * 设置 top 值 */ - top( - /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate(number tx, number ty)](Animation.translate.md) - * - * 平移变换 */ - translate( - /** 当仅有该参数时表示在 X 轴偏移 tx,单位 px */ - tx?: number, - /** 在 Y 轴平移的距离,单位为 px */ - ty?: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate3d(number tx, number ty, number tz)](Animation.translate3d.md) - * - * 对 xyz 坐标进行平移变换 */ - translate3d( - /** 在 X 轴平移的距离,单位为 px */ - tx?: number, - /** 在 Y 轴平移的距离,单位为 px */ - ty?: number, - /** 在 Z 轴平移的距离,单位为 px */ - tz?: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateX(number translation)](Animation.translateX.md) - * - * 对 X 轴平移 */ - translateX( - /** 在 X 轴平移的距离,单位为 px */ - translation: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateY(number translation)](Animation.translateY.md) - * - * 对 Y 轴平移 */ - translateY( - /** 在 Y 轴平移的距离,单位为 px */ - translation: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateZ(number translation)](Animation.translateZ.md) - * - * 对 Z 轴平移 */ - translateZ( - /** 在 Z 轴平移的距离,单位为 px */ - translation: number, - ): Animation; - /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.width(number|string value)](Animation.width.md) - * - * 设置宽度 */ - width( - /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */ - value: number | string, - ): Animation; - } - interface AudioContext { - /** [AudioContext.pause()](AudioContext.pause.md) - * - * 暂停音频。 */ - pause(): void; - /** [AudioContext.play()](AudioContext.play.md) - * - * 播放音频。 */ - play(): void; - /** [AudioContext.seek(number position)](AudioContext.seek.md) - * - * 跳转到指定位置。 */ - seek( - /** 跳转位置,单位 s */ - position: number, - ): void; - /** [AudioContext.setSrc(string src)](AudioContext.setSrc.md) - * - * 设置音频地址 */ - setSrc( - /** 音频地址 */ - src: string, - ): void; - } - interface BackgroundAudioManager { - /** [BackgroundAudioManager.onCanplay(function callback)](BackgroundAudioManager.onCanplay.md) - * - * 监听背景音频进入可播放状态事件。但不保证后面可以流畅播放 */ - onCanplay( - /** 背景音频进入可播放状态事件的回调函数 */ - callback: BackgroundAudioManagerOnCanplayCallback, - ): void; - /** [BackgroundAudioManager.onEnded(function callback)](BackgroundAudioManager.onEnded.md) - * - * 监听背景音频自然播放结束事件 */ - onEnded( - /** 背景音频自然播放结束事件的回调函数 */ - callback: BackgroundAudioManagerOnEndedCallback, - ): void; - /** [BackgroundAudioManager.onError(function callback)](BackgroundAudioManager.onError.md) - * - * 监听背景音频播放错误事件 */ - onError( - /** 背景音频播放错误事件的回调函数 */ - callback: BackgroundAudioManagerOnErrorCallback, - ): void; - /** [BackgroundAudioManager.onNext(function callback)](BackgroundAudioManager.onNext.md) - * - * 监听用户在系统音乐播放面板点击下一曲事件(仅iOS) */ - onNext( - /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */ - callback: OnNextCallback, - ): void; - /** [BackgroundAudioManager.onPause(function callback)](BackgroundAudioManager.onPause.md) - * - * 监听背景音频暂停事件 */ - onPause( - /** 背景音频暂停事件的回调函数 */ - callback: BackgroundAudioManagerOnPauseCallback, - ): void; - /** [BackgroundAudioManager.onPlay(function callback)](BackgroundAudioManager.onPlay.md) - * - * 监听背景音频播放事件 */ - onPlay( - /** 背景音频播放事件的回调函数 */ - callback: BackgroundAudioManagerOnPlayCallback, - ): void; - /** [BackgroundAudioManager.onPrev(function callback)](BackgroundAudioManager.onPrev.md) - * - * 监听用户在系统音乐播放面板点击上一曲事件(仅iOS) */ - onPrev( - /** 用户在系统音乐播放面板点击上一曲事件的回调函数 */ - callback: OnPrevCallback, - ): void; - /** [BackgroundAudioManager.onSeeked(function callback)](BackgroundAudioManager.onSeeked.md) - * - * 监听背景音频完成跳转操作事件 */ - onSeeked( - /** 背景音频完成跳转操作事件的回调函数 */ - callback: BackgroundAudioManagerOnSeekedCallback, - ): void; - /** [BackgroundAudioManager.onSeeking(function callback)](BackgroundAudioManager.onSeeking.md) - * - * 监听背景音频开始跳转操作事件 */ - onSeeking( - /** 背景音频开始跳转操作事件的回调函数 */ - callback: BackgroundAudioManagerOnSeekingCallback, - ): void; - /** [BackgroundAudioManager.onStop(function callback)](BackgroundAudioManager.onStop.md) - * - * 监听背景音频停止事件 */ - onStop( - /** 背景音频停止事件的回调函数 */ - callback: BackgroundAudioManagerOnStopCallback, - ): void; - /** [BackgroundAudioManager.onTimeUpdate(function callback)](BackgroundAudioManager.onTimeUpdate.md) - * - * 监听背景音频播放进度更新事件 */ - onTimeUpdate( - /** 背景音频播放进度更新事件的回调函数 */ - callback: BackgroundAudioManagerOnTimeUpdateCallback, - ): void; - /** [BackgroundAudioManager.onWaiting(function callback)](BackgroundAudioManager.onWaiting.md) - * - * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */ - onWaiting( - /** 音频加载中事件的回调函数 */ - callback: BackgroundAudioManagerOnWaitingCallback, - ): void; - /** [BackgroundAudioManager.pause()](BackgroundAudioManager.pause.md) - * - * 暂停音乐 */ - pause(): void; - /** [BackgroundAudioManager.play()](BackgroundAudioManager.play.md) - * - * 播放音乐 */ - play(): void; - /** [BackgroundAudioManager.seek(number currentTime)](BackgroundAudioManager.seek.md) - * - * 跳转到指定位置 */ - seek( - /** 跳转的位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */ - currentTime: number, - ): void; - /** [BackgroundAudioManager.stop()](BackgroundAudioManager.stop.md) - * - * 停止音乐 */ - stop(): void; - } - interface CameraContext { - /** [CameraContext.startRecord(Object object)](CameraContext.startRecord.md) - * - * 开始录像 */ - startRecord(option: CameraContextStartRecordOption): void; - /** [CameraContext.stopRecord(Object object)](CameraContext.stopRecord.md) - * - * 结束录像 */ - stopRecord(option?: StopRecordOption): void; - /** [CameraContext.takePhoto(Object object)](CameraContext.takePhoto.md) - * - * 拍摄照片 */ - takePhoto(option: TakePhotoOption): void; - } - interface CanvasContext { - /** [CanvasContext.arc(number x, number y, number r, number sAngle, number eAngle, number counterclockwise)](CanvasContext.arc.md) -* -* 创建一条弧线。 -* -* - 创建一个圆可以指定起始弧度为 0,终止弧度为 2 * Math.PI。 -* - 用 `stroke` 或者 `fill` 方法来在 `canvas` 中画弧线。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -// Draw coordinates -ctx.arc(100, 75, 50, 0, 2 * Math.PI) -ctx.setFillStyle('#EEEEEE') -ctx.fill() - -ctx.beginPath() -ctx.moveTo(40, 75) -ctx.lineTo(160, 75) -ctx.moveTo(100, 15) -ctx.lineTo(100, 135) -ctx.setStrokeStyle('#AAAAAA') -ctx.stroke() - -ctx.setFontSize(12) -ctx.setFillStyle('black') -ctx.fillText('0', 165, 78) -ctx.fillText('0.5*PI', 83, 145) -ctx.fillText('1*PI', 15, 78) -ctx.fillText('1.5*PI', 83, 10) - -// Draw points -ctx.beginPath() -ctx.arc(100, 75, 2, 0, 2 * Math.PI) -ctx.setFillStyle('lightgreen') -ctx.fill() - -ctx.beginPath() -ctx.arc(100, 25, 2, 0, 2 * Math.PI) -ctx.setFillStyle('blue') -ctx.fill() - -ctx.beginPath() -ctx.arc(150, 75, 2, 0, 2 * Math.PI) -ctx.setFillStyle('red') -ctx.fill() - -// Draw arc -ctx.beginPath() -ctx.arc(100, 75, 50, 0, 1.5 * Math.PI) -ctx.setStrokeStyle('#333333') -ctx.stroke() - -ctx.draw() -``` -* -* ![]((canvas/arc.png)) -* -* 针对 arc(100, 75, 50, 0, 1.5 * Math.PI)的三个关键坐标如下: -* -* - 绿色: 圆心 (100, 75) -* - 红色: 起始弧度 (0) -* - 蓝色: 终止弧度 (1.5 * Math.PI) */ - arc( - /** 圆心的 x 坐标 */ - x: number, - /** 圆心的 y 坐标 */ - y: number, - /** 圆的半径 */ - r: number, - /** 起始弧度,单位弧度(在3点钟方向) */ - sAngle: number, - /** 终止弧度 */ - eAngle: number, - /** 弧度的方向是否是逆时针 */ - counterclockwise?: number, - ): void; - /** [CanvasContext.arcTo(number x1, number y1, number x2, number y2, number radius)](CanvasContext.arcTo.md) - * - * 根据控制点和半径绘制圆弧路径。 - * - * 最低基础库: `1.9.90` */ - arcTo( - /** 第一个控制点的 x 轴坐标 */ - x1: number, - /** 第一个控制点的 y 轴坐标 */ - y1: number, - /** 第二个控制点的 x 轴坐标 */ - x2: number, - /** 第二个控制点的 y 轴坐标 */ - y2: number, - /** 圆弧的半径 */ - radius: number, - ): void; - /** [CanvasContext.beginPath()](CanvasContext.beginPath.md) -* -* 开始创建一个路径。需要调用 `fill` 或者 `stroke` 才会使用路径进行填充或描边 -* -* - 在最开始的时候相当于调用了一次 `beginPath`。 -* - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -// begin path -ctx.rect(10, 10, 100, 30) -ctx.setFillStyle('yellow') -ctx.fill() - -// begin another path -ctx.beginPath() -ctx.rect(10, 40, 100, 30) - -// only fill this rect, not in current path -ctx.setFillStyle('blue') -ctx.fillRect(10, 70, 100, 30) - -ctx.rect(10, 100, 100, 30) - -// it will fill current path -ctx.setFillStyle('red') -ctx.fill() -ctx.draw() -``` -* -* ![]((canvas/fill-path.png)) */ - beginPath(): void; - /** [CanvasContext.bezierCurveTo()](CanvasContext.bezierCurveTo.md) -* -* 创建三次方贝塞尔曲线路径。曲线的起始点为路径中前一个点。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -// Draw points -ctx.beginPath() -ctx.arc(20, 20, 2, 0, 2 * Math.PI) -ctx.setFillStyle('red') -ctx.fill() - -ctx.beginPath() -ctx.arc(200, 20, 2, 0, 2 * Math.PI) -ctx.setFillStyle('lightgreen') -ctx.fill() - -ctx.beginPath() -ctx.arc(20, 100, 2, 0, 2 * Math.PI) -ctx.arc(200, 100, 2, 0, 2 * Math.PI) -ctx.setFillStyle('blue') -ctx.fill() - -ctx.setFillStyle('black') -ctx.setFontSize(12) - -// Draw guides -ctx.beginPath() -ctx.moveTo(20, 20) -ctx.lineTo(20, 100) -ctx.lineTo(150, 75) - -ctx.moveTo(200, 20) -ctx.lineTo(200, 100) -ctx.lineTo(70, 75) -ctx.setStrokeStyle('#AAAAAA') -ctx.stroke() - -// Draw quadratic curve -ctx.beginPath() -ctx.moveTo(20, 20) -ctx.bezierCurveTo(20, 100, 200, 100, 200, 20) -ctx.setStrokeStyle('black') -ctx.stroke() - -ctx.draw() -``` -* -* ![]((canvas/bezier-curve.png)) -* -* 针对 moveTo(20, 20) bezierCurveTo(20, 100, 200, 100, 200, 20) 的三个关键坐标如下: -* -* - 红色:起始点(20, 20) -* - 蓝色:两个控制点(20, 100) (200, 100) -* - 绿色:终止点(200, 20) */ - bezierCurveTo(): void; - /** [CanvasContext.clearRect(number x, number y, number width, number height)](CanvasContext.clearRect.md) -* -* 清除画布上在该矩形区域内的内容 -* -* **示例代码** -* -* -* clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。 -* ```html -* -* ``` -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.setFillStyle('red') -ctx.fillRect(0, 0, 150, 200) -ctx.setFillStyle('blue') -ctx.fillRect(150, 0, 150, 200) -ctx.clearRect(10, 10, 150, 75) -ctx.draw() -``` -* ![]((canvas/clear-rect.png)) */ - clearRect( - /** 矩形路径左上角的横坐标 */ - x: number, - /** 矩形路径左上角的横坐标 */ - y: number, - /** 矩形路径的宽度 */ - width: number, - /** 矩形路径的高度 */ - height: number, - ): void; - /** [CanvasContext.clip()](CanvasContext.clip.md) -* -* 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -wx.downloadFile({ - url: 'http://is5.mzstatic.com/image/thumb/Purple128/v4/75/3b/90/753b907c-b7fb-5877-215a-759bd73691a4/source/50x50bb.jpg', - success: function(res) { - ctx.save() - ctx.beginPath() - ctx.arc(50, 50, 25, 0, 2*Math.PI) - ctx.clip() - ctx.drawImage(res.tempFilePath, 25, 25) - ctx.restore() - ctx.draw() - } -}) -``` -* ![]((canvas/clip.png)) -* -* 最低基础库: `1.6.0` */ - clip(): void; - /** [CanvasContext.closePath()](CanvasContext.closePath.md) -* -* 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.moveTo(10, 10) -ctx.lineTo(100, 10) -ctx.lineTo(100, 100) -ctx.closePath() -ctx.stroke() -ctx.draw() -``` -* ![]((canvas/close-line.png)) -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -// begin path -ctx.rect(10, 10, 100, 30) -ctx.closePath() - -// begin another path -ctx.beginPath() -ctx.rect(10, 40, 100, 30) - -// only fill this rect, not in current path -ctx.setFillStyle('blue') -ctx.fillRect(10, 70, 100, 30) - -ctx.rect(10, 100, 100, 30) - -// it will fill current path -ctx.setFillStyle('red') -ctx.fill() -ctx.draw() -``` -* -* ![]((canvas/close-path.png)) */ - closePath(): void; - /** [CanvasContext.createPattern(string image, string repetition)](CanvasContext.createPattern.md) - * - * 对指定的图像创建模式的方法,可在指定的方向上重复元图像 - * - * 最低基础库: `1.9.90` */ - createPattern( - /** 重复的图像源,仅支持包内路径和临时路径 */ - image: string, - /** 如何重复图像 */ - repetition: string, - ): void; - /** [CanvasContext.draw(boolean reserve, function callback)](CanvasContext.draw.md) -* -* 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。 -* -* **示例代码** -* -* -* 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。 -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setFillStyle('red') -ctx.fillRect(10, 10, 150, 100) -ctx.draw() -ctx.fillRect(50, 50, 150, 100) -ctx.draw(true) -``` -* ![]((canvas/reserve.png)) -* -* **示例代码** -* -* -* 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。 -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setFillStyle('red') -ctx.fillRect(10, 10, 150, 100) -ctx.draw() -ctx.fillRect(50, 50, 150, 100) -ctx.draw() -``` -* ![]((canvas/un-reserve.png)) */ - draw( - /** 本次绘制是否接着上一次绘制。即 reserve 参数为 false,则在本次调用绘制之前 native 层会先清空画布再继续绘制;若 reserve 参数为 true,则保留当前画布上的内容,本次调用 drawCanvas 绘制的内容覆盖在上面,默认 false。 */ - reserve: boolean, - /** 绘制完成后执行的回调函数 */ - callback: Function, - ): void; - /** [CanvasContext.draw(boolean reserve, function callback)](CanvasContext.draw.md) -* -* 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。 -* -* **示例代码** -* -* -* 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。 -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setFillStyle('red') -ctx.fillRect(10, 10, 150, 100) -ctx.draw() -ctx.fillRect(50, 50, 150, 100) -ctx.draw(true) -``` -* ![]((canvas/reserve.png)) -* -* **示例代码** -* -* -* 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。 -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setFillStyle('red') -ctx.fillRect(10, 10, 150, 100) -ctx.draw() -ctx.fillRect(50, 50, 150, 100) -ctx.draw() -``` -* ![]((canvas/un-reserve.png)) */ - draw( - /** 绘制完成后执行的回调函数 */ - callback: Function, - ): void; - /** [CanvasContext.drawImage(string imageResource, number dx, number dy, number dWidth, number dHeight, number sx, number sy, number sWidth, number sHeight)](CanvasContext.drawImage.md) -* -* 绘制图像到画布 -* -* **示例代码** -* -* -* -* 有三个版本的写法: -* -* - drawImage(dx, dy) -* - drawImage(dx, dy, dWidth, dHeight) -* - drawImage(sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持 -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -wx.chooseImage({ - success: function(res){ - ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100) - ctx.draw() - } -}) - -``` -* ![]((canvas/draw-image.png)) */ - drawImage( - /** 所要绘制的图片资源 */ - imageResource: string, - /** 图像的左上角在目标 canvas 上 x 轴的位置 */ - dx: number, - /** 图像的左上角在目标 canvas 上 y 轴的位置 */ - dy: number, - /** 在目标画布上绘制图像的宽度,允许对绘制的图像进行缩放 */ - dWidth: number, - /** 在目标画布上绘制图像的高度,允许对绘制的图像进行缩放 */ - dHeight: number, - /** 源图像的矩形选择框的左上角 x 坐标 */ - sx: number, - /** 源图像的矩形选择框的左上角 y 坐标 */ - sy: number, - /** 源图像的矩形选择框的宽度 */ - sWidth: number, - /** 源图像的矩形选择框的高度 */ - sHeight: number, - ): void; - /** [CanvasContext.fill()](CanvasContext.fill.md) -* -* 对当前路径中的内容进行填充。默认的填充色为黑色。 -* -* **示例代码** -* -* -* -* 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。 -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.moveTo(10, 10) -ctx.lineTo(100, 10) -ctx.lineTo(100, 100) -ctx.fill() -ctx.draw() -``` -* -* fill() 填充的的路径是从 beginPath() 开始计算,但是不会将 fillRect() 包含进去。 -* -* ![]((canvas/fill-line.png)) -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -// begin path -ctx.rect(10, 10, 100, 30) -ctx.setFillStyle('yellow') -ctx.fill() - -// begin another path -ctx.beginPath() -ctx.rect(10, 40, 100, 30) - -// only fill this rect, not in current path -ctx.setFillStyle('blue') -ctx.fillRect(10, 70, 100, 30) - -ctx.rect(10, 100, 100, 30) - -// it will fill current path -ctx.setFillStyle('red') -ctx.fill() -ctx.draw() -``` -* -* ![]((canvas/fill-path.png)) */ - fill(): void; - /** [CanvasContext.fillRect(number x, number y, number width, number height)](CanvasContext.fillRect.md) -* -* 填充一个矩形。用 [`setFillStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html) 设置矩形的填充色,如果没设置默认是黑色。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.setFillStyle('red') -ctx.fillRect(10, 10, 150, 75) -ctx.draw() -``` -* ![]((canvas/fill-rect.png)) */ - fillRect( - /** 矩形路径左上角的横坐标 */ - x: number, - /** 矩形路径左上角的横坐标 */ - y: number, - /** 矩形路径的宽度 */ - width: number, - /** 矩形路径的高度 */ - height: number, - ): void; - /** [CanvasContext.fillText(string text, number x, number y, number maxWidth)](CanvasContext.fillText.md) -* -* 在画布上绘制被填充的文本 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setFontSize(20) -ctx.fillText('Hello', 20, 20) -ctx.fillText('MINA', 100, 100) - -ctx.draw() -``` -* ![]((canvas/text.png)) */ - fillText( - /** 在画布上输出的文本 */ - text: string, - /** 绘制文本的左上角 x 坐标位置 */ - x: number, - /** 绘制文本的左上角 y 坐标位置 */ - y: number, - /** 需要绘制的最大宽度,可选 */ - maxWidth?: number, - ): void; - /** [CanvasContext.lineTo(number x, number y)](CanvasContext.lineTo.md) -* -* 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.moveTo(10, 10) -ctx.rect(10, 10, 100, 50) -ctx.lineTo(110, 60) -ctx.stroke() -ctx.draw() -``` -* ![]((canvas/line-to.png)) */ - lineTo( - /** 目标位置的 x 坐标 */ - x: number, - /** 目标位置的 y 坐标 */ - y: number, - ): void; - /** [CanvasContext.moveTo(number x, number y)](CanvasContext.moveTo.md) -* -* 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.moveTo(10, 10) -ctx.lineTo(100, 10) - -ctx.moveTo(10, 50) -ctx.lineTo(100, 50) -ctx.stroke() -ctx.draw() -``` -* ![]((canvas/move-to.png)) */ - moveTo( - /** 目标位置的 x 坐标 */ - x: number, - /** 目标位置的 y 坐标 */ - y: number, - ): void; - /** [CanvasContext.quadraticCurveTo(number cpx, number cpy, number x, number y)](CanvasContext.quadraticCurveTo.md) -* -* 创建二次贝塞尔曲线路径。曲线的起始点为路径中前一个点。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -// Draw points -ctx.beginPath() -ctx.arc(20, 20, 2, 0, 2 * Math.PI) -ctx.setFillStyle('red') -ctx.fill() - -ctx.beginPath() -ctx.arc(200, 20, 2, 0, 2 * Math.PI) -ctx.setFillStyle('lightgreen') -ctx.fill() - -ctx.beginPath() -ctx.arc(20, 100, 2, 0, 2 * Math.PI) -ctx.setFillStyle('blue') -ctx.fill() - -ctx.setFillStyle('black') -ctx.setFontSize(12) - -// Draw guides -ctx.beginPath() -ctx.moveTo(20, 20) -ctx.lineTo(20, 100) -ctx.lineTo(200, 20) -ctx.setStrokeStyle('#AAAAAA') -ctx.stroke() - -// Draw quadratic curve -ctx.beginPath() -ctx.moveTo(20, 20) -ctx.quadraticCurveTo(20, 100, 200, 20) -ctx.setStrokeStyle('black') -ctx.stroke() - -ctx.draw() -``` -* -* ![]((canvas/quadratic-curve-to.png)) -* -* 针对 moveTo(20, 20) quadraticCurveTo(20, 100, 200, 20) 的三个关键坐标如下: -* -* - 红色:起始点(20, 20) -* - 蓝色:控制点(20, 100) -* - 绿色:终止点(200, 20) */ - quadraticCurveTo( - /** 贝塞尔控制点的 x 坐标 */ - cpx: number, - /** 贝塞尔控制点的 y 坐标 */ - cpy: number, - /** 结束点的 x 坐标 */ - x: number, - /** 结束点的 y 坐标 */ - y: number, - ): void; - /** [CanvasContext.rect(number x, number y, number width, number height)](CanvasContext.rect.md) -* -* 创建一个矩形路径。需要用 [`fill`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html) 或者 [`stroke`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html) 方法将矩形真正的画到 `canvas` 中 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.rect(10, 10, 150, 75) -ctx.setFillStyle('red') -ctx.fill() -ctx.draw() -``` -* ![]((canvas/fill-rect.png)) */ - rect( - /** 矩形路径左上角的横坐标 */ - x: number, - /** 矩形路径左上角的横坐标 */ - y: number, - /** 矩形路径的宽度 */ - width: number, - /** 矩形路径的高度 */ - height: number, - ): void; - /** [CanvasContext.restore()](CanvasContext.restore.md) -* -* 恢复之前保存的绘图上下文。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -// save the default fill style -ctx.save() -ctx.setFillStyle('red') -ctx.fillRect(10, 10, 150, 100) - -// restore to the previous saved state -ctx.restore() -ctx.fillRect(50, 50, 150, 100) - -ctx.draw() -``` -* ![]((canvas/save-restore.png)) */ - restore(): void; - /** [CanvasContext.rotate(number rotate)](CanvasContext.rotate.md) -* -* 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.strokeRect(100, 10, 150, 100) -ctx.rotate(20 * Math.PI / 180) -ctx.strokeRect(100, 10, 150, 100) -ctx.rotate(20 * Math.PI / 180) -ctx.strokeRect(100, 10, 150, 100) - -ctx.draw() -``` -* ![]((canvas/rotate.png)) */ - rotate( - /** 旋转角度,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 */ - rotate: number, - ): void; - /** [CanvasContext.save()](CanvasContext.save.md) -* -* 保存绘图上下文。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -// save the default fill style -ctx.save() -ctx.setFillStyle('red') -ctx.fillRect(10, 10, 150, 100) - -// restore to the previous saved state -ctx.restore() -ctx.fillRect(50, 50, 150, 100) - -ctx.draw() -``` -* ![]((canvas/save-restore.png)) */ - save(): void; - /** [CanvasContext.scale(number scaleWidth, number scaleHeight)](CanvasContext.scale.md) -* -* 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.strokeRect(10, 10, 25, 15) -ctx.scale(2, 2) -ctx.strokeRect(10, 10, 25, 15) -ctx.scale(2, 2) -ctx.strokeRect(10, 10, 25, 15) - -ctx.draw() -``` -* ![]((canvas/scale.png)) */ - scale( - /** 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */ - scaleWidth: number, - /** 纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */ - scaleHeight: number, - ): void; - /** [CanvasContext.setFillStyle([Color](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Color.html) color)](CanvasContext.setFillStyle.md) -* -* 设置填充色。 -* -* **代码示例** -* -* -* ```js -const ctx = wx.createCanvasContext('myCanvas') -ctx.setFillStyle('red') -ctx.fillRect(10, 10, 150, 75) -ctx.draw() -``` -* ![]((canvas/fill-rect.png)) */ - setFillStyle( - /** [Color](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Color.html) - * - * 填充的颜色,默认颜色为 black。 */ - color: Color, - ): void; - /** [CanvasContext.setFontSize(number fontSize)](CanvasContext.setFontSize.md) -* -* 设置字体的字号 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setFontSize(20) -ctx.fillText('20', 20, 20) -ctx.setFontSize(30) -ctx.fillText('30', 40, 40) -ctx.setFontSize(40) -ctx.fillText('40', 60, 60) -ctx.setFontSize(50) -ctx.fillText('50', 90, 90) - -ctx.draw() -``` -* ![]((canvas/font-size.png)) */ - setFontSize( - /** 字体的字号 */ - fontSize: number, - ): void; - /** [CanvasContext.setGlobalAlpha(number alpha)](CanvasContext.setGlobalAlpha.md) -* -* 设置全局画笔透明度。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setFillStyle('red') -ctx.fillRect(10, 10, 150, 100) -ctx.setGlobalAlpha(0.2) -ctx.setFillStyle('blue') -ctx.fillRect(50, 50, 150, 100) -ctx.setFillStyle('yellow') -ctx.fillRect(100, 100, 150, 100) - -ctx.draw() -``` -* ![]((canvas/global-alpha.png)) */ - setGlobalAlpha( - /** 透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */ - alpha: number, - ): void; - /** [CanvasContext.setLineCap(string lineCap)](CanvasContext.setLineCap.md) -* -* 设置线条的端点样式 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.beginPath() -ctx.moveTo(10, 10) -ctx.lineTo(150, 10) -ctx.stroke() - -ctx.beginPath() -ctx.setLineCap('butt') -ctx.setLineWidth(10) -ctx.moveTo(10, 30) -ctx.lineTo(150, 30) -ctx.stroke() - -ctx.beginPath() -ctx.setLineCap('round') -ctx.setLineWidth(10) -ctx.moveTo(10, 50) -ctx.lineTo(150, 50) -ctx.stroke() - -ctx.beginPath() -ctx.setLineCap('square') -ctx.setLineWidth(10) -ctx.moveTo(10, 70) -ctx.lineTo(150, 70) -ctx.stroke() - -ctx.draw() -``` -* ![]((canvas/line-cap.png)) */ - setLineCap( - /** 线条的结束端点样式 */ - lineCap: string, - ): void; - /** [CanvasContext.setLineDash(Array. pattern, number offset)](CanvasContext.setLineDash.md) -* -* 设置虚线样式。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setLineDash([10, 20], 5); - -ctx.beginPath(); -ctx.moveTo(0,100); -ctx.lineTo(400, 100); -ctx.stroke(); - -ctx.draw() -``` -* ![]((canvas/set-line-dash.png)) -* -* 最低基础库: `1.6.0` */ - setLineDash( - /** 一组描述交替绘制线段和间距(坐标空间单位)长度的数字 */ - pattern: number[], - /** 虚线偏移量 */ - offset: number, - ): void; - /** [CanvasContext.setLineJoin(string lineJoin)](CanvasContext.setLineJoin.md) -* -* 设置线条的交点样式 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.beginPath() -ctx.moveTo(10, 10) -ctx.lineTo(100, 50) -ctx.lineTo(10, 90) -ctx.stroke() - -ctx.beginPath() -ctx.setLineJoin('bevel') -ctx.setLineWidth(10) -ctx.moveTo(50, 10) -ctx.lineTo(140, 50) -ctx.lineTo(50, 90) -ctx.stroke() - -ctx.beginPath() -ctx.setLineJoin('round') -ctx.setLineWidth(10) -ctx.moveTo(90, 10) -ctx.lineTo(180, 50) -ctx.lineTo(90, 90) -ctx.stroke() - -ctx.beginPath() -ctx.setLineJoin('miter') -ctx.setLineWidth(10) -ctx.moveTo(130, 10) -ctx.lineTo(220, 50) -ctx.lineTo(130, 90) -ctx.stroke() - -ctx.draw() -``` -* ![]((canvas/line-join.png)) */ - setLineJoin( - /** 线条的结束交点样式 */ - lineJoin: string, - ): void; - /** [CanvasContext.setLineWidth(number lineWidth)](CanvasContext.setLineWidth.md) -* -* 设置线条的宽度 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.beginPath() -ctx.moveTo(10, 10) -ctx.lineTo(150, 10) -ctx.stroke() - -ctx.beginPath() -ctx.setLineWidth(5) -ctx.moveTo(10, 30) -ctx.lineTo(150, 30) -ctx.stroke() - -ctx.beginPath() -ctx.setLineWidth(10) -ctx.moveTo(10, 50) -ctx.lineTo(150, 50) -ctx.stroke() - -ctx.beginPath() -ctx.setLineWidth(15) -ctx.moveTo(10, 70) -ctx.lineTo(150, 70) -ctx.stroke() - -ctx.draw() -``` -* -* ![]((canvas/line-width.png)) */ - setLineWidth( - /** 线条的宽度,单位px */ - lineWidth: number, - ): void; - /** [CanvasContext.setMiterLimit(number miterLimit)](CanvasContext.setMiterLimit.md) -* -* 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.beginPath() -ctx.setLineWidth(10) -ctx.setLineJoin('miter') -ctx.setMiterLimit(1) -ctx.moveTo(10, 10) -ctx.lineTo(100, 50) -ctx.lineTo(10, 90) -ctx.stroke() - -ctx.beginPath() -ctx.setLineWidth(10) -ctx.setLineJoin('miter') -ctx.setMiterLimit(2) -ctx.moveTo(50, 10) -ctx.lineTo(140, 50) -ctx.lineTo(50, 90) -ctx.stroke() - -ctx.beginPath() -ctx.setLineWidth(10) -ctx.setLineJoin('miter') -ctx.setMiterLimit(3) -ctx.moveTo(90, 10) -ctx.lineTo(180, 50) -ctx.lineTo(90, 90) -ctx.stroke() - -ctx.beginPath() -ctx.setLineWidth(10) -ctx.setLineJoin('miter') -ctx.setMiterLimit(4) -ctx.moveTo(130, 10) -ctx.lineTo(220, 50) -ctx.lineTo(130, 90) -ctx.stroke() - -ctx.draw() -``` -* ![]((canvas/miter-limit.png)) */ - setMiterLimit( - /** 最大斜接长度 */ - miterLimit: number, - ): void; - /** [CanvasContext.setShadow(number offsetX, number offsetY, number blur, string color)](CanvasContext.setShadow.md) -* -* 设定阴影样式。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.setFillStyle('red') -ctx.setShadow(10, 50, 50, 'blue') -ctx.fillRect(10, 10, 150, 75) -ctx.draw() -``` -* ![]((canvas/shadow.png)) */ - setShadow( - /** 阴影相对于形状在水平方向的偏移,默认值为 0。 */ - offsetX: number, - /** 阴影相对于形状在竖直方向的偏移,默认值为 0。 */ - offsetY: number, - /** 阴影的模糊级别,数值越大越模糊。范围 0- 100。,默认值为 0。 */ - blur: number, - /** 阴影的颜色。默认值为 black。 */ - color: string, - ): void; - /** [CanvasContext.setStrokeStyle([Color](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Color.html) color)](CanvasContext.setStrokeStyle.md) -* -* 设置描边颜色。 -* -* **代码示例** -* -* -* ```js -const ctx = wx.createCanvasContext('myCanvas') -ctx.setStrokeStyle('red') -ctx.strokeRect(10, 10, 150, 75) -ctx.draw() -``` -* ![]((canvas/stroke-rect.png)) */ - setStrokeStyle( - /** [Color](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Color.html) - * - * 描边的颜色,默认颜色为 black。 */ - color: Color, - ): void; - /** [CanvasContext.setTextAlign(string align)](CanvasContext.setTextAlign.md) -* -* 设置文字的对齐 -* -* **示例代码** -* -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setStrokeStyle('red') -ctx.moveTo(150, 20) -ctx.lineTo(150, 170) -ctx.stroke() - -ctx.setFontSize(15) -ctx.setTextAlign('left') -ctx.fillText('textAlign=left', 150, 60) - -ctx.setTextAlign('center') -ctx.fillText('textAlign=center', 150, 80) - -ctx.setTextAlign('right') -ctx.fillText('textAlign=right', 150, 100) - -ctx.draw() -``` -* -* ![]((canvas/set-text-align.png)) -* -* 最低基础库: `1.1.0` */ - setTextAlign( - /** 文字的对齐方式 */ - align: string, - ): void; - /** [CanvasContext.setTextBaseline(string textBaseline)](CanvasContext.setTextBaseline.md) -* -* 设置文字的竖直对齐 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.setStrokeStyle('red') -ctx.moveTo(5, 75) -ctx.lineTo(295, 75) -ctx.stroke() - -ctx.setFontSize(20) - -ctx.setTextBaseline('top') -ctx.fillText('top', 5, 75) - -ctx.setTextBaseline('middle') -ctx.fillText('middle', 50, 75) - -ctx.setTextBaseline('bottom') -ctx.fillText('bottom', 120, 75) - -ctx.setTextBaseline('normal') -ctx.fillText('normal', 200, 75) - -ctx.draw() -``` -* ![]((canvas/set-text-baseline.png)) -* -* 最低基础库: `1.4.0` */ - setTextBaseline( - /** 文字的竖直对齐方式 */ - textBaseline: string, - ): void; - /** [CanvasContext.setTransform(number scaleX, number scaleY, number skewX, number skewY, number translateX, number translateY)](CanvasContext.setTransform.md) - * - * 使用矩阵重新设置(覆盖)当前变换的方法 - * - * 最低基础库: `1.9.90` */ - setTransform( - /** 水平缩放 */ - scaleX: number, - /** 垂直缩放 */ - scaleY: number, - /** 水平倾斜 */ - skewX: number, - /** 垂直倾斜 */ - skewY: number, - /** 水平移动 */ - translateX: number, - /** 垂直移动 */ - translateY: number, - ): void; - /** [CanvasContext.stroke()](CanvasContext.stroke.md) -* -* 画出当前路径的边框。默认颜色色为黑色。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.moveTo(10, 10) -ctx.lineTo(100, 10) -ctx.lineTo(100, 100) -ctx.stroke() -ctx.draw() -``` -* ![]((canvas/stroke-line.png)) -* -* stroke() 描绘的的路径是从 beginPath() 开始计算,但是不会将 strokeRect() 包含进去。 -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -// begin path -ctx.rect(10, 10, 100, 30) -ctx.setStrokeStyle('yellow') -ctx.stroke() - -// begin another path -ctx.beginPath() -ctx.rect(10, 40, 100, 30) - -// only stoke this rect, not in current path -ctx.setStrokeStyle('blue') -ctx.strokeRect(10, 70, 100, 30) - -ctx.rect(10, 100, 100, 30) - -// it will stroke current path -ctx.setStrokeStyle('red') -ctx.stroke() -ctx.draw() -``` -* -* ![]((canvas/stroke-path.png)) */ - stroke(): void; - /** [CanvasContext.strokeRect(number x, number y, number width, number height)](CanvasContext.strokeRect.md) -* -* 画一个矩形(非填充)。 用 [`setStrokeStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html) 设置矩形线条的颜色,如果没设置默认是黑色。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') -ctx.setStrokeStyle('red') -ctx.strokeRect(10, 10, 150, 75) -ctx.draw() -``` -* ![]((canvas/stroke-rect.png)) */ - strokeRect( - /** 矩形路径左上角的横坐标 */ - x: number, - /** 矩形路径左上角的横坐标 */ - y: number, - /** 矩形路径的宽度 */ - width: number, - /** 矩形路径的高度 */ - height: number, - ): void; - /** [CanvasContext.strokeText(string text, number x, number y, number maxWidth)](CanvasContext.strokeText.md) - * - * 给定的 (x, y) 位置绘制文本描边的方法 - * - * 最低基础库: `1.9.90` */ - strokeText( - /** 要绘制的文本 */ - text: string, - /** 文本起始点的 x 轴坐标 */ - x: number, - /** 文本起始点的 y 轴坐标 */ - y: number, - /** 需要绘制的最大宽度,可选 */ - maxWidth?: number, - ): void; - /** [CanvasContext.transform(number scaleX, number scaleY, number skewX, number skewY, number translateX, number translateY)](CanvasContext.transform.md) - * - * 使用矩阵多次叠加当前变换的方法 - * - * 最低基础库: `1.9.90` */ - transform( - /** 水平缩放 */ - scaleX: number, - /** 垂直缩放 */ - scaleY: number, - /** 水平倾斜 */ - skewX: number, - /** 垂直倾斜 */ - skewY: number, - /** 水平移动 */ - translateX: number, - /** 垂直移动 */ - translateY: number, - ): void; - /** [CanvasContext.translate(number x, number y)](CanvasContext.translate.md) -* -* 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。 -* -* **示例代码** -* -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -ctx.strokeRect(10, 10, 150, 100) -ctx.translate(20, 20) -ctx.strokeRect(10, 10, 150, 100) -ctx.translate(20, 20) -ctx.strokeRect(10, 10, 150, 100) - -ctx.draw() -``` -* -* ![]((canvas/translate.png)) */ - translate( - /** 水平坐标平移量 */ - x: number, - /** 竖直坐标平移量 */ - y: number, - ): void; - /** [Object CanvasContext.measureText(string text)](CanvasContext.measureText.md) - * - * 测量文本尺寸信息。目前仅返回文本宽度。同步接口。 - * - * 最低基础库: `1.9.90` */ - measureText( - /** 要测量的文本 */ - text: string, - ): TextMetrics; - /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createCircularGradient(number x, number y, number r)](CanvasContext.createCircularGradient.md) -* -* 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -// Create circular gradient -const grd = ctx.createCircularGradient(75, 50, 50) -grd.addColorStop(0, 'red') -grd.addColorStop(1, 'white') - -// Fill with gradient -ctx.setFillStyle(grd) -ctx.fillRect(10, 10, 150, 80) -ctx.draw() -``` -* ![]((canvas/circular-gradient.png)) */ - createCircularGradient( - /** 圆心的 x 坐标 */ - x: number, - /** 圆心的 y 坐标 */ - y: number, - /** 圆的半径 */ - r: number, - ): CanvasGradient; - /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createLinearGradient(number x0, number y0, number x1, number y1)](CanvasContext.createLinearGradient.md) -* -* 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。 -* -* **示例代码** -* -* -* ```javascript -const ctx = wx.createCanvasContext('myCanvas') - -// Create linear gradient -const grd = ctx.createLinearGradient(0, 0, 200, 0) -grd.addColorStop(0, 'red') -grd.addColorStop(1, 'white') - -// Fill with gradient -ctx.setFillStyle(grd) -ctx.fillRect(10, 10, 150, 80) -ctx.draw() -``` -* ![]((canvas/linear-gradient.png)) */ - createLinearGradient( - /** 起点的 x 坐标 */ - x0: number, - /** 起点的 y 坐标 */ - y0: number, - /** 终点的 x 坐标 */ - x1: number, - /** 终点的 y 坐标 */ - y1: number, - ): CanvasGradient; - } - interface CanvasGradient { - /** [CanvasGradient.addColorStop(number stop, [Color](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Color.html) color)](CanvasGradient.addColorStop.md) -* -* 添加颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染 -* -* **示例代码** -* -* -* ```js -const ctx = wx.createCanvasContext('myCanvas') - -// Create circular gradient -const grd = ctx.createLinearGradient(30, 10, 120, 10) -grd.addColorStop(0, 'red') -grd.addColorStop(0.16, 'orange') -grd.addColorStop(0.33, 'yellow') -grd.addColorStop(0.5, 'green') -grd.addColorStop(0.66, 'cyan') -grd.addColorStop(0.83, 'blue') -grd.addColorStop(1, 'purple') - -// Fill with gradient -ctx.setFillStyle(grd) -ctx.fillRect(10, 10, 150, 80) -ctx.draw() -``` -* ![]((canvas/color-stop.png)) */ - addColorStop( - /** 表示渐变中开始与结束之间的位置,范围 0-1。 */ - stop: number, - /** [Color](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Color.html) - * - * 渐变点的颜色。 */ - color: Color, - ): void; - } - interface Console { - /** [console.debug()](console.debug.md) - * - * 向调试面板中打印 debug 日志 */ - debug( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void; - /** [console.error()](console.error.md) - * - * 向调试面板中打印 error 日志 */ - error( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void; - /** [console.group(string label)](console.group.md) - * - * 在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 [console.groupEnd](https://developers.weixin.qq.com/miniprogram/dev/api/debug/console.groupEnd.html)之后分组结束。 - * - * **注意** - * - * 仅在工具中有效,在 vConsole 中为空函数实现。 */ - group( - /** 分组标记,可选。 */ - label?: string, - ): void; - /** [console.groupEnd()](console.groupEnd.md) - * - * 结束由 [console.group](https://developers.weixin.qq.com/miniprogram/dev/api/debug/console.group.html) 创建的分组 - * - * **注意** - * - * 仅在工具中有效,在 vConsole 中为空函数实现。 */ - groupEnd(): void; - /** [console.info()](console.info.md) - * - * 向调试面板中打印 info 日志 */ - info( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void; - /** [console.log()](console.log.md) - * - * 向调试面板中打印 log 日志 */ - log( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void; - /** [console.warn()](console.warn.md) - * - * 向调试面板中打印 warn 日志 */ - warn( - /** 日志内容,可以有任意多个。 */ - ...args: any[] - ): void; - } - interface DownloadTask { - /** [DownloadTask.abort()](DownloadTask.abort.md) - * - * 中断下载任务 - * - * 最低基础库: `1.4.0` */ - abort(): void; - /** [DownloadTask.offHeadersReceived(function callback)](DownloadTask.offHeadersReceived.md) - * - * 取消监听 HTTP Response Header 事件 - * - * 最低基础库: `2.1.0` */ - offHeadersReceived( - /** HTTP Response Header 事件的回调函数 */ - callback: DownloadTaskOffHeadersReceivedCallback, - ): void; - /** [DownloadTask.offProgressUpdate(function callback)](DownloadTask.offProgressUpdate.md) - * - * 取消监听下载进度变化事件 - * - * 最低基础库: `2.1.0` */ - offProgressUpdate( - /** 下载进度变化事件的回调函数 */ - callback: DownloadTaskOffProgressUpdateCallback, - ): void; - /** [DownloadTask.onHeadersReceived(function callback)](DownloadTask.onHeadersReceived.md) - * - * 监听 HTTP Response Header 事件。会比请求完成事件更早 - * - * 最低基础库: `2.1.0` */ - onHeadersReceived( - /** HTTP Response Header 事件的回调函数 */ - callback: DownloadTaskOnHeadersReceivedCallback, - ): void; - /** [DownloadTask.onProgressUpdate(function callback)](DownloadTask.onProgressUpdate.md) - * - * 监听下载进度变化事件 - * - * 最低基础库: `1.4.0` */ - onProgressUpdate( - /** 下载进度变化事件的回调函数 */ - callback: DownloadTaskOnProgressUpdateCallback, - ): void; - } - interface FileSystemManager { - /** [Array. FileSystemManager.readdirSync(string dirPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html) - * - * [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本 */ - readdirSync( - /** 要读取的目录路径 */ - dirPath: string, - ): string[]; - /** [FileSystemManager.access(Object object)](FileSystemManager.access.md) - * - * 判断文件/目录是否存在 */ - access(option: AccessOption): void; - /** [FileSystemManager.accessSync(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.accessSync.html) - * - * [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本 */ - accessSync( - /** 要判断是否存在的文件/目录路径 */ - path: string, - ): void; - /** [FileSystemManager.appendFile(Object object)](FileSystemManager.appendFile.md) - * - * 在文件结尾追加内容 - * - * 最低基础库: `2.1.0` */ - appendFile(option: AppendFileOption): void; - /** [FileSystemManager.appendFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFileSync.html) - * - * [FileSystemManager.appendFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) 的同步版本 - * - * 最低基础库: `2.1.0` */ - appendFileSync( - /** 要追加内容的文件路径 */ - filePath: string, - /** 要追加的文本或二进制数据 */ - data: string | ArrayBuffer, - /** 指定写入文件的字符编码 */ - encoding?: string, - ): void; - /** [FileSystemManager.copyFile(Object object)](FileSystemManager.copyFile.md) - * - * 复制文件 */ - copyFile(option: CopyFileOption): void; - /** [FileSystemManager.copyFileSync(string srcPath, string destPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFileSync.html) - * - * [FileSystemManager.copyFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) 的同步版本 */ - copyFileSync( - /** 源文件路径,只可以是普通文件 */ - srcPath: string, - /** 目标文件路径 */ - destPath: string, - ): void; - /** [FileSystemManager.getFileInfo(Object object)](FileSystemManager.getFileInfo.md) - * - * 获取该小程序下的 本地临时文件 或 本地缓存文件 信息 */ - getFileInfo(option: FileSystemManagerGetFileInfoOption): void; - /** [FileSystemManager.getSavedFileList(Object object)](FileSystemManager.getSavedFileList.md) - * - * 获取该小程序下已保存的本地缓存文件列表 */ - getSavedFileList(option?: FileSystemManagerGetSavedFileListOption): void; - /** [FileSystemManager.mkdir(Object object)](FileSystemManager.mkdir.md) - * - * 创建目录 */ - mkdir(option: MkdirOption): void; - /** [FileSystemManager.mkdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdirSync.html) - * - * [FileSystemManager.mkdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) 的同步版本 */ - mkdirSync( - /** 创建的目录路径 */ - dirPath: string, - /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 - * - * 最低基础库: `2.3.0` */ - recursive?: boolean, - ): void; - /** [FileSystemManager.readFile(Object object)](FileSystemManager.readFile.md) - * - * 读取本地文件内容 */ - readFile(option: ReadFileOption): void; - /** [FileSystemManager.readdir(Object object)](FileSystemManager.readdir.md) - * - * 读取目录内文件列表 */ - readdir(option: ReaddirOption): void; - /** [FileSystemManager.removeSavedFile(Object object)](FileSystemManager.removeSavedFile.md) - * - * 删除该小程序下已保存的本地缓存文件 */ - removeSavedFile(option: FileSystemManagerRemoveSavedFileOption): void; - /** [FileSystemManager.rename(Object object)](FileSystemManager.rename.md) - * - * 重命名文件。可以把文件从 oldPath 移动到 newPath */ - rename(option: RenameOption): void; - /** [FileSystemManager.renameSync(string oldPath, string newPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.renameSync.html) - * - * [FileSystemManager.rename](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) 的同步版本 */ - renameSync( - /** 源文件路径,可以是普通文件或目录 */ - oldPath: string, - /** 新文件路径 */ - newPath: string, - ): void; - /** [FileSystemManager.rmdir(Object object)](FileSystemManager.rmdir.md) - * - * 删除目录 */ - rmdir(option: RmdirOption): void; - /** [FileSystemManager.rmdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdirSync.html) - * - * [FileSystemManager.rmdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) 的同步版本 */ - rmdirSync( - /** 要删除的目录路径 */ - dirPath: string, - /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 - * - * 最低基础库: `2.3.0` */ - recursive?: boolean, - ): void; - /** [FileSystemManager.saveFile(Object object)](FileSystemManager.saveFile.md) - * - * 保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。 */ - saveFile(option: FileSystemManagerSaveFileOption): void; - /** [FileSystemManager.stat(Object object)](FileSystemManager.stat.md) - * - * 获取文件 Stats 对象 */ - stat(option: StatOption): void; - /** [FileSystemManager.unlink(Object object)](FileSystemManager.unlink.md) - * - * 删除文件 */ - unlink(option: UnlinkOption): void; - /** [FileSystemManager.unlinkSync(string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlinkSync.html) - * - * [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本 */ - unlinkSync( - /** 要删除的文件路径 */ - filePath: string, - ): void; - /** [FileSystemManager.unzip(Object object)](FileSystemManager.unzip.md) - * - * 解压文件 */ - unzip(option: UnzipOption): void; - /** [FileSystemManager.writeFile(Object object)](FileSystemManager.writeFile.md) - * - * 写文件 */ - writeFile(option: WriteFileOption): void; - /** [FileSystemManager.writeFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFileSync.html) - * - * [FileSystemManager.writeFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) 的同步版本 */ - writeFileSync( - /** 要写入的文件路径 */ - filePath: string, - /** 要写入的文本或二进制数据 */ - data: string | ArrayBuffer, - /** 指定写入文件的字符编码 */ - encoding?: string, - ): void; - /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object FileSystemManager.statSync(string path, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html) - * - * [FileSystemManager.stat](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html) 的同步版本 */ - statSync( - /** 文件/目录路径 */ - path: string, - /** 是否递归获取目录下的每个文件的 Stats 信息 - * - * 最低基础库: `2.3.0` */ - recursive?: boolean, - ): Stats; - /** [number FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html) - * - * [FileSystemManager.saveFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) 的同步版本 */ - saveFileSync( - /** 临时存储文件路径 */ - tempFilePath: string, - /** 要存储的文件路径 */ - filePath?: string, - ): number; - /** [string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html) - * - * [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本 */ - readFileSync( - /** 要读取的文件的路径 */ - filePath: string, - /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 */ - encoding?: string, - ): string; - } - interface GeneralCallbackResult { - errMsg: string; - } - interface InnerAudioContext { - /** [InnerAudioContext.destroy()](InnerAudioContext.destroy.md) - * - * 销毁当前实例 */ - destroy(): void; - /** [InnerAudioContext.offCanplay(function callback)](InnerAudioContext.offCanplay.md) - * - * 取消监听音频进入可以播放状态的事件 - * - * 最低基础库: `1.9.0` */ - offCanplay( - /** 音频进入可以播放状态的事件的回调函数 */ - callback: OffCanplayCallback, - ): void; - /** [InnerAudioContext.offEnded(function callback)](InnerAudioContext.offEnded.md) - * - * 取消监听音频自然播放至结束的事件 - * - * 最低基础库: `1.9.0` */ - offEnded( - /** 音频自然播放至结束的事件的回调函数 */ - callback: OffEndedCallback, - ): void; - /** [InnerAudioContext.offError(function callback)](InnerAudioContext.offError.md) - * - * 取消监听音频播放错误事件 - * - * 最低基础库: `1.9.0` */ - offError( - /** 音频播放错误事件的回调函数 */ - callback: OffErrorCallback, - ): void; - /** [InnerAudioContext.offPause(function callback)](InnerAudioContext.offPause.md) - * - * 取消监听音频暂停事件 - * - * 最低基础库: `1.9.0` */ - offPause( - /** 音频暂停事件的回调函数 */ - callback: OffPauseCallback, - ): void; - /** [InnerAudioContext.offPlay(function callback)](InnerAudioContext.offPlay.md) - * - * 取消监听音频播放事件 - * - * 最低基础库: `1.9.0` */ - offPlay( - /** 音频播放事件的回调函数 */ - callback: OffPlayCallback, - ): void; - /** [InnerAudioContext.offSeeked(function callback)](InnerAudioContext.offSeeked.md) - * - * 取消监听音频完成跳转操作的事件 - * - * 最低基础库: `1.9.0` */ - offSeeked( - /** 音频完成跳转操作的事件的回调函数 */ - callback: OffSeekedCallback, - ): void; - /** [InnerAudioContext.offSeeking(function callback)](InnerAudioContext.offSeeking.md) - * - * 取消监听音频进行跳转操作的事件 - * - * 最低基础库: `1.9.0` */ - offSeeking( - /** 音频进行跳转操作的事件的回调函数 */ - callback: OffSeekingCallback, - ): void; - /** [InnerAudioContext.offStop(function callback)](InnerAudioContext.offStop.md) - * - * 取消监听音频停止事件 - * - * 最低基础库: `1.9.0` */ - offStop( - /** 音频停止事件的回调函数 */ - callback: OffStopCallback, - ): void; - /** [InnerAudioContext.offTimeUpdate(function callback)](InnerAudioContext.offTimeUpdate.md) - * - * 取消监听音频播放进度更新事件 - * - * 最低基础库: `1.9.0` */ - offTimeUpdate( - /** 音频播放进度更新事件的回调函数 */ - callback: OffTimeUpdateCallback, - ): void; - /** [InnerAudioContext.offWaiting(function callback)](InnerAudioContext.offWaiting.md) - * - * 取消监听音频加载中事件 - * - * 最低基础库: `1.9.0` */ - offWaiting( - /** 音频加载中事件的回调函数 */ - callback: OffWaitingCallback, - ): void; - /** [InnerAudioContext.onCanplay(function callback)](InnerAudioContext.onCanplay.md) - * - * 监听音频进入可以播放状态的事件。但不保证后面可以流畅播放 */ - onCanplay( - /** 音频进入可以播放状态的事件的回调函数 */ - callback: InnerAudioContextOnCanplayCallback, - ): void; - /** [InnerAudioContext.onEnded(function callback)](InnerAudioContext.onEnded.md) - * - * 监听音频自然播放至结束的事件 */ - onEnded( - /** 音频自然播放至结束的事件的回调函数 */ - callback: InnerAudioContextOnEndedCallback, - ): void; - /** [InnerAudioContext.onError(function callback)](InnerAudioContext.onError.md) - * - * 监听音频播放错误事件 */ - onError( - /** 音频播放错误事件的回调函数 */ - callback: InnerAudioContextOnErrorCallback, - ): void; - /** [InnerAudioContext.onPause(function callback)](InnerAudioContext.onPause.md) - * - * 监听音频暂停事件 */ - onPause( - /** 音频暂停事件的回调函数 */ - callback: InnerAudioContextOnPauseCallback, - ): void; - /** [InnerAudioContext.onPlay(function callback)](InnerAudioContext.onPlay.md) - * - * 监听音频播放事件 */ - onPlay( - /** 音频播放事件的回调函数 */ - callback: InnerAudioContextOnPlayCallback, - ): void; - /** [InnerAudioContext.onSeeked(function callback)](InnerAudioContext.onSeeked.md) - * - * 监听音频完成跳转操作的事件 */ - onSeeked( - /** 音频完成跳转操作的事件的回调函数 */ - callback: InnerAudioContextOnSeekedCallback, - ): void; - /** [InnerAudioContext.onSeeking(function callback)](InnerAudioContext.onSeeking.md) - * - * 监听音频进行跳转操作的事件 */ - onSeeking( - /** 音频进行跳转操作的事件的回调函数 */ - callback: InnerAudioContextOnSeekingCallback, - ): void; - /** [InnerAudioContext.onStop(function callback)](InnerAudioContext.onStop.md) - * - * 监听音频停止事件 */ - onStop( - /** 音频停止事件的回调函数 */ - callback: InnerAudioContextOnStopCallback, - ): void; - /** [InnerAudioContext.onTimeUpdate(function callback)](InnerAudioContext.onTimeUpdate.md) - * - * 监听音频播放进度更新事件 */ - onTimeUpdate( - /** 音频播放进度更新事件的回调函数 */ - callback: InnerAudioContextOnTimeUpdateCallback, - ): void; - /** [InnerAudioContext.onWaiting(function callback)](InnerAudioContext.onWaiting.md) - * - * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */ - onWaiting( - /** 音频加载中事件的回调函数 */ - callback: InnerAudioContextOnWaitingCallback, - ): void; - /** [InnerAudioContext.pause()](InnerAudioContext.pause.md) - * - * 暂停。暂停后的音频再播放会从暂停处开始播放 */ - pause(): void; - /** [InnerAudioContext.play()](InnerAudioContext.play.md) - * - * 播放 */ - play(): void; - /** [InnerAudioContext.seek(number position)](InnerAudioContext.seek.md) - * - * 跳转到指定位置 */ - seek( - /** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */ - position: number, - ): void; - /** [InnerAudioContext.stop()](InnerAudioContext.stop.md) - * - * 停止。停止后的音频再播放会从头开始播放。 */ - stop(): void; - } - interface IntersectionObserver { - /** [IntersectionObserver.disconnect()](IntersectionObserver.disconnect.md) - * - * 停止监听。回调函数将不再触发 - * - * **注意** - * - * 与页面显示区域的相交区域并不准确代表用户可见的区域,因为参与计算的区域是“布局区域”,布局区域可能会在绘制时被其他节点裁剪隐藏(如遇祖先节点中 overflow 样式为 hidden 的节点)或遮盖(如遇 fixed 定位的节点)。 */ - disconnect(): void; - /** [IntersectionObserver.observe(string targetSelector, function callback)](IntersectionObserver.observe.md) - * - * 指定目标节点并开始监听相交状态变化情况 */ - observe( - /** 选择器 */ - targetSelector: string, - /** 监听相交状态变化的回调函数 */ - callback: ObserveCallback, - ): void; - /** [IntersectionObserver.relativeTo(string selector, Object margins)](IntersectionObserver.relativeTo.md) - * - * 使用选择器指定一个节点,作为参照区域之一。 */ - relativeTo( - /** 选择器 */ - selector: string, - /** 用来扩展(或收缩)参照节点布局区域的边界 */ - margins?: RelativeToMargins, - ): void; - /** [IntersectionObserver.relativeToViewport(Object margins)](IntersectionObserver.relativeToViewport.md) -* -* 指定页面显示区域作为参照区域之一 -* -* **示例代码** -* -* -* 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。 -* ```javascript -Page({ - onLoad: function(){ - wx.createIntersectionObserver().relativeToViewport({bottom: 100}).observe('.target-class', (res) => { - res.intersectionRatio // 相交区域占目标节点的布局区域的比例 - res.intersectionRect // 相交区域 - res.intersectionRect.left // 相交区域的左边界坐标 - res.intersectionRect.top // 相交区域的上边界坐标 - res.intersectionRect.width // 相交区域的宽度 - res.intersectionRect.height // 相交区域的高度 - }) - } -}) -``` */ - relativeToViewport( - /** 用来扩展(或收缩)参照节点布局区域的边界 */ - margins?: RelativeToViewportMargins, - ): void; - } - interface LivePlayerContext { - /** [LivePlayerContext.exitFullScreen(Object object)](LivePlayerContext.exitFullScreen.md) - * - * 退出全屏 */ - exitFullScreen(option?: ExitFullScreenOption): void; - /** [LivePlayerContext.mute(Object object)](LivePlayerContext.mute.md) - * - * 静音 */ - mute(option?: MuteOption): void; - /** [LivePlayerContext.pause(Object object)](LivePlayerContext.pause.md) - * - * 暂停 - * - * 最低基础库: `1.9.90` */ - pause(option?: LivePlayerContextPauseOption): void; - /** [LivePlayerContext.play(Object object)](LivePlayerContext.play.md) - * - * 播放 */ - play(option?: PlayOption): void; - /** [LivePlayerContext.requestFullScreen(Object object)](LivePlayerContext.requestFullScreen.md) - * - * 进入全屏 */ - requestFullScreen(option: LivePlayerContextRequestFullScreenOption): void; - /** [LivePlayerContext.resume(Object object)](LivePlayerContext.resume.md) - * - * 恢复 - * - * 最低基础库: `1.9.90` */ - resume(option?: LivePlayerContextResumeOption): void; - /** [LivePlayerContext.stop(Object object)](LivePlayerContext.stop.md) - * - * 停止 */ - stop(option?: LivePlayerContextStopOption): void; - } - interface LivePusherContext { - /** [LivePusherContext.pause(Object object)](LivePusherContext.pause.md) - * - * 暂停推流 */ - pause(option?: LivePusherContextPauseOption): void; - /** [LivePusherContext.pauseBGM(Object object)](LivePusherContext.pauseBGM.md) - * - * 暂停背景音 - * - * 最低基础库: `2.4.0` */ - pauseBGM(option?: PauseBGMOption): void; - /** [LivePusherContext.playBGM(Object object)](LivePusherContext.playBGM.md) - * - * 播放背景音 - * - * 最低基础库: `2.4.0` */ - playBGM(option: PlayBGMOption): void; - /** [LivePusherContext.resume(Object object)](LivePusherContext.resume.md) - * - * 恢复推流 */ - resume(option?: LivePusherContextResumeOption): void; - /** [LivePusherContext.resumeBGM(Object object)](LivePusherContext.resumeBGM.md) - * - * 恢复背景音 - * - * 最低基础库: `2.4.0` */ - resumeBGM(option?: ResumeBGMOption): void; - /** [LivePusherContext.setBGMVolume(Object object)](LivePusherContext.setBGMVolume.md) - * - * 设置背景音音量 - * - * 最低基础库: `2.4.0` */ - setBGMVolume(option: SetBGMVolumeOption): void; - /** [LivePusherContext.snapshot(Object object)](LivePusherContext.snapshot.md) - * - * 快照 - * - * 最低基础库: `1.9.90` */ - snapshot(option?: SnapshotOption): void; - /** [LivePusherContext.start(Object object)](LivePusherContext.start.md) - * - * 播放推流 */ - start(option?: LivePusherContextStartOption): void; - /** [LivePusherContext.stop(Object object)](LivePusherContext.stop.md) - * - * 停止推流 */ - stop(option?: LivePusherContextStopOption): void; - /** [LivePusherContext.stopBGM(Object object)](LivePusherContext.stopBGM.md) - * - * 停止背景音 - * - * 最低基础库: `2.4.0` */ - stopBGM(option?: StopBGMOption): void; - /** [LivePusherContext.switchCamera(Object object)](LivePusherContext.switchCamera.md) - * - * 切换前后摄像头 */ - switchCamera(option?: SwitchCameraOption): void; - /** [LivePusherContext.toggleTorch(Object object)](LivePusherContext.toggleTorch.md) - * - * 切换 - * - * 最低基础库: `2.1.0` */ - toggleTorch(option?: ToggleTorchOption): void; - } - interface LogManager { - /** [LogManager.debug()](LogManager.debug.md) - * - * 写 debug 日志 */ - debug( - /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */ - ...args: any[] - ): void; - /** [LogManager.info()](LogManager.info.md) - * - * 写 info 日志 */ - info( - /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */ - ...args: any[] - ): void; - /** [LogManager.log()](LogManager.log.md) - * - * 写 log 日志 */ - log( - /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */ - ...args: any[] - ): void; - /** [LogManager.warn()](LogManager.warn.md) - * - * 写 warn 日志 */ - warn( - /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */ - ...args: any[] - ): void; - } - interface MapContext { - /** [MapContext.getCenterLocation(Object object)](MapContext.getCenterLocation.md) - * - * 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) */ - getCenterLocation(option?: GetCenterLocationOption): void; - /** [MapContext.getRegion(Object object)](MapContext.getRegion.md) - * - * 获取当前地图的视野范围 - * - * 最低基础库: `1.4.0` */ - getRegion(option?: GetRegionOption): void; - /** [MapContext.getScale(Object object)](MapContext.getScale.md) - * - * 获取当前地图的缩放级别 - * - * 最低基础库: `1.4.0` */ - getScale(option?: GetScaleOption): void; - /** [MapContext.includePoints(Object object)](MapContext.includePoints.md) - * - * 缩放视野展示所有经纬度 - * - * 最低基础库: `1.2.0` */ - includePoints(option: IncludePointsOption): void; - /** [MapContext.moveToLocation()](MapContext.moveToLocation.md) - * - * 将地图中心移动到当前定位点。需要配合map组件的show-location使用 */ - moveToLocation(): void; - /** [MapContext.translateMarker(Object object)](MapContext.translateMarker.md) - * - * 平移marker,带动画 - * - * 最低基础库: `1.2.0` */ - translateMarker(option: TranslateMarkerOption): void; - } - interface NodesRef { - /** [NodesRef.fields(Object fields)](NodesRef.fields.md) -* -* 获取节点的相关信息。需要获取的字段在fields中指定。返回值是 `nodesRef` 对应的 `selectorQuery` -* -* **注意** -* -* -* computedStyle 的优先级高于 size,当同时在 computedStyle 里指定了 width/height 和传入了 size: true,则优先返回 computedStyle 获取到的 width/height。 -* -* **示例代码** -* -* -* ```js -Page({ - getFields () { - wx.createSelectorQuery().select('#the-id').fields({ - dataset: true, - size: true, - scrollOffset: true, - properties: ['scrollX', 'scrollY'], - computedStyle: ['margin', 'backgroundColor'], - context: true, - }, function (res) { - res.dataset // 节点的dataset - res.width // 节点的宽度 - res.height // 节点的高度 - res.scrollLeft // 节点的水平滚动位置 - res.scrollTop // 节点的竖直滚动位置 - res.scrollX // 节点 scroll-x 属性的当前值 - res.scrollY // 节点 scroll-y 属性的当前值 - // 此处返回指定要返回的样式名 - res.margin - res.backgroundColor - res.context // 节点对应的 Context 对象 - }).exec() - } -}) -``` */ - fields(fields: Fields): void; - /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.boundingClientRect(function callback)](NodesRef.boundingClientRect.md) -* -* 添加节点的布局位置的查询请求。相对于显示区域,以像素为单位。其功能类似于 DOM 的 `getBoundingClientRect`。返回 `NodesRef` 对应的 `SelectorQuery`。 -* -* **示例代码** -* -* -* ```js -Page({ - getRect () { - wx.createSelectorQuery().select('#the-id').boundingClientRect(function(rect){ - rect.id // 节点的ID - rect.dataset // 节点的dataset - rect.left // 节点的左边界坐标 - rect.right // 节点的右边界坐标 - rect.top // 节点的上边界坐标 - rect.bottom // 节点的下边界坐标 - rect.width // 节点的宽度 - rect.height // 节点的高度 - }).exec() - }, - getAllRects () { - wx.createSelectorQuery().selectAll('.a-class').boundingClientRect(function(rects){ - rects.forEach(function(rect){ - rect.id // 节点的ID - rect.dataset // 节点的dataset - rect.left // 节点的左边界坐标 - rect.right // 节点的右边界坐标 - rect.top // 节点的上边界坐标 - rect.bottom // 节点的下边界坐标 - rect.width // 节点的宽度 - rect.height // 节点的高度 - }) - }).exec() - } -}) -``` */ - boundingClientRect( - /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */ - callback?: BoundingClientRectCallback, - ): SelectorQuery; - /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.context(function callback)](NodesRef.context.md) -* -* 添加节点的 Context 对象查询请求。目前支持 `VideoContext`、`CanvasContext`、`LivePlayerContext` 和 `MapContext` 的获取。 -* -* **示例代码** -* -* -* ```js -Page({ - getContext () { - wx.createSelectorQuery().select('.the-video-class').context(function(res){ - console.log(res.context) // 节点对应的 Context 对象。如:选中的节点是