• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alovajs / alova / #210

08 Oct 2024 07:26AM CUT coverage: 93.734% (-0.09%) from 93.826%
#210

push

github

web-flow
Merge pull request #554 from alovajs/changeset-release/main

ci: release

1608 of 1761 branches covered (91.31%)

Branch coverage included in aggregate %.

9537 of 10129 relevant lines covered (94.16%)

60.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.69
/packages/shared/src/model/FrameworkState.ts
1
import { GeneralState } from '@/types';
1✔
2

1✔
3
type UpdateFn<Data> = (state: GeneralState<Data>, newValue: Data) => void;
1✔
4
type DehydrateFn<Data> = (state: GeneralState<Data>) => Data;
1✔
5
type ExportFn<Data> = (state: GeneralState<Data>) => GeneralState<Data>;
1✔
6
export class FrameworkReadableState<Data, Key extends string> {
1✔
7
  s: GeneralState<Data>;
1✔
8

1✔
9
  k: Key;
1✔
10

1✔
11
  protected $dhy: DehydrateFn<Data>;
1✔
12

1✔
13
  protected $exp: ExportFn<Data>;
1✔
14

1✔
15
  constructor(state: GeneralState<Data>, key: Key, dehydrate: DehydrateFn<Data>, exportState: ExportFn<Data>) {
1✔
16
    this.s = state;
×
17
    this.k = key;
×
18
    this.$dhy = dehydrate;
×
19
    this.$exp = exportState;
×
20
  }
×
21

1✔
22
  get v() {
1✔
23
    return this.$dhy(this.s);
×
24
  }
×
25

1✔
26
  get e() {
1✔
27
    return this.$exp(this.s);
×
28
  }
×
29
}
1✔
30

1✔
31
export class FrameworkState<Data, Key extends string> extends FrameworkReadableState<Data, Key> {
1✔
32
  private $upd: UpdateFn<Data>;
1✔
33

1✔
34
  constructor(
1✔
35
    state: GeneralState<Data>,
×
36
    key: Key,
×
37
    dehydrate: DehydrateFn<Data>,
×
38
    exportState: ExportFn<Data>,
×
39
    update: UpdateFn<Data>
×
40
  ) {
×
41
    super(state, key, dehydrate, exportState);
×
42
    this.$upd = update;
×
43
  }
×
44

1✔
45
  set v(newValue: Data) {
1✔
46
    this.$upd(this.s, newValue);
×
47
  }
×
48

1✔
49
  get v() {
1✔
50
    return super.v;
×
51
  }
×
52
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc