Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 启动时报错 The script has error Cannot read properties of undefined (reading 'invokeActionsByTag') #602

Closed
linonetwo opened this issue Nov 25, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@linonetwo
Copy link
Contributor

Environment 环境信息

No response

Description 描述

VM5:3 wikiOperationInBrowser.executeTWJavaScriptWhenIdle The script has error Cannot read properties of undefined (reading 'invokeActionsByTag')

(async () => await new Promise((resolve, reject) => {
  const handler = () => {
    requestIdleCallback(() => {
      if (typeof $tw !== 'undefined') {
        try {
          const result = (() => {
            
const event = new Event('TidGi-invokeActionByTag');
return $tw.rootWidget.invokeActionsByTag("$:/tags/DarkLightChangeActions",event,{"dark-mode":"no"});

          })();
          resolve(result);
        } catch (error) {
          reject(error);
        }
      } else {
        // wait till $tw is not undefined.
        setTimeout(handler, 500);
      }
    }, { timeout: 500 });
  };
  handler();
}))()

VM5:3 wikiOperationInBrowser.ipcRenderer.on wiki-invoke-actions-by-tag The script has error Cannot read properties of undefined (reading 'invokeActionsByTag')

arguments_: [0.5387127593761245,"$:/tags/DarkLightChangeActions","{"dark-mode":"no"}"]
VM5:3 wikiOperationInBrowser.executeTWJavaScriptWhenIdle The script has error Cannot read properties of undefined (reading 'addTiddler')

(async () => await new Promise((resolve, reject) => {
  const handler = () => {
    requestIdleCallback(() => {
      if (typeof $tw !== 'undefined') {
        try {
          const result = (() => {
            
return $tw.wiki.addTiddler({ title: '$:/state/titleBarOpened', text: `no` });

          })();
          resolve(result);
        } catch (error) {
          reject(error);
        }
      } else {
        // wait till $tw is not undefined.
        setTimeout(handler, 500);
      }
    }, { timeout: 500 });
  };
  handler();
}))()

Steps to Reproduce 复现方式

正常打开巨型wiki

Additional Context 额外上下文

No response

@linonetwo linonetwo added the bug Something isn't working label Nov 25, 2024
@linonetwo linonetwo self-assigned this Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant