Last active
December 16, 2022 01:44
-
-
Save sdkfz181tiger/68d5e6d9f2a58122948c3f755e105c01 to your computer and use it in GitHub Desktop.
Module基礎
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { myName, myFunc, MyModule } from "./custom_module.js"; | |
$(document).ready(()=>{ | |
console.log("Ready!!"); | |
// Variable | |
console.log(myName); | |
// Function | |
myFunc(); | |
// Class | |
const myModule = new MyModule(); | |
myModule.sayHello(); | |
myModule.sayByebye(); | |
myModule.saySomething("#my_area", "Hello, Module!!"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export { myName, myFunc, MyModule }; | |
const myName = "Hoge!!"; | |
const myFunc = ()=>{ | |
console.log("Fuga!!"); | |
} | |
class MyModule{ | |
constructor(){ | |
console.log("MyModule"); | |
} | |
sayHello(){ | |
console.log("Hello!!"); | |
} | |
sayByebye(){ | |
console.log("Byebye!!"); | |
} | |
saySomething(selector, txt){ | |
$(selector).text(txt); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="shortcut icon" href="./images/favicon.ico"> | |
<title>Module</title> | |
</head> | |
<body> | |
<div id="my_container"> | |
<div> | |
<div>= Module =</div> | |
<div id="my_area">***</div> | |
</div> | |
</div> | |
<!-- JavaScript --> | |
<script src="//code.jquery.com/jquery-3.6.1.min.js"></script> | |
<script src="./custom_main.js" type="module"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment