Friday, July 18th, 2008

Semantic Constructors

Category: Prototype, Tip

>pre>

This monkey patch by kangax allows you to get sense from inspecting a constructor setup via Prototype.

His code changes a simple person class from:

javascript
< view plain text >
  1. Person + ''; // "function klass() { this.initialize.apply(this, arguments); }"

too:

javascript
< view plain text >
  1. Person + ''; // "function (name) { this.name = name; }"

If you want more help with Prototype and Script.aculo.us you can check out their newly changed support list.

Related Content:

Posted by Dion Almaer at 5:37 am
Comment here

+++--
3.5 rating from 21 votes

Comments Here »

Comments feed TrackBack URI

Leave a comment

You must be logged in to post a comment.