- ARCHIVE / JS.Class
- Inheritance, revisited
Late last year, I wrote a piece titled “Where’s my inheritance“, in which I argued against the inheritance implementation of various JavaScript libraries. I’ve recently been working on a rewrite of JS.Class that is much more Ruby-like, and it’s caused me to re-examine my thoughts on this issue.
With JS.Class 1.x, I made the conscious decision [...] - Dispatching YouTube API events to individual JavaScript objects
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 [...]
- A plea to IE
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]/,
[...] - JS.Class 1.6.0: Forwardable, State, and Ruby
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 [...]
- Composing DSLs in JavaScript
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 may [...] - With a little help from with
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 [...] - JS.Class 1.5 is now out
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 [...]
- Announcing Ojay, the nice way to use YUI
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 [...]
- Bringing “static” type-checking to JavaScript
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 [...]
- JS.Class 1.0 hits the shelves
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 [...]