Put your extensions on a diet with event pages

Thursday, June 21, 2012

Labels: ,

If you’re a Chrome extensions power user, you may be familiar with a task manager that looks like this:



That’s a lot of extensions running! Most of the time, they’re probably just sitting idle, waiting for the user to interact with them. Do they really need to be running and using your memory all the time?

Over the last several months, we've been working on a new feature for the extension system called Event Pages that we think will help reduce the memory used by these idle extensions. 

How They Work 

Event pages are an evolution of background pages, with one major improvement: rather than running in the background all the time, an event page only runs when it is handling events. Once an event page becomes idle, it is unloaded, freeing memory until the next time it’s needed. Learn more from the event page documentation.

To help event pages support some important use cases, we’re also developing a few new APIs.

  • The alarms API allows an extension to wake itself up at set times, to support features like periodically syncing data to the cloud. 
  • Some new events let extensions know when they have been installed, or when their event page is being unloaded. 
  • A declarative version of the webRequest API lets extensions do network interception without the need for a background page at all. 
Try it Out 

We plan to release event pages to Chrome’s beta and stable channels late this summer, but you can start experimenting with them on the developer channel today. Try converting your overweight extension to event pages, and let us know how it works.

Post a Comment