polling is kind of ugly  but also the simplest way i could think of to wait for something that happens after the timeout would have been incorrectly restarted i could also introduce a filter to wait for a beforeunload ack let me know if you think that is better  or if you have other suggestions 