document.addEventListener("DOMContentLoaded", ()=>{
    var img = document.getElementById("img");
    for (let id of ["A", "B"]) {
	let btn = document.getElementById(id);
	if (btn) {
	    btn.addEventListener("click", (e)=>{
		img.src = "img/" + id + ".png"; // "img/A.png" or "img/B.png"
	    });
	}
    }
    // serviceworkerのロード
    if ('serviceWorker' in navigator) {
	navigator.serviceWorker.register('./pwa-svw.js')
	    .then(function() {
		console.log('service worker registered');
	    });
    }
}, false);
