In association with heise online

23 January 2013, 14:03

JavaScript developers can experience dejavu

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

Dejavu logo For developers who are familiar with Object Orientation as implemented in PHP or Java, moving to JavaScript's prototypical inheritance model can be difficult, despite the power and flexibility it offers. That's why the developers at Indigo United have created dejavu, a JavaScript library which layers classical inheritance over JavaScript's native inheritance.

Dejavu offers classes (concrete, abstract and final), interfaces, mixins, private and protected members, static members, constants, context binding for functions, signature checks for methods, and more. A class declaration with dejavu can look like this:

var Person = Class.declare({
$name: 'Person',
_name: null,
__pinCode: null,

initialize: function (name, pinCode) {
this._name = name;
this.__pinCode = pinCode;
setTimeout(this._logName.$bind(this), 1000);

getName: function () {
return this._name;

_logName: function () {

The library comes with two builds, regular and AMD, the latter being optimised for speeding up the developer workflow by not needing to recompile everything. Each supports two modes, strict and loose, the former enforcing many checks during development, the latter performing fewer checks and therefore performing faster in production. The build system also includes an optimiser to make generated code more efficient and which also has specific modes to optimise for node.js and V8.

The code for dejavu is available from the project's GitHub repository, where there are further instructions on how to use the library and examples of its use. Dejavu is released under the MIT licence.


Print Version | Send by email | Permalink:

  • July's Community Calendar

The H Open

The H Security

The H Developer

The H Internet Toolkit