Skip to content

Instantly share code, notes, and snippets.

View lse123's full-sized avatar

Leonidas Savvides lse123

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Short example on using indexedDB with jquery mobile - last updated: May 2012">
<meta name="author" content="Ido Green">
<title>IndexedDB with JQM</title>
function backupAllTheContacts() {
navigator.contacts.find(["*"], function(contacts) {
console.log("contacts.length = " + contacts.length);
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
fileSystem.root.getFile("contacts.bak", {create: true, exclusive: false}, function(fileEntry) {
fileEntry.createWriter(function(writer) {
writer.onwriteend = function() {
console.log("backup complete");
};
writer.write(JSON.stringify(contacts));