YUI CustomEvent没有报告错误

时间:2009-02-06 18:23:40

标签: yui error-reporting

有谁知道如何让以下内容报告javascript错误? (任何浏览器)


<head>
    <title></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js">
    </script>
    <script type="text/javascript">

        ObjWithEvent = {
            testEvent: new YAHOO.util.CustomEvent("testEvent")
        };

        ObjSubscriber = {
            handleTestEvent: function(){
                alert('the next line will not show up in the error console');
                not_a_valid_function_bro();
            }
        };

        ObjWithEvent.testEvent.subscribe(ObjSubscriber.handleTestEvent);
        ObjWithEvent.testEvent.fire();
    </script>
</head>
<body>
</body>

1 个答案:

答案 0 :(得分:10)

可能是有史以来最糟糕的默认设置之一..... 默认情况下,YAHOO.util.Event.throwErrors设置为false,因此如果您想查看错误:

YAHOO.util.Event.throwErrors = true;