I'm new to Backbone, and i'm helping to maintain an app that has lots of Backbone and RequireJS code that does something like so:
define(
['backbone', 'underscore'],
function(Backbone, _) {
// some code here
}
);
I'd like to configure Underscore in each of these pages... In the most simple sense, I could just do something like so:
define(
['backbone', 'underscore'],
function(Backbone, _) {
// do some stuff to configure underscore
configureUnderscore(_);
}
);
but I'd like to leave each page's define
function alone, and just inject a callback that's called before the define
callback is called.
How can this be done with Backbone or RequireJS?