开发者

What might $.event.handle.apply mean in jQuery code?

What might $.e开发者_如何转开发vent.handle.apply mean in jQuery code?


jQuery.event.handle() is an internal jQuery method, used by the library to create and filter things like event namespaces. I wouldn't know why someone would ever call it manually, but what do I know ?

.apply() is a way in ECMA-/Javascript to invoke a function in a specific Context. It takes two arguments:

  • an object which serves as the Context
  • an array which represent the optional arguments

Example:

$.event.handle.apply(this, [event]);

This would execute the handle function in the Context of this (of course, that can vary) and passes in a single argument event (variable).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜