removed batter code from js

This commit is contained in:
Steven Gill 2013-05-20 17:40:11 -07:00
parent dfd668d145
commit 7c22bc74bc

View File

@ -1,5 +1,5 @@
// Platform: android
// 2.7.0rc1-80-geda98d1
// 2.7.0rc1-81-gc09114e
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@ -19,7 +19,7 @@
under the License.
*/
;(function() {
var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-80-geda98d1';
var CORDOVA_JS_BUILD_LABEL = '2.7.0rc1-81-gc09114e';
// file: lib/scripts/require.js
var require,
@ -4112,100 +4112,6 @@ var modulemapper = require('cordova/modulemapper');
modulemapper.clobbers('cordova/plugin/android/storage/openDatabase', 'openDatabase');
});
// file: lib/common/plugin/battery.js
define("cordova/plugin/battery", function(require, exports, module) {
/**
* This class contains information about the current battery status.
* @constructor
*/
var cordova = require('cordova'),
exec = require('cordova/exec');
function handlers() {
return battery.channels.batterystatus.numHandlers +
battery.channels.batterylow.numHandlers +
battery.channels.batterycritical.numHandlers;
}
var Battery = function() {
this._level = null;
this._isPlugged = null;
// Create new event handlers on the window (returns a channel instance)
this.channels = {
batterystatus:cordova.addWindowEventHandler("batterystatus"),
batterylow:cordova.addWindowEventHandler("batterylow"),
batterycritical:cordova.addWindowEventHandler("batterycritical")
};
for (var key in this.channels) {
this.channels[key].onHasSubscribersChange = Battery.onHasSubscribersChange;
}
};
/**
* Event handlers for when callbacks get registered for the battery.
* Keep track of how many handlers we have so we can start and stop the native battery listener
* appropriately (and hopefully save on battery life!).
*/
Battery.onHasSubscribersChange = function() {
// If we just registered the first handler, make sure native listener is started.
if (this.numHandlers === 1 && handlers() === 1) {
exec(battery._status, battery._error, "Battery", "start", []);
} else if (handlers() === 0) {
exec(null, null, "Battery", "stop", []);
}
};
/**
* Callback for battery status
*
* @param {Object} info keys: level, isPlugged
*/
Battery.prototype._status = function(info) {
if (info) {
var me = battery;
var level = info.level;
if (me._level !== level || me._isPlugged !== info.isPlugged) {
// Fire batterystatus event
cordova.fireWindowEvent("batterystatus", info);
// Fire low battery event
if (level === 20 || level === 5) {
if (level === 20) {
cordova.fireWindowEvent("batterylow", info);
}
else {
cordova.fireWindowEvent("batterycritical", info);
}
}
}
me._level = level;
me._isPlugged = info.isPlugged;
}
};
/**
* Error callback for battery start
*/
Battery.prototype._error = function(e) {
console.log("Error initializing Battery: " + e);
};
var battery = new Battery();
module.exports = battery;
});
// file: lib/common/plugin/battery/symbols.js
define("cordova/plugin/battery/symbols", function(require, exports, module) {
var modulemapper = require('cordova/modulemapper');
modulemapper.defaults('cordova/plugin/battery', 'navigator.battery');
});
// file: lib/common/plugin/camera/symbols.js