You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
WARNING: This is the BETA documentation. It may not work with the stable release of Chrome.
WARNING: This is unofficial documentation. It may not work with the current release of Chrome.

Google Chrome Extensions (Labs)

Events

An Event is an object that allows you to be notified when something interesting happens. Here's an example of using the chrome.tabs.onCreated event to be notified whenever there's a new tab:

chrome.tabs.onCreated.addListener(function(tab) {
  appendToLog('tabs.onCreated --'
              + ' window: ' + tab.windowId
              + ' tab: '    + tab.id
              + ' index: '  + tab.index
              + ' url: '    + tab.url);
});

As the example shows, you register for notification using addListener(). The argument to addListener() is always a function that you define to handle the event, but the parameters to the function depend on which event you're handling. Checking the documentation for chrome.tabs.onCreated, you can see that the function has a single parameter: a Tab object that has details about the newly created tab.

Methods

You can invoke the following methods on any Event object:

void addListener(function callback(...))
void removeListener(function callback(...))
bool hasListener(function callback(...))