-
Notifications
You must be signed in to change notification settings - Fork 232
Open
Description
据我所测试,web端的document.write这个应该和直接引入<script >的效率无异把。
所以基于此处,我是建议之间编译整个脚本块,
//<script>
Wind(function(){//包裹整个代码域
//可能而外需要做的就是判定Wind.compile是否在字符串中
var hello = Wind.compile("async", function () {
console.log("hello")
};
})
//<script>当然,如果真的是要预编译整个文档,我更推崇下面这种写法,更加优雅客观:
//<script>
Wind(function(){//包裹整个代码域
//可能而外需要做的就是判定Wind.compile是否在字符串中
var hello = function () {
"using wind";
console.log("hello")
};
})
//<script>这种写法就不用写一堆的判定了把,只要一些正则和字符串处理就OK了,更优雅的实现不是?@JeffreyZhao
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels