« Back
Sammy.RenderContext wait ( )
Pause the RenderContext queue. Combined with next() allows for async
operations.
Example
this.get('#/', function() {
this.load('mytext.json')
.then(function(content) {
var context = this,
data = JSON.parse(content);
// pause execution
context.wait();
// post to a url
$.post(data.url, {}, function(response) {
context.next(JSON.parse(response));
});
})
.then(function(data) {
// data is json from the previous post
$('#message').text(data.status);
});
});
comments powered by Disqus