Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: chrome/common/extensions/docs/examples/api/transientPage/basic/content.js

Issue 10280005: Fix the event page sample extension to say "event page". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: docgen Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 document.body.innerHTML = "";
6
7 function addButton(name, cb) {
8 var a = document.createElement("button");
9 a.innerText = name;
10 a.onclick = cb;
11 document.body.appendChild(document.createElement("br"));
12 document.body.appendChild(a);
13 }
14
15 function log(str) {
16 console.log(str);
17 logDiv.innerHTML += str + "<br>";
18 }
19
20 addButton("Clear logs", function() {
21 logDiv.innerHTML = "";
22 });
23
24 addButton("Send message with delayed response", function() {
25 chrome.extension.sendMessage({delayedResponse: true}, function(response) {
26 log("Background page responded: " + response);
27 });
28 });
29
30 addButton("Show counters", function() {
31 chrome.extension.sendMessage({getCounters: true}, function(response) {
32 log("In-memory counter is: " + response.counter);
33 log("Persisted counter is: " + response.persistentCounter);
34 });
35 });
36
37 addButton("Set an alarm", function() {
38 chrome.extension.sendMessage({setAlarm: true});
39 });
40
41 chrome.extension.onMessage.addListener(function(msg, _, sendResponse) {
42 log("Got message from background page: " + msg);
43 });
44
45 var logDiv = document.createElement("div");
46 logDiv.style.border = "1px dashed black";
47 document.body.appendChild(document.createElement("br"));
48 document.body.appendChild(logDiv);
49
50 log("Ready.");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698