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
Using only CoffeeScript to build an SmartPhone ...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Naoya Ito
October 29, 2011
Technology
9.9k
19
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Using only CoffeeScript to build an SmartPhone Application
Naoya Ito
October 29, 2011
More Decks by Naoya Ito
See All by Naoya Ito
Haskell を武器にして挑む競技プログラミング ─ 操作的思考から意味モデル思考へ
naoya
12
4.2k
Haskell でアルゴリズムを抽象化する / 関数型言語で競技プログラミング
naoya
21
7.8k
Functional TypeScript
naoya
18
6.8k
TypeScript 関数型スタイルでバックエンド開発のリアル
naoya
77
38k
シェルの履歴とイクンリメンタル検索を使う
naoya
16
6.7k
20230227-engineer-type-talk.pdf
naoya
91
86k
関数型プログラミングと型システムのメンタルモデル
naoya
63
110k
TypeScript による GraphQL バックエンド開発
naoya
29
37k
フロントエンドのパラダイムを参考にバックエンド開発を再考する / TypeScript による GraphQL バックエンド開発
naoya
67
25k
Other Decks in Technology
See All in Technology
GoとSIMDとWasmの今。
askua
3
520
LLMにもCAP定理があるという話
harukasakihara
0
250
Microsoft Build Keynoteふりかえり
tomokusaba
0
110
AIを「創る」と「使う」の循環 — HRテックが実践するリアルなAI組織実装
taketo957
0
1.8k
AIの性能が向上しても未解決な組織の重大問題は何か?/An Unsolved Organizational Problem in the Age of AI
moriyuya
2
450
protovalidate-es を導入してみた
bengo4com
0
160
AmazonRoute 53ではじめてのドメイン取得!HTTPS化までの道のりを整理してみた
usanchuu
3
110
LLMと共に進化するプロセスを目指して
ymatsuwitter
12
3.7k
AI フレンドリーなエラー監視を TypeScript で実現する
shinyaigeek
2
280
Dynamic Workersについて
yusukebe
2
640
AI活用を推進するために ファインディが下した、一つの小さな決断
starfish719
0
280
中期計画、2回作ってみた ~業務委託と正社員、両方の視点から~
demaecan
1
450
Featured
See All Featured
My Coaching Mixtape
mlcsv
0
140
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Code Reviewing Like a Champion
maltzj
528
40k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
170
The Mindset for Success: Future Career Progression
greggifford
PRO
0
360
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
200
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
200
KATA
mclloyd
PRO
35
15k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
160
エンジニアに許された特別な時間の終わり
watany
107
250k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
290
Transcript
CoffeeScript using only to build an SmartPhone Application Naoya Ito
Chrome To iOS
None
Node Titanium Mobile Chrome Extension + +
JavaScript
}); }); }); }); }); });
\(^o^)/
CoffeeScript will save us from the darkside of JavaScript
Node express = require "express" app = module.exports = express.createServer()
app.get "/", (req, res) -> res.render "index", title: "Express"
Titanium Mobile win = Ti.UI.createWindow title: "Chrome To iOS" table
= Ti.UI.createTableView top: 0 data: [] win.add table tabGroup = Ti.UI.createTabGroup tab = Ti.UI.createTab window: win tabGroup.addTab tab tabGroup.open()
Chrome Extension chrome.browserAction.onClicked.addListener (tab) -> chrome.tabs.executeScript null, file: "jquery-1.6.4.min.js", ->
chrome.tabs.executeScript null, file: "content_script.js" chrome.extension.onConnect.addListener (port) -> port.onMessage.addListener (info) -> socket = io.connect 'http://localhost:3000' socket.emit 'fireEvent:openUrl' title: info.title url: info.url image: info.image
To learn more about CoffeeScript
CoffeeScript All your product are belong to
How do they communicate with each other?
None
socket.emit() socket.emit() using socket.io for messaging
Hacking Titanium for enabling Socket.IO WebView proxy technique 0px WebView
left: -100 top: -100 enabling socket.io on HTML <head> socket.emit() Titanium.App.fireEvent() github.com/euforic/ChatSocks/tree/wv-proxy
WebView proxy for Socket.IO socket = {} socket.connect = (win)
-> proxy = Ti.UI.createWebView url: "webview/webview.html" top: -100, left: -100, width: 0 height: 0 win.add proxy # Alias for Titanium functions just for fun socket.emit = (e, params) -> Ti.App.fireEvent e, params socket.on = (e, callback) -> Ti.App.addEventListener e, callback on Titanium App
Open new URL when receiving socket events socket.on 'openUrl', (params)
-> table.prependRow $$.ui.createRow title: params.title || params.url message: 'URLを開く' image: params.image click: -> w = Ti.UI.createWindow() w.add Ti.UI.createWebView url: params.url tab.open w on Titanium App
Using socket.io on Chrome is easy # background.html <html> <head>
<script type="text/javascript" src="http://localhost:3000/socket.io/socket.io.js"></script> <script type="text/javascript" src="background.js"></script> </head> </html> # background.coffee chrome.extension.onConnect.addListener (port) -> port.onMessage.addListener (info) -> socket = io.connect 'http://localhost:3000' socket.emit 'fireEvent:openUrl' ... on Chrome Extension
done!
Node & Titanium Mobile can help you to write SmartPhone
Apps only in CoffeeScript Socket.IO makes work easy!
To learn more about CoffeeScript NO MORE JS HELL!?
Thanks! github/naoya/push-to-ios (Titanium App & Node server) github/naoya/chrome2ios (Chrome Extension)
Design inspired by: zachholman.com/posts/slide-design-for-developers/