diff --git a/css_auto-reload.js b/css_auto-reload.js index b8c92aa..236f005 100644 --- a/css_auto-reload.js +++ b/css_auto-reload.js @@ -48,3 +48,11 @@ StyleSheetList.prototype.toggle_autoreload = function toggle_autoreload(){ // usage: document.styleSheets.toggle_autoreload() return this.start_autoreload.running ? this.stop_autoreload() : this.start_autoreload(); }; + +StyleSheetList.prototype.reload_on_focus = function reload_on_focus(){ + // usage: document.styleSheets.reload_on_focus() + var that = this; + window.onfocus = function () { + that.reload(); + }; +};