Created
April 21, 2014 22:24
-
-
Save laser/11158659 to your computer and use it in GitHub Desktop.
jquery RPC client
This file contains hidden or 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
// Barrister Client Initialization | |
function initApp(callback) { | |
var client = Barrister.httpClient({ | |
'endpoint': '/todos', | |
'interfaces': ['TodoManager'] | |
}); | |
client.loadContract(function() { | |
var proxy = client.proxy('TodoManager'); | |
callback(null, proxy); | |
}); | |
} | |
// API Client Usage (Barrister) | |
initApp(function(err, TodoManager) { | |
TodoManager.readTodos(function(err, todos) { | |
$('#todos').text(JSON.stringify(todos)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment