IndexedDB
• Implementation-independent, key-value storage for the Web"
• Very verbose and complex API, intend to be wrapped by
libraries."
window.indexedDB.open(‘database’).onsuccess =
function (evt) {
evt.target.result.transation(‘store’)
.objectStore(store).get(‘key’).onsuccess =
function (evt) {
console.log(evt.target.result);
};
};
• 以上範例還不包含錯誤處理、版本升級、新建 object store …"
Slide 12
Slide 12 text
插播:DOMRequest
var req = doSomething();
req.onsuccess = function …
req.onerror = function …
req.addEventListener(‘success’, handler);
"
• 目前新設計的 API 會偏向使用 Promise / Future"
• 別忘了 ECMAScript 6 還會有 yield
Slide 13
Slide 13 text
選字
Slide 14
Slide 14 text
窮舉法
明|天拆政府
明天拆|政府
明天拆政|府
明|天拆|政府
明天|拆|政府
Slide 15
Slide 15 text
Composition of a number
h&ps://en.wikipedia.org/wiki/Composi8on_%28number_theory%29#Examples
Change log
• Dec 2011:First version in Firefox OS Gaia"
• … optimization"
• Feb 2012:Switch to McBopomofo data"
• Feb 6th 2012:First rewrite"
• … improvements"
• Mar 2012:Desktop demo page"
• Aug 2012:Announcement on blog"
• Dec 2012:Split from Firefox OS Gaia with git filter-branch
• Jul 22nd 2013:rewrite2 begin"
• Aug 3rd 2013:Talk in COSCUP 2013"
Slide 21
Slide 21 text
已知問題
• 手機記憶體有限,GC 效能低落
• 在低階手機完全不堪使用
• 比 Emscripten 編譯的 libchewing 還要慢!?
• Closure/module pattern 內部無法單元測試
• 從外顯行為測試 ~1300 行的 Javascript:嗯,祝好運。
• There is a huge difference between hacking things
together in a short time and bootstrapping an
maintainable software project
挑戰
• 無法延遲目前的 keyboardEvent,必須要提供 sync
response"
• Race condition"
• IndexedDB in worker thread is not available in
Firefox (yet, bug 701634)"
• … 說不定全部做完
Slide 30
Slide 30 text
meta
• Mozilla is hiring in Taipei, for Firefox OS!"
• MozTW 志工招募中!"
• Code: https://github.com/timdream/jszhuyin"
• Demo: http://timdream.org/jszhuyin/"
• 貓: