Toolverse
All skills

gpui-event

by longbridge

Event handling and subscriptions in GPUI. Use when implementing events, observers, or event-driven patterns. Supports custom events, entity observations, and event subscriptions for coordinating between components.

Installation

Pick a client and clone the repository into its skills directory.

Installation

Quick info

Category
Frontend

About this skill

Event handling and subscriptions in GPUI. Use when implementing events, observers, or event-driven patterns. Supports custom events, entity observations, and event subscriptions for coordinating between components.

How to use

  1. Zdefiniuj enum dla swoich zdarzeń, dodając warianty dla każdego typu zdarzenia, które chcesz emitować (np. DataUpdated z danymi lub ActionTriggered bez parametrów). Oznacz enum atrybutem #[derive(Clone)], aby umożliwić klonowanie zdarzeń.

  2. W metodzie komponentu, która zmienia stan, wyemituj zdarzenie za pomocą cx.emit(TwojZdarzenie::Wariant), a następnie wywołaj cx.notify(), aby powiadomić system o zmianie.

  3. Aby nasłuchiwać zdarzeń z innego komponentu, użyj cx.subscribe() w konstruktorze słuchacza, przekazując referencję do źródła zdarzeń i closure, który obsługuje każdy wariant zdarzenia.

  4. W closure subskrypcji dopasuj wzorzec zdarzenia (match event) i wykonaj odpowiednią akcję dla każdego wariantu, na przykład zaktualizuj stan lub wyzwól callback.

  5. Aby reagować na zmiany stanu encji bez zdefiniowanych zdarzeń, użyj cx.observe() zamiast subscribe — obserwator zostanie powiadomiony za każdym razem, gdy obserwowana encja wywoła cx.notify().

  6. Pamiętaj, aby odłączyć subskrypcje i obserwatory za pomocą .detach(), aby uniknąć wycieków pamięci i niepotrzebnych powiadomień.

Related skills

screenshot-to-code

by OneWave-AI

Convert UI screenshots into working HTML/CSS/React/Vue code. Detects design patterns, components, and generates responsive layouts. Use this when users provide screenshots of websites, apps, or UI designs and want code implementation.

Frontend
94209

frontend-slides

by sickn33

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual

Frontend
65135

livewire-development

by spatie

Develops reactive Livewire 4 components. Activates when creating, updating, or modifying Livewire components; working with wire:model, wire:click, wire:loading, or any wire: directives; adding real-time updates, loading states, or reactivity; debugging component behavior;

Frontend
2335

google-official-seo-guide

by littleben

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

Frontend
101196

theme-factory

by anthropics

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

Frontend
40139

shadcn-ui-setup

by maneeshanif

Install and configure Shadcn/ui component library with Radix UI primitives, Aceternity UI effects, set up components, and manage the component registry. Use when adding Shadcn/ui to a Next.js project or installing specific UI components for Phase 2.

Frontend
23167