Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
IonicaBizau committed Nov 7, 2021
1 parent c045c90 commit 0731cb0
Show file tree
Hide file tree
Showing 5 changed files with 6,815 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
*~
*.log
node_modules
*.env
.DS_Store
package-lock.json
.bloggify/*
26 changes: 23 additions & 3 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ You can see below the API reference of this module.
Finds the value of parameter passed in first argument.

#### Params

- **String** `name`: The parameter name.
- **Boolean** `notDecoded`: If `true`, the result will be encoded.

Expand All @@ -19,6 +20,7 @@ the parameter is there, but it doesn't have a value, the value will
be `true`.

#### Params

- **String** `search`: An optional string that should be parsed (default: `window.location.search`).

#### Return
Expand All @@ -28,6 +30,7 @@ be `true`.
Stringifies a query object.

#### Params

- **Object** `queryObj`: The object that should be stringified.

#### Return
Expand All @@ -37,6 +40,7 @@ Stringifies a query object.
Adds, updates or deletes a parameter (without page refresh).

#### Params

- **String|Object** `param`: The parameter name or name-value pairs as object.
- **String** `value`: The parameter value. If `undefined`, the parameter will be removed.
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
Expand All @@ -50,6 +54,7 @@ will not bring you to the old location.
Returns the page url, but not including the domain name.

#### Params

- **Boolean** `excludeHash`: If `true`, the location hash will not be appended in the result.

#### Return
Expand All @@ -59,8 +64,9 @@ Returns the page url, but not including the domain name.
Sets/gets the hash value.

#### Params

- **String** `newHash`: The hash to set.
- **Boolean** `triggerPopState`: Triggers the popstate handlers (by default falsly).
- **Boolean** `triggerPopState`: Triggers the hashchange (by default falsly).

#### Return
- **String** The location hash.
Expand All @@ -69,6 +75,7 @@ Sets/gets the hash value.
Update the full url (pathname, search, hash).

#### Params

- **String** `s`: The new url to set.
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
will not bring you to the old location.
Expand All @@ -77,11 +84,11 @@ will not bring you to the old location.
#### Return
- **String** The set url.

### `getLocation(pathname, push, triggerPopState)`
pathname
### `pathname(pathname, push, triggerPopState)`
Sets/gets the pathname.

#### Params

- **String** `pathname`: The pathname to set.
- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
will not bring you to the old location.
Expand All @@ -90,19 +97,31 @@ will not bring you to the old location.
#### Return
- **String** The set url.

### `triggerHashchangeCb()`
Calls the hashchange handlers.

### `triggerPopStateCb()`
Calls the popstate handlers.

### `onPopState(cb)`
Adds a popstate handler.

#### Params

- **Function** `cb`: The callback function.

### `onHashchange(cb)`
Adds a hashchange handler.

#### Params

- **Function** `cb`: The callback function.

### `removeHash(push, trigger)`
Removes the hash from the url.

#### Params

- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
will not bring you to the old location.
- **Boolean** `trigger`: Triggers the popstate handlers (by default falsly).
Expand All @@ -111,6 +130,7 @@ will not bring you to the old location.
Removes the querystring parameters from the url.

#### Params

- **Boolean** `push`: If `true`, the page will be kept in the history, otherwise the location will be changed but by pressing the back button
will not bring you to the old location.
- **Boolean** `trigger`: Triggers the popstate handlers (by default falsly).
Expand Down
Loading

0 comments on commit 0731cb0

Please sign in to comment.