Notification API

Last Updated: Oct 18, 2012

Methods

These JavaScript methods are available to all Pokki apps.

pokki.notify(object notification)

Create an alert. Once created, the alert is sent to the platform, where it may be displayed as determined by the platform.

Parameters

notification (object)

title (string)

Primary string displayed in the alert.

subtitle (optional string)

Secondary title string displayed in the alert.

text (optional string)

Descriptive string displayed in the alert.

icon (optional string)

Path to the icon associated with the alert. Relative paths to the app’s package, and absolute paths to HTTP/HTTPS. The icon must be at least 29 pixels width and high.

data (optional object)

Data associated with the alert, which is provided the app upon the user taking action with the alert. This object is serialized with JSON.stringify before making it to the platform.

Return
The method returns a reference to the alert. The reference is unique, per application, and are never reused.

Example

var notificationId = pokki.notify({
 title : person.Name,
 text : 'Click here to accept or reject this friend request.',
 iconPath : 'icons/friendRequest.png',
 data: {
   eventType : 'friendRequest',
   requestUserId : person.id
 }
});

pokki.cancelNotify(object)

Remove a created alert from the platform, including toasts and alert history.

Parameters

notificationReference (object)
The the alert identifier created by pokki.notify.

Example

pokki.cancelNotify(notificationRef);

pokki.cancelAllNotify()

Remove all alerts created by the app.

Example

pokki.cancelAllNotify();

Events

notifyClicked(object, object)

Fired when an alert created by the app was clicked by the user. The alert may have been in the form of a toast or alert history. This event is fired only into the background page.

Parameters

data (object)
Data associated with the alert.
notificationReference (string)
The the alert identifier created by pokki.notify.
Example
pokki.addEventListener('notifyClicked',
 function(data, id) {
   if (data.eventType == 'friendRequest') {
     $friendRequestDialog.init(data.requestUserId);
     $friendRequestDialog.show(...);
   }
 }
);

pokki.setIconBadge(integer)

Sets the number inset in of app's badge on the top-right of the icon in the taskbar or dock and Apps Menu. Updates the badge number if it’s currently visible or causes the badge to display.

Parameters

number (integer)
The number to display in your app’s badge. Accepted range: 1 to 999. Numbers above 999 are clipped to 999.

Return

No return value.

pokki.removeIconBadge()

Removes the badge displayed on the app's icon in the taskbar or dock and Apps Menu.

Parameters

No parameters.

Return

No return value.
help@pokki.com
http://assets1.desk.com/
@Pokki
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
Invalid characters found
/customer/en/portal/articles/autocomplete