Thursday, September 25th, 2008

Pi.js: Simple JavaScript Library

Category: JavaScript, Library

Azer Koculu has released his Pi.js framework, which is a lightweight system that includes a minimal set of modules, and the ability to use and provide plugins.

By default you get:

  • pi.env: browser detection
  • pi.get: DOM access
  • pi.util: Extensions to JavaScript (e.g. support currying, includes, viewport config, and more)
  • pi.base: OO subsystem
  • pi.element: Create and modify the DOM
  • p.xhr: Remoting
  • Extensions to native objects such as Array, Function, Number, and String

There are then plugins to provide functionality such as Comet support, and a storage wrapper.

Pi has been used in the excellent Firebug Lite update that Azer worked on.

Posted by Dion Almaer at 6:04 am
6 Comments

+++--
3 rating from 34 votes

6 Comments »

Comments feed TrackBack URI

whats the fuzz ?

Comment by Montago — September 25, 2008

Who would use this framework?

I took a quick look at the documentation and I didn’t find anything interesting/different/cool. Apologies if I missed something obvious.

Comment by ragjunk — September 25, 2008

How about a slickspeed competition?

Comment by Aimos — September 25, 2008

pi.env = {
ie: /MSIE/i.test(navigator.userAgent),
ie6: /MSIE 6/i.test(navigator.userAgent),
ie7: /MSIE 7/i.test(navigator.userAgent),
ie8: /MSIE 8/i.test(navigator.userAgent),
firefox: /Firefox/i.test(navigator.userAgent),
opera: /Opera/i.test(navigator.userAgent),
webkit: /Webkit/i.test(navigator.userAgent)
};

Oh, boy!

Comment by eyelidlessness — September 25, 2008

Holy crip it’s a crapple:
.

var MyForm = new pi.element("form").attribute.addClass("MyForm").child.add(
new pi.element("label").update("Username:"),
new pi.element("input").attribute.set("type","text"),
new pi.element("button").event.addListener("click",function(){
alert("Hello World!");
}).update("Submit")
).insert(document.body);

.
.
to create:

Username:

Submit

Comment by TNO — September 25, 2008

Ajaxian fail…corrected result from above code:

to create:
<form class=”MyForm”>
<label>Username:</label>
<input type=”text”>
<button>Submit</button>
</form>
</code>

Comment by TNO — September 25, 2008

Leave a comment

You must be logged in to post a comment.