« Back
Sammy.Application helpers ( extensions )
Helpers extends the EventContext prototype specific to this app. This allows you to define app specific helper functions that can be used whenever you're inside of an event context (templates, routes, bind).
Example
var app = $.sammy(function() {
helpers({
upcase: function(text) {
return text.toString().toUpperCase();
}
});
get('#/', function() { with(this) {
// inside of this context I can use the helpers
$('#main').html(upcase($('#main').text());
}});
});
Arguments
extensionsAn object collection of functions to extend the context.
comments powered by Disqus