Error: Cannot read properties of undefined (reading 'toDataURL') at t.default._setupIcon
See original GitHub issueIssue Description
Describe the bug When using the package, it is firing the following error message on preload.ts:
Uncaught TypeError: Cannot read properties of undefined (reading 'toDataURL') at t.default._setupIcon
To Reproduce Steps to reproduce the behavior:
- Create a new electron + typescript project following this template: https://github.com/Deluze/electron-vue-template
- Follow the instructions to setup custom-electron-titlebar
- Add the following declaration to a .d.ts file to enable importing custom-electron-titlebar
declare module "custom-electron-titlebar/main" {
import type cetMain from "custom-electron-titlebar/dist/main/main";
export const setupTitlebar: typeof cetMain.setupTitlebar;
export const attachTitlebarToWindow: typeof cetMain.attachTitlebarToWindow;
}
- See the error in the console
Expected behavior The expected behavior is to show the title bar
Screenshots
Desktop:
- OS: Windows 11
- Electron version: 20.1.0
- Node Version: 16.13
Issue Analytics
- State:
- Created 7 months ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Cannot read property toDataURL of undefined - Stack Overflow
Your code reads like this var ctx = document.createElement("canvas"); var ctx1 = ctx.getContext("2d"); var asd = convertCanvasToImage(ctx1) ...
Read more >TypeError: Cannot read property 'toDataURL' of undefined ...
In a TS file ISSUE import qrcode from 'qrcode'; const result = qrcode.toDataURL('xxxx') throw error TypeError: Cannot read property 'toDataURL' of undefined ...
Read more >ERROR TypeError: Cannot read property title of undefined
Your browser can' t play this video. Learn more. Switch camera ... Solved: ERROR TypeError : Cannot read property title of undefined.
Read more >Cannot read properties of undefined' - JavaScript Debugging
How To Fix 'Uncaught TypeError : Cannot read properties of undefined ' - JavaScript Debugging.
Read more >Can Not Read Properties of Undefined Reading Map in React ...
If you are looking at can not read properties of undefined reading map in react js error or map function is not displaying...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Working on it
This bug was fixed in the clean code branch. In the next few weeks a beta will be released and in the next month the stable version. 🚀🚀