Javascript + Firebug console.log (), how not to get exceptions?

I am writing a javascript / HTML5 canvas library to provide the basic GUI elements for web audio applications.

There's a small demo of a script that creates widgets with a library and compiles them in a graphical interface. You can find it @ http://bitterspring.net/webshifter/

The problem is that it works correctly in Chrome and Firefox 3.6 - 4.0, but, in the latter cases, only with firebug. Without a firebug script, it seems to see nothing on the screen, while with firebug it does.

The only firebug related code components are some console.log instructions that I use to track library behavior. But these statements should not affect a browser that does not support firebug, as I learned on the Firebug forums. What can prevent the example script from working in these cases?

For example, the library code + example was recently added http://github.com/janesconference/KievII .

EDIT: It appears that when the console is undefined, console.log () throws an exception. Is there a way to save code logging lines and not get exceptions? (yes, you can check the console! = undefined, but is there a better way?)

EDIT: looks like it's a trick ( Font )

if (typeof console=="undefined"){console={log:function(A){var B=false;if(B){alert(A)}}}}
+3
1

, console .

:

if (typeof console=="undefined"){console={log:function(A){var B=false;if(B){alert(A)}}}}

- console - Firefox 4, console , console.

console, , : http://benalman.com/projects/javascript-debug-console-log/, .

+2

Source: https://habr.com/ru/post/1768148/


All Articles