Callback

Multiple lines of statements are queued rather than being executed simultaneously. A callback function queues the statements and executes them one by one.

Its syntax is as follows:

var callbacks = $.Callbacks();

The object created can be used to add, remove, instantiate, and disable callbacks. The supported functions are callbacks.add(), callbacks.remove(), callbacks.fire(), and callbacks.disable().

callbacks.add()

This function is used to add all the functions in an array that are to be called later.

Parameters

This takes flags as strings as its parameters.

Returns

This method returns the callback's object to which it is associated with, (this).

Description

The callbacks.add() function adds the function to the callback array.

Here is an example ...

Get Web Developer's Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.