• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2021 Huawei Device Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7*     http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15
16declare class URLSearchParams {
17    constructor(init ? : string[][] | Record<string, string> | string | URLSearchParams
18};
19
20/** Appends a specified key/value pair as a new search parameter.
21 */
22append(name: string, value : string) : void;
23
24/** Delete the given search parameter and its associated value,
25 * from the list of all search parameters.
26 */
27delete(name: string) : void;
28
29/** Returns all the values associated with a given search parameter
30 * as an array.
31 */
32getAll(name: string) : string[];
33
34/** Returns an iterator allowing to go through all key/value
35 * pairs contained in this object.
36 */
37entries() : IterableIterator<[string, string]>;
38
39/** Allows iteration through all values contained in this object via a callback function.
40 */
41forEach(callbackfn: (value: string, key : string, parent : this) = > void, thisArg ? : object) : void;
42
43/** Returns the first value associated to the  given search parameter.
44 */
45get(name: string) : string | null;
46
47/** Returns a Boolean that indicates whether a parameter with the
48 * specified name exists.
49 */
50has(name: string) : boolean;
51
52/**Sets the value associated with a given search parameter to the
53 * given value.If there were several matching values, this methods
54 * deletes the others. If the search parameter doesn't exist, this
55 * methods creates it.
56 */
57set(name: string, value : string) : void;
58
59/** Sort all key/value pairs contained in this object in place and
60  * return undefined.
61  */
62sort() : void;
63
64/** Returns an iterator allowing to go through all keys contained
65  * in this object.
66  */
67keys() :IterableIterator<string>;
68
69/** Returns an iterator allowing to go through all values contained
70  * in this object.
71  */
72values() : IterableIterator<string>;
73
74
75/** Returns an iterator allowing to go through all key/value
76  * pairs contained in this object.
77  */
78[Symbol.iterator]() : IterableIterator<[string, string]>;
79
80/** Returns a query string suitable for use in a URL.
81   */
82toString() :string;
83}
84
85/* web api URL interface */
86declare class URL {
87   /**    constructor of URL
88   *    url:absolute URL string or a relative URL string
89   *    base:base URL string
90   */
91    constructor(url: string, base ? : string | URL);
92
93    /* methods */
94    createObjectURL(object: object) : string;
95    revokeObjectURL(url: string) : void;
96    toString() : string;
97    toJSON() : string;
98
99    /*    fragment identifier of URL */
100hash: string;
101    /*    domain: port of URL */
102host: string;
103    /* domain of URL */
104hostname:    string;
105    /*    whole URL */
106href: string;
107    /*    contain the origin    of the URL, readonly */
108    readonly origin : string;
109    /*    password specified before the domain name */
110password: string;
111    /* an '/' followed by the path of the URL */
112pathname: string;
113    /* port of the URL */
114port:    string;
115    /*    the protocol scheme of the URL, readonly */
116protocol:    string;
117    /*    indicating the parameter string of the URL */
118search: string;
119    /* URLSearchParams object which used to access the individual query parameters */
120    readonly searchParams : URLSearchParams;
121    /* the username before the domain name */
122username: string;
123}
124
125export {URL, URLSearchParams};