W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2008

[whatwg] HTML vs Plain Text in Notifications

From: Greg Houston <gregory.houston@gmail.com>
Date: Thu, 11 Sep 2008 00:07:58 -0500
Message-ID: <29ae901a0809102207g28e6bfecjf1d33554065aca06@mail.gmail.com>
On Wed, Sep 10, 2008 at 9:26 PM, Dmitry Titov <dimich at google.com> wrote:
>
> So instead of:
>   <script>
>    function callback() { ... }
>    ...
>    window.showNotification("You've got mail!",
>                                        "From: Santa Claus",
>                                        "What's in your wishlist?",
>                                        "http://.../icon.png",
>                                        callback);
>    ...
>    </script>
>
> it would be closer to:
>   <script>
>    ...
>    balloon_window = window.open("http://.../mail_notification?id=....",
> "_notification");
>    ...
>    </script>

Something else to consider, though more verbose, once you start
passing this many arguments it is a lot easier to make sense out of
the arguments as an object rather than an array. This is how it would
look in a JavaScript framework:

window.showNotification({
	title: 'You\'ve got mail!',
	subtitle: 'From: Santa Claus',
	description: 'What\'s in your wishlist?',
	icon: 'http://www.foo.com/icon.png',
	onclick: function(){
		// Do something
	}
});

or

window.showNotification({
	id: 'myNotification',
	class: 'myNotificationClass',
	title: 'You\'ve got mail!',
	url: 'http://www.foo.com/my_notification.html',
	icon: 'http://www.foo.com/icon.png',
	onclick: function(){
		// Do something
	},
	onSuccess: function(){
		// Do something after the URL is loaded. Could also be called onload
or onComplete
	}	
});

- Greg
Received on Wednesday, 10 September 2008 22:07:58 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:05 UTC