Revelations of the evening

I spent most of this evening banging my head against the wall, shaving one yak after another, trying to make headway on JSDBI. A full fledged yak shaving expedition.

How to get Venkman to run on Firefox on Gentoo

First off, I spent a fair amount of time trying to get Venkman, the javascript debugger for Firefox, to work on my Gentoo box. I kept getting the error:

An exception occurred while initializing, please file a bug.
BadMojo 4: JS Debugger Service is not installed. @
line 122 (initDebugger)

Turns out I needed to recompile Firefox with the mozdevelop flag set, which sets –enable-jsd in the configure for firefox. If only the error message was more helpful. There’s a growing thread on bug 288777 about it.

How Javascript Object.prototype works

Javascript only barely supports inhertance, by way of the Object.prototype property. If an object gets a method called on it that it doesn’t have, it looks at it’s own prototype. If it doesn’t find it there, then it looks at the prototype’s prototype, and so on recursively, until it either bottoms out, or finds a method to satisfy it. There’s a really good writeup on javascript inheritance by Kevin Lindsey.

How to use prototype.js to get both object method inheritance and class method inheritance

Do the following:

ChildClass = Class.create();
ChildClass.extend(ParentClass);
ChildClass.prototype = (new ParentClass()).extend( {
initialize: function (){
}
});

Then both methods and properties in the prototype of ParentClass get carried over, as well as things like ParentClass.myStaticMethod.

Leave a reply