Skip to content

Commit

Permalink
Merge pull request #13 from reatlat/improve-validation
Browse files Browse the repository at this point in the history
Refactor undefined check for hbspt.forms.create
  • Loading branch information
reatlat authored Aug 13, 2024
2 parents 9ac618d + 1a43fd4 commit 3659c96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module.exports = (eleventyConfig, options = {}) => {
if (e.data === "hsFormsEmbedLoaded") {
w.removeEventListener("message", cb);
const interval = setInterval(function() {
if (hbspt?.forms?.create && typeof hbspt.forms.create === 'function') {
if ( typeof ((hbspt||{}).forms||{}).create === 'function' ) {
clearInterval(interval);
hbspt.forms.create(JSON.parse(decodeURIComponent('${encodedConfig}')));
}
Expand Down

0 comments on commit 3659c96

Please sign in to comment.