new idea for PIES

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.

阅读更多
换一批

没有更多推荐了,返回首页