Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
daun committed Jul 8, 2023
2 parents f549ff1 + 88da90f commit 699b3e8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @swup/astro

## 0.1.4

- Update readme

## 0.1.3

- Provide global swup instance on window
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export default defineConfig({
updateHead: true,
reloadScripts: false,
debug: false,
globalInstance: false,
})
]
});
Expand Down Expand Up @@ -300,7 +301,7 @@ Add debug output by swup and its plugins to the browser console. Useful during d

```js
{
debug: false
debug: true
}
```

Expand All @@ -309,23 +310,23 @@ Add debug output by swup and its plugins to the browser console. Useful during d
Store the initialized swup instance in `window.swup`. Useful if you need to add custom hooks or
plugins.

```js
{
globalInstance: true
}
```

## Advanced usage

### Access to the swup instance

For more advanced usage like registering custom hook handlers or installing plugins, you need access
For more advanced usage like registering hook handlers or installing custom plugins, you need access
to the swup instance itself. Enable the `globalInstance` option to have the swup instance available
at `window.swup`. You can then use swup's API directly.

```js
{
globalInstance: true
}
```

```html
<script>
window.swup.hooks.on('pageView', () => console.log('New page opened'));
window.swup.use(new MyCustomSwupPlugin())
</script>
```

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@swup/astro",
"description": "Smooth page transitions, smart preloading and more in Astro",
"version": "0.1.3",
"version": "0.1.4",
"type": "module",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
Expand Down

0 comments on commit 699b3e8

Please sign in to comment.