Skip to content

Commit

Permalink
readme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
serikshaikamalov committed Jul 3, 2024
1 parent a5cb93c commit cea049d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,29 @@ In this example:
# Snippets

## How to deal with dark/light mode

## EventTarget as a global storage

Why to use it?

- A way of communication between components
- Source of the truth
- Implement subscriber/listener pattern

Interface

```js
interface EventTarget {
addEventListener(
type: string,
callback: EventListenerOrEventListenerObject | null,
options?: AddEventListenerOptions | boolean
): void;
dispatchEvent(event: Event): boolean;
removeEventListener(
type: string,
callback: EventListenerOrEventListenerObject | null,
options?: EventListenerOptions | boolean
): void;
}
```

0 comments on commit cea049d

Please sign in to comment.