class Notification

The notification object controls the sticky notes underneath the Repl header.

Constructor

class obs.notification

Create a notification object associated with the notifications.

Methods

notification.fatal(key: string, value: string)

Set a notification, at level fatal, that is displayed underneath the REPL header. The notification is identified using the key and can be deleted with this same key.

notification.error(key: string, value: string)

Set a notification, at level error, that is displayed underneath the REPL header. The notification is identified using the key and can be deleted with this same key.

notification.warn(key: string, value: string)

Set a notification, at level warning, that is displayed underneath the REPL header. The notification is identified using the key and can be deleted with this same key.

notification.remove(key: string)

Remove a notification. When removed it will not be displayed anymore.

notification.contains(key: string) → boolean

Check whether a notification exist. When it exists the method will return the value true.

Example usage

The following code shows an example of adding a notification.

import obs

notification = obs.notification()
notification.warn('wrn1', 'SD storage capacity less than 6%')

if notification.contains('wrn1'):
    # ... do something