Types notification
This commit is contained in:
parent
4ffb365c64
commit
4d784b530a
|
@ -98,7 +98,6 @@ export type Store = BaseStore &
|
|||
sort: Writable<any>
|
||||
subscribe: any
|
||||
dispatch: (event: string, data: any) => any
|
||||
notifications: Writable<any>
|
||||
width: Writable<number>
|
||||
bounds: Readable<any>
|
||||
height: Readable<number>
|
||||
|
@ -108,7 +107,8 @@ export type Store = BaseStore &
|
|||
Config.Store &
|
||||
Conditions.Store &
|
||||
Cache.Store &
|
||||
Viewport.Store
|
||||
Viewport.Store &
|
||||
Notifications.Store
|
||||
|
||||
export const attachStores = (context: Store): Store => {
|
||||
// Atomic store creation
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
import { notifications as BBUINotifications } from "@budibase/bbui"
|
||||
import { derived } from "svelte/store"
|
||||
import { derived, Readable } from "svelte/store"
|
||||
import { Store as StoreContext } from "."
|
||||
|
||||
export const createStores = (context: StoreContext) => {
|
||||
interface NotificationStore {
|
||||
notifications: Readable<{
|
||||
success: (message: string) => void
|
||||
error: (message: string) => void
|
||||
}>
|
||||
}
|
||||
|
||||
export type Store = NotificationStore
|
||||
|
||||
export const createStores = (context: StoreContext): NotificationStore => {
|
||||
const { notifySuccess, notifyError } = context
|
||||
|
||||
// Normally we would not derive a store in "createStores" as it should be
|
||||
|
|
Loading…
Reference in New Issue