import "@here/harp-fetch" ; import { TileKey } from "@here/harp-geoutils" ; import { EventDispatcher } from "three" ; remarks export abstract class DataProvider extends EventDispatcher { private readonly m_clients : Set < Object > = new Set ( ) ; private m_connectPromise : Promise < void > | undefined ; param client returns register ( client ) { if ( this . m_clients . size === 0 ) { this . m_connectPromise = this . connect ( ) ; } this . m_clients . add ( client ) ; return this . m_connectPromise ! ; } param client unregister ( client ) { if ( this . m_clients . delete ( client ) && this . m_clients . size === 0 ) { this . dispose ( ) ; } } /**
     * Returns `true` if it has been connected successfully.
     */ abstract ready ( ) ; /**
     * Load the data of a  {@link @here/map-view@Tile} asynchronously.
     *
     *  param tileKey param abortSignal returns abstract getTile ( tileKey , abortSignal ? ) ; param listener returns example onDidInvalidate ? ( listener ) ; returns protected abstract connect ( ) ; /**
     * Destroys this `DataProvider`. Implementations of `DataProvider` must dispose of
     * asynchronous operations and services here.
     */ protected abstract dispose ( ) ; }