From fb1e238cb202576bdc94c28b59eed4d1f085941e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Thu, 23 Jul 2020 14:29:07 +0200 Subject: [PATCH] Check if window is available --- lib/ical/helpers.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ical/helpers.js b/lib/ical/helpers.js index b4fdb94f..71860bf0 100644 --- a/lib/ical/helpers.js +++ b/lib/ical/helpers.js @@ -4,10 +4,10 @@ * Portions Copyright (C) Philipp Kewisch, 2011-2015 */ -if ('noModule' in HTMLScriptElement.prototype) { - // In case ical.js is executed in a JavaScript module, strict mode is enabled - // and requires a global variable to be assigned explicitly to e.g. the window - // object. +if (typeof window !== 'undefined' && 'noModule' in HTMLScriptElement.prototype) { + // In case ical.js is executed in the browser and a JavaScript module, strict + // mode is enabled and requires a global variable to be assigned explicitly + // to e.g. the window object. window.ICAL = {}; }