9
0
mirror of https://gitee.com/shuto/customCamera.git synced 2026-04-14 00:00:03 +08:00

Add the cameraIsStarted method at plugin

This commit is contained in:
Christophe BOUCAUT
2015-06-10 16:17:47 +02:00
parent 7d55f52cab
commit b47b6b2108
+20 -2
View File
@@ -4,6 +4,8 @@
// Get cordova plugin. // Get cordova plugin.
var exec = require("cordova/exec"); var exec = require("cordova/exec");
var cameraIsStarted = false;
// constructor. // constructor.
function CustomCameraExport() {} function CustomCameraExport() {}
@@ -41,13 +43,20 @@
} }
function successFctCallback(data) { function successFctCallback(data) {
successFct(data); cameraIsStarted = false;
if (successFct instanceof Function) {
successFct(data);
}
} }
function failFctCallback(data) { function failFctCallback(data) {
failFct(data.code, data.message); cameraIsStarted = false;
if (failFct instanceof Function) {
failFct(data.code, data.message);
}
} }
cameraIsStarted = true;
exec( exec(
successFctCallback, successFctCallback,
failFctCallback, failFctCallback,
@@ -70,5 +79,14 @@
); );
}; };
/**
* Check if the camera is started or not.
*
* @return {boolean} True: It's started, else false.
*/
CustomCameraExport.prototype.cameraIsStarted = function() {
return cameraIsStarted;
};
module.exports = new CustomCameraExport(); module.exports = new CustomCameraExport();
})(require, module); })(require, module);