http://www.learningjquery.com/2007/10/a-plugin-development-pattern
heck, he even uses "options" for the name, and that probably is not
coincidence as many people follow Mike's suggested pattern
On Oct 31, 6:50 pm, numerical25 <numerica...@aol.com> wrote:
> I am looking through some previous made code and I notice a special varible
> called options. I suppose it special because my html editor gives it a
> purple color that stands out as if its a predefined varible. the code looks
> like something below
>
> $('#begin').click(function(){
> $('#log').val('')
> $('#display').val('')
> log('Started recording: ' + duration + 'ms')
>
> $.Events({ duration: duration }, function(){
> $('#display').val(this.exportJSON())
> log('Finished recording')
> })
> })
>
> // Then the plugin recieves it like this
>
> $.Events = function(options, callback) {
> if (callback) options.finished = callback
> return (new Eventer(options)).start()
> }
>
> // I understand that you can pass variables in a parameter through an array.
> is this options keyword a way to present the values in the the array ???
>
> If so then where did this finished varible come from. can you add more
> varibles to the keyword 'options' ???
> --
> View this message in context:http://old.nabble.com/what-does-options-mean-----tp26146827s27240p261...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
No comments:
Post a Comment