From 1e5b9b98e039408dca420e42fb576f8a5bdc121c Mon Sep 17 00:00:00 2001 From: cskwg Date: Mon, 10 Jun 2013 11:50:45 +0300 Subject: [PATCH] Update openseadragon.js modified console to make it easy to break into the debugger when errors happen. --- src/openseadragon.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index ee5e0dac..45c10bb7 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -1341,11 +1341,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ request.open( "GET", options.url, options.async ); request.send( null ); } catch (e) { - $.console.log( - "%s while making AJAX request: %s", - e.name, - e.message - ); + $.console.log(e.name + " while making AJAX request: " + e.message); request.onreadystatechange = null; request = null; @@ -1637,18 +1633,19 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ * @static * @private */ - var nullfunction = function( msg ){ - //document.location.hash = msg; - }; - - $.console = window.console || { - log: nullfunction, - debug: nullfunction, - info: nullfunction, - warn: nullfunction, - error: nullfunction + // modified to make it easy to break into the debugger when errors happen. + var logfunction = function (msg) { + if (window.console) return window.console.log(msg); + window.alert(msg); }; - + $.console = { + log: function (msg) { logfunction(msg); }, + debug: function (msg) { logfunction(msg); }, + info: function (msg) { logfunction(msg); }, + warn: function (msg) { logfunction(msg); }, + error: function (msg) { logfunction(msg); } + }; + // Adding support for HTML5's requestAnimationFrame as suggested by acdha. // Implementation taken from matt synder's post here: