Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Last active February 18, 2016 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwhinnery/2234a269add3cc707646 to your computer and use it in GitHub Desktop.
Save kwhinnery/2234a269add3cc707646 to your computer and use it in GitHub Desktop.
var map = client.sync.map('uniqueName');
map.set('foo', { bar: 42 }).then(function() {
console.log('set it!');
}).catch(function(err) {
console.log('dang it, dont have access');
});
// same as above...
map.set('foo', { bar: 42 }, function(err) {
if (err) return console.log('dang it, dont have access');
console.log('set it!');
});
map.on('value', function(value) {
console.log('value updated');
});
map.on('error', function(err) {
if (err.code == 403) {
console.log('sync failed because you dont have access');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment