$.Events = function(options, callback)

This defines a function called $.Events that takes 2 parameters. When
you see a parameter named options, you can usually assume that it
represents a hash. When you see a param named callback, it means that
the function expects either the name of some function or an anonymous
function block.

$.Events({ duration: duration }, function(){ ...});

This is an example of the function being called. The 2 parameters
passed are a hash ( { duration: duration } ) and an anonymous
function.

So, if you wish to pass more/different options, include them in the
hash that's passed here, eg:

$.Events({ duration: duration, foo: bar }, function(){ ...});

On Sat, Oct 31, 2009 at 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-----tp26146827s27240p26146827.html
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.
>
>

Reply via email to