Index: chrome/common/extensions/docs/examples/apps/background-simple/index.js |
diff --git a/chrome/common/extensions/docs/examples/apps/background-simple/index.js b/chrome/common/extensions/docs/examples/apps/background-simple/index.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a788d1c419b2975679becbad620546eabfa2be5b |
--- /dev/null |
+++ b/chrome/common/extensions/docs/examples/apps/background-simple/index.js |
@@ -0,0 +1,24 @@ |
+// Check for support |
Mike West
2012/01/27 16:06:32
Copyright.
|
+if (window.chrome && window.chrome.app && window.chrome.app.isInstalled) { |
+ document.getElementById('supported').className = ''; |
+} else { |
+ document.getElementById('unsupported').className = ''; |
+} |
+var bgWinUrl = "background.html#yay"; |
+var bgWinName = "bgNotifier"; |
+ |
+function openBackgroundWindow() { |
+ window.open(bgWinUrl, bgWinName, "background"); |
+} |
+ |
+function closeBackgroundWindow() { |
+ var w = window.open(bgWinUrl, bgWinName, "background"); |
+ w.close(); |
+} |
+ |
+document.addEventListener('DOMContentLoaded', function() { |
+ document.querySelector('#openBackgroundWindow').addEventListener( |
+ 'click', openBackgroundWindow); |
+ document.querySelector('#closeBackgroundWindow').addEventListener( |
+ 'click', closeBackgroundWindow); |
+}); |