What is 'typeof define === 'function' && define['amd']' used for?
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.
What is 'typeof define === 'function' && define['amd']' used for?的更多相关文章
- Spark笔记之使用UDF(User Define Function)
一.UDF介绍 UDF(User Define Function),即用户自定义函数,Spark的官方文档中没有对UDF做过多介绍,猜想可能是认为比较简单吧. 几乎所有sql数据库的实现都为用户提供了 ...
- 微信小程序 - cb回调(typeof cb == "function" && cb(obj);)
typeof cb == "function" && cb(obj) 但凡用了Promise,这种方式就可以抛弃了. Page({ data: {}, onLoad ...
- Js Pattern - Self Define Function
This pattern is useful when your function has some initial preparatory work to do andit needs to do ...
- hive 添加UDF(user define function) hive的insert语句
add JAR /home/hadoop/study/study2/utf.jar; package my.bigdata.udf; import org.apache.hadoop.hive.ql. ...
- python define function
>>> def square(x): ... 'calculates the square of the number x.' ... return x*x ... >> ...
- js模块定义——支持CMD&AMD&直接加载
/* animate */ //直接加载 (function() { var animate = {} //balabala window.animate = animate; })(); //AMD ...
- 认识AMD、CMD、UMD、CommonJS
0.导言 JavaScript的生态系统一直在稳步增长,当各种组件混合使用时,就可能会发现不是所有的组件都能“和平共处”,为了解决这些问题,各种模块规范就出来了. 1.AMD(Asynchromous ...
- 解决sea.js引用jQuery提示$ is not a function的问题
在使用sea.js的如下写法引用jQuery文件时, //main.jsdefine(function(require,exports,module){ var $ = require('jquery ...
- angularjs + fis +modJS 对于支持amd规范的组建处理(PhotoSwipe 支持,百度webUpload支持)
这不是很好的处理方式,但是能够解决问题,希望有大神推荐更好的方式. 前端模块使用angularjs + fis +modJS 开发前端应用有两个月了.总结了以下的优点: fis 自动构建,自动发布,功 ...
随机推荐
- 闭包、装饰器decorator、迭代器与生成器、面向过程编程、三元表达式、列表解析与生成器表达式
一.装饰器 一.装饰器的知识储备 不想修改函数的调用方式,但是还想在原来的函数前后添加功能 1.可变长参数 :*args和**kwargs def index(name,age): print(na ...
- 弹出ifream
top.$.jBox("iframe:"+'${ctx}/synopsis/hmlwxSynopsis/addItem', {title: "添加作品",w ...
- doT学习(二)之用法集合
Advanced templating: illustrates defines and includes. Include external snippet defined in a variabl ...
- java获取json数组格式中的值
第一种方法: String str = "{'array':[{'id':5,'name':'张三'},{'id':6,'name':'李四'}]}"; JSONArray jso ...
- 十、LaTex数学公式初步
- VMware安装,安装CentOS 6.3 ,安装CentOS 7_1511_mini
VMware安装包+汉化包+序列号 百度云链接:https://pan.baidu.com/s/1c8ZsZc9ySdCdxrywFO4eUA 提取码:iq7k 打开 VMware Workstati ...
- 状态码是canceled
timeout : 1000 给ajax配置如上属性 $.ajax({ type:"post", url:"pro/savePro", timeout : 10 ...
- 机器学习聚类算法之K-means
一.概念 K-means是一种典型的聚类算法,它是基于距离的,是一种无监督的机器学习算法. K-means需要提前设置聚类数量,我们称之为簇,还要为之设置初始质心. 缺点: 1.循环计算点到质心的距离 ...
- python + excel 使用
为了提高工作效率(偷懒),用python去解决. 工作需要,需要将excel文件转化为csv文件,要是手工的一个个去转换,每个sheet页不但有几十个字段,中间还夹杂着空格,然后按顺序转换成csv文件 ...
- typedef int(init_fnc_t) (void)的理解
typedef int(init_fnc_t) (void); 这个就是一个取别名的过程. 我们通常情况下会如下使用 typedef :typedef int MyInt;MyInt a; 这个时候我 ...