Skip to content
Permalink
Browse files
CB-12227 (windows) Fixed Browserify error
  • Loading branch information
alsorokin committed Dec 12, 2016
1 parent 76d388a commit 1d8218621645e45c25898d04f5e87d41e90b3e6a
Showing 1 changed file with 52 additions and 52 deletions.
@@ -57,69 +57,69 @@ if (PowerManager) {
};

require("cordova/exec/proxy").add("Battery", BatteryWin10);
return;
}

} else {

var stopped;

var stopped;
var handleResponse = function(successCb, errorCb, jsonResponse) {
var info = JSON.parse(jsonResponse);

function handleResponse(successCb, errorCb, jsonResponse) {
var info = JSON.parse(jsonResponse);
if (info.hasOwnProperty("exceptionMessage")) {
errorCb(info.exceptionMessage);
return;
}

if (info.hasOwnProperty("exceptionMessage")) {
errorCb(info.exceptionMessage);
return;
}
successCb(info, { keepCallback: true });
};

successCb(info, { keepCallback: true });
}
var Battery = {
start: function (win, fail, args, env) {
function getBatteryStatus(success, error) {
handleResponse(success, error, BatteryStatus.BatteryStatus.start());
}

var Battery = {
start: function (win, fail, args, env) {
function getBatteryStatus(success, error) {
handleResponse(success, error, BatteryStatus.BatteryStatus.start());
}
function getBatteryStatusLevelChangeEvent(success, error) {
return BatteryStatus.BatteryStatus.getBatteryStatusChangeEvent().done(function (result) {
if (stopped) {
return;
}

function getBatteryStatusLevelChangeEvent(success, error) {
return BatteryStatus.BatteryStatus.getBatteryStatusChangeEvent().done(function (result) {
if (stopped) {
return;
}
handleResponse(success, error, result);

handleResponse(success, error, result);
setTimeout(function() { getBatteryStatusLevelChangeEvent(success, error); }, 0);
}, function(err) {
fail(err);
});
}

setTimeout(function() { getBatteryStatusLevelChangeEvent(success, error); }, 0);
}, function(err) {
fail(err);
});
}
// Battery API supported on Phone devices only so in case of
// desktop/tablet the only one choice is to fail with appropriate message.
if (!WinJS.Utilities.isPhone) {
fail("The operation is not supported on Windows Desktop devices.");
return;
}

// Battery API supported on Phone devices only so in case of
// desktop/tablet the only one choice is to fail with appropriate message.
if (!WinJS.Utilities.isPhone) {
fail("The operation is not supported on Windows Desktop devices.");
return;
}
stopped = false;
try {
getBatteryStatus(win, fail);
getBatteryStatusLevelChangeEvent(win, fail);
} catch(e) {
fail(e);
}
},

stopped = false;
try {
getBatteryStatus(win, fail);
getBatteryStatusLevelChangeEvent(win, fail);
} catch(e) {
fail(e);
}
},
stop: function () {
// Battery API supported on Phone devices only so in case of
// desktop/tablet device we don't need for any actions.
if (!WinJS.Utilities.isPhone) {
return;
}

stop: function () {
// Battery API supported on Phone devices only so in case of
// desktop/tablet device we don't need for any actions.
if (!WinJS.Utilities.isPhone) {
return;
stopped = true;
BatteryStatus.BatteryStatus.stop();
}
};

stopped = true;
BatteryStatus.BatteryStatus.stop();
}
};

require("cordova/exec/proxy").add("Battery", Battery);
require("cordova/exec/proxy").add("Battery", Battery);
}

0 comments on commit 1d82186

Please sign in to comment.