JavaScript Firebug的控制台助手

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript Firebug的控制台助手相关的知识,希望对你有一定的参考价值。

var put = function() { try{ console.log.apply(this,arguments); }catch(e){ alert(arguments); } };
function logAllMembers( obj ) {
	for( var member in obj )
		if ( obj[member] != null)
			put(member + ' = ' + obj[member] + '\n Argument(s) length: ' + obj[member].length +'\n');
};

/*  use 'put' like this: put('this is a message that will appear in the console');

use 'logAllMembers' like this:
// make a class
FOO.insides = function (){}; 
FOO.insides.prototype = { 

  count:  10,
  stub:   [],

  methodOne: function(args){
    return 'method one';
  }, 
  
  methodTwo: function(args, args2, args3){
    return 'method two'
  } 
};
// create a new instance
bar = new FOO.insides();

bar.stub = ['apple','banana','pear','peach','apple'];

// look inside the instance
logAllMembers(bar);

// will return this:
stub = apple,banana,pear,peach,apple 
 Argument(s) length: 5
count = 10 
 Argument(s) length: undefined
methodOne = function (args) { 
  return "method one"; 
} 
 Argument(s) length: 1
methodTwo = function (args, args2, args3) {
 return "method two";
}
 Argument(s) length: 3

*/

以上是关于JavaScript Firebug的控制台助手的主要内容,如果未能解决你的问题,请参考以下文章

火狐插件(fireBug)

火狐插件(fireBug)

WEB性能测试工具

通过 Firebug 控制台加载 javascript

JavaScript Firebug控制台日志代理

JavaScript 停止Firebug控制台命令错误