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
Learn Web Frontend with Electron
Search
Linda_pp
November 07, 2015
Technology
13k
28
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Learn Web Frontend with Electron
Slide at #nodefest
Linda_pp
November 07, 2015
More Decks by Linda_pp
See All by Linda_pp
actionlint の Linter 設計
rhysd
7
6.7k
ripgrep をライブラリとして使う
rhysd
0
790
port-monolith-to-wasm-for-chrome-extension
rhysd
0
580
Fuzzing Rust Text Editor
rhysd
1
3.1k
Vim compiled to WebAssembly
rhysd
5
2.4k
about-neovim-0.4.0-floating-window
rhysd
3
2.4k
reply.vim
rhysd
0
1.4k
Vim ported to WebAssembly (VimConf 2018)
rhysd
4
3.6k
go-selfupdate-github で ツールを自己アップデートする
rhysd
5
4.7k
Other Decks in Technology
See All in Technology
全社共通データ基盤をつくる。ソニーのDatabricks活用とデータガバナンス設計の裏側
sony
0
410
More Freedom on the Same Shared GPU Cluster: A Small Team’s Experience with vCluster
nttcom
0
130
Claude起点の仕様駆動開発
tanakaseiya
0
380
Execution in the Kingdom of Agents: Reflections on Abstraction and Complexity
bcantrill
0
840
「とりあえず動く」の先へ。 AI時代のチーム開発と内部設計/2026-slsdays
slsops
0
140
Deep Data Security 機能解説
oracle4engineer
PRO
2
690
[2026 Oracle Technical Deep Dive] OCI AI Resilience -OCIのセキュリティ対策機能をきちんと使いこなす- (2026年9月17日開催)
oracle4engineer
PRO
0
120
【データ横丁主催】AI Agentがコンテキストを使って仕事をした後、何が残るのか― 組織の経験を次の判断に引き継ぐ「Agent Memory」
shisyu_gaku
2
330
Google Cloud Next Tokyo 26登壇時のスクリプト
recruitengineers
PRO
0
190
[2026 Oracle Technical Deep Dive] AI時代のデータベース基盤をどう選ぶ? Exadata Database Serviceの選択肢と使い分け (2026年9月17日開催)
oracle4engineer
PRO
0
220
データ品質を壊しながらSnowflakeのAIに分析させてみた
kawanago
0
500
購入ドメインでの課題と取り組み
ykagano
0
130
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
So, you think you're a good person
axbom
PRO
2
2.2k
Code Review Best Practice
trishagee
74
20k
Paper Plane (Part 1)
katiecoart
PRO
2
11k
YesSQL, Process and Tooling at Scale
rocio
174
15k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
460
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Navigating Team Friction
lara
192
16k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
260
A Tale of Four Properties
chriscoyier
163
24k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Transcript
Σϒॳ৺ऀ͕ Electron Ͱϑ ϩϯτΤϯυೖͨ͠ ɹɹɹ౦ژNodeֶԂࡇ 2015
@Linda_pp @rhysd
$ ͱ--7.ͰԶݴޠίϯύΠϥ ʢ%BDITʣ 4IJCB 5SFOEZ 5JMFDUSPO • ͦͷଞ • Vim
ϓϥάΠϯʢclever-f.vim, committia.vim, …) • Crystal Languageʢຊମ, Crisp, crdoc, vim-crystalʣ
$ ͱ--7.ͰԶݴޠίϯύΠϥ ʢ%BDITʣ 4IJCB 5SFOEZ 5JMFDUSPO &MFDUSPOͰσεΫτοϓΞϓϦʂ • ͦͷଞ •
Vim ϓϥάΠϯʢclever-f.vim, committia.vim, …) • Crystal Languageʢຊମ, Crisp, crdoc, vim-crystalʣ
͓͠ͳ͕͖ • Electron ͱ • Electron Ͱ ϑϩϯτΤϯυ ೖ •
Electron ։ൃ Tips
Electron ͱ • Electron ͱ • Electron ΞϓϦͷΞʔΩςΫνϟ • ΞϓϦྫ
Electron ͱ • ΫϩεϓϥοτϑΥʔϜͳσεΫτοϓΞϓ ϦϑϨʔϜϫʔΫʢOS X, Windows, Linuxʣ • Web
ͷٕज़ͰσεΫτοϓΞϓϦ͕ͭ͘ΕΔ ʢɹɹChromium + ɹɹʣ • GitHub ʢ@zcbenzʣɼAtom Editor ͷͨΊ ʹͭ͘ΒΕͨ
http://electron.atom.io/
$ISPNJVN .BJO1SPDFTT ϝΠϯϓϩηεΞϓϦ 3FOEFSFS1SPDFTT ΣϒΞϓϦ *1$ TQBXO
Main Process • ϓϩάϥϜͷΤϯτϦϙΠϯτͰ Node.js Ξϓ Ϧ • ϒϥβΟϯυͷཧ •
ΟϯυΛ্ཱͪ͛ͯRenderer ϓϩηεΛ ىಈ͢Δ • ։͍ͨΟϯυͰ html ϑΝΠϧΛϩʔυ
Renderer Process • Main ϓϩηε͕ϩʔυͨ͠ html ϑΝΠϧ͕ ΤϯτϦϙΠϯτ ʢChrome ͷλϒʣ
• ҰൠతͳγϯάϧϖʔδΞϓϦέʔγϣϯͱ ࣮ͯ͠ • αϯυϘοΫε֎Ͱ࣮ߦ͞ΕΔ
σεΫτοϓΞϓϦ͚ػೳ • Windows Installer • Auto Updater for Windows and
OS X (Squirrel) • Desktop Integration • Dock (OS X) • αϜωΠϧπʔϧόʔ (Windows) • ௨ʢOS XɼLinuxʣ • Mac AppStore ͚Ϗϧυ
࠷খͷΞϓϦέʔγϣϯ 1 { 2 name: MinimalApp, 3 version: 0.0.1, 4
main: main.js, 5 devDependencies: { 6 electron-prebuilt: ^0.34.2 7 } 8 } 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>Minimal App</title> 6 </head> 7 <body> 8 Hello, world!! 9 </body> 10 </html> 1 'use strict'; 2 const app = require('app'); 3 const BrowserWindow 4 = require('browser-window'); 5 const path = require('path'); 6 7 app.on('ready', () => { 8 let win = new BrowserWindow( 9 {width: 800, height: 600} 10 ); 11 win.on('closed', () => { 12 win = null; 13 app.quit(); 14 }); 15 const url = 'file://' 16 + path.join(__dirname, 'index.html'); 17 win.loadUrl(url); 18 }); NBJOKT QBDLBHFKTPO JOEFYIUNM
࠷খͷΞϓϦέʔγϣϯ OPEF@NPEVMFTCJOFMFDUSPO
جຊతͳ։ൃπʔϧ • electron-compile • JS, CSS ΛΞϓϦىಈ࣌ʹ on the fly
ͰίϯύΠϧ • electron-packager • ֤ϓϥοτϑΥʔϜ͚ʹҰൃͰύοέʔδ࡞ • electron-rebuild • ໘ͳ native ύοέʔδͷϏϧυΛࣗಈԽ • electron-mocha • mocha Ͱॻ͍ͨςετΛ Electron ্ʢϝΠϯ or ϨϯμϥʣͰ࣮ߦ
αϯϓϧΞϓϦɿCurve-app IUUQTHJUIVCDPNCFOPHMFDVSWFBQQ • GitHub ͷதͷਓ ͷαϯϓϧΞϓϦ • جຊతͳ Electron ։ൃπʔϧͷ͍
ํ͕͔Δ
Ϧιʔε • https://github.com/atom/electron/tree/master/docs • ެࣜυΩϡϝϯτɽඞಡɽ • https://discuss.atom.io/c/electron • Electron ͷ࣭͕Ͱ͖ΔϑΥʔϥϜɽ
• https://github.com/sindresorhus/awesome-electron • awesome Ϧετɽ • Slack • atomio ͷ #electronɼelectron-jp
IUUQLPCJUPRJJUBDPNXJO Electron ΞϓϦྫ1 Kobito for Windows
IUUQTOZMBTDPN/ Electron ΞϓϦྫ2 Nylas N1
IUUQTXXXHJUCPPLDPNFEJUPS Electron ΞϓϦྫ3 GitBook Editor
Electron Ͱ ϑϩϯτΤϯυೖ • Electron ͷྑ͞ • ࣗͷ߹ • ϑϩϯτΤϯυΛษڧ͠ͳ͕Β࡞ͬ
ͨΞϓϦ
Electron ͷྑ͞ • େͳ web ͷࢿ࢈͕͑Δ • Node.js ͷࢿ࢈͕͑Δ •
ΣϒαʔϏε͚ʹ࡞ͨ͠ίϯϙʔωϯτ͕ͦͷ·· ͑ΔʢReact ίϯϙʔωϯτͳͲʣ • Chromium ͚ͩߟ͍͑ͯΕྑ͍ʢES2015, HTML5ɼCSS3 ͍์ʣ • ࡞Γ࢝Ί͔ͯΒಈ͔ͤΔΑ͏ʹͳΔ·Ͱ͕͘͢͝ૣ͍
ࣗͷ߹ ࣄͰʮWindows Ͱಈ͘ GUI ݕূπʔϧʯ ͕ඞཁʹͳΔ → Javaʁ Qtʁ ͲͪΒ͋·Γ֮͑ͯͳ͍…
→ Ͳ͏ͤͳΒ web ֶΔ Electron ͬͯ ΈΔ͔ʂ
web ͷ͕ࣝແ͍ͷΛߟྀʹ ೖΕͯαΫοͱͰ͖ͨ ࠓ·Ͱ΄͍͠ͱࢥ͍ͭͭࠊ͕ॏ ͔ͬͨπʔϧͬ͞ͱͰ͖Δͷ Ͱ…ʁ
ͭͬͯ͘Έͨ • ShibaɿϚʔΫμϯϓϨϏϡʔΞϓϦ • TrendyɿGitHub τϨϯυϦϙδτϦΫϥΠΞ ϯτ • TilectronɿλΠϧܕΟϯυϒϥβ •
࡞Γத
Shiba IUUQTHJUIVCDPNSIZTE4IJCB
Shiba • จॻϏϡϫʔʢϑΝΠϧอଘ࣌ʹࣗಈߋ৽ʣ • ɹɹPolymer + ɹɹTypeScript • ͪΐ͏Ͳ Polymer
1.0 ͕ग़ͨλΠϛϯάͩͬ ͨ • ϓϥάΠϯͱͯ͠ WebComponent ΛՃ͢ Δ͜ͱͰରԠจॻΛՃͰ͖ΔΑ͏ʹ͍ͨ͠ IUUQTHJUIVCDPNSIZTE4IJCB
Trendy IUUQTSIZTEHJUIVCJP5SFOEZ
Trendy • GitHub ͷ Trending ϖʔδΛ crawling ͯ͠৽نϦϙ δτϦ͕͋Ε௨͢Δ •
ϝΠϯϓϩηεଆͰ crawling ͯ͠Ϩϯμϥଆʹ௨ • ϝχϡʔόʔΞϓϦ • React + Flux + ɹ Primer +ɹɹTypeScript • Flux ָ͍͠ IUUQTSIZTEHJUIVCJP5SFOEZ
Tilectron IUUQTHJUIVCDPNSIZTE5JMFDUSPO
Tilectron • ͍σΟεϓϨΠ͚ͷΟϯυׂՄೳͳϒϥ βɽΟϯυ͕ڱ͘ͳͬͨΒϞόΠϧϖʔδʹ fallbackʢ࡞Γதʣ • ɹ React + Redux
+ ES2015 + Dexie.js • ϒϥβͷίΞ෦ Electron Λͦͷ··͑Δ <webview/> • UI ͱΩʔϚοϐϯά෦Λ͕ΜΔ IUUQTHJUIVCDPNSIZTE5JMFDUSPO
Electron ։ൃ Tips • ΩʔϘʔυγϣʔτΧοτ • ΞϓϦ config • Electron
ΞϓϦͷςετ • npm ύοέʔδͱͯ͢͠Δ • ωΠςΟϒΞϓϦʹ͍ۙσβΠϯ • …ͦͷଞʢ͕࣌ؒ͋Εʣ
ΩʔϘʔυγϣʔτΧοτ • HTML KeyboardEvent • https://github.com/ccampbell/mousetrap • https://github.com/atom/atom-keymap • Menu
ͷ item ͷγϣʔτΧοτ • global-shortcut Ϟδϡʔϧ • ϗοτΩʔͳͲ
ΞϓϦͷ config JSON Schema Ͱઃఆ߲Λఆٛͯ͠ json- editor Ͱઃఆ UI Λੜ
IUUQTHJUIVCDPNKEPSOKTPOFEJUPS
ΞϓϦͷ config IUUQTHJUIVCDPNKEPSOKTPOFEJUPS
Electron ΞϓϦͷςετ • Electron ඇґଘ → Ұൠతͳ node ΞϓϦͱಉ͡ •
Ϩϯμϥϓϩηε or ϝΠϯϓϩηεͷΈͷ୯ମςετ → electron-mocha • Ϩϯμϥϓϩηε + ϝΠϯϓϩηε • → WebDriver.js + Selenium Ͱ E2E ςετ • http://electron.atom.io/docs/v0.34.0/tutorial/using-selenium-and- webdriver/ • → ςετ࣮ߦ༻ͷখ͍͞ Electron ΞϓϦΛࣗલͰͭ͘Δ
Electron ΞϓϦͷςετ Electron ϔουϨεͰ࣮ߦͰ͖ͳ͍ͷͰɼ Travis Docker ্Ͱ࣮ߦ͢Δ࣌ԾϞχ λΛ͏ 1
before_script: 2 - "export DISPLAY=:99.0" 3 - "sh -e /etc/init.d/xvfb start"
npm ύοέʔδͰఏڙ͢Δ • ύοέʔδͱͯͭͭ͠͠ɼίϚϯυҰൃͰೖ Δ npm ύοέʔδͱͯ͢͠Δ • electron ͷόΠφϦΛෳΞϓϦͰڞ༗͢Δ
• electron-prebuilt Λ͋͑ͯґଘؔʹೖΕͳ͍ ʢnpm2ʣ • npm3
ωΠςΟϒΞϓϦʹ͍ۙ σβΠϯ • PhotonʢOS X ෩ʣ IUUQQIPUPOLJUDPN
ωΠςΟϒΞϓϦʹ͍ۙ σβΠϯ • react-desktop • ʢϓϥοτϑΥʔϜωΠςΟϒͳσβΠϯʣ IUUQQIPUPOLJUDPN
γϯάϧΠϯελϯεΞϓϦ 1 var myWindow = null; 2 3 var shouldQuit
= app.makeSingleInstance(function(cmdline, workdir) { 4 // Someone tried to run a second instance, we should focus our window 5 if (myWindow) { 6 if (myWindow.isMinimized()) myWindow.restore(); 7 myWindow.focus(); 8 } 9 return true; 10 }); 11 12 if (shouldQuit) { 13 app.quit(); 14 return; 15 } 16 17 // Create myWindow, load the rest of the app, etc... 18 app.on('ready', function() { /*...*/ }); ಉ͡ΞϓϦΛෳىಈ͠ͳ͍Α͏ʹ͢Δʢv0.34.1~ʣ
ϝχϡʔόʔΞϓϦ MojibarʢֆจࣈೖྗʣɹgitifyʢGitHub ௨ʣ IUUQTHJUIVCDPNNVBONPKJCBS IUUQTHJUIVCDPNFLPOTUBOUJOJEJTHJUJGZ
ϝχϡʔόʔΞϓϦ Electron ͷΟϯυΛϝχϡʔόʔΞϓϦ ͱͯ͠ wrap ͨ͠ϥΠϒϥϦ IUUQTHJUIVCDPNNBYPHEFONFOVCBS
ipc ͷҙ • ipc େ͖͍σʔλΛΓͱΓ͢Δͱ͍ • େ͖͍σʔλΛΓͱΓ͢Δͷආ͚Δ • ϑΝΠϧܦ༝ •
WebSocket • ϝΠϯϓϩηεΛ worker తʹ͏ͷΊͯ WebWorker Λ͏ • https://github.com/atom/electron/issues/1258
·ͱΊ • Electron ͰσεΫτοϓΞϓϦ͕؆୯ʹͭ͘ ΕΔ • ΫϩεϒϥβΛؾʹͤͣϑϩϯτΤϯυٕ ज़Λֶָ͘͠Δ • Electron
ͰφΠεͳσεΫτοϓΞϓϦΛͭ ͘ΔͨΊͷݟΛڞ༗͍͖ͯ͠·͠ΐ͏ʂ