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.

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

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试