Skip to content

Commit 2a96fa3

Browse files
committed
Store: expose source and cache as read-only props
1 parent 0f4d4ad commit 2a96fa3

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

addon/-private/store.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export interface StoreSettings {
2626
}
2727

2828
export default class Store {
29-
source: MemorySource;
30-
cache: Cache;
29+
private _source: MemorySource;
30+
private _cache: Cache;
3131

3232
static create(injections: StoreSettings): Store {
3333
const owner = getOwner(injections);
@@ -37,18 +37,26 @@ export default class Store {
3737
}
3838

3939
constructor(settings: StoreSettings) {
40-
this.source = settings.source;
40+
this._source = settings.source;
4141

42-
this.cache = new Cache({
42+
this._cache = new Cache({
4343
sourceCache: this.source.cache,
4444
modelFactory: new ModelFactory(this)
4545
});
4646
}
4747

4848
destroy() {
49-
this.cache.destroy();
50-
delete this.source;
51-
delete this.cache;
49+
this._cache.destroy();
50+
delete this._source;
51+
delete this._cache;
52+
}
53+
54+
get source(): MemorySource {
55+
return this._source;
56+
}
57+
58+
get cache(): Cache {
59+
return this._cache;
5260
}
5361

5462
get keyMap(): KeyMap | undefined {

0 commit comments

Comments
 (0)