Documentation
¶
Overview ¶
Package notify is the notification centre: core.NotificationService in memory. Posting stores the notification (newest first, at most Max) and publishes core.NotificationPosted; the shell turns that into a toast and a badge on the bell of the status bar.
A centre opened over Documents (Open) keeps its info, success and warning notifications across restarts, until they are cleared; errors belong to the session that had them and are not kept. Saving happens on a goroutine after each change (the newest list wins); Close waits for it.
Imports: core.
Index ¶
Constants ¶
const DocKey = "notifications"
DocKey is the document the notifications are kept in.
const Max = 200
Max is how many notifications the centre keeps; older ones drop off.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Center ¶
type Center struct {
// contains filtered or unexported fields
}
Center implements core.NotificationService.
func Open ¶
Open returns a centre that keeps its notifications in docs, with the ones kept last time. A document that does not decode is ignored (and replaced at the next change): Open then returns the empty centre and the error, for the log.
func (*Center) Close ¶
func (c *Center) Close()
Close waits for pending saves (call it before closing the store).
func (*Center) Post ¶
func (c *Center) Post(n core.Notification)
Post stores n, filling its ID and Time when empty, and publishes NotificationPosted. A notification with the ID of one stored replaces it (as unread), so a repeated problem shows once. It never blocks.