Giter VIP home page Giter VIP logo

navigation's Introduction

Navigation

This is a library for managing browser navigation yourself.

The core functionality is the ability to “navigate” to new URLs, changing the address bar of the browser without the browser kicking off a request to your servers. Instead, you manage the changes yourself in Elm.

This is common in single-page apps (SPAs) where you switch between different pages without doing a full refresh. This can mean you have less network traffic and get people from page to page more quickly.

Examples

Check out the examples/ directory of this repo. The README there will give you more information.

Terminology

The term “routing” is commonly used as a blanket term for anything related to managing the address bar yourself. I think this term is misleading, and probably harmful to the architecture of front-end applications.

  • On Servers — You are literally routing payloads to functions. Servers can make the assumption that all queries are independent. There is no state to persist. There is no concept of “going back” to some other URL.

  • In Browsers — We treat the address bar as an input (like mouse or keyboard) so we can update our app more efficiently. The whole point is that nothing is independent! You can persist state. You can go back.

My point is that routing on servers has an intuitive and clear meaning. You route payloads to functions. What we want in browsers overlaps only in that we are also dealing with URLs. Otherwise, the goals are entirely different. So why take a term with a clear and obvious meaning and apply it to something 95% unrelated?

Point is, I have named this library elm-lang/navigation to emphasize our actual goals in the browser. This library is for managing browser navigation yourself. If you want URL parsing, you can use libraries like evancz/url-parser. Between the terms “managed navigation” and “URL parsing” we have covered the core concepts in a clearer and more helpful way.

navigation's People

Contributors

process-bot avatar

Watchers

Alex Kovalevych avatar James Cloos avatar

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.