這是去年在公司的簡報,最近沒什麼產值,貼貼舊文章XD
Closure Template 是google release 的工具Closure Tools其中之一,我會注意到這個工具是因為前端產生動態layout的需求愈來愈多,雖然已經很盡力要將邏輯與template分開,但前端跟layout的結合實在是太密切,很難說分就分,雖然要把layout獨立出來要花更多時間,但至少會更好維護,往後要換template也不用再重寫程式,本篇文章稍微紀錄一下使用心得與過程。
if (typeof examples == 'undefined') { var examples = {}; }
{namespace examples}
/**
* Says hello to the world.
*/
{template .helloWorld}
Hello world!
{/template}
if (typeof examples == 'undefined') { var examples = {}; }
if (typeof examples.helloworld == 'undefined') { examples.helloworld = {}; }
{template .helloName}
blablabla
{/template}
java -jar SoyToJsSrcCompiler.jar --outputPathFormat simple.js simple.soy
前端程式越搞越複雜,接踵而至的問題越來越多,雖然瀏覽器的效能不斷地提昇,但是只要IE6沒被淘汰的一天,網頁程式設計師永遠要替IE6補洞,Memory Leak是一個非常難搞得議題。關於微軟的官方說法可以參考Understanding and Solving Internet Explorer Leak Patterns,裡頭有詳細說明IE6會如何發生memory leak的情況。發生memory leak的徵狀就是:記憶體不斷飆上去,就算reload頁面,記憶體也不會被釋放,除非關掉瀏覽器。
在此不介紹為何為引發memory leak,因為我覺得這是瀏覽器應該要處理的問題,要拿出來講只是因為IE6沒辦法處理好罷了,雖然其他瀏覽器也並不是沒有這個問題,但是至少問題都沒有這麼嚴重,因此只需要針對IE6來處理即可。以下是我整理出幾種比較好的處理方式: More »
Once you complete these steps, IE Mobile will display error messages for any script errors that occur.
new Date().getTime()來取得目前的time stamp,今天在cssRain看到JavaScript—new Date().getTime()的简写方式,發現
+new Date()這兩個會出現相同的結果,這讓我不禁好奇了「+」這個運算符他的特殊用法, 測試了幾個結果: More »

Categories
Tag Cloud
Blog RSS
Comments RSS
Last 50 Posts
Back
Void « Default
Life
Earth
Wind
Water
Fire
Light 