NoticeStoreclass

new NoticeStore<S>(notices: NoticesStore<S>, children?: ReactNode | null, status?: S | undefined)
ParamType
noticesNoticesStore<S>
The parent store to add this notice to. required
childrenReactNode
null
The notice content (optional).
statusS
The notice status (optional).
Return
NoticeStore<S>
Store holding a single notice's content and status, owned by a NoticesStore.
PropertyType
.keyunknown
Defaults to getRandomKey() readonly

Store holding a single notice's content and status, owned by a NoticesStore.

  • Auto-closes itself a few seconds after opening unless its status is "loading".
  • Adds itself to its parent NoticesStore on construction and removes itself on close() or disposal.

Examples

const notice = notices.show("Saved", "success"); notice.close();

Methods

Go

NoticeStore.show()method

Update the notice's content and status, resetting its auto-close timer.

show(children?: ReactNode | undefined, status: S | undefined = this.value.status): void
Go

NoticeStore.close()method

Close this notice permanently, removing it from its parent NoticesStore.

close(): void