- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / examples / apps / background-simple / index.js
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 // Check for support
6 if (window.chrome && window.chrome.app && window.chrome.app.isInstalled) {
7   document.getElementById('supported').className = '';
8 } else {
9   document.getElementById('unsupported').className = '';
10 }
11 var bgWinUrl = "background.html#yay";
12 var bgWinName = "bgNotifier";
13
14 function openBackgroundWindow() {
15   window.open(bgWinUrl, bgWinName, "background");
16 }
17
18 function closeBackgroundWindow() {
19   var w = window.open(bgWinUrl, bgWinName, "background");
20   w.close();
21 }
22
23 document.addEventListener('DOMContentLoaded', function() {
24   document.querySelector('#openBackgroundWindow').addEventListener(
25     'click', openBackgroundWindow);
26   document.querySelector('#closeBackgroundWindow').addEventListener(
27     'click', closeBackgroundWindow);
28 });