Signed-off-by: lifansheng <lifansheng1@huawei.com>

On branch master
 Your branch is up to date with 'origin/master'.
This commit is contained in:
lifansheng
2021-12-01 19:40:07 +08:00
parent 5b0d1d93b5
commit d9fdb6d4c8
3 changed files with 94 additions and 0 deletions
+88
View File
@@ -1,3 +1,91 @@
In the jsapi / workers directory, the definitions of some interfaces refer to their definitions in the webapi.
The following is a reference to the defined interface:
declare namespace util {
class TextDecoder {
/**
* the source encoding's name, lowercased.
* @since 7
* @sysCap SystemCapability.CCRuntime
*/
readonly encoding: string;
/**
* Returns `true` if error mode is "fatal", and `false` otherwise.
* @since 7
* @sysCap SystemCapability.CCRuntime
*/
readonly fatal: boolean;
/**
* Returns `true` if ignore BOM flag is set, and `false` otherwise.
* @since 7
* @sysCap SystemCapability.CCRuntime
*/
readonly ignoreBOM = false;
/**
* the textEncoder constructor.
* @param 7
* @sysCap SystemCapability.CCRuntime
* @param encoding decoding format
*/
constructor(
encoding?: string,
options?: { fatal?: boolean; ignoreBOM?: boolean },
);
/**
* Returns the result of running encoding's decoder.
* @since 7
* @sysCap SystemCapability.CCRuntime
* @param input decoded numbers in accordance with the format
* @return return decoded text
*/
decode(input: Uint8Array, options?: { stream?: false }): string;
}
class TextEncoder {
/**
* Encoding format.
* @since 7
* @sysCap SystemCapability.CCRuntime
*/
readonly encoding = "utf-8";
/**
* the textEncoder constructor.
* @since 7
* @sysCap SystemCapability.CCRuntime
*/
constructor();
/**
* Returns the result of encoder.
* @since 7
* @sysCap SystemCapability.CCRuntime
* @param The string to be encoded.
* @return returns the encoded text.
*/
encode(input?: string): Uint8Array;
/**
* encode string, write the result to dest array.
* @since 7
* @sysCap SystemCapability.CCRuntime
* @param input The string to be encoded.
* @param dest decoded numbers in accordance with the format
* @return returns Returns the object, where read represents
* the number of characters that have been encoded, and written
* represents the number of bytes occupied by the encoded characters.
*/
encodeInto(
input: string,
dest: Uint8Array,
): { read: number; written: number };
}
}
Apache License
Version 2.0, January 2004
+3
View File
@@ -1019,3 +1019,6 @@ var result = proc.isWeakSet(new WeakSet());
[base/compileruntime/js_util_module/](base/compileruntime/js_util_module-readme.md)
### License
Util is available under [Mozilla license](https://www.mozilla.org/en-US/MPL/), and the documentation is detailed in [documentation](https://gitee.com/openharmony/js_util_module/blob/master/LICENSE_docs). See [LICENSE](https://gitee.com/openharmony/js_util_module/blob/master/LICENSE) for the full license text.
+3
View File
@@ -1020,3 +1020,6 @@ var result = proc.isWeakSet(new WeakSet());
[base/compileruntime/js_util_module/](base/compileruntime/js_util_module-readme.md)
## 许可证
Util在[Mozilla许可证](https://www.mozilla.org/en-US/MPL/)下可用,说明文档详见[说明文档](https://gitee.com/openharmony/js_util_module/blob/master/LICENSE_docs)。有关完整的许可证文本,有关完整的许可证文本,请参见[许可证](https://gitee.com/openharmony/js_util_module/blob/master/LICENSE)