a.js

define(function(require, exports, module) {
var test = function(){
console.log("hello world")
} //if using just this, Tern doesn't get it, but works with RequireJS
module.exports = test; //this works with Tern already
// return test; });

test.html

<!DOCTYPE html>
<html lang="en"> <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head> <body>
<button onclick="test()">test</button>
<script>
function test() {
require(['./a.js'], function (sayHi) {
console.log(sayHi);
});
}
</script>
<script src="https://requirejs.org/docs/release/2.3.6/minified/require.js"></script>
</body> </html>

最新文章

  1. Asp.Net MVC&lt;七&gt;:Model
  2. 虚拟机安装LINUX网络配置注意的问题
  3. day03-java
  4. 在JSP页面显示九九乘法表
  5. jquery之 off()方法
  6. CentOS 6.6 yum 方式安装sunversion 服务器
  7. axure7.0 汉化包下载
  8. 使用 环境变量 来配置批量配置apache
  9. 向PE文件中添加一个Section
  10. 使用脚本管理IIS
  11. c++中经常需要访问对象中的成员的三种方式
  12. 重操JS旧业第一弹:Script与JS加载
  13. 【AngularJS】 2.0 版本发布
  14. Spring容器组建注解@Component和Resouces实现完全注解配置
  15. dotnetcore 自动迁移工具
  16. 使用lamdba函数对list排序
  17. ln 软链
  18. 缓存系列之二:CDN与其他层面缓存
  19. Comparison of Static Code Analysis Tools for Java
  20. Top 10 Javascript MVC 框架

热门文章

  1. C#工程缺少IIS组件无法打开的解决办法
  2. linux服务器免密钥登录
  3. hdu-1166 敌兵布阵---树状数组模板
  4. PAT (Advanced Level) Practise - 1092. To Buy or Not to Buy (20)
  5. CUDA &amp;&amp; GPU中dim3介绍
  6. java基础面试题:说说&amp;和&amp;&amp;的区别
  7. 关于多行文本 textarea 在ios 真机上padding相对安卓较大问题
  8. 深入浅出:了解for循环中保留i值得方法
  9. 32-2题:LeetCode102. Binary Tree Level Order Traversal二叉树层次遍历/分行从上到下打印二叉树
  10. POJ 2406 Power String