Skip to content

Commit

Permalink
Merge pull request #3 from BRIXTOL/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
panoply authored Mar 30, 2021
2 parents cdd7c08 + 7ed3260 commit db64ba5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

#### 30/03/2021 | v0.1.2-beta.1

- Fix some type definitions
- Update Readme to to accurate description

#### 30/03/2021 | v0.1.1-beta.1

- Fixes Prefetch hover toggle between navigation
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brixtol/pjax",
"version": "0.1.1-beta.1",
"version": "0.1.2-beta.1",
"private": false,
"description": "A modern next generation pjax solution for SSR web applications",
"author": "ΝΙΚΟΛΑΣ ΣΑΒΒΙΔΗΣ",
Expand Down
24 changes: 14 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Example
The first thing we want to do is make a connection with Pjax. In your JavaScript bundle, we need to initialize. Our example web application has 3 pages, the home page, about page and contact page. We are going to instruct pjax to replace the `<nav>` and `<main>` fragments on every visit and then we are going to leverage `data-pjax` attributes to replace an additional fragment when we navigate to the contact page.

<br>
**JavaScript Bundle**
<strong>JavaScript Bundle</strong>
<br>

<!-- prettier-ignore -->
Expand All @@ -102,6 +102,7 @@ export default () => {
```

**Home Page**

<br>
Below we have a very basic Home Page with pjax wired up and all `<a>` elements will be intercepted and cached. SSR web application (in most cases) will only ever have a couple of fragments that change between navigation, so keeping to that logic lets begin..

Expand Down Expand Up @@ -470,15 +471,15 @@ Example

<a
href="*"
data-pjax-replace="(['target1', 'target2'])">
data-pjax-replace="(['#target1', '#target2'])">
Link
</a>

<div data-pjax-target="target1">
<div id="target1">
I will be replaced on next navigation
</div>

<div data-pjax-target="target2">
<div id="target2">
I will be replaced on next navigation
</div>

Expand All @@ -505,15 +506,15 @@ Example

<a
href="*"
data-pjax-prepend="(['target-1', 'target-2'])">
data-pjax-prepend="(['#target-1', '#target-2'])">
Page 2
</a>

<div data-pjax-target="target-1">
<div id="target-1">
I will prepend to target-2 on next navigation
</div>

<div data-pjax-target="target-2">
<div id="target-2">
<p>target-1 will prepended to me on next navigation</p>
</div>

Expand All @@ -526,11 +527,11 @@ Example

<a
href="*"
data-pjax-prepend="(['target-1', 'target-2'])">
data-pjax-prepend="(['#target-1', '#target-2'])">
Page 2
</a>

<div data-pjax-target="target-2">
<div id="target-2">

<!-- An action reference record is applied -->
<div data-pjax-action="xxxxxxx">
Expand Down Expand Up @@ -581,7 +582,10 @@ Example
<a data-pjax-prefetch="hover" href="*"></a>

<!-- prefetch will begin 500ms after hover but will cancel if mouse existed before threshold -->
<a data-pjax-prefetch="intersect" data-pjax-threshold="500" href="*"></a>
<a data-pjax-prefetch="hover" data-pjax-threshold="500" href="*"></a>

<!-- Prefetch will begin once this link becomes visible in viewport -->
<a data-pjax-prefetch="intersect" href="*"></a>
```
</details>
Expand Down
10 changes: 4 additions & 6 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ declare module "@brixtol/pjax" {
export function connect(options?: IPresets): IPage;

/**
* **NOT YET AVAILABLE**
*
* Fetches state page by url. Pass `false` to clear cache
*/
export function cache(ref?: string | false): IPage;
Expand All @@ -23,6 +25,8 @@ declare module "@brixtol/pjax" {
export function clear(url?: string): IPage;

/**
* **NOT YET AVAILABLE**
*
* Reloads the current page
*/
export function reload(): void;
Expand All @@ -32,12 +36,6 @@ declare module "@brixtol/pjax" {
*/
export function uuid(size?: string): string;

/**
* Captures current `<body>` element and upon next history visit
* will use the capture as replacement.
*/
export function capture(url: string): string;

/**
* Programmatic visit to location
*/
Expand Down

0 comments on commit db64ba5

Please sign in to comment.