Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Last active Feb 18, 2016
Embed
What would you like to do?
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