Re: [jQuery] Plugin Authoring : How to keep plugin state?

2007-02-18 Thread Blair Mitchelmore
If you only want the last time the function was called: jQuery.debug; // Stores last called date for jQuery.fn.debug jQuery.fn.debug = function() { jQuery.debug = new Date(); return this.each(function() { alert(this); }); }; Other things like recording all previous calls and

Re: [jQuery] Plugin Authoring: Custom Alias

2006-12-26 Thread Aaron Heimlich
I made a few minor spelling and grammar changes, but otherwise it's good. -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com On 12/26/06, Jörn Zaefferer [EMAIL PROTECTED] wrote: Hi folks, just added the Custom Alias section to the plugin authoring guide. If you

Re: [jQuery] Plugin Authoring: Custom Alias

2006-12-26 Thread Mike Alsup
just added the Custom Alias section to the plugin authoring guide. If you don't know about this yet, check it out. Anyway, please correct or improve it! Nice job, Jörn. That's a handy page. ___ jQuery mailing list discuss@jquery.com

Re: [jQuery] Plugin Authoring

2006-10-15 Thread John Resig
Authoring guidelines say Always use jQuery instead of $ inside your plugin code - that allows users to change the alias for jQuery in a single place. Does this mean only the first line jQuery.fn... or should also extend be jQuery.extend()? That means everywhere inside. So if you did

Re: [jQuery] Plugin Authoring

2006-10-15 Thread John Resig
jQuery.fn.pluginMethod = function(options) { var settings = $.extend({ stuff: [5, 3, 6, 1], name: pete, speed: 5 }, options || {}); // other plugin code }; So far this is the shortest way to write that particular snippet, and I'd like to see it in your plugins :-) And

Re: [jQuery] Plugin Authoring

2006-10-15 Thread Klaus Hartl
John Resig schrieb: jQuery.fn.pluginMethod = function(options) { var settings = $.extend({ stuff: [5, 3, 6, 1], name: pete, speed: 5 }, options || {}); // other plugin code }; So far this is the shortest way to write that particular snippet, and I'd like to see it in

Re: [jQuery] Plugin Authoring

2006-10-15 Thread John Resig
This is cool, but as plugin developer I cannot assume the latest jQuery SVN version, right? Right - once this feature comes out (say, 1.0.3) then it would be more acceptable to require it. I guess you could always just be on the safe side and do || {}, at least until the release of 1.1 (to

Re: [jQuery] Plugin Authoring

2006-10-15 Thread Jörn Zaefferer
Hi John! And this is even shorter, plus there's one less variable being defined: jQuery.fn.pluginMethod = function(settings) { settings = jQuery.extend({ // stuff }, settings); }; As noted previously - make sure that you use jQuery.extend() instead of $.extend().

Re: [jQuery] Plugin Authoring

2006-10-15 Thread Jörn Zaefferer
Dave Methvin schrieb: Still, if you're writing a plugin only for your personal (well, non-public) use and you're not using prototype.js, then you can freely use $() in plugins because there will be no conflict. I like the idea of using $ for prototyping. When you go back and refactor and

Re: [jQuery] Plugin Authoring

2006-10-15 Thread Michael Geary
Authoring guidelines say Always use jQuery instead of $ inside your plugin code - that allows users to change the alias for jQuery in a single place. Does this mean only the first line jQuery.fn... or should also extend be jQuery.extend()? That means everywhere inside. So if you did