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 * @syscap SystemCapability.Utils.Lang 920 * @since 7 921 */ 922 /** 923 * Gets and sets the fragment portion of the URL. 924 * 925 * @syscap SystemCapability.Utils.Lang 926 * @crossplatform 927 * @since 10 928 */ 929 /** 930 * Gets and sets the fragment portion of the URL. 931 * 932 * @syscap SystemCapability.Utils.Lang 933 * @crossplatform 934 * @atomicservice 935 * @since 11 936 */ 937 hash: string; 938 939 /** 940 * Gets and sets the host portion of the URL. 941 * 942 * @syscap SystemCapability.Utils.Lang 943 * @since 7 944 */ 945 /** 946 * Gets and sets the host portion of the URL. 947 * 948 * @syscap SystemCapability.Utils.Lang 949 * @crossplatform 950 * @since 10 951 */ 952 /** 953 * Gets and sets the host portion of the URL. 954 * 955 * @syscap SystemCapability.Utils.Lang 956 * @crossplatform 957 * @atomicservice 958 * @since 11 959 */ 960 host: string; 961 962 /** 963 * Gets and sets the host name portion of the URL,not include the port. 964 * 965 * @syscap SystemCapability.Utils.Lang 966 * @since 7 967 */ 968 /** 969 * Gets and sets the host name portion of the URL,not include the port. 970 * 971 * @syscap SystemCapability.Utils.Lang 972 * @crossplatform 973 * @since 10 974 */ 975 /** 976 * Gets and sets the host name portion of the URL,not include the port. 977 * 978 * @syscap SystemCapability.Utils.Lang 979 * @crossplatform 980 * @atomicservice 981 * @since 11 982 */ 983 hostname: string; 984 985 /** 986 * Gets and sets the serialized URL. 987 * 988 * @syscap SystemCapability.Utils.Lang 989 * @since 7 990 */ 991 /** 992 * Gets and sets the serialized URL. 993 * 994 * @syscap SystemCapability.Utils.Lang 995 * @crossplatform 996 * @since 10 997 */ 998 /** 999 * Gets and sets the serialized URL. 1000 * 1001 * @syscap SystemCapability.Utils.Lang 1002 * @crossplatform 1003 * @atomicservice 1004 * @since 11 1005 */ 1006 href: string; 1007 1008 /** 1009 * Gets the read-only serialization of the URL's origin. 1010 * 1011 * @syscap SystemCapability.Utils.Lang 1012 * @since 7 1013 */ 1014 /** 1015 * Gets the read-only serialization of the URL's origin. 1016 * 1017 * @syscap SystemCapability.Utils.Lang 1018 * @crossplatform 1019 * @since 10 1020 */ 1021 /** 1022 * Gets the read-only serialization of the URL's origin. 1023 * 1024 * @syscap SystemCapability.Utils.Lang 1025 * @crossplatform 1026 * @atomicservice 1027 * @since 11 1028 */ 1029 readonly origin: string; 1030 1031 /** 1032 * Gets and sets the password portion of the URL. 1033 * 1034 * @syscap SystemCapability.Utils.Lang 1035 * @since 7 1036 */ 1037 /** 1038 * Gets and sets the password portion of the URL. 1039 * 1040 * @syscap SystemCapability.Utils.Lang 1041 * @crossplatform 1042 * @since 10 1043 */ 1044 /** 1045 * Gets and sets the password portion of the URL. 1046 * 1047 * @syscap SystemCapability.Utils.Lang 1048 * @crossplatform 1049 * @atomicservice 1050 * @since 11 1051 */ 1052 password: string; 1053 1054 /** 1055 * Gets and sets the path portion of the URL. 1056 * 1057 * @syscap SystemCapability.Utils.Lang 1058 * @since 7 1059 */ 1060 /** 1061 * Gets and sets the path portion of the URL. 1062 * 1063 * @syscap SystemCapability.Utils.Lang 1064 * @crossplatform 1065 * @since 10 1066 */ 1067 /** 1068 * Gets and sets the path portion of the URL. 1069 * 1070 * @syscap SystemCapability.Utils.Lang 1071 * @crossplatform 1072 * @atomicservice 1073 * @since 11 1074 */ 1075 pathname: string; 1076 1077 /** 1078 * Gets and sets the port portion of the URL. 1079 * 1080 * @syscap SystemCapability.Utils.Lang 1081 * @since 7 1082 */ 1083 /** 1084 * Gets and sets the port portion of the URL. 1085 * 1086 * @syscap SystemCapability.Utils.Lang 1087 * @crossplatform 1088 * @since 10 1089 */ 1090 /** 1091 * Gets and sets the port portion of the URL. 1092 * 1093 * @syscap SystemCapability.Utils.Lang 1094 * @crossplatform 1095 * @atomicservice 1096 * @since 11 1097 */ 1098 port: string; 1099 1100 /** 1101 * Gets and sets the protocol portion of the URL. 1102 * 1103 * @syscap SystemCapability.Utils.Lang 1104 * @since 7 1105 */ 1106 /** 1107 * Gets and sets the protocol portion of the URL. 1108 * 1109 * @syscap SystemCapability.Utils.Lang 1110 * @crossplatform 1111 * @since 10 1112 */ 1113 /** 1114 * Gets and sets the protocol portion of the URL. 1115 * 1116 * @syscap SystemCapability.Utils.Lang 1117 * @crossplatform 1118 * @atomicservice 1119 * @since 11 1120 */ 1121 protocol: string; 1122 1123 /** 1124 * Gets and sets the serialized query portion of the URL. 1125 * 1126 * @syscap SystemCapability.Utils.Lang 1127 * @since 7 1128 */ 1129 /** 1130 * Gets and sets the serialized query portion of the URL. 1131 * 1132 * @syscap SystemCapability.Utils.Lang 1133 * @crossplatform 1134 * @since 10 1135 */ 1136 /** 1137 * Gets and sets the serialized query portion of the URL. 1138 * 1139 * @syscap SystemCapability.Utils.Lang 1140 * @crossplatform 1141 * @atomicservice 1142 * @since 11 1143 */ 1144 search: string; 1145 1146 /** 1147 * Gets the URLSearchParams object that represents the URL query parameter. 1148 * This property is read-only, but URLSearchParams provides an object that can be used to change 1149 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1150 * 1151 * @syscap SystemCapability.Utils.Lang 1152 * @since 7 1153 * @deprecated since 9 1154 * @useinstead ohos.url.URL.params 1155 */ 1156 readonly searchParams: URLSearchParams; 1157 1158 /** 1159 * Gets the URLParams object that represents the URL query parameter. 1160 * This property is read-only, but URLParams provides an object that can be used to change 1161 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1162 * 1163 * @syscap SystemCapability.Utils.Lang 1164 * @since 9 1165 */ 1166 /** 1167 * Gets the URLParams object that represents the URL query parameter. 1168 * This property is read-only, but URLParams provides an object that can be used to change 1169 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1170 * 1171 * @syscap SystemCapability.Utils.Lang 1172 * @crossplatform 1173 * @since 10 1174 */ 1175 /** 1176 * Gets the URLParams object that represents the URL query parameter. 1177 * This property is read-only, but URLParams provides an object that can be used to change 1178 * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. 1179 * 1180 * @syscap SystemCapability.Utils.Lang 1181 * @crossplatform 1182 * @atomicservice 1183 * @since 11 1184 */ 1185 readonly params: URLParams; 1186 1187 /** 1188 * Gets and sets the username portion of the URL. 1189 * 1190 * @syscap SystemCapability.Utils.Lang 1191 * @since 7 1192 */ 1193 /** 1194 * Gets and sets the username portion of the URL. 1195 * 1196 * @syscap SystemCapability.Utils.Lang 1197 * @crossplatform 1198 * @since 10 1199 */ 1200 /** 1201 * Gets and sets the username portion of the URL. 1202 * 1203 * @syscap SystemCapability.Utils.Lang 1204 * @crossplatform 1205 * @atomicservice 1206 * @since 11 1207 */ 1208 username: string; 1209 } 1210} 1211export default url; 1212