Wednesday, June 27, 2012

Working with Node.js & Mootools

This article will simply explain how to make use of Mootools with ServerSide JavaScript. I am focusing on NodeJS and will try to explain how to do it. I have worked on Mootools on client side in the past, but recently got a chance to work on NodeJS project, so it is based on my current experience with this project. Ok so lets get started with a simple example of creating a class, instantiating it object and calling some functions, here it goes.

var Application = new Class(
    Implements: [process.EventEmitter],
    initialize: function()
        console.log("App initialize");
    compute: function()
        console.log("App compute");
var app = new Application();
app.on("done", function() { console.log("App done"); });

You must have Server Side mootools in the current working directory, downlodable from Mootools Site
Try running the code.

E:\mootools-node>node server.js
App initialize
App compute
App done

1 comment:

  1. I will also dig into Node.JS soon. MooTools is one of the best things happened in my life (Can't imagine myself using the other libs, maybe dojo or prototype, but still in an other dimension).