Make cachedNode a hot observable to disable several loads of meshes and images

This commit is contained in:
Johan Gyllenspetz 2016-01-18 17:47:45 -08:00
parent 89e5d3c13d
commit 83be315025

View File

@ -13,7 +13,7 @@ export class GraphService {
private _updates$: rx.Subject<any> = new rx.Subject<any>();
private _cache$: rx.Subject<any> = new rx.Subject<any>();
private _cachedNode$: rx.Observable<Node>;
private _cachedNode$: rx.ConnectableObservable<Node>;
private _graph$: rx.Observable<Graph>;
@ -44,7 +44,8 @@ export class GraphService {
return node.key + node.lastCacheEvict;
}).flatMap<Node>((node: Node): rx.Observable<Node> => {
return node.cacheAssets();
});
}).publish();
this._cachedNode$.connect();
// make tilesservice aware of that a new node is beeing cached
this._cachedNode$.subscribe(this._tilesService.cacheNode$);