Testing a cordova plugin in browser

  • Is it possible to test Cordova plugins used in a Quasar app in the browser?

    I am using the plugin cordova-plugin-camera the functionality is working when I run in the IOS simulator, but it is hard to debug this way and is a very slow
    development process.

    I have read that you should be able to use the Cordova platform browser to test, but when trying this method i receive the error:

    Uncaught TypeError: Cannot read property 'getPicture' of undefined

    The code in my function is:

    navigator.camera.getPicture(this.cameraSuccess, this.cameraError, {
     destinationType: Camera.DestinationType.DATA_URL,
     sourceType: Camera.PictureSourceType.PHOTOLIBRARY 

    It appears that navigator.camera is not defined, is there any way to resolve this?

    Additionally when using quasar dev to work I get the following warnings/error:

    http://eslint.org/docs/rules/no-undef 'Camera' is not defined

    Is there anyway to resolve this warning?

  • I don’t know about the first issue, but to work around the ESLint issue, you can add Camera to the globals section in your .eslintrc.js

Log in to reply