| 1 |
import { Scheduler } from '../Scheduler'; |
| 2 |
import { SubscriptionLog } from './SubscriptionLog'; |
| 3 |
|
| 4 |
export class SubscriptionLoggable { |
| 5 |
public subscriptions: SubscriptionLog[] = []; |
| 6 |
// @ts-ignore: Property has no initializer and is not definitely assigned |
| 7 |
scheduler: Scheduler; |
| 8 |
|
| 9 |
logSubscribedFrame(): number { |
| 10 |
this.subscriptions.push(new SubscriptionLog(this.scheduler.now())); |
| 11 |
return this.subscriptions.length - 1; |
| 12 |
} |
| 13 |
|
| 14 |
logUnsubscribedFrame(index: number) { |
| 15 |
const subscriptionLogs = this.subscriptions; |
| 16 |
const oldSubscriptionLog = subscriptionLogs[index]; |
| 17 |
subscriptionLogs[index] = new SubscriptionLog( |
| 18 |
oldSubscriptionLog.subscribedFrame, |
| 19 |
this.scheduler.now() |
| 20 |
); |
| 21 |
} |
| 22 |
} |