| 517 | url(): string; |
| 518 | url(url: string): this; |
| 519 | url(url?: string): string | this { |
| 520 | if (typeof url === 'string') { |
| 521 | if (!url.length) { |
| 522 | url = '/'; |
| 523 | } |
| 524 | |
| 525 | const match = PATH_MATCH.exec(url); |
| 526 | if (!match) return this; |
| 527 | if (match[1] || url === '') this.path(this.urlCodec.decodePath(match[1])); |
| 528 | if (match[2] || match[1] || url === '') this.search(match[3] || ''); |
| 529 | this.hash(match[5] || ''); |
| 530 | |
| 531 | // Chainable method |
| 532 | return this; |
| 533 | } |
| 534 | |
| 535 | return this.$$url; |
| 536 | } |
| 537 | |
| 538 | /** |
| 539 | * Retrieves the protocol of the current URL. |