Last active
February 9, 2016 22:58
-
-
Save kwhinnery/337910ac32b6f1f24cde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = twilio.sync('jwt token here'); | |
// Example Document interaction | |
var doc = client.Document('uniqueName'); | |
doc.set({ | |
foo: 'bar' | |
}); | |
doc.on('update', function(e) { | |
console.log('doc was updated'); | |
}); | |
// Example Map interaction | |
var map = client.Map('uniqueMapName'); | |
map.set('foo', { bar: true }); | |
console.log(map.get('foo').bar); | |
map.on('itemAdded', function(key, value) { | |
console.log('We now have ' + key + ' set to: ' + value); | |
}); | |
map.on('itemUpdated', function(key, newValue, oldValue) { | |
console.log('Now ' + key + ' is set to: ' + newValue); | |
console.log('It used to be: ' + oldValue); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment