Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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.5k
改善 Programmer 生活的 SQL 技巧
racklin
44
62k
Builds Desktop-App for Web Developers
racklin
4
500
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.8k
Other Decks in Programming
See All in Programming
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
140
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
410
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
490
Simple Storage Service(S3) is not simple
iwatsukayura
0
280
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
contenteditable と日本語入力に向き合う
colorful12
0
190
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.3k
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
カツオ、ご期待ください
suneo3476
0
180
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
230
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
6k
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
225
10k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
How to Ace a Technical Interview
jacobian
280
24k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
Ruling the World: When Life Gets Gamed
codingconduct
0
400
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Bash Introduction
62gerente
615
220k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
930
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
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