hop

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

  • Owner: sporto/hop
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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

Building routes

Nesting routes

Matching routes

Reverse routing

API

Changelog

Testing Hop

More docs

Upgrade guide 5 to 6

Upgrade guide 4 to 5

Upgrade guide 3 to 4

Upgrade guide 2.1 to 3.0

Version 5 documentation

Version 4 documentation

Version 3 documentation

Version 2 documentation

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

Main metrics

Overview
Name With Ownersporto/hop
Primary LanguageElm
Program languageElm (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2015-11-20 21:25:44
Pushed At2017-08-14 14:05:12
Last Commit At2016-11-15 08:31:27
Release Count20
Last Release Name6.0.1 (Posted on 2016-10-26 15:56:49)
First Release Name1.0.0 (Posted on 2015-12-17 19:39:23)
用户参与
Stargazers Count294
Watchers Count14
Fork Count21
Commits Count496
Has Issues Enabled
Issues Count35
Issue Open Count4
Pull Requests Count10
Pull Requests Open Count0
Pull Requests Close Count1
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private