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