Code Monkey home page Code Monkey logo

Comments (2)

hidde avatar hidde commented on May 19, 2024 1

Thanks for the explanation, that's very helpful! Was worried about user confusion and compat, but seems neither are warranted here, thanks!

from svelte-navigator.

mefechoel avatar mefechoel commented on May 19, 2024

It actually does not redeclare it, it shadows the global location. It might be an issue when using var, but Svelte probably wraps the component in a function anyways, so it would still just shadow location.

This is just fine for js engines, and since you should not need to access window.location, when using a Router, shadowing it won't restrict you in development.

You're probably worried about it being confusing to users, rather than browser compatibility though, but I'd still argue, that when using a Router you should rely on it to be your source for location, rather than the browser.

It is also how react-router and @reach/router do it.

I hope that clarifies it :)

from svelte-navigator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.