From 4a7738cebcbfd6f9e0a7d22431ebf31bc23d4739 Mon Sep 17 00:00:00 2001 From: Anton Date: Sat, 16 Mar 2024 11:30:01 +0100 Subject: [PATCH] Allow suncalc to be exported via `globalThis` --- modules/.eslintrc.js | 1 + modules/suncalc.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/.eslintrc.js b/modules/.eslintrc.js index 734b5e8f1..cc0dd660e 100644 --- a/modules/.eslintrc.js +++ b/modules/.eslintrc.js @@ -92,6 +92,7 @@ module.exports = { "getSerial": "readonly", "getTime": "readonly", "global": "readonly", + "globalThis": "writable", "HIGH": "readonly", "I2C1": "readonly", "Infinity": "readonly", diff --git a/modules/suncalc.js b/modules/suncalc.js index 7fd78c8d7..52f837fab 100644 --- a/modules/suncalc.js +++ b/modules/suncalc.js @@ -336,6 +336,6 @@ SunCalc.getMoonTimes = function (date, lat, lng, inUTC) { // export as Node module / AMD module / browser variable if (typeof exports === 'object' && typeof module !== 'undefined') module.exports = SunCalc; //else if (typeof define === 'function' && define.amd) define(SunCalc); -//else window.SunCalc = SunCalc; +else globalThis.SunCalc = SunCalc; }());