Skip to content

Commit

Permalink
Readme updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
ciscoheat committed Jan 25, 2024
1 parent 9d3725e commit 8a5ebdf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ $: if ($flash) {

## Flash message options

When calling `getFlash`, you can specify options, which will be set for the current route and the ones below.
When calling `getFlash`, you can specify options, which will be inherited for the current route and the ones below.

```ts
const flash = getFlash(page, {
Expand All @@ -272,15 +272,15 @@ initFlash(page, {

### clearOnNavigate

If `true` (the default), the flash message will be removed when navigating to a different url.
If `true` (the default), the flash message will be removed when navigating to a different route.

### clearAfterMs

Can be set to a number of milliseconds before the flash message is automatically set to `undefined`.

### clearArray

If you specify `App.PageData['flash']` as an array, the library will concatenate messages into the array instead of replacing them. But if you always want to clear the previous messages for arrays, set the `clearArray` option to `true`.
If you specify `App.PageData['flash']` as an array, the library will concatenate messages into the array instead of replacing them. But if you always want to clear the previous messages for arrays, set the `clearArray` option to `true`. If your flash message isn't an array, this option will have no effect.

### flashCookieOptions

Expand All @@ -296,10 +296,12 @@ export const load = loadFlash(async (event) => {
});
```

And correspondingly, on the client:
And correspondingly, on the client (in a top-level component):

```ts
const flash = getFlash(page, {
import { initFlash } from 'sveltekit-flash-message';

initFlash(page, {
flashCookieOptions: { sameSite: 'lax' }
});
```
Expand Down

0 comments on commit 8a5ebdf

Please sign in to comment.