Notifications

The viewer.notify(opts) function shows a notification dizmo along the right edge starting from the top and automatically choosing a free slot to position the next notification dizmo.

The opts parameter contains the options the dizmo will be instantiated with; all but title are optional:

Simple example

    viewer.notify({title:"Good morning!"});

Full example

    viewer.notify({
        button_1: 'Close',
        button_2: 'Reply',
        title: 'My Contact',
        sub_title: 'RE: Last Email',
        text: 'Oh, this is brilliant—how soon can we get this working?',
     // important: true,

        callback: function (message) {

            switch (message) {
                case 'click':
                    console.debug('from', this.identifier, '=>', 'click');
                    break;
                case 'timeout':
                    console.debug('from', this.identifier, '=>', 'timeout');
                    break;
                case 'reply':
                    console.debug('from', this.identifier, '=>', 'reply');
                    break;
                case 'close':
                    console.debug('from', this.identifier, '=>', 'close');
                    this.publicStorage.setProperty('close', true);
                    break;
                default:
                    console.debug('from', this.identifier, '=>', message);
            }
        },

        timeout: 5000 // or: null
    });

Custom image

By default, Icon.svg in the assets Folder of the notifying dizmo is used as the image for the notification. If you want to use your own, copy it into the assets Folder of your dizmo, and then add the icon option:

    viewer.notify({title:"Threshold reached","icon":"assets/warning-triangle.svg"});