标签:
参考文献:
http://bbs.egret-labs.org/thread-267-3-1.html
http://docs.egret-labs.org/post/manual/threelibs/uselibs.html
假设我的项目在c:\egret\demo
1. 项目发布后,有一个index.html,添加一段js:
// http://bbs.egret-labs.org/forum.php?mod=viewthread&tid=267&highlight=js
// http://docs.egret-labs.org/post/manual/threelibs/uselibs.html
function __statistics__(category,action,label,value) {
_czc.push(["_trackEvent",category,action,label,value,‘‘]);
}
2. 在项目里面调用这个js:
__statistics__(‘FRAMEWORK.BOTTOM‘, ‘CLICK‘, ‘‘, ‘‘);
3. 这个时候如果编译,会提示找不到方法。那么,在项目新建一个mylibs目录。
4. 新建一个me.d.ts:
declare function __statistics__(category:string,action:string,label:string,value:string): void;
5. 新建一个bendmark.json
{
"name": "benchmark",
"dependence": ["core"],
"source":"",
"file_list": [
"me.d.ts"
]
}
6. 修改egretProperties.json,modules下添加:
{
"name":"benchmark",
"path":"/mylibs/"
}
既:
{"document_class": "Main","modules": [
{"name": "core"},
{"name": "version_old"},
{"name": "res"},
{"name": "gui"},
{"name":"benchmark","path":"/mylibs/"}
],"native": {"path_ignore": []
},"egret_version": "2.0.2"}
7. egret build -e -clean 就可以看到编译成功了。多么的傻逼啊!
标签: