--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
--
I can't address all of your questions, but "when:1000" will make it run 1 second after you set your alarm, so remove it. Also, try setting the period to 10 minutes instead of 1 like you have it. Also, you may want to detect the alarm name in the listener to avoid any issues if you add another alarm. That said, I do find alarms in the context of event pages a bit confusing as well -- fleshing out the doc page could help a lot
Hm, it sounds like we need some documentation on how event
registration works for event pages.
PhistucK is doing it correctly. The first time you ever listen to an
event within an extension version, the system records it so that it
can wake up your extension to receive the event. However, you must
call addListener() each time your event pages runs to associate the
bit of code you want to to run with the event.
You can an example of this in the Gmail Checker sample:
http://developer.chrome.com/beta/samples.html#bb57f7a0132cbeb36ad7e7bb0ab75c21704234ca
As a side note, the minimum period is typically 5 minutes, I believe,
but you can set it much lower when an extension is unpacked for
development. We'll add doc about this too.
only thing they can do is start killing processes. Since classicbackground pages are not designed to be killed and restored, the only
option is to kill tabs instead. This is a really frustrating UX, and
So a basic, typical skeleton for using the alarms API would be:
chrome.runtime.onInstalled.addListener(function() {
chrome.alarms.create(...);
});
chrome.alarms.onAlarm.addListener(function(alarm) {
...
});
Anyway, event pages are optional. If you find that it results in your
extension being less responsive than you like, you're free to not use
them. You'll just miss out on this opportunity for being featured in
the store. We plan to do this with all major new features though, so
you'll have another shot.
We may try to encourage event pages more strenuously in the future,
but it's going to depend on how successful they are I suppose. And we
don't have any plans along those lines today.
- a
Maybe it will appeal to more if there is an event for "on extension first load/on Chrome browser start" or "on Chrome browser close".I'm playing around with an undo close tab extension where there is an option to save closed tabs after browser close.If the option is disabled the closed tab data is cleared on browser start, specifically when the background page loads via the DOMContentLoaded event.But if I switch to event pages, the DOMContentLoaded event will be triggered everytime the event page loads thus clearing the closed tab data every time instead of once either on browser start or browser close.Or I should stick with persistant background pages?I'm still very new to Javascript (but I'm trained in Java).
On Tuesday, 28 August 2012 04:33:37 UTC+8, Aaron Boodman wrote:Hello extension developers!
In Chrome 22, we’re releasing two new APIs that we hope you’ll use to kill off your memory-guzzling background pages:
- Event pages are a replacement for background pages. They are similar to background pages, except that they are automatically destroyed by the system when idle, and brought back to life when needed. Converting to event pages is usually really easy, and will improve Chrome’s performance and responsiveness -- especially on lower-power devices.
- The Storage API is a replacement for HTML5’s localStorage, but with a couple big advantages. The Storage API can be used within content scripts directly, without having to send messages to a background page. This should allow many extensions to completely remove their background pages. The Storage API also has built-in support for synchronization. Any data stored within the sync namespace is automatically replicated to each device the user has your extension installed on.
To add some extra incentive, we’ll be featuring the awesomest extensions that kill their background pages using either of these APIs in the Chrome Web Store. Featured extensions periodically show up at the top of the extensions category, with gigantic promotional images that are pretty much impossible to miss. We'll also be selecting a few of these extensions to showcase in an upcoming blog post. To be eligible, just upload your converted, background-page-free extension to the Chrome Web Store by October 1.Note that both these new APIs require manifest version 2. We plan to require manifest v2 for updates to all existing extensions starting in Chrome 23, so this is a good thing to start looking at now anyway.
So get out your editor and a scalpel, and let us know how these APIs work for you. If you have any questions, just reply to this message, or start a new thread on the mailing list.
Happy hacking,
- Ben (storage), Matt (event pages), Yoyo (event pages), and Aaron (overhead)
--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/8QZcExdXhpQJ.
☆PhistucK
To unsubscribe from this group, send email to chromium-extensions+unsub...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/PwNvScQjcT8J.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msg/chromium-extensions/-/2eL_BeFRE3MJ.