import { Throttler } from '../../../web/js/datastore/Throttler' ; import { RepoDocMetaLoader } from './RepoDocMetaLoader' ; import { Releaseable } from '../../../web/js/reactor/EventListener' ; export class RepoDocMetaLoaders { /**
     * Add an EventListener to the RepoDocMetaLoader that's throttled so that
     * we get periodic updates for performance reasons.
     *
     */ public static addThrottlingEventListener ( repoDocMetaLoader , callback ) { const throttlerOpts = { maxRequests : 250 , maxTimeout : 500 } ; const refreshThrottler = new Throttler ( ( ) => callback ( ) , throttlerOpts ) ; return repoDocMetaLoader . addEventListener ( event => { refreshThrottler . exec ( ) ; } ) ; } }