understanding what gets returned when a plugin thats attached to $(jQuery) is executed .
Hey guys suppose i have the following plugin:
- ;(function($) {
- $.me = function() {
-
- console.log('i am a plugin that does nothing !')
-
- if(this.init) {
- // if "if" gets executed , all methods exposed with only $.timer are exposed and available
- return new $.me();
- } else {
- // so if "else" gets executed all methods exposed through jQuery $. are available ? correct ?
- return this;
- }
- };
- })(jQuery);
I have commented my difficulty but , i'lll repeat them here , now suppose i call the above plugin like so:
- var t = $.me('just a parameter');
and the if condition in the plugin is executed, that means:
if "if" gets executed , all methods exposed only with $.me are exposed and available
and now suppose the else condition gets executed, that means:
// so if "else" gets executed all methods exposed through jQuery $. are available ? correct ?
Am i correct in both my assumptions as to what gets returned ?
Thank you.
Gautam.