In my opinion the best option is to use phonegap serve
. Ripple is ok but it lacks of native features management.
Some plugins have an implementation for browser, so full api will be available. The ones that doesn't have it, phonegap cli will manage it.
In order to use it, you must first install browser platform:
$ cordova platform add browser
$ phonegap serve
I've been trying to use cordova serve
but it doesn't work as phonegap
does in my case.
Once phonegap serve
is launched, you can debug your app in browser.
UPDATE
From https://github.com/apache/cordova-plugin-contacts/pull/122/files you could implement your own callback responses. This is a very straight forward implementation that you can extend as you need (see create, find, pickContact and contact for implementation details):
var contacts = [];
var mockContacts = require('./mockContacts'); // This is a json mock file with your contacts
function Contact(contact) {
var field;
for (field in contact) {
if (contact.hasOwnProperty(field)) {
this[field] = contact[field];
}
}
}
Contact.prototype.clone = function () {
// You can implement this methods if needed as well
}
Contact.prototype.remove = function () {
// You can implement this methods if needed as well
}
Contact.prototype.save = function () {
// You can implement this methods if needed as well
}
mockContacts.map(function (contact) {
contacts.push(new Contact(contact));
};
function createContact(contact) {
var newContact = new Contact(contact);
contacts.push(newContact);
return newContact;
}
function findContact(contactFields, contactSuccess, contactError, contactFindOptions) {
contactSuccess = contactSuccess || function () {};
contactSuccess(contacts); // You can filter the contacts if needed
return true;
}
function pickContact(contactSuccess, contactError) {
contactSuccess = contactSuccess || function () {};
contactSuccess(contacts[0]);
return true;
}
module.exports = {
create: createContact,
find: findContact,
pickContact: pickContact
};