今天天文台發出雷暴警告, HKWW 已能成功顯示。
基本的流程和 function 都可以算是已經完成, 但有幾個問題須要解決。
一) 用 Extension Wizard 的 build.sh 所 compile 出來的 .xpi 不能運作
原因似乎是 build.sh compile 出來的 .xpi 和 chrome.manifest 所描述的不同。
在 chrome.manifest 中, content locale 和 skin 都是 plain directory 來 access,
但在 .xpi 中, 它們都是包含在 .jar 中。
因為仍在開發中, 所以可遲些才 fix 這個 minor bug.
二) 如果開了二個 Firefox window, 各自會 create 自己的 HKWW object
這樣, 每個 window 會各自用自己的 timer update。 因而造成顯示的資料不一的情况。
同時因為每個 window 都會下載天氣資料而浪廢了網絡資源。
解決方法為把從天文台下載資的 function 轉為一個 XPCOM Service。
但可能要多用幾日去 study XPCOM 的 details.
Reference:
How to build a XPCOM in Javascript