1.callbacks.add(callbacks)//回调列表中添加一个回调或回调的集合

// a sample logging function to be added to a callbacks list
var foo = function( value ){
console.log( 'foo:' + value );
} // another function to also be added to the list
var bar = function( value ){
console.log( 'bar:' + value );
} var callbacks = $.Callbacks(); // add the function 'foo' to the list
callbacks.add( foo ); // fire the items on the list
callbacks.fire( 'hello' );
// outputs: 'foo: hello' // add the function 'bar' to the list
callbacks.add( bar ); // fire the items on the list again
callbacks.fire( 'world' ); // outputs:
// 'foo: world'
// 'bar: world'

2.callbacks.disable()//禁用回调列表中的回调

// a sample logging function to be added to a callbacks list
var foo = function( value ){
console.log( value );
} var callbacks = $.Callbacks(); // add the above function to the list
callbacks.add( foo ); // fire the items on the list
callbacks.fire( 'foo' ); // outputs: foo // disable further calls being possible
callbacks.disable(); // attempt to fire with 'foobar' as an argument
callbacks.fire( 'foobar' ); // foobar isn't output

3.callbacks.empty()//从列表中删除所有的回调.

// a sample logging function to be added to a callbacks list
var foo = function( value1, value2 ){
console.log( 'foo:' + value1 + ',' + value2 );
} // another function to also be added to the list
var bar = function( value1, value2 ){
console.log( 'bar:' + value1 + ',' + value2 );
} var callbacks = $.Callbacks(); // add the two functions
callbacks.add( foo );
callbacks.add( bar ); // empty the callbacks list
callbacks.empty(); // check to ensure all callbacks have been removed
console.log( callbacks.has( foo ) ); // false
console.log( callbacks.has( bar ) ); // false

4.callbacks.fire(arguments)//禁用回调列表中的回调

// 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' ); // outputs: 'foo: hello'
callbacks.fire( 'world '); // outputs: 'foo: world' // add another function to the list
var bar = function( value ){
console.log( 'bar:' + value );
} // add this function to the list
callbacks.add( bar ); // fire the items on the list again
callbacks.fire( 'hello again' );
// outputs:
// 'foo: hello again'
// 'bar: hello again'

5.callbacks.fired()//用给定的参数调用所有的回调。

// 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' ); // outputs: 'foo: hello'
callbacks.fire( 'world '); // outputs: 'foo: world' // test to establish if the callbacks have been called
console.log( callbacks.fired() );

6.callbacks.fireWith([context][,args])//访问给定的上下文和参数列表中的所有回调

7.callbacks.has(callback)//确定是否提供的回调列表

8.callbacks.lock()//锁定在其当前状态的回调列表。

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

10.callbacks.remove(callbacks)//删除回调或回调回调列表的集合。

11.jQuery.callbacks(flags)//一个多用途的回调列表对象,提供了强大的的方式来管理回调函数列表。

jQuery慢慢啃之回调(十三)的更多相关文章

  1. jQuery慢慢啃之工具(十)

    1.jQuery.support//一组用于展示不同浏览器各自特性和bug的属性集合 2.jQuery.browser//浏览器内核标识.依据 navigator.userAgent 判断. 可用值: ...

  2. jQuery慢慢啃之ajax(九)

    1.jQuery.ajax(url,[settings])//通过 HTTP 请求加载远程数据 如果要处理$.ajax()得到的数据,则需要使用回调函数.beforeSend.error.dataFi ...

  3. jQuery慢慢啃之特效(八)

    1.show([speed,[easing],[fn]])\\显示隐藏的匹配元素 //speed:三种预定速度之一的字符串("slow","normal", o ...

  4. jQuery慢慢啃之事件对象(十一)

    1.event.currentTarget//在事件冒泡阶段中的当前DOM元素 $("p").click(function(event) { alert( event.curren ...

  5. jQuery慢慢啃之事件(七)

    1.ready(fn)//当DOM载入就绪可以查询及操纵时绑定一个要执行的函数. $(document).ready(function(){ // 在这里写你的代码...}); 使用 $(docume ...

  6. jQuery慢慢啃之CSS(六)

    1.css(name|pro|[,val|fn])//访问匹配元素的样式属性 $("p").css("color");//获取 $("p") ...

  7. jQuery慢慢啃之文档处理(五)

    1.append(content|fn)//向每个匹配的元素内部追加内容. $("p").append("<b>Hello</b>"); ...

  8. jQuery慢慢啃筛选(四)

    1.eq(index|-index) 获取第N个元素 其中负数:一个整数,指示元素的位置,从集合中的最后一个元素开始倒数.(1算起) $("p").eq(1)//获取匹配的第二个元 ...

  9. jQuery慢慢啃之核心(一)

    1. $("div > p"); div 元素的所有p子元素. $(document.body).css( "background", "bla ...

随机推荐

  1. EF-查看生成的SQL语句

    老版本中:EF 4和EF 3.5 SP1 using (var context = new TestDBEntities()) { var query = from p in context.Pare ...

  2. QT5.1在Windows下 出现QApplication: No such file or directory 问题的解决办法

    QT5.0.1在Windows下 出现QApplication: No such file or directory 问题的解决办法 分类: 编程语言学习 软件使用 QT编程学习2013-03-07 ...

  3. codeforces Codeforces 650A Watchmen

    题意:两点(x1,y1), (x2,y2)的曼哈顿距离=欧几里得距离 也就是:x1=x2或y1=y2,再删除重合点造成的重复计数即可. #include <stdio.h> #includ ...

  4. C语言volatile关键字

    volatile提醒编译器它后面所定义的变量随时都有可能改变,因此编译后的程序每次需要存储或读取这个变量的时候,都会直接从变量地址中读取数据.如果没有volatile关键字,则编译器可能优化读取和存储 ...

  5. 超强vim配置文件

    简易安装方法: https://github.com/ma6174/vim 打开终端,执行下面的命令就自动安装好了: wget -qO- https://raw.github.com/ma6174/v ...

  6. redhat开启linux server

    1.redhat linux5 enterprize 默认情况下是没有安装telnet server,可以使用rpm -q telnet查询,下图是安装后的查询结果

  7. Echarts双轴图的配置.

    在series中的数据组加个属性,yAxisIndex: 1,表示第二个数据用的是第二个y轴,不加这个属性的话都是默认0,即第一个属性,再配置yAxis的值第一个为左侧坐标轴,右册坐标轴为第二个配置参 ...

  8. JAVA基础英语单词表(中)

    factory                                 / 'fæktəri /                    工厂 fetch                     ...

  9. DES加密,Tk写的简单的GUI

    # -*- coding: UTF-8 -*- from Tkinter import * from tkMessageBox import * ip = [ 58,50,42,34,26,18,10 ...

  10. Cocos2d-x 3.1.1 学习日志4--cocos2d-x解决中文乱码问题的几种办法

    做个打飞机的游戏,由于版本号太新,网上基本没有教教程,我的版本号是cocos2d-x 3.1.1的.今天遇到cocos2dx中中文乱码的问题.无奈仅仅好Google百度寻求答案,明确了这个问题的缘由. ...