Skip to content

Commit

Permalink
Replace window with globalThis (#8912)
Browse files Browse the repository at this point in the history
* Update js-ui.ts

Replaced window with globalThis. This will fix the issue #8911

* Added fallback to window

If globalThis is undefined fallback to windows.
  • Loading branch information
kesavkolla authored Oct 8, 2024
1 parent facb8b3 commit aa4d887
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/entries/js-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ function doPopupSurvey(props: any): void {
});
}

let jQueryInst = window["jQuery"] || window["$"];
let gcontext = globalThis;
if (typeof globalThis === "undefined") gcontext = window;
let jQueryInst = gcontext["jQuery"] || gcontext["$"];

if (typeof jQueryInst !== "undefined") {
initJquery(jQueryInst);
Expand Down Expand Up @@ -107,4 +109,4 @@ export { SurveyModel as Model } from "survey-core";

import { checkLibraryVersion } from "survey-core";

checkLibraryVersion(`${process.env.VERSION}`, "survey-js-ui");
checkLibraryVersion(`${process.env.VERSION}`, "survey-js-ui");

0 comments on commit aa4d887

Please sign in to comment.