Skip to content
Browse files

Load cache reload iframe as soon as we have a url

We should not wait for onload to fire because it might never fire.
Instead, we run the cache reload code as soon as we have a url, and
allow it to reload the user's browser cache.
  • Loading branch information...
1 parent ce1a279 commit 54c8412cbee661f108f9fa625ca585570db77350 @bluesmoon committed Jan 29, 2013
Showing with 8 additions and 19 deletions.
  1. +8 −19 plugins/cache_reload.js
View
27 plugins/cache_reload.js
@@ -11,33 +11,22 @@ BOOMR = BOOMR || {};
BOOMR.plugins = BOOMR.plugins || {};
var impl = {
- url: "",
- initialized: false
+ url: ""
};
BOOMR.plugins.CACHE_RELOAD = {
init: function(config) {
BOOMR.utils.pluginConfig(impl, config, "CACHE_RELOAD", ["url"]);
- if(this.initalized)
+ if(!impl.url)
return this;
- BOOMR.subscribe(
- "page_ready",
- function() {
- if(!impl.url)
- return;
- // we use document and not BOOMR.window.document since
- // we can run inside the boomerang iframe if any
- var i=document.createElement('iframe');
- i.style.display="none";
- i.src=impl.url;
- document.body.appendChild(i);
- },
- null,
- null
- );
- this.initialized = true;
+ // we use document and not BOOMR.window.document since
+ // we can run inside the boomerang iframe if any
+ var i=document.createElement('iframe');
+ i.style.display="none";
+ i.src=impl.url;
+ document.body.appendChild(i);
return this;
},

0 comments on commit 54c8412

Please sign in to comment.
Something went wrong with that request. Please try again.