Javascript でカスタム クラスを作成しました。Mac OS の Safari と Chrome では問題なく動作しますが、iPad ではエラーが発生します。
エラーを取得するために、Safari の [開発] メニューからデバッグしています。奇妙なのは、オンラインで結果が見つからないということです。これについて詳しく知ることができます。エラーは「予約語 'class' の予期しない使用です」です。
私のJS:
class LoadingIndicator{ // error is here
constructor(elementID){
this.tick = 8;
this.waitStatus = document.getElementById(elementID);
this.animateLoaderVar = setInterval(
this.animateLoader.bind(this),
10
)
}
animateLoader (){
if(this.tick == 8){
this.waitStatus.firstElementChild.innerHTML = ".";
}
else if(this.tick == 16){
this.waitStatus.firstElementChild.innerHTML = "..";
}else if(this.tick == 24){
this.waitStatus.firstElementChild.innerHTML = "...";
this.tick = 0;
}
this.tick += 1;
}
removeLoader(){
this.waitStatus.outerHTML = "";
delete this.waitStatus;
clearInterval(this.animateLoaderVar);
}
}