A task scheduler and idle-detector for JavaScript