欢迎光临
我们一直在努力

js如何使用callbacks.fireWith

小编给大家分享一下js如何使用callbacks.fireWith,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

  callbacks.fireWith( [context ] [, args ] )

  描述: 访问给定的上下文和参数列表中的所有回调。

  添加的版本: 1.7callbacks.fireWith( [context ] [, args ] )

  context

  Type:

  该列表中的回调被触发的上下文引用

  args

  Type:

  一个参数或参数列表传回给回调列表。

  此方法返回绑定它的那个回调对象(this).

  Example

  使用 callbacks.fireWith() 访问给定的上下文和参数列表中的所有回调:

  // a sample logging function to be added to a callbacks list

  var log = function( value1, value2 ) {

  console.log( "Received: " + value1 + "," + value2 );

  };

  var callbacks = $.Callbacks();

  // add the log method to the callbacks list

  callbacks.add( log );

  // fire the callbacks on the list using the context "window"

  // and an arguments array

  callbacks.fireWith( window, ["foo","bar"]);

  // outputs: "Received: foo, bar"

以上是“js如何使用callbacks.fireWith”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注云搜网行业资讯频道!

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。