import { RemoteBuildServer } from "../../dal/remotebuildserver" ; import { ModificationSubscription } from "../notifications/modificationsubscription" ; export class EventCounter { private counter : number ; private constructor ( ) { } public static async getInstance ( remoteBuildServer , subscription ) { const instance = new EventCounter ( ) ; const serializedSubscription = subscription . serialize ( ) ; instance . counter = await remoteBuildServer . getTotalNumberOfEvents ( serializedSubscription ) ; return instance ; } public update ( newCounter ) { this . counter = newCounter . counter ; } public notEquals ( newCounter ) { return ! newCounter || this . counter !== newCounter . counter ; } }