Creating custom dojox.dtl filters

Tags:

Dojo’s implementation of the Django Template Language (DTL) is pretty convenient for client-side templating in Dojo applications. However, sometimes you need to customize formatting of values, or add other custom logic to it. Using a filter for this purpose is quite convenient, but Dojo’s implementation is completely undocumented as to how you would add your own. Turns out it’s actually …

Thoughts on CoffeeScript

Tags:

I initially dismissed CoffeeScript as just another silly attempt at making JavaScript not be JavaScript. It probably also compiled the code into some sort of totally wonky JavaScript, too. However, after thinking about it for a while, I decided to actually try CoffeeScript and see for myself. Now, after using it quite extensively on some projects, I feel I’m qualified …

11 common Dojo gotchas

Tags:

Dojo is a great JavaScript toolkit, but it’s not perfect: It has a couple of gotchas that can be hard to debug just based on the error (or the lack of it). To rectify this, here’s a list of some common mistakes and their solutions. It’s usually good to just go through each of these if you can’t figure out …

Using Dojo’s dijit widgets for simple controller/view layers

Tags:

More complex JavaScript applications benefit from the MVC pattern just like other sorts of applications. Just like for other sorts of applications, there are dedicated MVC libraries for JavaScript, such as JavaScriptMVC. Dojo, in my opinion one of the most powerful and flexible JS libraries, can be easily adapted to provide a reasonably well working MVC scheme, so why use …

Can you make JavaScript’s String mutable?

Tags:

Here’s a question I was pondering a couple of days ago: Can you make JavaScript’s String object mutable, as in modifiable without having to re-assign the string. Why would this be useful? Sometimes you might share a string between objects, and you’d want changing it in one place get reflected in elsewhere. If you had a single string object, which …

Rendering graphics in JavaScript games

Tags:

As I’ve been rewriting TankWar, I’ve been thinking of various approaches to displaying the game’s graphics. At the moment, I can count three feasible approaches for rendering game graphics: DHTML – In other words, using divs with images and moving them around Canvas A hybrid: Canvas with DHTML I’ve considered each of these, and they all have some pros and …

Rewriting TankWar: Assessing the damage

Tags:

I have decided to rewrite TankWar, and I’ll be writing a bunch of blog posts about the process. If you ever wanted to know how to write a scorched earth/worms-like game using just JavaScript, now is your chance to learn ;) This is the first one: Assessing the damage. In other words, take a look at the old code and …

TankWar has online mode again: This time on Opera Unite

Tags:

You may recall an earlier post about TankWar, my 100% JavaScript cannons-game. Back when I wrote it, I included online play, but the server went down with a hard disk failure. Now, I have rewritten the online mode – this time that part is also all JavaScript – continue reading to find out what makes it tick.