Skip to content

Instantly share code, notes, and snippets.

View Akxe's full-sized avatar
🦄

Adam Eisenreich Akxe

🦄
  • Česká republika
  • 04:30 (UTC +01:00)
View GitHub Profile
@Akxe
Akxe / PortAwareSharedWorker.ts
Last active September 13, 2024 00:01
PortAwareSharedWorker, shared worker that know who is still connected and who is not
/// <reference lib="webworker" />
type SharedWorkerPort = MessagePort | DedicatedWorkerGlobalScope;
class PortAwareSharedWorkerPort<T extends SharedWorkerPort = SharedWorkerPort, D = any> {
private readonly weakRef: WeakRef<T>;
private disconnected = false;
constructor(
port: T,
onMessage: (eventData: D) => void,
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"version": 2,
"final_space": true,
"console_title_template": "{{.UserName}}@{{.HostName}} in {{ .PWD }}",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [