// Example of using Underscore's _.debounce function // debounce is useful for situations where you get multiple events fired // from one action. For example resize event is sent multiple times when // window is resized var reloadIfResizeChange = _.debounce(function() { window.location.reload(); }, 200); window.addEventListener('resize', reloadIfResizeChange);