Say I got this singleton object with some public methods and one private method:
var QuestionFactory = (function() {
// private method
function google_it_first() { ... }
// public methods
return {
ask_a_stupid_question: function() { ... },
ask_a_relatively_non_stupid_question: function() { ... },
ask_a_difficult_question: function() { ... }
}
})();
What I'd like to be able to do is call google_it_first
method first, when any public method is called. How do I implement it without explicitly calling it inside each public method?