mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 02:11:54 +00:00
send message when websocket open and clear store cache on reset
This commit is contained in:
committed by
Aiden McClelland
parent
b34557e8d3
commit
a72c1c5499
@@ -20,9 +20,6 @@ export class PatchDB<T> {
|
|||||||
.pipe(
|
.pipe(
|
||||||
tap(update => this.store.update(update)),
|
tap(update => this.store.update(update)),
|
||||||
concatMap(() => of(this.store.cache)),
|
concatMap(() => of(this.store.cache)),
|
||||||
finalize(() => {
|
|
||||||
this.store.reset()
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ export class WebsocketSource<T> implements Source<T> {
|
|||||||
url: this.url,
|
url: this.url,
|
||||||
openObserver: {
|
openObserver: {
|
||||||
next: () => {
|
next: () => {
|
||||||
console.log('WebSocket connection open')
|
this.websocket$!.next(document.cookie as any)
|
||||||
this.websocket$!.next('open message' as any)
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export class Store<T extends { [key: string]: any }> {
|
|||||||
|
|
||||||
reset (): void {
|
reset (): void {
|
||||||
Object.values(this.watchedNodes).forEach(node => node.complete())
|
Object.values(this.watchedNodes).forEach(node => node.complete())
|
||||||
|
this.watchedNodes = { }
|
||||||
this.stash.clear()
|
this.stash.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user