平时调试JS的时候,需要大量使用alert语句,不仅效率不高,而且老弹确认窗口,让人觉得不悦。今天在网上找文章看的时候发现了一个很酷的javascript:Blackbird ,去了他的官方转转,看看这个口号是与alert说再见的js有什么特别之处。

javascript调试工具:Blackbird !say "hello" to Blackbird and "goodbye" to alert().
     这是Blackbird 的界面,够黑的,呵呵。用过firebug调试JS的朋友这个界面应该很熟悉了javascript调试工具:Blackbird !say "hello" to Blackbird and "goodbye" to alert().,现在大家知道Blackbird 的主要用途了,它就是方便JS作者输出调试信息的,看来真的可以给alert说再见了。
    Blackbird js框架中只有4个文件:blackbird_icons.png,blackbird_panel.png,blackbird.js,blackbird.css。我们只需要在页面中引入他的JS和CSS,就可以使用它方便的输出功能了。
<html>
<head>
<script type="text/javascript" src="/PATH/TO/blackbird.js"></script>
<link type="text/css" rel="Stylesheet" href="/PATH/TO/blackbird.css" />
...
</head>
...
     如需要输出上图中的信息,js代码是这样的:
     log.debug( 'this is a debug message' );
     log.info( 'this is an info message' );
     log.warn( 'this is a warning message' );
     log.error( 'this is an error message' );
     是不是很便利,呵呵。
 
看看Blackbird 的API(摘抄的):
     log.toggle()          显示或隐藏 Blackbird
     log.move()            移动
     log.resize()           修改 Blackbird 窗口显示大小
     log.clear()             清空信息
     log.debug( message )   debug 信息
     log.info( message )     一般消息
     log.warn( message )      警告信息
     log.error( message )    错误信息
     log.profile( label )     计算消耗时间
 
下图是Blackbird 控制台的快捷键:
javascript调试工具:Blackbird !say "hello" to Blackbird and "goodbye" to alert().
 

相关文章:

  • 2021-09-04
  • 2021-07-23
  • 2021-11-06
  • 2021-06-20
  • 2021-09-02
  • 2022-12-23
  • 2022-03-07
  • 2022-01-30
猜你喜欢
  • 2021-11-04
  • 2021-11-15
  • 2021-10-31
  • 2018-12-01
  • 2021-06-07
  • 2021-10-22
  • 2022-01-24
相关资源
相似解决方案