跟随函数(jQuery,window,document)有什么作用;意思? [英] What does following a function with (jQuery, window, document); mean?

查看:82
本文介绍了跟随函数(jQuery,window,document)有什么作用;意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下插件:

;(function($, window, document)
{
...
...

})(jQuery, window, document);

我能理解的是什么;是为了并且也意识到$是jQuery但有人可以解释为什么函数后跟(jQuery,window,document);

I can understand what the ; is for and also realize that $ is the jQuery but can someone explain why is the function followed by (jQuery, window, document);

推荐答案

它被称为'自我ivoking'或'立即调用'功能。这意味着该函数在使用最后一组括号中的参数创建后立即运行。

It's called a 'self ivoking' or 'immediately invoked' function. It means that the function is run as soon as it is created using the parameters in the final set of brackets.

更多信息

这篇关于跟随函数(jQuery,window,document)有什么作用;意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆