Closed gladchinda closed 4 years ago
When constructing the CookiesEuBanner instance, it is possible that the argument passed as the launchFunction named parameter may not be a function.
CookiesEuBanner
launchFunction
// Boolean explicitly passed here new CookiesEuBanner(false); // Undefined implicitly passed here: new CookiesEuBanner();
For any of the above scenarios, the code will throw a TypeError indicating that the designated launchFunction is not a function.
TypeError
Hence, a type check is required to ascertain that the launchFunction is a function. And if not, a no-op function can be used as a fallback.
This pull request fixes this issue: #57
See my response: https://github.com/Alex-D/Cookies-EU-banner/issues/57#issuecomment-623745076
When constructing the
CookiesEuBanner
instance, it is possible that the argument passed as thelaunchFunction
named parameter may not be a function.For any of the above scenarios, the code will throw a
TypeError
indicating that the designatedlaunchFunction
is not a function.Hence, a type check is required to ascertain that the
launchFunction
is a function. And if not, a no-op function can be used as a fallback.