improve type check

Co-authored-by: AHOHNMYC <24810600+AHOHNMYC@users.noreply.github.com>
This commit is contained in:
bonjinnorenka 2023-08-30 00:26:20 +09:00 committed by GitHub
parent 37cd696a46
commit 26f9e8bf0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,7 @@ class invidious_embed{
this.addEventListener('loadedmetadata',()=>{this.event_executor('ready');this.loaded=true});
this.addEventListener('loadedmetadata',()=>{this.setVolume(this.volume)});
this.player_iframe.src = iframe_src;
if(options.width!==undefined&&typeof options.width==='number'){
if (typeof options.width === 'number'){
this.player_iframe.width = options.width;
}
else{
@ -139,7 +139,7 @@ class invidious_embed{
this.message_wait[message.data.command] = [];
break;
case 'event':
if(message.data.eventname!==undefined&&typeof message.data.eventname==='string'){
if (typeof message.data.eventname === 'string') {
this.event_executor(message.data.eventname);
var previous_status = this.player_status;
switch(message.data.eventname){
@ -254,7 +254,7 @@ class invidious_embed{
else{
mediaContetUrl = option;
}
if(startSeconds_arg!==undefined&&typeof startSeconds_arg==='number'){
if (typeof startSeconds_arg === 'number') {
startSeconds = startSeconds_arg;
}
}
@ -268,7 +268,7 @@ class invidious_embed{
this.event_executor('error');
}
}
else if(option.mediaContentUrl!==undefined&&typeof option.mediaContentUrl==='string'){
else if (typeof option.mediaContentUrl === 'string') {
mediaContetUrl = option.mediaContentUrl;
}
else{