Tea and Cake

The adventures of a small spotted skunk.

Making javascript classy, for better or worse

written by pomke, on Jan 5, 2011 5:10:00 PM.

A long time ago, ooh six years now I was working on a heavily Javascript based project with a team of pythonistas turned reluctant UI programmers. Before you say anything, yes I know Javascript is a prototype based language and that is one of its strengths, however in some situations having a class implementation helps fit the language into functionally fixed brains.

The Pomke Javascript Library was something that I created and adapted over time to fill this gap. The library implements two basic concepts, a class and a module construct. These behave in a way that will make python developers feel right at home, modules can depend on other modules which will be demand loaded, classes support multiple inheritance with a sane MRO, your methods are bound to your objects so they can be handed off as callbacks and maintain their reference to self^h^h^h^hthis and much more.

Anyway, I’ve dug it out recently of a project which is removing this style of programming and I’ve put up a bit of a page with a demo which you can find here. I hope this can be of some use to someone somewhere ^_^

Lots of Love,

Pomke

Leave a Reply