Skip to content

Commit

Permalink
fix: prevent $tw.wiki undefined error
Browse files Browse the repository at this point in the history
fixes #602
  • Loading branch information
linonetwo committed Nov 25, 2024
1 parent 3e51aec commit ed7a2ba
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async function executeTWJavaScriptWhenIdle<T>(script: string, options?: { onlyWh
(async () => await new Promise((resolve, reject) => {
const handler = () => {
requestIdleCallback(() => {
if (typeof $tw !== 'undefined') {
if (typeof $tw?.rootWidget !== 'undefined' && typeof $tw?.wiki !== 'undefined') {
try {
const result = (() => {
${script}
Expand Down

0 comments on commit ed7a2ba

Please sign in to comment.