Sammy.RenderContext then ( callback )
The "core" of the RenderContext object, adds the callback to the
queue. If the context is waiting (meaning an async operation is happening)
then the callback will be executed in order, once the other operations are
complete. If there is no currently executing operation, the callback
is executed immediately.
The value returned from the callback is stored in content for the
subsiquent operation. If you return false, the queue will pause, and
the next callback in the queue will not be executed until next() is
called. This allows for the guarunteed order of execution while working
with async operations.
If then() is passed a string instead of a function, the string is looked up as a helper method on the event context.
Example
this.get('#/', function() {
// initialize the RenderContext
// Even though `load()` executes async, the next `then()`
// wont execute until the load finishes
this.load('myfile.txt')
.then(function(content) {
// the first argument to then is the content of the
// prev operation
$('#main').html(content);
});
});