* Return the URL from where is served the RapiDoc component, removing any hash and route prefix
()
| 818 | * Return the URL from where is served the RapiDoc component, removing any hash and route prefix |
| 819 | */ |
| 820 | getComponentBaseURL() { |
| 821 | const { href } = window.location; |
| 822 | |
| 823 | // Remove end of string # or / |
| 824 | const cleanRouterPrefix = this.routePrefix.replace(/(#|\/)$/, ''); |
| 825 | |
| 826 | if (!cleanRouterPrefix) { |
| 827 | return href.split('#')[0]; |
| 828 | } |
| 829 | |
| 830 | const indexOfRoutePrefix = href.lastIndexOf(cleanRouterPrefix); |
| 831 | |
| 832 | if (indexOfRoutePrefix === -1) { |
| 833 | return href; |
| 834 | } |
| 835 | |
| 836 | return href.slice(0, indexOfRoutePrefix); |
| 837 | } |
| 838 | |
| 839 | /** |
| 840 | * From the URL return the ID of the element whether it is in the hash or if used a router prefix without a hash |
no outgoing calls
no test coverage detected