UNPKG

sveltekit-flash-message

Version:

Send temporary data to the next request after redirect. Works with both SSR and client.

19 lines (18 loc) 1.25 kB
import { type Writable, type Readable } from 'svelte/store'; import type { Page } from '@sveltejs/kit'; import type { FlashOptions } from './options.js'; export declare function initFlash(page: Readable<Page>, options?: Partial<FlashOptions>): Writable<App.PageData['flash']>; /** * Retrieves the flash message store for display or modification. * @param page Page store, imported from `$app/state`. * @param {FlashOptions} options for the flash message. Can only be set once, usually at the highest level component where getFlash is called for the first time. * @returns The flash message store. */ export declare function getFlash(page: Readable<Page> | Page, options?: Partial<FlashOptions>): Writable<App.PageData['flash']>; /** * Update the flash message manually, usually after a fetch request. * @param page Page store, imported from `$app/state`. * @param {Promise<void>} update A callback which is executed *before* the message is updated, to delay the message until navigation events are completed, for example when using `goto`. * @returns {Promise<boolean>} `true` if a flash message existed, `false` if not. */ export declare function updateFlash(page: Readable<Page> | Page, update?: () => Promise<void>): Promise<boolean>;