Skip to content

Instantly share code, notes, and snippets.

Created January 15, 2013 17:49
Show Gist options
  • Save anonymous/4540452 to your computer and use it in GitHub Desktop.
Save anonymous/4540452 to your computer and use it in GitHub Desktop.
/**
* an api for adding soemthing to the developer toolbar
*/
var devtool = require('devtools/toolbar').Tool({
label: 'My Dev Tool',
contentURL: self.data.url('index.html'),
contentScritpFile: self.data.url('tool.js')
onOpen: function(worker) {
worker.on('x', y); // etc.
}
});
/**
* an api for creating a custom logging channel in the gobal console
* firePHPConsole has the same methods as console eg log, warn, etc
* see: https://developer.mozilla.org/en-US/docs/DOM/console
*/
function firePHPParser(raw) {
// ...etc
return parsed;
}
var firePHPConsole = require('devtools/console').Console({
label: 'FirePHP',
parser: firePHPParser,
scope: 'tab' // or global
});
var firePHP = require('page-mod').PageMod({ /* etc */
contentScriptFile: self.data.url('parser.js'),
onAttach: function(worker) {
worker.on('firePHP', function(message) {
firePHPConsole.log('')
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment