Skip to content

Instantly share code, notes, and snippets.

@benoitlahoz
benoitlahoz / child.html
Created April 29, 2025 16:28
'paint' event not triggered if window is created via 'setWindowOpenHandler'
<!DOCTYPE html>
<html style="width: 100vw; height: 100vh;">
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'unsafe-inline'; script-src 'self' 'unsafe-inline'">
<title>Hello World!</title>
</head>
<body style="width: 100%; height: 100%; margin: 0;">
<canvas id="my-canvas" style="background-color: black; width: 100%; height: 100%;" />
@benoitlahoz
benoitlahoz / 0_ipc-emit.ts
Last active May 26, 2024 09:19
IPC communication in Electron with client-side callback.
// Renderer.
/**
* Describes the function used to call `invoke` on ipcRenderer.
*/
type InvokeFn = (channel: string, ...args: any[]) => Promise<any>;
/**
* The `invoke` function returned by the `exposeInMainWorld` of the preload script
* or by `ipcRenderer` itself.