Home  >  jQuery

Example of callbacks.locked() in jQuery

March 30, 2013
locked() in jQuery checks if callback list is locked or not to fire callback methods. It is called on callback list as
callbacks.locked()
 
Sample example is given below.

<html>
<body>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
var show = function( val ) {
	console.log(val);
};

var callbacks = $.Callbacks();

callbacks.add( show );

console.log(callbacks.locked());

callbacks.fire("Hellow");

callbacks.lock();

console.log(callbacks.locked());

callbacks.fire("World!");
</script>
</body>
</html>
 
 


Output
In console output will look like
false
Hellow
true
 
FIND MORE TUTORILAS






©2019 concretepage.com | Privacy Policy | Contact Us