Skip to content

Commit

Permalink
fork & add url fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
gaverhae committed Jul 11, 2018
1 parent ce02504 commit befb321
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions README.md
@@ -1,11 +1,10 @@
# pushy
[![Build Status](https://travis-ci.org/kibu-australia/pushy.svg?branch=master)](https://travis-ci.org/kibu-australia/pushy)

A Clojurescript library for quick and easy HTML5 pushState.

## Install

[![Clojars Project](http://clojars.org/kibu/pushy/latest-version.svg)](http://clojars.org/kibu/pushy)
[![Clojars Project](http://clojars.org/sparrho/pushy/latest-version.svg)](http://clojars.org/sparrho/pushy)

## Usage

Expand Down
6 changes: 3 additions & 3 deletions project.clj
@@ -1,6 +1,6 @@
(defproject kibu/pushy "0.3.8"
:description "HTML5 pushState for Clojurescript"
:url "https://github.com/kibu-australia/pushy"
(defproject sparrho/pushy "0.3.10"
:description "HTML5 pushState for Clojurescript (Sparrho fork)"
:url "https://github.com/Sparrho/pushy"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}

Expand Down
9 changes: 6 additions & 3 deletions src/pushy/core.cljs
Expand Up @@ -19,7 +19,7 @@
(defn- set-retrieve-token! [t]
(set! (.. t -retrieveToken)
(fn [path-prefix location]
(str (.-pathname location) (.-search location))))
(str (.-pathname location) (.-search location) (.-fragment location))))
t)

(defn- set-create-url! [t]
Expand Down Expand Up @@ -49,9 +49,12 @@

(defn- get-token-from-uri [uri]
(let [path (.getPath uri)
query (.getQuery uri)]
query (.getQuery uri)
fragment (.getFragment uri)]
;; Include query string in token
(if (empty? query) path (str path "?" query))))
(cond-> path
(seq query) (str "?" query)
(seq fragment) (str "#" fragment))))

(defn pushy
"Takes in three functions:
Expand Down

0 comments on commit befb321

Please sign in to comment.