mojito-debug
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -18,4 +18,4 @@ /* | ||
this.iframe = iframe; | ||
this.document = iframe._node.contentDocument; | ||
this.window = iframe._node.contentWindow; | ||
this.document = this.window.document; | ||
this.opened = Y.Debug.mode !== 'hide'; | ||
@@ -74,4 +74,32 @@ | ||
window = self.window, | ||
loaded = false; | ||
loaded = false, | ||
done = function () { | ||
if (loaded) { | ||
// If the application iframe has already loaded then a subsequent load | ||
// means that the application was reloaded and the debugger didn't catch it. | ||
// This reloads the entire page with the new application url such that the debugger | ||
// and the application remain in sync. | ||
self._navigateToUrl(window.location.href); | ||
return; | ||
} | ||
if (self.opened) { | ||
self.iframe.setStyle('height', 'auto'); | ||
self.iframe.setStyle('height', self.window.document.body.scrollHeight + 'px'); | ||
} | ||
// If either catching of navigation was not possible, now it is | ||
// since the iframe is fully loaded. | ||
self._catchLinkNavigation(); | ||
self._catchFormNavigation(); | ||
loaded = true; | ||
// Asynchronously calling callback to make sure the application is shown entirely before the debugger. | ||
// This seems to avoid flickering. | ||
setTimeout(function () { | ||
callback(); | ||
}, 0); | ||
}; | ||
if (Y.Debug.mode !== 'hide') { | ||
@@ -90,30 +118,7 @@ self.open(false); | ||
iframe.on('load', function () { | ||
if (loaded) { | ||
// If the application iframe has already loaded then a subsequent load | ||
// means that the application was reloaded and the debugger didn't catch it. | ||
// This reloads the entire page with the new application url such that the debugger | ||
// and the application remain in sync. | ||
self._navigateToUrl(window.location.href); | ||
return; | ||
} | ||
if (self.document.readyState === 'complete') { | ||
done(); | ||
} | ||
if (self.opened) { | ||
self.iframe.setStyle('height', 'auto'); | ||
self.iframe.setStyle('height', self.window.document.body.scrollHeight + 'px'); | ||
} | ||
// If either catching of navigation was not possible, now it is | ||
// since the iframe is fully loaded. | ||
self._catchLinkNavigation(); | ||
self._catchFormNavigation(); | ||
loaded = true; | ||
// Asynchronously calling callback to make sure the application is shown entirely before the debugger. | ||
// This seems to avoid flickering. | ||
setTimeout(function () { | ||
callback(); | ||
}, 0); | ||
}); | ||
iframe.on('load', done); | ||
}, | ||
@@ -120,0 +125,0 @@ |
{ | ||
"name": "mojito-debug", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "mojito-debug helps developers debug their applications through debug hooks, whose results are shown on the client-side under the application when the 'debug' parameter appears in the URL.", | ||
@@ -5,0 +5,0 @@ "author": "Albert Jimenez <jimenez@yahoo-inc.com>", |
Sorry, the diff of this file is not supported yet
421103
2812