GreaseMonkey作成時のデバッグ
autopagerize を勉強で読んでたら使っていて便利そうだったので。
//初期設定 var DEBUG = true; function debug() { if ( typeof DEBUG != 'undefined' && DEBUG ) { console.log.apply(this, arguments) } }
そして、
var testText = "this is test text"; debug('test:', testText);
こんな感じでデバッグしたいもの呼び出す。
これなら、リリース時には
var DEBUG = true;
の true を false に変えるだけでいいし。
便利。