feat(store): lit bindings (#289)

This commit is contained in:
rahim
2026-01-06 22:26:09 +11:00
committed by GitHub
parent 36ea73f424
commit 648aae7e31
50 changed files with 3561 additions and 412 deletions
+34 -1
View File
@@ -129,6 +129,18 @@ packages/utils/src/dom/
- Follow the `act → assert` pattern.
- Use `vi.fn()` for mocks and spies.
### Test describe() Names
Use the class or function name being tested:
```ts
// selector-controller.test.ts
describe('SelectorController', () => { ... });
// provider-mixin.test.ts
describe('createStoreProviderMixin', () => { ... });
```
## Guidelines
When generating or editing code in this repository, follow these rules to ensure safe, highquality contributions:
@@ -244,6 +256,27 @@ destroy(): void {
}
```
### Cleanup Pattern
Use `Disposer` from `@videojs/utils/events` when managing multiple cleanup functions:
```ts
import { Disposer } from '@videojs/utils/events';
#disposer = new Disposer();
connect(): void {
this.#disposer.add(store.subscribe(...));
this.#disposer.add(queue.subscribe(...));
}
disconnect(): void {
this.#disposer.dispose();
}
```
For single cleanup, use a simple unsubscribe function.
### No Hungarian Type Notation
Never prefix type parameters with `T`. Use descriptive names instead:
@@ -323,4 +356,4 @@ export function onEvent<K extends keyof HTMLElementEventMap>(...): Promise<...>;
export function supportsIdleCallback(): boolean { ... }
get size(): number { ... }
add(cleanup: CleanupFn): void { ... }
```
```