关于jQuery、CommonJS、AMD和RequireJS

在使用某js插件时,发现用法当中有这样一句

var Excel = require('exceljs');

require的用法以前没用接触过,发现并不能直接使用,于是找到如下

CommonJS

最初的commonJS的创建者想要设计一种并不局限于浏览器使用JS的module format……

所以建立了CommonJS规范,也就是CommonAPI。
这样做是为了分开写js还能引入使用,如上面赋值给Excel

requireJS

How to get started with requireJS
http://requirejs.org/docs/start.html
How to use requireJS with jQuery
http://requirejs.org/docs/jquery.html
Why AMD?(注意,此AMD非彼AMD)
http://requirejs.org/docs/whyamd.html

各个版本的jQuery官方下载:
https://code.jquery.com/( uncompressed是未压缩的,minified是min版本的)
三者之间关系:
http://stackoverflow.com/questions/16521471/relation-between-commonjs-amd-and-requirejs

AMD

Asynchronous Module Definition(AMD,异步模块定义),下面这里也讲了AMD和commonJS的关系:
https://github.com/amdjs/amdjs-api/blob/master/AMD.md

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值