Improve frontend docstrings

This commit is contained in:
Juho Teperi 2021-11-03 12:52:45 +02:00
parent ac68f0f726
commit 9eded42ba1
2 changed files with 29 additions and 16 deletions

View file

@ -43,7 +43,10 @@
(defn (defn
^{:see-also ["reitit.frontend.history/href"]} ^{:see-also ["reitit.frontend.history/href"]}
href href
"Generate link href for the given route and parameters "Generate a URL for a route defined by name, with given path-params and query-params.
The URL is formatted using Reitit frontend history handler, so using it with
anchor element href will correctly trigger route change event.
Note: currently collections in query-parameters are encoded as field-value Note: currently collections in query-parameters are encoded as field-value
pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them
@ -58,11 +61,13 @@
(defn (defn
^{:see-also ["reitit.frontend.history/push-state"]} ^{:see-also ["reitit.frontend.history/push-state"]}
push-state push-state
"Creates url using the given route and parameters, pushes those to "Updates the browser location and pushes new entry to the history stack using
history stack with pushState and triggers on-navigate callback on the URL built from a route defined by name, with given path-params and
history handler. query-params.
Note: currently collections in query-parameters are encoded as field-value Will also trigger on-navigate callback on Reitit frontend History handler.
Note: currently collections in query parameters are encoded as field-value
pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them
differently, convert the collections to strings first. differently, convert the collections to strings first.
@ -78,9 +83,11 @@
(defn (defn
^{:see-also ["reitit.frontend.history/replace-state"]} ^{:see-also ["reitit.frontend.history/replace-state"]}
replace-state replace-state
"Creates url using the given route and parameters, replaces latest entry on "Updates the browser location and replaces latest entry in the history stack
history stack with replaceState and triggers on-navigate callback on the using URL built from a route defined by name, with given path-params and
history handler. query-params.
Will also trigger on-navigate callback on Reitit frontend History handler.
Note: currently collections in query-parameters are encoded as field-value Note: currently collections in query-parameters are encoded as field-value
pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them

View file

@ -178,9 +178,12 @@
(-stop history))) (-stop history)))
(defn href (defn href
"Generate link href for the given route and parameters "Generate a URL for a route defined by name, with given path-params and query-params.
Note: currently collections in query-parameters are encoded as field-value The URL is formatted using Reitit frontend history handler, so using it with
anchor element href will correctly trigger route change event.
Note: currently collections in query parameters are encoded as field-value
pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them
differently, convert the collections to strings first." differently, convert the collections to strings first."
([history name] ([history name]
@ -194,9 +197,10 @@
(defn (defn
^{:see-also ["reitit.core/match->path"]} ^{:see-also ["reitit.core/match->path"]}
push-state push-state
"Creates url using the given route and parameters, pushes those to "Updates the browser URL and pushes new entry to the history stack using
history stack with pushState and triggers on-navigate callback on the a route defined by name, with given path-params and query-params.
history handler.
Will also trigger on-navigate callback on Reitit frontend History handler.
Note: currently collections in query-parameters are encoded as field-value Note: currently collections in query-parameters are encoded as field-value
pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them
@ -216,9 +220,11 @@
(-on-navigate history path)))) (-on-navigate history path))))
(defn replace-state (defn replace-state
"Creates url using the given route and parameters, replaces latest entry on "Updates the browser location and replaces latest entry in the history stack
history stack with replaceState and triggers on-navigate callback on the using URL built from a route defined by name, with given path-params and
history handler. query-params.
Will also trigger on-navigate callback on Reitit frontend History handler.
Note: currently collections in query-parameters are encoded as field-value Note: currently collections in query-parameters are encoded as field-value
pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them pairs separated by &, i.e. \"?a=1&a=2\", if you want to encode them