location.js 606 B

1234567891011121314151617181920212223
  1. // window location-related functions in a separate module so they can be mocked/stubbed in tests
  2. export const location = {
  3. assign(url) {
  4. // eslint-disable-next-line no-restricted-syntax
  5. window.location.assign(url)
  6. },
  7. replace(url) {
  8. // eslint-disable-next-line no-restricted-syntax
  9. window.location.replace(url)
  10. },
  11. reload() {
  12. // eslint-disable-next-line no-restricted-syntax
  13. window.location.reload()
  14. },
  15. setHash(hash) {
  16. window.location.hash = hash
  17. },
  18. toString() {
  19. // eslint-disable-next-line no-restricted-syntax
  20. return window.location.toString()
  21. },
  22. }