I have the below code:
filtersManager = (function ($) {
var that = this;
function configure() {
// some work
return that;
};
function process() {
// some work
return that;
}
return {
// public functions
configure: configure,
process: process
};
}(jQuery));
but when it's called using the below it fails:
filtersManager.configure().process();
Error: Object doesn't support property or method 'process'
whereas the below works:
filtersManager.configure();
filtersManager.process();
this
depends on how you call a function.this
inside each function is already the object. – Frankfrankalmoign}(jQuery));
is this correct closing isn't it should be})(jQuery);
this way. – Gusgusba}(jQuery))
in fact makes more sense, as the function is being called and wrapped in parenthesis to force an expression. – Frankfrankalmoign