MessageTray.Notification: Cinnamon Javascript Reference Manual

## MessageTray.Notification MessageTray.Notification — A shell notification. |

## Functions

| update ()
| scrollTo ()
| addButton ()
| clearButtons ()

## Properties

object | source |
string | title |
string | body |
object | params |

## Object Hierarchy

        Object
        ╰── MessageTray.Notification

## Description

Creates a notification with the associated title and body

`params` can contain values for 'body', 'icon', 'titleMarkup', 'bodyMarkup', and 'silent' parameters.

By default, the icon shown is created by calling source.createNotificationIcon(). However, if `params` contains an 'icon' parameter, the passed in icon will be shown.

If `params` contains a 'titleMarkup', or 'bodyMarkup' parameter with the value `true`, then the corresponding element is assumed to use pango markup. If the parameter is not present for an element, then anything that looks like markup in that element will appear literally in the output.

If `params` contains a 'silent' parameter with the value `true`, then the associated sound effects are suppressed. Note that notifications with an URGENT priority will always play a sound effect if there is one set.

## Functions

### update ()

    update (string   title,
            string   body,
            object   params);

Updates the notification timestamp, title, and body and regenerates the icon.

#### Parameters

title | the new title |
body | the new body |
params | as in the Notification constructor |

### scrollTo ()

    scrollTo (St.Side   side);

Scrolls the content area (if scrollable) to the indicated edge

#### Parameters

side | St.Side.TOP or St.Side.BOTTOM |

### addButton ()

    addButton (number   id,
               string   label);

Adds a button with the given `label` to the notification. All action buttons will appear in a single row at the bottom of the notification.

If the button is clicked, the notification will emit the `action`-invoked signal with `id` as a parameter.

#### Parameters

id | the action ID |
label | the label for the action's button |

### clearButtons ()

    clearButtons ();

Removes all buttons.

## Property Details

### The `“source”` property

      “source”                   object

The notification's Source

### The `“title”` property

      “title”                    string

The title/summary text

### The `“body”` property

      “body”                     string

Optional - body text

### The `“params”` property

      “params”                   object

Optional - additional params