jquery 手册
Ajax
属性(Attributes)
回调对象(Callbacks ..
核心(Core)
CSS
数据(Data)
延迟对象(Deferred o ..
尺寸(Dimensions)
效果(Effects)
事件(Events)
表单(Forms)
文档操作(Manipulati ..
杂项(Miscellaneou ..
位置(Offset)
插件编写(Plugin Aut ..
属性(Properties)
选择器(Selectors)
遍历(Traversing)
工具(Utilities)

Returns: BooleanBoolean .callbacks.locked( )

描述: 确定回调列表是否已被锁定。
  • version added: 1.7
  • .callbacks.locked( )

Example

callbacks.locked() 确定回调列表的锁定状态。

Example

callbacks.locked() 确定回调列表是否已被锁定:


<!DOCTYPE html>
<html>
<head>
  <script src="../jquery.min.js"></script>
  <body>
  <script>

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

var callbacks = $.Callbacks();

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

// fire the items on the list, passing an argument
callbacks.fire( 'hello' );
// outputs 'foo: hello'

// lock the callbacks list
callbacks.lock();

// test the lock-state of the list
document.write( callbacks.locked() ); //true

</script>
</body>
</html>

Demo:

Examples: