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).
精彩评论