If I have some OO javascript that looks like so:
function someFunction(a, b, c) {
// do something with a, b, and c
}
function theLoader() {
loadFunction: someFunction,
load: function() {
// invoke the loadFunction with the proper parameter set
}
}
var myLoader = new theLoader();
myLoader.load();
Let's assume that 'theLoader' is expected to be abstract and generic. I could call it and set the 'loadFunction' to almost anything, so I don't know what the arguments are going to be at any given time. The 'load' method must invoke the 'loadFunction' and somehow be able to get an argument set to it....
How can I accomplish what I'm trying to do? If this is a bad way to go about it, we can totally refactor the code. I'd like to keep restrictions off of the 'loadFunction' so I don't have to code loader functions in a special way.
At the end of the day, I'd like to package theLoader into it's own .js file and not have to monkey with it.
So -- if you know the answer, help a brother out!!
Thanks, g