Reputation: 1
I have a request that will be called every 5 seconds, I can use intercept to capture it and count how many times it has been called, but is there a way I can tell how often it has been called?
Upvotes: 0
Views: 74
Reputation: 4385
Depends on what you have in the intercept. If you use a routeHandler function, it's easy to record the call time in an array
const calls = []
calls.push(Date.now()) // start
intercept(url, (req) => {
calls.push(Date.now()) // each call
})
Upvotes: 2