strict object property type check

This commit is contained in:
siikamiika 2020-04-05 19:24:13 +03:00
parent aea7c590d1
commit 5596a8f6f7

View File

@ -318,10 +318,10 @@ const yomichan = (() => {
} }
getTemporaryListenerResult(eventHandler, userCallback, timeout=null) { getTemporaryListenerResult(eventHandler, userCallback, timeout=null) {
if ( if (!(
typeof eventHandler.addListener === 'undefined' || typeof eventHandler.addListener === 'function' ||
typeof eventHandler.removeListener === 'undefined' typeof eventHandler.removeListener === 'function'
) { )) {
throw new Error('Event handler type not supported'); throw new Error('Event handler type not supported');
} }