Last week, I had the enviable task of creating a skinnable version of the YouTube player using JavaScript; something that would drop some HTML into the page that could be styled using CSS. Naturally, I wanted to package it up as a reusable class so you could, if required, create several videos on a single [...]
Please, please implement getters and setters in your JavaScript engine. I cannot tell you how much I want to add this to JS.Class: var MagicMethods = { included: function(klass) { var define = function(object, name) { var shortName = name.replace(/^[gs]et[A-Z]/, function(s) { return s.charAt(3).toLowerCase() }); if (/^get[A-Z]/.test(name)) object.__defineGetter__(shortName, function() { return this[name]() }); if (/^set[A-Z]/.test(name)) [...]
A little update: JS.Class 1.6.0 is now out. The main new features are a port of Ruby’s Forwardable module for method delegation, an implementation of the State pattern (which I’m using heavily for building UI code), and JS.Ruby, which is something I wrote about a few weeks back. Also, I’ve implemented the extended hook to [...]
Further to my previous post I thought I’d share the approach I’ve been using to compose DSLs in JavaScript. If you want a more involved example, check out the currently in-development Forms module for Ojay. For this example I’m going to be writing a simple permissions language that sets up rules about when certain methods [...]
You know the old saying: with (JavaScript) { metaprogramming.is(‘possible’); } I’m going to leave the discussion of what constitutes metaprogramming to another day (read: never), but what I will say is that I’m becoming more interested in DSLs and fluent interfaces. I want the code I write to work at a very high level, where [...]
Hot on the heels of Ojay comes a new release of JS.Class, my Ruby-inspired JavaScript library for class-based OOP. Ojay is itself based on JS.Class, and has influenced the design of some of its new features. There has been one small change to the 1.0 API, and a stack of additional modules added in; it’s [...]
I’ve been wanting to talk about this project for weeks if not months, and now I finally can. the OTHER media (the web shop I work for) is open-sourcing Ojay, a project I’ve been developing on-and-off since I started at the company back in October. It’s a wrapper for the core DOM, event, animation and [...]
It looks like my language to learn for this year is Java. Last year (well, tail end of 2006) is was Ruby and Rails, and I’m very much still learning as far as those are concerned. I also got heavily into JavaScript; I’d done a little jQuery before but 2007 was the year I really [...]
After much sweating, coding, and documentaion site-building, the 1.0 release of JS.Class is upon us. Thanks to the current edge version of PackR, I’ve managed to keep the filesize down but add boatloads of new features. I’ve tried to cram as much of the Ruby way into it as I can, with a pinch of [...]
Update: from what I can gather from going through the source code, $super in Prototype actually refers to the method in the parent class, rather than the old method in the current class. My point about the other libraries mentioned below stands, though. Also, my apologies to Dan, whom I cornered at @media Ajax and [...]
© The If Works. Powered by WordPress using the DePo Skinny Theme.