From e2a8ab038aa8770f110d1dcd102324e19cc507a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Thu, 19 Jan 2017 10:56:26 +0100 Subject: [PATCH] Add `setEnabled` function --- www/background-mode.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/www/background-mode.js b/www/background-mode.js index a51afbf..8dcc3f9 100644 --- a/www/background-mode.js +++ b/www/background-mode.js @@ -60,6 +60,21 @@ exports.disable = function () { cordova.exec(fn, null, 'BackgroundMode', 'disable', []); }; +/** + * Enable or disable the background mode. + * + * @param [ Bool ] enable The status to set for. + * + * @return [ Void ] + */ +exports.setEnabled = function (enable) { + if (enable) { + this.enable(); + } else { + this.disable(); + } +}; + /** * List of all available options with their default value. *