(href, opts = {})
| 185 | }, |
| 186 | |
| 187 | navigate(href, opts = {}) { |
| 188 | const target = href.startsWith('#') ? href : `#${href}`; |
| 189 | if (opts.replace) { |
| 190 | history.replaceState(history.state, '', target); |
| 191 | onHashWritten(); |
| 192 | return; |
| 193 | } |
| 194 | if (location.hash === target) return; |
| 195 | location.hash = target; |
| 196 | // hashchange fires asynchronously; the sync is idempotent, so calling it |
| 197 | // now keeps a navigate() immediately followed by a read consistent. |
| 198 | onHashWritten(); |
| 199 | }, |
| 200 | |
| 201 | back() { |
| 202 | history.back(); |
no test coverage detected