JavaScript フレームワーク fairy support js
moduleの初期処理

初期処理

index.html、index.jsを下記に変更しましょう

index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>
sample
</title>
<script id="fs-js" src="http://localhost:8000/js/fairysupport.min.js" data-page-root="http://localhost:8000/page"></script>
</head>
<body>
    <div data-obj="obj"></div>
    <div><button data-name="sample">sample</button></div>
</body>
</html>
index.js
export class Index {

    constructor() {
        console.log("constructor");
        console.log('obj' in this);
    }

    init() {
        console.log("init");
        console.log('obj' in this);
    }

    sample_click(event) {
        alert("Hello fairysupport");
    }

}

constructorではまだ、webページとjsは結びつけられていません
webページとjsが結びつけられると、フレームワークはinitメソッドを呼び出します


次ページ定数

目次