On Wed, Sep 10, 2008 at 9:26 PM, Dmitry Titov <[EMAIL PROTECTED]> 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

Reply via email to