1 // Copyright 2014 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.
6 'content/public/renderer/service_provider',
7 'extensions/common/mojo/keep_alive.mojom',
9 ], function(serviceProvider, mojom, core) {
12 * An object that keeps the background page alive until closed.
14 * @alias module:keep_alive~KeepAlive
16 function KeepAlive() {
18 * The handle to the keep-alive object in the browser.
22 this.handle_ = serviceProvider.connectToService(mojom.KeepAlive.name);
26 * Removes this keep-alive.
28 KeepAlive.prototype.close = function() {
29 core.close(this.handle_);
36 * Creates a keep-alive.
37 * @return {!module:keep_alive~KeepAlive} A new keep-alive.
39 createKeepAlive: function() { return new KeepAlive(); }