Layout Options

  • Fixed Header
    Makes the header top fixed, always visible!
  • Fixed Sidebar
    Makes the sidebar left fixed, always visible!
Introduction
Webconcept

Description

The callbacks.firedWith() method calls all callbacks in a list with the given context and arguments.


v1.7

This method has the form:

callbacks.firedWith([context] [, args])
Parameter Description
context (optional) Specifies a reference to the context in which the callbacks in the list should be fired
args (optional) Specifies an argument, or array of arguments, to pass to the callbacks in the list

Return Value

This form return is undefined.

Examples

Use the callbacks.firedWith() method to fire a list of callbacks with a specific context and an array of arguments:

// a sample logging function to be added to a callbacks list
var log = function(value1, value2){
  console.log('Received:' + value1 + ',' + value2 );
}

var callbacks = $.Callbacks();

// add the log method to the callbacks list

callbacks.add(log);

// fire the callbacks on the list using the context 'window'
// and an arguments array
callbacks.fireWith(window, ['foo','bar']);

// output is: Received: foo, bar

Description

The callbacks.fired() method determines if the callbacks have already been called at least once.


v1.7

This method has the form:

callbacks.fired()

Return Value

This form returns a Boolean.

Examples

Use the callbacks.fired() method to determine if the callbacks in a list have been called at least once:

// a sample logging function to be added to a callbacks list
var foo = function(value){
  console.log('foo:' + value);
}

var callbacks = $.Callbacks();

// add the function 'foo' to the list
callbacks.add(foo);

// fire the items on the list
callbacks.fire('hello');

// output is: 'foo: hello'

callbacks.fire('world');

// output is: 'foo: world'

// test to check if the callbacks have been called
console.log(callbacks.fired());