From 83be3150251c3ba5263c46853f9ff88f0474cd98 Mon Sep 17 00:00:00 2001 From: Johan Gyllenspetz Date: Mon, 18 Jan 2016 17:47:45 -0800 Subject: [PATCH] Make cachedNode a hot observable to disable several loads of meshes and images --- src/graph/GraphService.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/graph/GraphService.ts b/src/graph/GraphService.ts index 22680ba8..17b35e2d 100644 --- a/src/graph/GraphService.ts +++ b/src/graph/GraphService.ts @@ -13,7 +13,7 @@ export class GraphService { private _updates$: rx.Subject = new rx.Subject(); private _cache$: rx.Subject = new rx.Subject(); - private _cachedNode$: rx.Observable; + private _cachedNode$: rx.ConnectableObservable; private _graph$: rx.Observable; @@ -44,7 +44,8 @@ export class GraphService { return node.key + node.lastCacheEvict; }).flatMap((node: Node): rx.Observable => { return node.cacheAssets(); - }); + }).publish(); + this._cachedNode$.connect(); // make tilesservice aware of that a new node is beeing cached this._cachedNode$.subscribe(this._tilesService.cacheNode$);