Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
XULRunner + JS 開發跨平台且具擴充性應用程式
Search
Rack Lin (阿土伯)
May 17, 2013
Programming
1.6k
9
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
XULRunner + JS 開發跨平台且具擴充性應用程式
Rack Lin (阿土伯)
May 17, 2013
More Decks by Rack Lin (阿土伯)
See All by Rack Lin (阿土伯)
Phalcon / Phalcon Kernel / Zephir 簡介
racklin
14
2.4k
改善 Programmer 生活的 SQL 技巧
racklin
44
62k
Builds Desktop-App for Web Developers
racklin
4
470
Web 開發者也可以寫出跨平台的 Desktop App
racklin
17
5.7k
Plugin-able POS Solutions by Javascript @HDM9 Taiwan
racklin
9
1.5k
Phalcon PHP Framework and Phalcon Kernel Introduction - phpconftw2012
racklin
10
2.7k
Other Decks in Programming
See All in Programming
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
500
yield再入門 #phpcon
o0h
PRO
0
700
アルゴリズムは何を圧縮しているのか ─ Haskell から育った「圧縮代数」というメンタルモデル
naoya
16
3.6k
継続モナドとリアクティブプログラミング
yukikurage
3
630
AIエージェントで 変わるAndroid開発環境
takahirom
2
710
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
400
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
150
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
160
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
350
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
2
270
Embedded SREと共に達成した会員管理システムのAWS移行 - SRE NEXT 2026 ランチスポンサーセッション
niftycorp
PRO
1
2.9k
Foundation Models frameworkで画像分析
ryodeveloper
1
130
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
640
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
260
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
490
Discover your Explorer Soul
emna__ayadi
2
1.2k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.6k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Designing for Timeless Needs
cassininazir
1
390
Speed Design
sergeychernyshev
33
1.9k
Everyday Curiosity
cassininazir
0
260
Transcript
XULRunner + JS 開發跨平台且 具擴充性應⽤用程式 Rack Lin
阿土伯 @JSDCTW2013
about:me • ViViPOS Co., Ltd 技術總監 – 利用
JavaScript 寫 〞收銀機〞(傳統產業,全新感受) • CoCo 都可、50嵐、歇腳亭、Yamaha 、星聚點KTV…… • PHP / JavaScript / Java Programmer (目前移情於 Scala ) •
[email protected]
• hRps://twiRer.com/racklin • hRp://www.plurk.com/racklin • hRps://www.facebook.com/racklin1002 • hRp://racklin.blogspot.tw/ (生小孩後就變癈墟)
about:me • 我是坐在電腦 前端的工程師。
跨平台程式開發 • 工程師的浪漫?寫跨平台程式是我的夢想。
跨平台定義 • 下忍時以為跨平台程式就是: 跨
Windows 95 / Windows 98 / Windows NT Windows XP …………
跨平台定義 • 中忍時跨平台程式是: 跨
Windows / Linux / Mac OSX
跨平台定義 • 上忍時跨平台程式是: 跨
Windows / Linux / Mac OSX Mobile Android / iOS / Firefox OS
跨平台定義 • 只有火影能: 跨
Windows 8 / Windows 8 RT
跨平台的挑戰 • GUI ToolKits • Binding Languages
• … • … • … • 因為 JSDC + 時間關係 – 總之選定 XULRunner + JS
在開始談 XULRunner 前 你聽過 Rich Client Pla`orm 嗎?
Rich Client Platform (wiki) • A standard bundling framework
• User interface management • User settings management • Storage management • Window management • Update manager - Eclipse RCP - Netbeans Platform - Spring Framework RCP
Netbeans Pla`orm • Empty app1 (30MB)
WHY RCP • 寫完一支程式很容易,完成一個產品是很 困難的。 – 經常 Branch / Code
Generator Customer A Customer B Customer C
是做產品還是代工? • 你希望再代工多少個, 讓我們數到十。
WHY RCP • Upstream Core Components • Customizadon
– Customer A ( Core + A1 + B1 + C1 ….) – Customer B ( Core + A1 + C1 + D1 …) – Customer C ( Core + A1 + E1 + F1 …) XULRunner / Applicadon Launcher Core (Main UI / API)
將專案拆成小模組 • 這裡的模組化,並不是程式中的套件或模組, 而是彼此獨立的應用程式。 • 小模組易於開發及測試 • 小模組昇級容易且快速
• 小模組各思其職 • 想想 eclipse / netbeans IDE . • 想想 firefox / google chrome
一堆小模組
產品
Javascript 界的 RCP XULRunner
Firefox • Firefox 是基於 XULRunner 下開發。 – 在 URL
中輸入 – chrome://browser/content/
Incepdon?
XULApp StarterKit • hRps://github.com/racklin/xulapp-‐starterkit • Build Scripts (MacOSX
/ Linux / Windows) • Skeleton UI Sehngs – Window / Menubar / Statusbar • Javascript Libraries – jQuery – GREUdls – Lodash • Embedded Develop Tools – SQLite Manager – DOM Inspector – JSConsole
XULApp StarterKit • MacOSX DMG (34MB)
XULRunner 基本特色 • Cross-‐Pla`orm • I18n / l10n
• Gecko rendering engine – HTML5 * – CSS3 – JavaScript – XML (XSLT, XMLHRpRequest, DOMParser)
當成 PhoneGap 用 XULApp StarterKit Demo
HTML5 / CSS3 / JS hRps://github.com/racklin/xulapp-‐starterkit-‐app-‐webapp-‐wrapper hRps://github.com/racklin/xulapp-‐starterkit-‐app-‐todomvc
Hybrid Development • TodoMVC With NodeJS+ExpressJS – HTML5 for
FrontEnd, NodeJS for BackEnd Services
萌典 Windows/Linux/MacOSX Preferences System
萌典 Windows/Linux/MacOSX Preferences System
XULRunner 神兵 • XUL – XUL – XUL Overlays
• Preferences System • XPCOM(Cross-‐Pla`orm Component Object Model) – C++ / Python / Java / Javascript – Low Level API • Ex. File Systems / Databases / Thread
XULRunner 利器 • Installadon and upgrade mechanism – XPInstall
• Extension Manager • XBL – reusable components
XULRunner + JS 開發跨平台且 具擴充性應⽤用程式
XUL • XML User Interface Language。 – 啥?
– 它提供了⼀一套跨平台的widget定義。 • BuRon / List / Tree / Tab / Menubar. – Why ?? 我們已經有 HTML5 了? • 如同 Java 中的 Swing / SWT • XUL 使用的是 Nadve Pla`orm UI. HTML 則是由 CSS 中定義,各平台一致。
Mac OSX XUL DEMO
Linux XUL DEMO
大家看出差異了嗎?
沒有是正常的! Linux 裝了 mac4lin - Mac OS/X 主題
XUL Overlays • 由 chrome.manifest 中以 URI 定義
– overlay chrome://a/content/a.xul chrome://b/ content/b.xul • UI overlays – Like: $(‘#id’).arer(<html>) , $(‘#id’).before(<html>) – 發生在 DOMContentLoaded Event Trigger 之前 • Scripts Hook – Javascript Script tag 也能 overlay , 所以我們可以於 Extensions 插入 js 至現有程式中。
XUL Overlays • 還有一個兄弟 override – 用另一個 URI
內容 取代原 URI 內容。 – overide chrome://a/content/a.xul chrome://b/ content/b.xul
Live Coding Demo XUL Overlays / Override
Overlay Demo
Overlay Demo
Override demo
XUL Overlays / override • 它解決了程式設計師在實作 Plugin 的困苦
– 在即有程式中,感知擴充程式的存在並溝通 – 在即有畫面中,提供擴充程式描繪 UI / 佈局 • Override 它解決了 – Live Patch bugs – Template / Reports
Preferences System • about:config 看到的東西 • App or
Extensions 目錄下的 \defaults \preferences\*.js as system preferences. • Profile 目錄下的 prefs.js as user preferences. • Merge system and user preferences when startup .
Preferences System • Key-‐Value Databases ( JSON) •
User Preferences • Registry System • Inter-‐Process-‐Communicadon (別這麼用)
XPCOM • 提供 Driver / Adaptor – DBUS /
OSD / VKB / ZeroMQ • 利用 C++ 實作高效能 • mozIJSSubScriptLoader – 強大邪惡的存在 – Extend DSL -‐> JS – Encode JS – Trial Expire Date
Ready for Producdon ? 工程師都怕將來被釘在牆上
XULRunner Hall of Fame • Firefox • Komodo
Edit • Flickr Uploader • VIVIPOS – 全球超過 6000 台收銀機日以繼夜的當白老鼠
LIVE DEMO VIVIPOS
HDM9 • 在眾設計師面前, VIVIPOS 太醜。 向業界可 敬的對手
CASIO POS 山寨 致敬
VIVIPOS MAIN UI
Addons Manager Demo Enable 台灣電子發票 Addon.
Main UI With 電子發票 電子發票 UI Overlay 至現有
POS 視窗 電子發票 相關功能鍵
後台設定 • 新的 Icon 出現在後台設定(Preferences) 電子發票設定
Services Binding • User Preferences / Services Registry.
來自電子發票 Addon Link Services To UI
剩下十秒鐘了
買房子最重要的三件事: LOCATION LOCATION LOCATION
寫軟體最重要的三件事: EXTENSION EXTENSION EXTENSION
工商服務 歡迎提案合作
Resources • Slide: hRp://goo.gl/w1WIh • XULApp StarterKit:
hRps://github.com/racklin/xulapp-‐starterkit • XULRunner – MDN hRps://developer.mozilla.org/en-‐US/docs/ XULRunner