Bug fix following on from #161 as started noticing some errors when using console logging as the metric needed for that is not available in the new listener function.
Annoyingly postMessage doesn't get a response, so can no longer get the tabId (which we use as a key to see if the tab was started in background) hence why we needed to set this up as a separate listener. We now set a tabLoadedInBackground variable - and also only set this once rather than for each update as it shouldn't change.
In theory it can be a little racy as depends on the message coming back, but it always was racy anyway, and will be updated on next metric.
Bug fix following on from #161 as started noticing some errors when using console logging as the
metric
needed for that is not available in the new listener function.Annoyingly
postMessage
doesn't get a response, so can no longer get thetabId
(which we use as a key to see if the tab was started in background) hence why we needed to set this up as a separate listener. We now set atabLoadedInBackground
variable - and also only set this once rather than for each update as it shouldn't change.In theory it can be a little racy as depends on the message coming back, but it always was racy anyway, and will be updated on next metric.