From a67bd8ed5099b8bb54c22d33222ceb2867a6a1c3 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Wed, 1 Dec 2021 18:59:21 +0800 Subject: [PATCH 1/4] Signed-off-by: lifansheng On branch master Your branch is up to date with 'origin/master'. --- LICENSE | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 + README_zh.md | 4 + 3 files changed, 249 insertions(+) diff --git a/LICENSE b/LICENSE index 4a459866..f363d5c1 100755 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,244 @@ +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 url { + class URLSearchParams { + /** + * A parameterized constructor used to create an URLSearchParams instance. + * As the input parameter of the constructor function, init supports four types. + * The input parameter is a character string two-dimensional array. + * The input parameter is the object list. + * The input parameter is a character string. + * The input parameter is the URLSearchParams object. + */ + constructor(init?: string[][] | Record | string | URLSearchParams); + + /** + * Appends a specified key/value pair as a new search parameter. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Key name of the search parameter to be inserted. + * @param value Values of search parameters to be inserted. + */ + append(name: string, value: string): void; + + /** + * Deletes the given search parameter and its associated value,from the list of all search parameters. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param Name of the key-value pair to be deleted. + */ + delete(name: string): void; + + /** + * Returns all key-value pairs associated with a given search parameter as an array. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param Name Specifies the name of a key value. + * @return string[] Returns all key-value pairs with the specified name. + */ + getAll(name: string): string[]; + + /** + * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * The first item of Array is name, and the second item of Array is value. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an iterator for ES6. + */ + entries(): IterableIterator<[string, string]>; + + /** + * Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param value Current traversal key value. + * @param key Indicates the name of the key that is traversed. + * @param searchParams The instance object that is currently calling the forEach method. + */ + forEach(callbackfn: (value: string, key: string, searchParams: this) => void): void; + + /** + * Returns the first value associated to the given search parameter. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Specifies the name of a key-value pair. + * @return Returns the first value found by name. If no value is found, null is returned. + */ + get(name: string): string | null; + + /** + * Returns a Boolean that indicates whether a parameter with the specified name exists. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Specifies the name of a key-value pair. + * @return Returns a Boolean value that indicates whether a found + */ + has(name: string): boolean; + + /** + * Sets the value associated with a given search parameter to the + * given value. If there were several matching values, this method + * deletes the others. If the search parameter doesn't exist, this + * method creates it. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Key name of the parameter to be set. + * @param value Indicates the parameter value to be set. + */ + set(name: string, value: string): void; + + /** + * Sort all key/value pairs contained in this object in place and return undefined. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + sort(): void; + + /** + * Returns an iterator allowing to go through all keys contained in this object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an ES6 Iterator over the names of each name-value pair. + */ + keys(): IterableIterator; + + /** + * Returns an iterator allowing to go through all values contained in this object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an ES6 Iterator over the values of each name-value pair. + */ + values(): IterableIterator; + + /** + * Returns an iterator allowing to go through all key/value + * pairs contained in this object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * The first item of Array is name, and the second item of Array is value. + */ + [Symbol.iterator](): IterableIterator<[string, string]>; + + /** + * Returns a query string suitable for use in a URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns a search parameter serialized as a string, percent-encoded if necessary. + */ + toString(): string; + } + + class URL { + /** + * URL constructor, which is used to instantiate a URL object. + * url: Absolute or relative input URL to resolve. Base is required if input is relative. + * If input is an absolute value, base ignores the value. + * base: Base URL to parse if input is not absolute. + */ + constructor(url: string, base?: string | URL); + + /** + * Returns the serialized URL as a string. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns the serialized URL as a string. + */ + toString(): string; + + /** + * Returns the serialized URL as a string. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns the serialized URL as a string. + */ + toJSON(): string; + + /** + * Gets and sets the fragment portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + hash: string; + + /** + * Gets and sets the host portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + host: string; + + /** + * Gets and sets the host name portion of the URL,not include the port. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + hostname: string; + + /** + * Gets and sets the serialized URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + href: string; + + /** + * Gets the read-only serialization of the URL's origin. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + readonly origin: string; + + /** + * Gets and sets the password portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + password: string; + + /** + * Gets and sets the path portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + pathname: string; + + /** + * Gets and sets the port portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + port: string; + + /** + * Gets and sets the protocol portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + protocol: string; + + /** + * Gets and sets the serialized query portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + search: string; + + /** + * Gets the URLSearchParams object that represents the URL query parameter. + * This property is read-only, but URLSearchParams provides an object that can be used to change + * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @note Be careful when modifying with .searchParams, because the URLSearchParams + * object uses different rules to determine which characters to + * percent-encode according to the WHATWG specification. + */ + readonly searchParams: URLSearchParams; + username: string; + } +} Apache License Version 2.0, January 2004 diff --git a/README.md b/README.md index 93343d0b..b4410a43 100755 --- a/README.md +++ b/README.md @@ -333,3 +333,7 @@ var result = convertml.convert(xml, {compact: false, spaces: 4}); [js_api_module Subsystem](https://gitee.com/OHOS_STD/js_api_module) [base/compileruntime/js_api_module/](base/compileruntime/js_api_module-readme.md) + +## License + +URL is available under [Mozilla license](https://www.mozilla.org/en-US/MPL/), and the documentation is detailed in [documentation](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE_docs). See [LICENSE](https://gitee.com/openharmony/js_api_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 794dbbd9..167b8069 100755 --- a/README_zh.md +++ b/README_zh.md @@ -335,3 +335,7 @@ var result = convertml.convert(xml, {compact: false, spaces: 4}); [js_api_module子系统](https://gitee.com/OHOS_STD/js_api_module) [base/compileruntime/js_api_module/](base/compileruntime/js_api_module/readme.md) + +## 许可证 + +URL在[Mozilla许可证](https://www.mozilla.org/en-US/MPL/)下可用,说明文档详见[说明文档](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE_docs)。有关完整的许可证文本,有关完整的许可证文本,请参见[许可证](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE) \ No newline at end of file -- Gitee From 53dd28610b78d1dec076bf236e5d976654728a89 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Wed, 1 Dec 2021 19:02:55 +0800 Subject: [PATCH 2/4] Signed-off-by: lifansheng On branch master Your branch is up to date with 'origin/master'. --- README_zh.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_zh.md b/README_zh.md index 167b8069..3faa2afc 100755 --- a/README_zh.md +++ b/README_zh.md @@ -338,4 +338,4 @@ var result = convertml.convert(xml, {compact: false, spaces: 4}); ## 许可证 -URL在[Mozilla许可证](https://www.mozilla.org/en-US/MPL/)下可用,说明文档详见[说明文档](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE_docs)。有关完整的许可证文本,有关完整的许可证文本,请参见[许可证](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE) \ No newline at end of file +URL在[Mozilla许可证](https://www.mozilla.org/en-US/MPL/)下可用,说明文档详见[说明文档](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE_docs)。有关完整的许可证文本,请参见[许可证](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE) \ No newline at end of file -- Gitee From fbcd406a582ae1fb82e79714a99e160201ced721 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Wed, 1 Dec 2021 20:28:54 +0800 Subject: [PATCH 3/4] Signed-off-by: lifansheng On branch master Your branch is up to date with 'origin/master'. --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index f363d5c1..29260bf4 100755 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -In the jsapi / workers directory, the definitions of some interfaces refer to their definitions in the webapi. +In the jsapi / api directory, the definitions of some interfaces refer to their definitions in the webapi. The following is a reference to the defined interface: declare namespace url { -- Gitee From 438194fed4879ac8813df227566e136fc4ce5ee0 Mon Sep 17 00:00:00 2001 From: lifansheng Date: Fri, 3 Dec 2021 14:37:39 +0800 Subject: [PATCH 4/4] Signed-off-by: lifansheng On branch master Your branch is up to date with 'origin/master'. --- LICENSE | 241 ----------------------------------------------- README.md | 2 +- README_zh.md | 4 +- mozilla_docs.txt | 44 +++++++++ 4 files changed, 47 insertions(+), 244 deletions(-) create mode 100644 mozilla_docs.txt diff --git a/LICENSE b/LICENSE index 29260bf4..4a459866 100755 --- a/LICENSE +++ b/LICENSE @@ -1,244 +1,3 @@ -In the jsapi / api directory, the definitions of some interfaces refer to their definitions in the webapi. -The following is a reference to the defined interface: - -declare namespace url { - class URLSearchParams { - /** - * A parameterized constructor used to create an URLSearchParams instance. - * As the input parameter of the constructor function, init supports four types. - * The input parameter is a character string two-dimensional array. - * The input parameter is the object list. - * The input parameter is a character string. - * The input parameter is the URLSearchParams object. - */ - constructor(init?: string[][] | Record | string | URLSearchParams); - - /** - * Appends a specified key/value pair as a new search parameter. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param name Key name of the search parameter to be inserted. - * @param value Values of search parameters to be inserted. - */ - append(name: string, value: string): void; - - /** - * Deletes the given search parameter and its associated value,from the list of all search parameters. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param Name of the key-value pair to be deleted. - */ - delete(name: string): void; - - /** - * Returns all key-value pairs associated with a given search parameter as an array. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param Name Specifies the name of a key value. - * @return string[] Returns all key-value pairs with the specified name. - */ - getAll(name: string): string[]; - - /** - * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * The first item of Array is name, and the second item of Array is value. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return Returns an iterator for ES6. - */ - entries(): IterableIterator<[string, string]>; - - /** - * Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param value Current traversal key value. - * @param key Indicates the name of the key that is traversed. - * @param searchParams The instance object that is currently calling the forEach method. - */ - forEach(callbackfn: (value: string, key: string, searchParams: this) => void): void; - - /** - * Returns the first value associated to the given search parameter. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param name Specifies the name of a key-value pair. - * @return Returns the first value found by name. If no value is found, null is returned. - */ - get(name: string): string | null; - - /** - * Returns a Boolean that indicates whether a parameter with the specified name exists. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param name Specifies the name of a key-value pair. - * @return Returns a Boolean value that indicates whether a found - */ - has(name: string): boolean; - - /** - * Sets the value associated with a given search parameter to the - * given value. If there were several matching values, this method - * deletes the others. If the search parameter doesn't exist, this - * method creates it. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @param name Key name of the parameter to be set. - * @param value Indicates the parameter value to be set. - */ - set(name: string, value: string): void; - - /** - * Sort all key/value pairs contained in this object in place and return undefined. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - sort(): void; - - /** - * Returns an iterator allowing to go through all keys contained in this object. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return Returns an ES6 Iterator over the names of each name-value pair. - */ - keys(): IterableIterator; - - /** - * Returns an iterator allowing to go through all values contained in this object. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return Returns an ES6 Iterator over the values of each name-value pair. - */ - values(): IterableIterator; - - /** - * Returns an iterator allowing to go through all key/value - * pairs contained in this object. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * The first item of Array is name, and the second item of Array is value. - */ - [Symbol.iterator](): IterableIterator<[string, string]>; - - /** - * Returns a query string suitable for use in a URL. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return Returns a search parameter serialized as a string, percent-encoded if necessary. - */ - toString(): string; - } - - class URL { - /** - * URL constructor, which is used to instantiate a URL object. - * url: Absolute or relative input URL to resolve. Base is required if input is relative. - * If input is an absolute value, base ignores the value. - * base: Base URL to parse if input is not absolute. - */ - constructor(url: string, base?: string | URL); - - /** - * Returns the serialized URL as a string. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return Returns the serialized URL as a string. - */ - toString(): string; - - /** - * Returns the serialized URL as a string. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @return Returns the serialized URL as a string. - */ - toJSON(): string; - - /** - * Gets and sets the fragment portion of the URL. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - hash: string; - - /** - * Gets and sets the host portion of the URL. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - host: string; - - /** - * Gets and sets the host name portion of the URL,not include the port. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - hostname: string; - - /** - * Gets and sets the serialized URL. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - href: string; - - /** - * Gets the read-only serialization of the URL's origin. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - readonly origin: string; - - /** - * Gets and sets the password portion of the URL. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - password: string; - - /** - * Gets and sets the path portion of the URL. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - pathname: string; - - /** - * Gets and sets the port portion of the URL. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - port: string; - - /** - * Gets and sets the protocol portion of the URL. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - protocol: string; - - /** - * Gets and sets the serialized query portion of the URL. - * @since 7 - * @sysCap SystemCapability.CCRuntime - */ - search: string; - - /** - * Gets the URLSearchParams object that represents the URL query parameter. - * This property is read-only, but URLSearchParams provides an object that can be used to change - * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. - * @since 7 - * @sysCap SystemCapability.CCRuntime - * @note Be careful when modifying with .searchParams, because the URLSearchParams - * object uses different rules to determine which characters to - * percent-encode according to the WHATWG specification. - */ - readonly searchParams: URLSearchParams; - username: string; - } -} Apache License Version 2.0, January 2004 diff --git a/README.md b/README.md index b4410a43..06197679 100755 --- a/README.md +++ b/README.md @@ -336,4 +336,4 @@ var result = convertml.convert(xml, {compact: false, spaces: 4}); ## License -URL is available under [Mozilla license](https://www.mozilla.org/en-US/MPL/), and the documentation is detailed in [documentation](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE_docs). See [LICENSE](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE) for the full license text. \ No newline at end of file +URL is available under [Mozilla license](https://www.mozilla.org/en-US/MPL/), and the documentation is detailed in [documentation](https://gitee.com/openharmony/js_api_module/blob/master/mozilla_docs.txt). See [LICENSE](https://gitee.com/openharmony/js_api_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 3faa2afc..6366df05 100755 --- a/README_zh.md +++ b/README_zh.md @@ -336,6 +336,6 @@ var result = convertml.convert(xml, {compact: false, spaces: 4}); [base/compileruntime/js_api_module/](base/compileruntime/js_api_module/readme.md) -## 许可证 +### 许可证 -URL在[Mozilla许可证](https://www.mozilla.org/en-US/MPL/)下可用,说明文档详见[说明文档](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE_docs)。有关完整的许可证文本,请参见[许可证](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE) \ No newline at end of file +URL在[Mozilla许可证](https://www.mozilla.org/en-US/MPL/)下可用,说明文档详见[说明文档](https://gitee.com/openharmony/js_api_module/blob/master/mozilla_docs.txt)。有关完整的许可证文本,有关完整的许可证文本,请参见[许可证](https://gitee.com/openharmony/js_api_module/blob/master/LICENSE) \ No newline at end of file diff --git a/mozilla_docs.txt b/mozilla_docs.txt new file mode 100644 index 00000000..ab6f2a65 --- /dev/null +++ b/mozilla_docs.txt @@ -0,0 +1,44 @@ + +The definitions of some interfaces implemented in jsapi/api/js_url.cpp are released under Mozilla license. + +The definitions and functions of these interfaces are consistent with the standard interfaces under mozila license, +but the implementation of specific functions is independent and self-developed. + +All interfaces are described in d.ts, the following is the interface written in d.ts under to Mozilla license + +class URLSearchParams { + + constructor(init?: string[][] | Record | string | URLSearchParams); + append(name: string, value: string): void; + delete(name: string): void; + getAll(name: string): string[]; + entries(): IterableIterator<[string, string]>; + forEach(callbackfn: (value: string, key: string, searchParams: this) => void): void; + get(name: string): string | null; + has(name: string): boolean; + set(name: string, value: string): void; + sort(): void; + keys(): IterableIterator; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator<[string, string]>; + toString(): string; +} + +class URL { + + constructor(url: string, base?: string | URL); + toString(): string; + toJSON(): string; + hash: string; + host: string; + hostname: string; + href: string; + readonly origin: string; + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + readonly searchParams: URLSearchParams; + username: string; +} \ No newline at end of file -- Gitee