Javascript 什么是((窗口)=>;{…})(窗口);意思
项目中的I文件包含以下代码:Javascript 什么是((窗口)=>;{…})(窗口);意思,javascript,Javascript,项目中的I文件包含以下代码: //begin of the file ((window) => { 'use strict'; class View extends GSM.EventEmitter { constructor() { super(); //some function here } })(window); //end of the file 这个结构意味着什么 这一行是什么意思?((窗口)=>{}(窗口); constructor
//begin of the file
((window) => {
'use strict';
class View extends GSM.EventEmitter {
constructor() {
super();
//some function here
}
})(window);
//end of the file
- 这个结构意味着什么
- 这一行是什么意思?
((窗口)=>{}(窗口);
是什么意思constructor()
我的英语有点差,希望我把问题说清楚。:-es6箭头功能,了解更多细节 和阶级
这是写在ES6上的模块模式。它允许您将变量分组在同一范围内,并将它们与其他“模块”隔离 你可以找到更详细的答案
构造函数
函数允许您初始化类实例 我的回答有用吗?还是你需要更多信息???
(function(/* your deps */){
//your code
var privateVariable;
}(/* your dependencies */))