index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello RequireJS</title>
<script type="text/javascript" src="http://requirejs.org/docs/release/2.3.2/minified/require.js"></script>
</head>
<body>
<!-- place content here --->
<script>
requirejs(["scripts/say", "scripts/say2"], function(say, say2) {
//alert(say.hello());
//say.func1();
});
</script>
</body>
</html>
/scriptscripts/say.js
define([], function(){
console.log("실행-say");
//func1();
function func1() {
console.log("func1() 함수");
}
return {
hello: function(){
return "Hello World";
},
func1: func1
};
});
/scriptscripts/say2.js
define([], function(){
var fruits = ["Apple","Banana","Orange","Strawberry"];
fruits.forEach(function (item, index, array) {
console.log(item, index);
});
});
'Development > ETC' 카테고리의 다른 글
[맥]맥북 일반 키보드 (0) | 2020.04.15 |
---|---|
Tizen Studio <mdm.h> 파일 오류뜰때 (0) | 2020.01.21 |
[RequireJS]require() vs. define() (0) | 2019.12.02 |
비콘 서비스 (0) | 2019.11.07 |
[Freemarker] Eclipse Syntax Highlighting (0) | 2019.10.24 |