mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(store): lit bindings (#289)
This commit is contained in:
@@ -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, high‑quality 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 { ... }
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user