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

文件格式(UMD、注释头) #6

Open
unclay opened this issue Apr 2, 2019 · 0 comments
Open

文件格式(UMD、注释头) #6

unclay opened this issue Apr 2, 2019 · 0 comments

Comments

@unclay
Copy link
Owner

unclay commented Apr 2, 2019

注释头

/*
* @Description: test
* @Author: Clay
* @Date: 2019-04-01
* @LastEditors: Clay
* @LastEditTime: 2019-04-01 17:56
*/

UMD模板

(function (root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD
    define(['jquery'], factory);
  } else if (typeof exports === 'object') {
    // Node, CommonJS之类的
    module.exports = factory(require('jquery'));
  } else {
    // 浏览器全局变量(root 即 window)
    root.returnExports = factory(root.jQuery);
  }
}(this, function ($) {
  // 方法
  function myFunc(){};

  // 暴露公共方法
  return myFunc;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant