UNPKG

metawrite

Version:

Appwrite SDK with ready to go components for Svelte / SvelteKit

58 lines (57 loc) 1.76 kB
import { SvelteComponentTyped } from "svelte"; declare const __propDef: { props: { channels: string | string[]; }; events: { [evt: string]: CustomEvent<any>; }; slots: { default: { payload: void; actions: { subscribe: () => void; unsubscribe: () => void; }; }; }; }; export declare type RealtimeProps = typeof __propDef.props; export declare type RealtimeEvents = typeof __propDef.events; export declare type RealtimeSlots = typeof __propDef.slots; /** * ### `<Realtime />` * * For more information about using Realtime in Appwrite see [Realtime documentation](https://appwrite.io/docs/realtime). * * #### Arguments * * - channels - *required* `string | string[]` * * #### Directives * * **let:payload** - The payload from the subscription will contain [following properties](https://appwrite.io/docs/realtime#payload). * * **let:actions** * | Name | Description | * | --- | --- | * | `subscribe()` | Subscribing to all updates related to one or more channels. | * | `unsubscribe()` | If you no longer want to receive updates from a subscription, you can unsubscribe so that your callbacks are no longer called. | * * #### Example * * ```svelte * <script> * import { Realtime } from 'metawrite'; * </script> * * <Realtime channels="account" let:actions let:payload> * <h1>{payload.timestamp}</h1> * <button on:click={actions.subscribe()}>Subscribe to Account channel</button> * <button on:click={actions.unsubscribe()}>Unsubscribe from Account channel</button> * </Realtime> * ``` */ export default class Realtime extends SvelteComponentTyped<RealtimeProps, RealtimeEvents, RealtimeSlots> { } export {};