Labs/Jetpack/JEP/34

From MozillaWiki
< Labs‎ | Jetpack‎ | JEP
Jump to: navigation, search

JEP 34 - Notification Boxes

  • Champion: Morgan 'ARR!' Allen <morganrallen at gmail>
  • Implementer: Morgan 'ARR!' Allen <morganrallen at gmail>
  • Status: Implementing
  • Type: API Track
  • Created: 09 Dec 2009
  • Reference Implementation: jetpack.future.import('notificationBox')
  • Relevant Bugs: bug 533649
  • JEP Index

Introduction and Rationale

This JEP describes the use of Notification Boxes (drop down dialogs like Remember Passwords and Allow Pop-ups).

Proposal

Functions for working with Notification Boxes will reside in jetpack.notificationBox

Displaying Notification

jetpack.notificationBox.show(config);

Arguments:

  • message: Message to be displayed in the Notification
  • delay: Optional delay in seconds until Notification closes.
  • icon: Optional URI for icon (default chrome://browser/skin/Info.png)
  • buttons: An optional array of buttons to add to the bar
    • label: Label for button
    • accessKey: Access key for button
    • popup: XUL(?) dialog to popup on click
    • callback: Function to execute on click.

Examples

jetpack.future.import('notificationBox');
jetpack.notificationBox.show({
 message: 'Lookuphere! Hey! You guys! Lookuphere!',
 delay: 3,
 buttons: [{
  accessKey: null,
  label: 'Hoot',
  callback: function() { console.log('Woot!'); }
 }]
});