diff --git a/LICENSE b/LICENSE index f433b1a53f5b830a205fd2df78e2b34974656c7b..4a2cb1b3ae0cbc3bffac6ef7b398feb219fb3329 100755 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,91 @@ +In the jsapi / util 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 diff --git a/README.md b/README.md index 2c766ffb6501b275549a84f4f1c5b21eb19fe5c5..63d53a87c5183b71216079852ff1b8f8de483865 100755 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file diff --git a/README_zh.md b/README_zh.md index d010d056200966c426556d8ae68a03dffce3d6fc..c659e13c5ed8c58364edede9c41dd9346d9a0030 100644 --- a/README_zh.md +++ b/README_zh.md @@ -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) \ No newline at end of file