原创 new idea for PIES收藏

新一篇: Thought of js package, namespace or module again | 旧一篇: VML cache issue

This week, I got a new idea to achieve neat code for import, Along with the original idea, I could say here is the best JS package/import framework!

Code Sample:

Declare packages:

$package('net.sf.sarissa').
    bindSrc('scripts/sarissa/sarissa.js#Sarissa');

$package('a.b.c').
    bindSrc('scripts/test.js#Test');

scripts/test.js

$import (net.sf.sarissa.Sarissa);

function Test(url) {
    this.doc = Sarissa.getDomDocument();
    doc.load(url);
    ...
}

another js which use a.b.c.Test

$import (a.b.c.Test);

var test = new Test('test.xml');

assert (typeof Sarissa == 'undefined');  // not like the original PIES, as my new idea, Sarissa will not need to be exported to global namespace.

发表于 @ 2006年11月23日 02:59:00|评论(loading...)|编辑

新一篇: Thought of js package, namespace or module again | 旧一篇: VML cache issue

评论:没有评论。

发表评论  


当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
Csdn Blog version 3.1a
Copyright © hax