Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[框架工程项目] 45.模块化怎么做? #868

Open
qiilee opened this issue Nov 28, 2019 · 0 comments
Open

[框架工程项目] 45.模块化怎么做? #868

qiilee opened this issue Nov 28, 2019 · 0 comments

Comments

@qiilee
Copy link
Member

qiilee commented Nov 28, 2019

答案:

立即执行函数,不暴露私有成员

var module1 = (function() {
  var _count = 0;
  var m1 = function() {
    //...
  };
  var m2 = function() {
    //...
  };
  return {
    m1: m1,
    m2: m2
  };
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant