Jquery callbacks
-
Upload
learningtech -
Category
Technology
-
view
463 -
download
0
Transcript of Jquery callbacks
![Page 1: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/1.jpg)
jQuery Callbacks Object
Nat
2014/03/28
![Page 2: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/2.jpg)
jQuery.Callbacks()
![Page 3: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/3.jpg)
example
![Page 4: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/4.jpg)
methods
callbacks.add()
Add a callback or a collection of callbacks to a callback list.
callbacks.disable()
Disable a callback list from doing anything more.
callbacks.disabled()
Determine if the callbacks list has been disabled.
callbacks.empty()
Remove all of the callbacks from a list.
![Page 5: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/5.jpg)
methods
callbacks.fire()
Call all of the callbacks with the given arguments
callbacks.fired()
Determine if the callbacks have already been called at least once.
callbacks.fireWith()
Call all callbacks in a list with the given context and arguments.
![Page 6: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/6.jpg)
methods
callbacks.has()
Determine whether a supplied callback is in a list
callbacks.lock()
Lock a callback list in its current state.
callbacks.locked()
Determine if the callbacks list has been locked.
callbacks.remove()
Remove a callback or a collection of callbacks from a callback list.
![Page 7: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/7.jpg)
Supported Flags
Possible flags:
once: Ensures the callback list can only be fired once (like a Deferred).
memory: Keeps track of previous values and will call any callback added after the list has been fired right away with the latest "memorized" values (like a Deferred).
unique: Ensures a callback can only be added once (so there are no duplicates in the list).
stopOnFalse: Interrupts callings when a callback returns false.
![Page 8: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/8.jpg)
once flag
![Page 9: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/9.jpg)
Memory flag
![Page 10: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/10.jpg)
unique flag
![Page 11: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/11.jpg)
stopOnFalse flag
![Page 12: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/12.jpg)
unique memory flags
![Page 13: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/13.jpg)
example
![Page 14: Jquery callbacks](https://reader036.fdocuments.in/reader036/viewer/2022082920/5555d3b3d8b42aaf158b4e43/html5/thumbnails/14.jpg)
references
https://api.jquery.com/jQuery.Callbacks/
http://stackoverflow.com/questions/8070894/when-would-i-use-jquery-callbacks