diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-19 04:03:40 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-19 04:03:40 +0000 |
commit | 79abb7cc1a10fb38303126033d64905f8f9945a8 (patch) | |
tree | 11c7baf963fe88b8e1c2667a918c61b8ae749f98 /chrome/common/extensions/docs/templates/articles/faq.html | |
parent | 037ac5775688ad949db0fff065c03efcb14fbb0a (diff) | |
download | chromium_src-79abb7cc1a10fb38303126033d64905f8f9945a8.zip chromium_src-79abb7cc1a10fb38303126033d64905f8f9945a8.tar.gz chromium_src-79abb7cc1a10fb38303126033d64905f8f9945a8.tar.bz2 |
Update "First run" FAQ doc to suggest chrome.runtime.onInstalled.
BUG=149149
TBR=yoz@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10955002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157489 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs/templates/articles/faq.html')
-rw-r--r-- | chrome/common/extensions/docs/templates/articles/faq.html | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/chrome/common/extensions/docs/templates/articles/faq.html b/chrome/common/extensions/docs/templates/articles/faq.html index 9cec4d9..0539c56 100644 --- a/chrome/common/extensions/docs/templates/articles/faq.html +++ b/chrome/common/extensions/docs/templates/articles/faq.html @@ -275,10 +275,11 @@ cros,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####</pre> <h3 id="faq-lifecycle-events">Can extensions be notified when they are installed/uninstalled?</h3> <p> - No, there are no events an extension can listen to in order to determine - whether it has been installed or uninstalled. However, an extension can - determine when it has been run for the first time. See <a - href="#faq-firstrun">this FAQ entry</a> for information. + You can listen to the + <a href="runtime.html#event-onInstalled">runtime.onInstalled</a> + event to be notified when your extension is installed or updated, or when + Chrome itself is updated. There is no corresponding event for when your + extension is uninstalled. </p> @@ -351,21 +352,11 @@ cros,beta,#.#.###.#,#.#.###.#,mm/dd/yy,mm/dd/yy,#####,#####,#####</pre> <h3 id="faq-firstrun">How can an extension determine whether it is running for the first time?</h3> <p> - An extension can check to see whether it is running for the first time by - checking for the presence of a value in localStorage, and writing the value if - it does not exist. For example: + You can listen to the + <a href="runtime.html#event-onInstalled">runtime.onInstalled</a> + event. See <a href="#faq-lifecycle-events">this FAQ entry</a>. </p> -<pre>var firstRun = (localStorage['firstRun'] == 'true'); -if (!firstRun) { - localStorage['firstRun'] = 'true'; -}</pre> - -<p> - Note that this check should be run in a background page, not a content script. -</p> - - <h2>Features and bugs</h2> @@ -483,4 +474,4 @@ if (!firstRun) { to the ticket you starred or opened. This will make it easier for others with the same request to find the correct ticket. </li> -</ol>
\ No newline at end of file +</ol> |