import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { shareReplay, map } from 'rxjs/operators'; import { RPCService } from '@loafer/ng-rpc'; import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; @Injectable() export class MetaCrawlerService { private metaCrawlerCache$: Observable; public constructor( private rpcService: RPCService, ) { } public readAll(): Observable { if (!this.metaCrawlerCache$) { this.metaCrawlerCache$ = this.rpcService.call('MetaCrawlerService.readAll').pipe( shareReplay(1), ); } return this.metaCrawlerCache$; } }