1/* 2 * Copyright (c) 2021-2022 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 16/** 17 * @file 18 * @kit ArkTS 19 */ 20 21/** 22 * The url module provides utilities for URL resolution and parsing. 23 * 24 * @namespace url 25 * @syscap SystemCapability.Utils.Lang 26 * @since 7 27 */ 28/** 29 * The url module provides utilities for URL resolution and parsing. 30 * 31 * @namespace url 32 * @syscap SystemCapability.Utils.Lang 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * The url module provides utilities for URL resolution and parsing. 38 * 39 * @namespace url 40 * @syscap SystemCapability.Utils.Lang 41 * @crossplatform 42 * @atomicservice 43 * @since 11 44 */ 45declare namespace url { 46 /** 47 * The URLSearchParams interface defines some practical methods to process URL query strings. 48 * 49 * @syscap SystemCapability.Utils.Lang 50 * @since 7 51 * @deprecated since 9 52 * @useinstead ohos.url.URLParams 53 * @name URLSearchParams 54 */ 55 class URLSearchParams { 56 /** 57 * A parameterized constructor used to create an URLSearchParams instance. 58 * As the input parameter of the constructor function, init supports four types. 59 * The input parameter is a character string two-dimensional array. 60 * The input parameter is the object list. 61 * The input parameter is a character string. 62 * The input parameter is the URLSearchParams object. 63 * 64 * @param { string[][] | Record<string, string> | string | URLSearchParams } init - init init 65 * @syscap SystemCapability.Utils.Lang 66 * @since 7 67 * @deprecated since 9 68 * @useinstead ohos.url.URLParams.constructor 69 */ 70 constructor(init?: string[][] | Record<string, string> | string | URLSearchParams); 71 72 /** 73 * Appends a specified key/value pair as a new search parameter. 74 * 75 * @param { string } name - name name Key name of the search parameter to be inserted. 76 * @param { string } value - value value Values of search parameters to be inserted. 77 * @syscap SystemCapability.Utils.Lang 78 * @since 7 79 * @deprecated since 9 80 * @useinstead ohos.url.URLParams.append 81 */ 82 append(name: string, value: string): void; 83 84 /** 85 * Deletes the given search parameter and its associated value,from the list of all search parameters. 86 * 87 * @param { string } name - name name Name of the key-value pair to be deleted. 88 * @syscap SystemCapability.Utils.Lang 89 * @since 7 90 * @deprecated since 9 91 * @useinstead ohos.url.URLParams.delete 92 */ 93 delete(name: string): void; 94 95 /** 96 * Returns all key-value pairs associated with a given search parameter as an array. 97 * 98 * @param { string } name - name name Specifies the name of a key value. 99 * @returns { string[] } string[] Returns all key-value pairs with the specified name. 100 * @syscap SystemCapability.Utils.Lang 101 * @since 7 102 * @deprecated since 9 103 * @useinstead ohos.url.URLParams.getAll 104 */ 105 getAll(name: string): string[]; 106 107 /** 108 * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 109 * The first item of Array is name, and the second item of Array is value. 110 * 111 * @returns { IterableIterator<[string, string]> } Returns an iterator for ES6. 112 * @syscap SystemCapability.Utils.Lang 113 * @since 7 114 * @deprecated since 9 115 * @useinstead ohos.url.URLParams.entries 116 */ 117 entries(): IterableIterator<[string, string]>; 118 119 /** 120 * Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. 121 * 122 * @param { function } callbackFn - callbackFn callbackFn Current traversal key value. 123 * @param { Object } thisArg - thisArg thisArg thisArg to be used as this value for when callbackFn is called 124 * @syscap SystemCapability.Utils.Lang 125 * @since 7 126 * @deprecated since 9 127 * @useinstead ohos.url.URLParams.forEach 128 */ 129 forEach(callbackFn: (value: string, key: string, searchParams: URLSearchParams) => void, thisArg?: Object): void; 130 131 /** 132 * Returns the first value associated to the given search parameter. 133 * 134 * @param { string } name - name name Specifies the name of a key-value pair. 135 * @returns { string | null } Returns the first value found by name. If no value is found, null is returned. 136 * @syscap SystemCapability.Utils.Lang 137 * @since 7 138 * @deprecated since 9 139 * @useinstead ohos.url.URLParams.get 140 */ 141 get(name: string): string | null; 142 143 /** 144 * Returns a Boolean that indicates whether a parameter with the specified name exists. 145 * 146 * @param { string } name - name name Specifies the name of a key-value pair. 147 * @returns { boolean } Returns a Boolean value that indicates whether a found 148 * @syscap SystemCapability.Utils.Lang 149 * @since 7 150 * @deprecated since 9 151 * @useinstead ohos.url.URLParams.has 152 */ 153 has(name: string): boolean; 154 155 /** 156 * Sets the value associated with a given search parameter to the 157 * given value. If there were several matching values, this method 158 * deletes the others. If the search parameter doesn't exist, this 159 * method creates it. 160 * 161 * @param { string } name - name name Key name of the parameter to be set. 162 * @param { string } value - value value Indicates the parameter value to be set. 163 * @syscap SystemCapability.Utils.Lang 164 * @since 7 165 * @deprecated since 9 166 * @useinstead ohos.url.URLParams.set 167 */ 168 set(name: string, value: string): void; 169 170 /** 171 * Sort all key/value pairs contained in this object in place and return undefined. 172 * 173 * @syscap SystemCapability.Utils.Lang 174 * @since 7 175 * @deprecated since 9 176 * @useinstead ohos.url.URLParams.sort 177 */ 178 sort(): void; 179 180 /** 181 * Returns an iterator allowing to go through all keys contained in this object. 182 * 183 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the names of each name-value pair. 184 * @syscap SystemCapability.Utils.Lang 185 * @since 7 186 * @deprecated since 9 187 * @useinstead ohos.url.URLParams.keys 188 */ 189 keys(): IterableIterator<string>; 190 191 /** 192 * Returns an iterator allowing to go through all values contained in this object. 193 * 194 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the values of each name-value pair. 195 * @syscap SystemCapability.Utils.Lang 196 * @since 7 197 * @deprecated since 9 198 * @useinstead ohos.url.URLParams.values 199 */ 200 values(): IterableIterator<string>; 201 202 /** 203 * Returns an iterator allowing to go through all key/value 204 * pairs contained in this object. 205 * @returns { IterableIterator<[string, string]> } Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 206 * The first item of Array is name, and the second item of Array is value. 207 * @syscap SystemCapability.Utils.Lang 208 * @since 7 209 * @deprecated since 9 210 * @useinstead ohos.url.URLParams.[Symbol.iterator] 211 */ 212 [Symbol.iterator](): IterableIterator<[string, string]>; 213 214 /** 215 * Returns a query string suitable for use in a URL. 216 * 217 * @returns { string } Returns a search parameter serialized as a string, percent-encoded if necessary. 218 * @syscap SystemCapability.Utils.Lang 219 * @since 7 220 * @deprecated since 9 221 * @useinstead ohos.url.URLParams.toString 222 */ 223 toString(): string; 224 } 225 226 /** 227 * The URLParams interface defines some practical methods to process URL query strings. 228 * 229 * @syscap SystemCapability.Utils.Lang 230 * @since 9 231 * @name URLParams 232 */ 233 /** 234 * The URLParams interface defines some practical methods to process URL query strings. 235 * 236 * @syscap SystemCapability.Utils.Lang 237 * @crossplatform 238 * @since 10 239 * @name URLParams 240 */ 241 /** 242 * The URLParams interface defines some practical methods to process URL query strings. 243 * 244 * @syscap SystemCapability.Utils.Lang 245 * @crossplatform 246 * @atomicservice 247 * @since 11 248 * @name URLParams 249 */ 250 class URLParams { 251 /** 252 * A parameterized constructor used to create an URLParams instance. 253 * As the input parameter of the constructor function, init supports four types. 254 * The input parameter is a character string two-dimensional array. 255 * The input parameter is the object list. 256 * The input parameter is a character string. 257 * The input parameter is the URLParams object. 258 * 259 * @param { string[][] | Record<string, string> | string | URLParams } [init] - init init 260 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types; 3.Parameter verification failed. 261 * @syscap SystemCapability.Utils.Lang 262 * @since 9 263 */ 264 /** 265 * A parameterized constructor used to create an URLParams instance. 266 * As the input parameter of the constructor function, init supports four types. 267 * The input parameter is a character string two-dimensional array. 268 * The input parameter is the object list. 269 * The input parameter is a character string. 270 * The input parameter is the URLParams object. 271 * 272 * @param { string[][] | Record<string, string> | string | URLParams } [init] - init init 273 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types; 2.Parameter verification failed. 274 * @syscap SystemCapability.Utils.Lang 275 * @crossplatform 276 * @since 10 277 */ 278 /** 279 * A parameterized constructor used to create an URLParams instance. 280 * As the input parameter of the constructor function, init supports four types. 281 * The input parameter is a character string two-dimensional array. 282 * The input parameter is the object list. 283 * The input parameter is a character string. 284 * The input parameter is the URLParams object. 285 * 286 * @param { string[][] | Record<string, string> | string | URLParams } [init] - init init 287 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types; 2.Parameter verification failed. 288 * @syscap SystemCapability.Utils.Lang 289 * @crossplatform 290 * @atomicservice 291 * @since 11 292 */ 293 constructor(init?: string[][] | Record<string, string> | string | URLParams); 294 295 /** 296 * Appends a specified key/value pair as a new search parameter. 297 * 298 * @param { string } name - name name Key name of the search parameter to be inserted. 299 * @param { string } value - value value Values of search parameters to be inserted. 300 * @throws { BusinessError } 401 - Parameter error. Possible causes: 301 * 1.Mandatory parameters are left unspecified; 302 * 2.Incorrect parameter types; 303 * 3.Parameter verification failed. 304 * @syscap SystemCapability.Utils.Lang 305 * @since 9 306 */ 307 /** 308 * Appends a specified key/value pair as a new search parameter. 309 * 310 * @param { string } name - name name Key name of the search parameter to be inserted. 311 * @param { string } value - value value Values of search parameters to be inserted. 312 * @throws { BusinessError } 401 - Parameter error. Possible causes: 313 * 1.Mandatory parameters are left unspecified; 314 * 2.Incorrect parameter types; 315 * 3.Parameter verification failed. 316 * @syscap SystemCapability.Utils.Lang 317 * @crossplatform 318 * @since 10 319 */ 320 /** 321 * Appends a specified key/value pair as a new search parameter. 322 * 323 * @param { string } name - name name Key name of the search parameter to be inserted. 324 * @param { string } value - value value Values of search parameters to be inserted. 325 * @throws { BusinessError } 401 - Parameter error. Possible causes: 326 * 1.Mandatory parameters are left unspecified; 327 * 2.Incorrect parameter types; 328 * 3.Parameter verification failed. 329 * @syscap SystemCapability.Utils.Lang 330 * @crossplatform 331 * @atomicservice 332 * @since 11 333 */ 334 append(name: string, value: string): void; 335 336 /** 337 * Deletes the given search parameter and its associated value,from the list of all search parameters. 338 * 339 * @param { string } name - name name Name of the key-value pair to be deleted. 340 * @throws { BusinessError } 401 - Parameter error. Possible causes: 341 * 1.Mandatory parameters are left unspecified; 342 * 2.Incorrect parameter types; 343 * 3.Parameter verification failed. 344 * @syscap SystemCapability.Utils.Lang 345 * @since 9 346 */ 347 /** 348 * Deletes the given search parameter and its associated value,from the list of all search parameters. 349 * 350 * @param { string } name - name name Name of the key-value pair to be deleted. 351 * @throws { BusinessError } 401 - Parameter error. Possible causes: 352 * 1.Mandatory parameters are left unspecified; 353 * 2.Incorrect parameter types; 354 * 3.Parameter verification failed. 355 * @syscap SystemCapability.Utils.Lang 356 * @crossplatform 357 * @since 10 358 */ 359 /** 360 * Deletes the given search parameter and its associated value,from the list of all search parameters. 361 * 362 * @param { string } name - name name Name of the key-value pair to be deleted. 363 * @throws { BusinessError } 401 - Parameter error. Possible causes: 364 * 1.Mandatory parameters are left unspecified; 365 * 2.Incorrect parameter types; 366 * 3.Parameter verification failed. 367 * @syscap SystemCapability.Utils.Lang 368 * @crossplatform 369 * @atomicservice 370 * @since 11 371 */ 372 delete(name: string): void; 373 374 /** 375 * Returns all key-value pairs associated with a given search parameter as an array. 376 * 377 * @param { string } name - name name Specifies the name of a key value. 378 * @returns { string[] } string[] Returns all key-value pairs with the specified name. 379 * @throws { BusinessError } 401 - Parameter error. Possible causes: 380 * 1.Mandatory parameters are left unspecified; 381 * 2.Incorrect parameter types; 382 * 3.Parameter verification failed. 383 * @syscap SystemCapability.Utils.Lang 384 * @since 9 385 */ 386 /** 387 * Returns all key-value pairs associated with a given search parameter as an array. 388 * 389 * @param { string } name - name name Specifies the name of a key value. 390 * @returns { string[] } string[] Returns all key-value pairs with the specified name. 391 * @throws { BusinessError } 401 - Parameter error. Possible causes: 392 * 1.Mandatory parameters are left unspecified; 393 * 2.Incorrect parameter types; 394 * 3.Parameter verification failed. 395 * @syscap SystemCapability.Utils.Lang 396 * @crossplatform 397 * @since 10 398 */ 399 /** 400 * Returns all key-value pairs associated with a given search parameter as an array. 401 * 402 * @param { string } name - name name Specifies the name of a key value. 403 * @returns { string[] } string[] Returns all key-value pairs with the specified name. 404 * @throws { BusinessError } 401 - Parameter error. Possible causes: 405 * 1.Mandatory parameters are left unspecified; 406 * 2.Incorrect parameter types; 407 * 3.Parameter verification failed. 408 * @syscap SystemCapability.Utils.Lang 409 * @crossplatform 410 * @atomicservice 411 * @since 11 412 */ 413 getAll(name: string): string[]; 414 415 /** 416 * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 417 * The first item of Array is name, and the second item of Array is value. 418 * 419 * @returns { IterableIterator<[string, string]> } Returns an iterator for ES6. 420 * @syscap SystemCapability.Utils.Lang 421 * @since 9 422 */ 423 /** 424 * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 425 * The first item of Array is name, and the second item of Array is value. 426 * 427 * @returns { IterableIterator<[string, string]> } Returns an iterator for ES6. 428 * @syscap SystemCapability.Utils.Lang 429 * @crossplatform 430 * @since 10 431 */ 432 /** 433 * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 434 * The first item of Array is name, and the second item of Array is value. 435 * 436 * @returns { IterableIterator<[string, string]> } Returns an iterator for ES6. 437 * @syscap SystemCapability.Utils.Lang 438 * @crossplatform 439 * @atomicservice 440 * @since 11 441 */ 442 entries(): IterableIterator<[string, string]>; 443 444 /** 445 * Callback functions are used to traverse key-value pairs on the URLParams instance object. 446 * 447 * @param { function } callbackFn - callbackFn value Current traversal key value, 448 * key Indicates the name of the key that is traversed. 449 * @param { Object } [thisArg] - thisArg thisArg to be used as this value for when callbackFn is called 450 * @throws { BusinessError } 401 - Parameter error. Possible causes: 451 * 1.Mandatory parameters are left unspecified; 452 * 2.Incorrect parameter types; 453 * 3.Parameter verification failed. 454 * @syscap SystemCapability.Utils.Lang 455 * @since 9 456 */ 457 /** 458 * Callback functions are used to traverse key-value pairs on the URLParams instance object. 459 * 460 * @param { function } callbackFn - callbackFn value Current traversal key value, 461 * key Indicates the name of the key that is traversed. 462 * @param { Object } [thisArg] - thisArg thisArg to be used as this value for when callbackFn is called 463 * @throws { BusinessError } 401 - Parameter error. Possible causes: 464 * 1.Mandatory parameters are left unspecified; 465 * 2.Incorrect parameter types; 466 * 3.Parameter verification failed. 467 * @syscap SystemCapability.Utils.Lang 468 * @crossplatform 469 * @since 10 470 */ 471 /** 472 * Callback functions are used to traverse key-value pairs on the URLParams instance object. 473 * 474 * @param { function } callbackFn - callbackFn value Current traversal key value, 475 * key Indicates the name of the key that is traversed. 476 * @param { Object } [thisArg] - thisArg thisArg to be used as this value for when callbackFn is called 477 * @throws { BusinessError } 401 - Parameter error. Possible causes: 478 * 1.Mandatory parameters are left unspecified; 479 * 2.Incorrect parameter types; 480 * 3.Parameter verification failed. 481 * @syscap SystemCapability.Utils.Lang 482 * @crossplatform 483 * @atomicservice 484 * @since 11 485 */ 486 forEach(callbackFn: (value: string, key: string, searchParams: URLParams) => void, thisArg?: Object): void; 487 488 /** 489 * Returns the first value associated to the given search parameter. 490 * 491 * @param { string } name - name name Specifies the name of a key-value pair. 492 * @returns { string | null } Returns the first value found by name. If no value is found, null is returned. 493 * @throws { BusinessError } 401 - Parameter error. Possible causes: 494 * 1.Mandatory parameters are left unspecified; 495 * 2.Incorrect parameter types; 496 * 3.Parameter verification failed. 497 * @syscap SystemCapability.Utils.Lang 498 * @since 9 499 */ 500 /** 501 * Returns the first value associated to the given search parameter. 502 * 503 * @param { string } name - name name Specifies the name of a key-value pair. 504 * @returns { string | null } Returns the first value found by name. If no value is found, null is returned. 505 * @throws { BusinessError } 401 - Parameter error. Possible causes: 506 * 1.Mandatory parameters are left unspecified; 507 * 2.Incorrect parameter types; 508 * 3.Parameter verification failed. 509 * @syscap SystemCapability.Utils.Lang 510 * @crossplatform 511 * @since 10 512 */ 513 /** 514 * Returns the first value associated to the given search parameter. 515 * 516 * @param { string } name - name name Specifies the name of a key-value pair. 517 * @returns { string | null } Returns the first value found by name. If no value is found, null is returned. 518 * @throws { BusinessError } 401 - Parameter error. Possible causes: 519 * 1.Mandatory parameters are left unspecified; 520 * 2.Incorrect parameter types; 521 * 3.Parameter verification failed. 522 * @syscap SystemCapability.Utils.Lang 523 * @crossplatform 524 * @atomicservice 525 * @since 11 526 */ 527 get(name: string): string | null; 528 529 /** 530 * Returns a Boolean that indicates whether a parameter with the specified name exists. 531 * 532 * @param { string } name - name name Specifies the name of a key-value pair. 533 * @returns { boolean } Returns a Boolean value that indicates whether a found 534 * @throws { BusinessError } 401 - Parameter error. Possible causes: 535 * 1.Mandatory parameters are left unspecified; 536 * 2.Incorrect parameter types. 537 * @syscap SystemCapability.Utils.Lang 538 * @since 9 539 */ 540 /** 541 * Returns a Boolean that indicates whether a parameter with the specified name exists. 542 * 543 * @param { string } name - name name Specifies the name of a key-value pair. 544 * @returns { boolean } Returns a Boolean value that indicates whether a found 545 * @throws { BusinessError } 401 - Parameter error. Possible causes: 546 * 1.Mandatory parameters are left unspecified; 547 * 2.Incorrect parameter types. 548 * @syscap SystemCapability.Utils.Lang 549 * @crossplatform 550 * @since 10 551 */ 552 /** 553 * Returns a Boolean that indicates whether a parameter with the specified name exists. 554 * 555 * @param { string } name - name name Specifies the name of a key-value pair. 556 * @returns { boolean } Returns a Boolean value that indicates whether a found 557 * @throws { BusinessError } 401 - Parameter error. Possible causes: 558 * 1.Mandatory parameters are left unspecified; 559 * 2.Incorrect parameter types. 560 * @syscap SystemCapability.Utils.Lang 561 * @crossplatform 562 * @atomicservice 563 * @since 11 564 */ 565 has(name: string): boolean; 566 567 /** 568 * Sets the value associated with a given search parameter to the 569 * given value. If there were several matching values, this method 570 * deletes the others. If the search parameter doesn't exist, this 571 * method creates it. 572 * 573 * @param { string } name - name name Key name of the parameter to be set. 574 * @param { string } value - value value Indicates the parameter value to be set. 575 * @throws { BusinessError } 401 - Parameter error. Possible causes: 576 * 1.Mandatory parameters are left unspecified; 577 * 2.Incorrect parameter types; 578 * 3.Parameter verification failed. 579 * @syscap SystemCapability.Utils.Lang 580 * @since 9 581 */ 582 /** 583 * Sets the value associated with a given search parameter to the 584 * given value. If there were several matching values, this method 585 * deletes the others. If the search parameter doesn't exist, this 586 * method creates it. 587 * 588 * @param { string } name - name name Key name of the parameter to be set. 589 * @param { string } value - value value Indicates the parameter value to be set. 590 * @throws { BusinessError } 401 - Parameter error. Possible causes: 591 * 1.Mandatory parameters are left unspecified; 592 * 2.Incorrect parameter types; 593 * 3.Parameter verification failed. 594 * @syscap SystemCapability.Utils.Lang 595 * @crossplatform 596 * @since 10 597 */ 598 /** 599 * Sets the value associated with a given search parameter to the 600 * given value. If there were several matching values, this method 601 * deletes the others. If the search parameter doesn't exist, this 602 * method creates it. 603 * 604 * @param { string } name - name name Key name of the parameter to be set. 605 * @param { string } value - value value Indicates the parameter value to be set. 606 * @throws { BusinessError } 401 - Parameter error. Possible causes: 607 * 1.Mandatory parameters are left unspecified; 608 * 2.Incorrect parameter types; 609 * 3.Parameter verification failed. 610 * @syscap SystemCapability.Utils.Lang 611 * @crossplatform 612 * @atomicservice 613 * @since 11 614 */ 615 set(name: string, value: string): void; 616 617 /** 618 * Sort all key/value pairs contained in this object in place and return undefined. 619 * 620 * @syscap SystemCapability.Utils.Lang 621 * @since 9 622 */ 623 /** 624 * Sort all key/value pairs contained in this object in place and return undefined. 625 * 626 * @syscap SystemCapability.Utils.Lang 627 * @crossplatform 628 * @since 10 629 */ 630 /** 631 * Sort all key/value pairs contained in this object in place and return undefined. 632 * 633 * @syscap SystemCapability.Utils.Lang 634 * @crossplatform 635 * @atomicservice 636 * @since 11 637 */ 638 sort(): void; 639 640 /** 641 * Returns an iterator allowing to go through all keys contained in this object. 642 * 643 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the names of each name-value pair. 644 * @syscap SystemCapability.Utils.Lang 645 * @since 9 646 */ 647 /** 648 * Returns an iterator allowing to go through all keys contained in this object. 649 * 650 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the names of each name-value pair. 651 * @syscap SystemCapability.Utils.Lang 652 * @crossplatform 653 * @since 10 654 */ 655 /** 656 * Returns an iterator allowing to go through all keys contained in this object. 657 * 658 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the names of each name-value pair. 659 * @syscap SystemCapability.Utils.Lang 660 * @crossplatform 661 * @atomicservice 662 * @since 11 663 */ 664 keys(): IterableIterator<string>; 665 666 /** 667 * Returns an iterator allowing to go through all values contained in this object. 668 * 669 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the values of each name-value pair. 670 * @syscap SystemCapability.Utils.Lang 671 * @since 9 672 */ 673 /** 674 * Returns an iterator allowing to go through all values contained in this object. 675 * 676 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the values of each name-value pair. 677 * @syscap SystemCapability.Utils.Lang 678 * @crossplatform 679 * @since 10 680 */ 681 /** 682 * Returns an iterator allowing to go through all values contained in this object. 683 * 684 * @returns { IterableIterator<string> } Returns an ES6 Iterator over the values of each name-value pair. 685 * @syscap SystemCapability.Utils.Lang 686 * @crossplatform 687 * @atomicservice 688 * @since 11 689 */ 690 values(): IterableIterator<string>; 691 692 /** 693 * Returns an iterator allowing to go through all key/value 694 * pairs contained in this object. 695 * 696 * @returns { IterableIterator<[string, string]> } Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 697 * The first item of Array is name, and the second item of Array is value. 698 * @syscap SystemCapability.Utils.Lang 699 * @since 9 700 */ 701 /** 702 * Returns an iterator allowing to go through all key/value 703 * pairs contained in this object. 704 * 705 * @returns { IterableIterator<[string, string]> } Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 706 * The first item of Array is name, and the second item of Array is value. 707 * @syscap SystemCapability.Utils.Lang 708 * @crossplatform 709 * @since 10 710 */ 711 /** 712 * Returns an iterator allowing to go through all key/value 713 * pairs contained in this object. 714 * 715 * @returns { IterableIterator<[string, string]> } Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. 716 * The first item of Array is name, and the second item of Array is value. 717 * @syscap SystemCapability.Utils.Lang 718 * @crossplatform 719 * @atomicservice 720 * @since 11 721 */ 722 [Symbol.iterator](): IterableIterator<[string, string]>; 723 724 /** 725 * Returns a query string suitable for use in a URL. 726 * 727 * @returns { string } Returns a search parameter serialized as a string, percent-encoded if necessary. 728 * @syscap SystemCapability.Utils.Lang 729 * @since 9 730 */ 731 /** 732 * Returns a query string suitable for use in a URL. 733 * 734 * @returns { string } Returns a search parameter serialized as a string, percent-encoded if necessary. 735 * @syscap SystemCapability.Utils.Lang 736 * @crossplatform 737 * @since 10 738 */ 739 /** 740 * Returns a query string suitable for use in a URL. 741 * 742 * @returns { string } Returns a search parameter serialized as a string, percent-encoded if necessary. 743 * @syscap SystemCapability.Utils.Lang 744 * @crossplatform 745 * @atomicservice 746 * @since 11 747 */ 748 toString(): string; 749 } 750 751 /** 752 * The interface of URL is used to parse, construct, normalize, and encode URLs. 753 * 754 * @syscap SystemCapability.Utils.Lang 755 * @since 7 756 * @name URL 757 */ 758 /** 759 * The interface of URL is used to parse, construct, normalize, and encode URLs. 760 * 761 * @syscap SystemCapability.Utils.Lang 762 * @crossplatform 763 * @since 10 764 * @name URL 765 */ 766 /** 767 * The interface of URL is used to parse, construct, normalize, and encode URLs. 768 * 769 * @syscap SystemCapability.Utils.Lang 770 * @crossplatform 771 * @atomicservice 772 * @since 11 773 * @name URL 774 */ 775 class URL { 776 /** 777 * URL constructor, which is used to instantiate a URL object. 778 * url: Absolute or relative input URL to resolve. Base is required if input is relative. 779 * If input is an absolute value, base ignores the value. 780 * base: Base URL to parse if input is not absolute. 781 * 782 * @param { string } url - url url 783 * @param { string | URL } base - base base 784 * @syscap SystemCapability.Utils.Lang 785 * @since 7 786 * @deprecated since 9 787 * @useinstead ohos.url.URL.parseURL 788 */ 789 constructor(url: string, base?: string | URL); 790 791 /** 792 * URL constructor, which is used to instantiate a URL object. 793 * 794 * @syscap SystemCapability.Utils.Lang 795 * @since 9 796 */ 797 /** 798 * URL constructor, which is used to instantiate a URL object. 799 * 800 * @syscap SystemCapability.Utils.Lang 801 * @crossplatform 802 * @since 10 803 */ 804 /** 805 * URL constructor, which is used to instantiate a URL object. 806 * 807 * @syscap SystemCapability.Utils.Lang 808 * @crossplatform 809 * @atomicservice 810 * @since 11 811 */ 812 constructor(); 813 814 /** 815 * Replaces the original constructor to process arguments and return a url object. 816 * 817 * @param { string } url - url url Absolute or relative input URL to resolve. Base is required if input is relative. 818 * If input is an absolute value, base ignores the value. 819 * @param { string | URL } [base] - base base Base URL to parse if input is not absolute. 820 * @returns { URL } 821 * @throws { BusinessError } 401 - Parameter error. Possible causes: 822 * 1.Mandatory parameters are left unspecified; 823 * 2.Incorrect parameter types; 824 * 3.Parameter verification failed. 825 * @throws { BusinessError } 10200002 - Invalid url string. 826 * @syscap SystemCapability.Utils.Lang 827 * @since 9 828 */ 829 /** 830 * Replaces the original constructor to process arguments and return a url object. 831 * 832 * @param { string } url - url url Absolute or relative input URL to resolve. Base is required if input is relative. 833 * If input is an absolute value, base ignores the value. 834 * @param { string | URL } [base] - base base Base URL to parse if input is not absolute. 835 * @returns { URL } 836 * @throws { BusinessError } 401 - Parameter error. Possible causes: 837 * 1.Mandatory parameters are left unspecified; 838 * 2.Incorrect parameter types; 839 * 3.Parameter verification failed. 840 * @throws { BusinessError } 10200002 - Invalid url string. 841 * @syscap SystemCapability.Utils.Lang 842 * @crossplatform 843 * @since 10 844 */ 845 /** 846 * Replaces the original constructor to process arguments and return a url object. 847 * 848 * @param { string } url - url url Absolute or relative input URL to resolve. Base is required if input is relative. 849 * If input is an absolute value, base ignores the value. 850 * @param { string | URL } [base] - base base Base URL to parse if input is not absolute. 851 * @returns { URL } 852 * @throws { BusinessError } 401 - Parameter error. Possible causes: 853 * 1.Mandatory parameters are left unspecified; 854 * 2.Incorrect parameter types; 855 * 3.Parameter verification failed. 856 * @throws { BusinessError } 10200002 - Invalid url string. 857 * @syscap SystemCapability.Utils.Lang 858 * @crossplatform 859 * @atomicservice 860 * @since 11 861 */ 862 static parseURL(url: string, base?: string | URL): URL; 863 864 /** 865 * Returns the serialized URL as a string. 866 * 867 * @returns { string } Returns the serialized URL as a string. 868 * @syscap SystemCapability.Utils.Lang 869 * @since 7 870 */ 871 /** 872 * Returns the serialized URL as a string. 873 * 874 * @returns { string } Returns the serialized URL as a string. 875 * @syscap SystemCapability.Utils.Lang 876 * @crossplatform 877 * @since 10 878 */ 879 /** 880 * Returns the serialized URL as a string. 881 * 882 * @returns { string } Returns the serialized URL as a string. 883 * @syscap SystemCapability.Utils.Lang 884 * @crossplatform 885 * @atomicservice 886 * @since 11 887 */ 888 toString(): string; 889 890 /** 891 * Returns the serialized URL as a string. 892 * 893 * @returns { string } Returns the serialized URL as a string. 894 * @syscap SystemCapability.Utils.Lang 895 * @since 7 896 */ 897 /** 898 * Returns the serialized URL as a string. 899 * 900 * @returns { string } Returns the serialized URL as a string. 901 * @syscap SystemCapability.Utils.Lang 902 * @crossplatform 903 * @since 10 904 */ 905 /** 906 * Returns the serialized URL as a string. 907 * 908 * @returns { string } Returns the serialized URL as a string. 909 * @syscap SystemCapability.Utils.Lang 910 * @crossplatform 911 * @atomicservice 912 * @since 11 913 */ 914 toJSON(): string; 915 916 /** 917 * Gets and sets the fragment portion of the URL. 918 * 919 * @type { string } 920 * @syscap SystemCapability.Utils.Lang 921 * @since 7 922 */ 923 /** 924 * Gets and sets the fragment portion of the URL. 925 * 926 * @type { string } 927 * @syscap SystemCapability.Utils.Lang 928 * @crossplatform 929 * @since 10 930 */ 931 /** 932 * Gets and sets the fragment portion of the URL. 933 * 934 * @type { string } 935 * @syscap SystemCapability.Utils.Lang 936 * @crossplatform 937 * @atomicservice 938 * @since 11 939 */ 940 hash: string; 941 942 /** 943 * Gets and sets the host portion of the URL. 944 * 945 * @type { string } 946 * @syscap SystemCapability.Utils.Lang 947 * @since 7 948 */ 949 /** 950 * Gets and sets the host portion of the URL. 951 * 952 * @type { string } 953 * @syscap SystemCapability.Utils.Lang 954 * @crossplatform 955 * @since 10 956 */ 957 /** 958 * Gets and sets the host portion of the URL. 959 * 960 * @type { string } 961 * @syscap SystemCapability.Utils.Lang 962 * @crossplatform 963 * @atomicservice 964 * @since 11 965 */ 966 host: string; 967 968 /** 969 * Gets and sets the host name portion of the URL,not include the port. 970 * 971 * @type { string } 972 * @syscap SystemCapability.Utils.Lang 973 * @since 7 974 */ 975 /** 976 * Gets and sets the host name portion of the URL,not include the port. 977 * 978 * @type { string } 979 * @syscap SystemCapability.Utils.Lang 980 * @crossplatform 981 * @since 10 982 */ 983 /** 984 * Gets and sets the host name portion of the URL,not include the port. 985 * 986 * @type { string } 987 * @syscap SystemCapability.Utils.Lang 988 * @crossplatform 989 * @atomicservice 990 * @since 11 991 */ 992 hostname: string; 993 994 /** 995 * Gets and sets the serialized URL. 996 * 997 * @type { string } 998 * @syscap SystemCapability.Utils.Lang 999 * @since 7 1000 */ 1001 /** 1002 * Gets and sets the serialized URL. 1003 * 1004 * @type { string } 1005 * @syscap SystemCapability.Utils.Lang 1006 * @crossplatform 1007 * @since 10 1008 */ 1009 /** 1010 * Gets and sets the serialized URL. 1011 * 1012 * @type { string } 1013 * @syscap SystemCapability.Utils.Lang 1014 * @crossplatform 1015 * @atomicservice 1016 * @since 11 1017 */ 1018 href: string; 1019 1020 /** 1021 * Gets the read-only serialization of the URL's origin. 1022 * 1023 * @type { string } 1024 * @syscap SystemCapability.Utils.Lang 1025 * @since 7 1026 */ 1027 /** 1028 * Gets the read-only serialization of the URL's origin. 1029 * 1030 * @type { string } 1031 * @syscap SystemCapability.Utils.Lang 1032 * @crossplatform 1033 * @since 10 1034 */ 1035 /** 1036 * Gets the read-only serialization of the URL's origin. 1037 * 1038 * @type { string } 1039 * @readonly 1040 * @syscap SystemCapability.Utils.Lang 1041 * @crossplatform 1042 * @atomicservice 1043 * @since 11 1044 */ 1045 readonly origin: string; 1046 1047 /** 1048 * Gets and sets the password portion of the URL. 1049 * 1050 * @type { string } 1051 * @syscap SystemCapability.Utils.Lang 1052 * @since 7 1053 */ 1054 /** 1055 * Gets and sets the password portion of the URL. 1056 * 1057 * @type { string } 1058 * @syscap SystemCapability.Utils.Lang 1059 * @crossplatform 1060 * @since 10 1061 */ 1062 /** 1063 * Gets and sets the password portion of the URL. 1064 * 1065 * @type { string } 1066 * @syscap SystemCapability.Utils.Lang 1067 * @crossplatform 1068 * @atomicservice 1069 * @since 11 1070 */ 1071 password: string; 1072 1073 /** 1074 * Gets and sets the path portion of the URL. 1075 * 1076 * @type { string } 1077 * @syscap SystemCapability.Utils.Lang 1078 * @since 7 1079 */ 1080 /** 1081 * Gets and sets the path portion of the URL. 1082 * 1083 * @type { string } 1084 * @syscap SystemCapability.Utils.Lang 1085 * @crossplatform 1086 * @since 10 1087 */ 1088 /** 1089 * Gets and sets the path portion of the URL. 1090 * 1091 * @type { string } 1092 * @syscap SystemCapability.Utils.Lang 1093 * @crossplatform 1094 * @atomicservice 1095 * @since 11 1096 */ 1097 pathname: string; 1098 1099 /** 1100 * Gets and sets the port portion of the URL. 1101 * 1102 * @type { string } 1103 * @syscap SystemCapability.Utils.Lang 1104 * @since 7 1105 */ 1106 /** 1107 * Gets and sets the port portion of the URL. 1108 * 1109 * @type { string } 1110 * @syscap SystemCapability.Utils.Lang 1111 * @crossplatform 1112 * @since 10 1113 */ 1114 /** 1115 * Gets and sets the port portion of the URL. 1116 * 1117 * @type { string } 1118 * @syscap SystemCapability.Utils.Lang 1119 * @crossplatform 1120 * @atomicservice 1121 * @since 11 1122 */ 1123 port: string; 1124 1125 /** 1126 * Gets and sets the protocol portion of the URL. 1127 * 1128 * @type { string } 1129 * @syscap SystemCapability.Utils.Lang 1130 * @since 7 1131 */ 1132 /** 1133 * Gets and sets the protocol portion of the URL. 1134 * 1135 * @type { string } 1136 * @syscap SystemCapability.Utils.Lang 1137 * @crossplatform 1138 * @since 10 1139 */ 1140 /** 1141 * Gets and sets the protocol portion of the URL. 1142 * 1143 * @type { string } 1144 * @syscap SystemCapability.Utils.Lang 1145 * @crossplatform 1146 * @atomicservice 1147 * @since 11 1148 */ 1149 protocol: string; 1150 1151 /** 1152 * Gets and sets the serialized query portion of the URL. 1153 * 1154 * @type { string } 1155 * @syscap SystemCapability.Utils.Lang 1156 * @since 7 1157 */ 1158 /** 1159 * Gets and sets the serialized query portion of the URL. 1160 * 1161 * @type { string } 1162 * @syscap SystemCapability.Utils.Lang 1163 * @crossplatform 1164 * @since 10 1165 */ 1166 /** 1167 * Gets and sets the serialized query portion of the URL. 1168 * 1169 * @type { string } 1170 * @syscap SystemCapability.Utils.Lang 1171 * @crossplatform 1172 * @atomicservice 1173 * @since 11 1174 */ 1175 search: string; 1176 1177 /** 1178 * Gets the URLSearchParams object that represents the URL query parameter. 1179 * This property is read-only, but URLSearchParams provides an object that can be used to change 1180 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1181 * 1182 * @syscap SystemCapability.Utils.Lang 1183 * @since 7 1184 * @deprecated since 9 1185 * @useinstead ohos.url.URL.params 1186 */ 1187 readonly searchParams: URLSearchParams; 1188 1189 /** 1190 * Gets the URLParams object that represents the URL query parameter. 1191 * This property is read-only, but URLParams provides an object that can be used to change 1192 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1193 * 1194 * @type { URLParams } 1195 * @syscap SystemCapability.Utils.Lang 1196 * @since 9 1197 */ 1198 /** 1199 * Gets the URLParams object that represents the URL query parameter. 1200 * This property is read-only, but URLParams provides an object that can be used to change 1201 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1202 * 1203 * @type { URLParams } 1204 * @syscap SystemCapability.Utils.Lang 1205 * @crossplatform 1206 * @since 10 1207 */ 1208 /** 1209 * Gets the URLParams object that represents the URL query parameter. 1210 * This property is read-only, but URLParams provides an object that can be used to change 1211 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1212 * 1213 * @type { URLParams } 1214 * @readonly 1215 * @syscap SystemCapability.Utils.Lang 1216 * @crossplatform 1217 * @atomicservice 1218 * @since 11 1219 */ 1220 readonly params: URLParams; 1221 1222 /** 1223 * Gets and sets the username portion of the URL. 1224 * 1225 * @type { string } 1226 * @syscap SystemCapability.Utils.Lang 1227 * @since 7 1228 */ 1229 /** 1230 * Gets and sets the username portion of the URL. 1231 * 1232 * @type { string } 1233 * @syscap SystemCapability.Utils.Lang 1234 * @crossplatform 1235 * @since 10 1236 */ 1237 /** 1238 * Gets and sets the username portion of the URL. 1239 * 1240 * @type { string } 1241 * @syscap SystemCapability.Utils.Lang 1242 * @crossplatform 1243 * @atomicservice 1244 * @since 11 1245 */ 1246 username: string; 1247 } 1248} 1249export default url; 1250