.newApply() ?

Garrett Smith dhtmlkitchen at gmail.com
Sat Nov 10 17:17:58 PST 2007


I know it's too late for a proposal, but I keep wanting a couple of
things for AOP stuff.

One is a newApply

Creational = {
getByNode : function(el){
	if(!this.hasOwnProperty("instances")) this.instances = {};
	return this.instances.hasOwnProperty(el.id) && this.instances[el.id] ||
	(this.instances[el.id] = this.new.apply(arguments)); // <-- Fictitious syntax.
}
}

function Widget(el, dir){

}

Wiget.getByNode = Creational.getByNode; // Borrow the getByNode method

So that way, I can have a Widget based on a node, yet still pass
varargs to the constructor.

Garrett

-- 
Programming is a collaborative art.



More information about the Es4-discuss mailing list