Crafting the SAPO Campus platform, a thousand pixels at a time.
Search
Latest posts

High Performance Javascript - dealing with JSON

No Widget is an Island

Designing Email - Part II

Designing Email - Part I

The amazing "widget" object

The Facebook Witch Project

SAPO Campus keynote from OSL Unesco demonstration session

SAPO Campus session at the UNESCO OSL Seminar

SAPO Campus - Eden Seventh Open Classroom Conference

SAPO Campus leaflet for the UA freshmen

Archive

Janeiro 2011

Novembro 2010

Fevereiro 2010

Dezembro 2009

Novembro 2009

Outubro 2009

Setembro 2009

Julho 2009

Maio 2009

Abril 2009

Março 2009

Fevereiro 2009

Dezembro 2008

Novembro 2008

Outubro 2008

Setembro 2008

Terça-feira, 28 de Julho de 2009
Notification Server: Widget Support
After concluding yesterday's post about the Javascript-powered Notification Server, I realized it had a gaping hole the size of the Grand Canyon. The platform could send notifications, but what about support for widgets? It sure would be cool if widgets could join in on the fun.

After about half an hour, the Notification Server supported notifications coming from widgets. The way you send out a notification is a little different, but still easy nonetheless:
var notification = {};
notification.kind = "success";
notification.message = "A hearty hello from me, the widget! I'm at the beach you see :)";
widget.sendNotification(notification);

Basically, you just need to create an empty object and populate it with the kind and message variables. You can omit variables, of course, causing their value to default to the Notification object prototype. You can probably notice I made no mention of callback: right now, defining a callback is not supported due to security reasons - a malicious widget could try to execute a platform function or even on another widget.

widget.sendNotification is actually a custom extension to the Netvibes UWA, and is meant to abstract the widget developer from the rather ugly Environment.sendRemote command, which sends a remote message to the widget platform.

Also, as of now, widget notifications are considered slightly less important than platform ones. The current implementation forces a skew parameter with a value of -1 on notifications coming from widgets, which decreases their overall priority by one point in the priority queue. This may be subject to change as development wears on.

Published by bruno-abrantes às 11:32

About us
Janeiro 2011
Dom
Seg
Ter
Qua
Qui
Sex
Sab

1

2
3
4
5
6
7
8

9
10
11
12
13
14
15

16
17
18
19
20
21
22

23
24
25
26
27
28
29

30
31


tags

todas as tags

subscrever feeds

RSSPosts

RSSComentários

RSSComentários do post