I am trying to invoke just a javascript function from my added cordova plugin :
below is my code :
Generated js file after adding pulgin :
cordova.define("cordova-plugin-custom-camera-preview.PreviewCamera", function(require, exports, module) { var previewCamera = {
createEvent: function(successCallback, errorCallback) {
}
}
var previewCamera = {
createEvent: function(successCallback, errorCallback) {
cordova.exec(successCallback,errorCallback, "CustomCameraPreview", "action_preview_camera_pulgin", "" );
}
}
});
This is how i m trying to invoke above function in html :
<script type="text/javascript" src="../plugins/cordova-plugin-custom-camera-preview/PreviewCamera.js"></script>
function customCamera( ) {
PreviewCamera.previewCamera.createEvent(function()
{
alert("S");
}, function()
{
alert("F");
});
}
Issue : 09-18 14:16:49.516 14182-14182/com.rule14.bancmate I/chromium﹕ [INFO:CONSOLE(318)] "Uncaught ReferenceError: plugin is not defined", source: file:///android_asset/www/pages/xxx.html (318)
EDIT : a part of cordova-plugin.js :
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/cordova-plugin-camera/www/CameraConstants.js",
"id": "cordova-plugin-camera.Camera",
"clobbers": [
"Camera"
]
},
{
"file": "plugins/cordova-plugin-camera/www/CameraPopoverOptions.js",
"id": "cordova-plugin-camera.CameraPopoverOptions",
"clobbers": [
"CameraPopoverOptions"
]
},
{
"file": "plugins/cordova-plugin-camera/www/Camera.js",
"id": "cordova-plugin-camera.camera",
"clobbers": [
"navigator.camera"
]
},
{
"file": "plugins/cordova-plugin-camera/www/CameraPopoverHandle.js",
"id": "cordova-plugin-camera.CameraPopoverHandle",
"clobbers": [
"CameraPopoverHandle"
]
},
{
"file": "plugins/cordova-plugin-whitelist/whitelist.js",
"id": "cordova-plugin-whitelist.whitelist",
"runs": true
},
{
"file": "plugins/cordova-plugin-custom-camera-preview/PreviewCamera.js",
"id": "cordova-plugin-custom-camera-preview.PreviewCamera",
"clobbers": [
"PreviewCamera"
]
}
];
module.exports.metadata =
// TOP OF METADATA
{
"cordova-plugin-camera": "1.2.0",
"cordova-plugin-whitelist": "1.0.0",
"cordova-plugin-custom-camera-preview": "1.0"
}
// BOTTOM OF METADATA
});