Skip to content
This repository has been archived by the owner on Mar 9, 2018. It is now read-only.
/ hop Public archive

[Deprecated] Navigation and routing helpers for single page applications in Elm

License

Notifications You must be signed in to change notification settings

sporto/hop

Repository files navigation

Hop: Navigation and routing helpers for Elm SPAs

Build Status

alt Hop

With the release of Elm 0.18 the official libraries Navigation and UrlParser have become a lot more robust and useful. They now integrate a lot of the functionality that Hop used to provide for previous versions of Elm. For example UrlParser now has parseHash and parsePath. Because of this I'm not convinced that Hop needs to be upgraded to Elm 0.18. I'll wait and see if this library could provide value in 0.18.

Hop is a helper library meant to be used with:

  • Navigation v1 for listening to location changes in the browser and pushing changes to it.
  • UrlParser v1 for constructing routes and parsing URLs.

What Hop provides

On top of these two packages above, Hop helps with:

  • Abstracting the differences between push or hash routing
  • Providing helpers for working with the query string
  • Encode / Decode the location path
  • Encode / Decode the query string

Getting Started

Please see this example app. It explains how to wire everything in the comments.

Docs

More docs

Hash routing

A proper url should have the query before the hash e.g. ?keyword=Ja#/users/1, but when using hash routing, query parameters are appended after the hash path e.g. #/users/1?keyword=Ja. This is done for aesthetics and so the router is fully controlled by the hash fragment.

Examples

See examples/basic and examples/full folders. To run the example apps:

  • Clone this repo
  • Go to example folder
  • Follow the readme in that folder

About

[Deprecated] Navigation and routing helpers for single page applications in Elm

Resources

License

Stars

Watchers

Forks

Packages

No packages published