removed window reference before setInterval to make module compatible with node.js