Skip to content

Instantly share code, notes, and snippets.

@sergi
Created November 20, 2014 17:50
Show Gist options
  • Save sergi/e299a6c9918c0ba35f63 to your computer and use it in GitHub Desktop.
Save sergi/e299a6c9918c0ba35f63 to your computer and use it in GitHub Desktop.
navigator.getDataStores('sergi2').then(function(stores) {
console.log(stores.length)
var store = stores[0];
return store.add({ "blah": false }).then(function(id) {
document.body.innerHTML = 'Inserted value in sergi2: ' + id;
});
}, function(e) {
document.body.innerHTML = 'Error inserting value in sergi2: ' + e;
console.log(e);
});
navigator.getDataStores('sergi3').then(function(stores) {
var store = stores[0];
return store.add({ "blah": true }).then(function(id) {
document.body.innerHTML = 'Inserted value in sergi2: ' + id;
});
}, function(e) {
document.body.innerHTML = 'Error inserting value in sergi2: ' + e;
console.log(e);
});
{
"version": "0.1.0",
"name": "bl",
"description": "A template with the bare minimum structure",
"launch_path": "/index.html",
"icons": {
"16": "/img/icons/icon16x16.png",
"48": "/img/icons/icon48x48.png",
"60": "/img/icons/icon60x60.png",
"128": "/img/icons/icon128x128.png"
},
"developer": {
"name": "Your name",
"url": "http://example.com"
},
"type": "certified",
"permissions": {},
"installs_allowed_from": [
"*"
],
"default_locale": "en",
"datastores-owned": {
"sergi1": {
"access": "readwrite",
"description": "my data store"
},
"sergi2": {
"access": "readwrite",
"description": "my data store2"
},
"sergi3": {
"access": "readwrite",
"description": "my data store2"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment