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) {
if (
typeof eventHandler.addListener === 'undefined' ||
typeof eventHandler.removeListener === 'undefined'
) {
if (!(
typeof eventHandler.addListener === 'function' ||
typeof eventHandler.removeListener === 'function'
)) {
throw new Error('Event handler type not supported');
}