Fun With MooTool Part 3: Class Mutators

2013 Jun23

he Class system in [Mootools]( a exceptionally powerful for the little amount of code that it is comprised of. A large part of that power comes from the Mutator system. A Mutator can be thought of a lot like a plug-in. However unlike most plug-ins that are executed at run time, Mootools Mutators are executed at the time a class is [actually defined]( altering the end result of the class

A Mutator is nothing more than a JavaScript function that has access to the internals of the class it is attached to. These functions are stored in a Mutators namespace in the Mootools library.

Read More

Fun With Mootools Part 2: Protected Methods

2012 Jul17

rivate and protected class methods can come in handy when creating complex applications. While JavaScript doesn't provide these features natively, [Mootools]( provides a mechanism to define protected methods on a class. Protected means that the function can only be called by the originating class or a sub-class of the originating class. An attempt to call a protected function by a different class or from an instance of the class would result in error. Here is how you do that with a mootools classs:

var SecretClass = new Class({
	, initialize: function( options ){
		this.setOptions( options );
		var s = this.protectedMethod();

	 * A regular class method 
	,publicMethod: function( name ){
		alert("Hello" + ( name || "world") + "!"
Read More
filed under:  mootools class javascript oop

Pythonic Iterators With Mootools

2012 Jun12

ython comes standard with an interesting module called, [itertools](http://, which provides a set of functions that make performing complex computations that revolve around iteration much easier. It is actually a invaluable set of tools to have at your disposal when you get comfortable with them. The module itself can work with anything that implements the [iterator]( interface. An iterator is an object wrapper around some sequence that exposes a method called next. When the next method is called, the iterator should return the next item in the sequence and throws a StopIteration exception when there is nothing left in the sequence. While JavaScript doesn't

Read More

Fun With Mootools Part 1: The Class toElement method

2012 Apr14

he [MooTools]( ( My Object Orientated Tools ) JavaScript framework is a pretty sweet piece of software. It's goal is to make developing with JavaScript easier. It provides large set of tools for building complex JavaScript applications. There are a lot of hidden [goodies]( tucked away in the framework that kick off one of those ["AHa!" moments]( One of those goodies is the toElement method on classes. One of those goodies is the **toElement** method on classes.

The Class' method, toElement, works in tandem with the MooTools ( $ ) method. In most cases, Classes center around a DOM element for some reason

Read More
filed under:  dom mootools class javascript oop