What is 'typeof define === 'function' && define['amd']' used for?

This code checks for the presence of require.js, a JavaScript dependency management library.

If 'define' is not undefined and it is a function and 'amd' (asynchronous module definition) is also defined then the code assumes that require.js is in play.

If this is so then it defines 'factory' and passes jQuery to it as a dependency. Otherwise it sets up the dependencies that the code needs by attaching them to the root object.

As for what 'factory' is: it is not defined by the Javascript framework, it will be a function in the same file most likely. It will take the parameter jQuery.

最新文章

  1. sublime快捷键
  2. SQL Server:字符串函数
  3. Elo rating system 模拟
  4. android 高效加载大图
  5. dedecms代码研究七
  6. 如何写出无法维护的代码(JAVA版)
  7. IDEA14 Ultimate Edition注册码
  8. oracle 实例名和服务名以及数据库名区别
  9. javascript中定义事件的三种方式
  10. 测试heightlight
  11. thinkphp5.0 架构
  12. JSON依赖的选择
  13. 基于nutch-1.2实现本地搜索引擎
  14. 深入理解Java虚拟机7-chap10-11-斗者4星
  15. spring 框架学习网站
  16. Python爬虫之提取Bing搜索的背景图片并设置为Windows的电脑桌面
  17. Asp.Net 合并图片(二维码和其他图片合并)
  18. MongoDB T-shirt 来了
  19. arcgis desktop 地理编码服务发布
  20. JavaBean与XML转换——XStream使用笔记

热门文章

  1. SpringMVC-JSON数据交换
  2. async 异步抓取 花瓣网高清大图 30s爬取500张
  3. MySQL索引优化 笔记
  4. ubuntu中apache的ssl证书配置及url重写
  5. springmvc中的视图模型的返回方式
  6. js 继承,Object.setPrototypeOf | Object.getPrototypeOf | Object.create class
  7. php前端做过滤校验
  8. 【vsCode】识别.vue/一键生成.vue模板文件
  9. docker 开启特权模式
  10. TanksWar(坦克大战三维、二维版以及90版)