Skip to content

Instantly share code, notes, and snippets.

@MariuszWisniewski
Created October 1, 2014 15:52
Show Gist options
  • Save MariuszWisniewski/4a0c7d50c03b380c0b42 to your computer and use it in GitHub Desktop.
Save MariuszWisniewski/4a0c7d50c03b380c0b42 to your computer and use it in GitHub Desktop.
Getting started
1)
var syncano = SyncanoConnector.getInstance();
syncano.connect( {instance: 'YOUR-INSTANCE-NAME', api_key: 'YOUR-API-KEY'}, function(auth) {
console.log("Connected")
});
2)
syncano.Data.new( PROJECT-ID, 'Default', {title: "My title"}, function() {
console.log("Saved!")
});
3)
syncano.Data.get( PROJECT-ID, 'Default', {order: 'DESC'}, function(list) {
if (list.length) {
console.log('Last object: ' + list[0].title);
} else {
console.log('No stored objects!');
}
});
4)
syncano.connect( {instance: 'YOUR-INSTANCE-NAME', api_key: 'YOUR-API-KEY'}, function(auth) {
syncano.Subscription.subscribeProject(PROJECT-ID, function(result) {
console.log("Subscribed");
})
});
syncano.on('syncano:newdata:project-PROJECT-ID', function(data) {
if (data) {
console.log('Data: ' + data);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment