Web technologies for desktop development

26
Web technologies for desktop development Darko Kukovec @DarkoKukovec

description

 

Transcript of Web technologies for desktop development

Page 1: Web technologies for desktop development

Web technologies for desktop development

Darko Kukovec@DarkoKukovec

Page 2: Web technologies for desktop development

Hybrid apps

● Web technologies + native wrapper● Mobile hybrid apps

– PhoneGap– Custom

● Desktop

Page 3: Web technologies for desktop development

Why hybrid desktop applications?

Page 4: Web technologies for desktop development

Multi-platform development

• Java

• .NET + mono

• QT

• Hybrid app

Page 5: Web technologies for desktop development

Wrappers

Page 6: Web technologies for desktop development

Adobe Air

• Slow

• Limited developer tools

• HTML5 + ActionScript

• Distribution: Executable file

Page 7: Web technologies for desktop development

Qt

• Custom wrapper

• HTML5 + native code– C++– Python– JavaScript

● Distribution: Executable file

Page 8: Web technologies for desktop development

Chrome Apps

● HTML5 + Chrome APIs– 50+ APIs

● Distribution: Chrome Web Store

Page 9: Web technologies for desktop development

app.js

• webkit + node.js

• Slow development

• HTML5 + node.js● Distribution: Executable file

Page 10: Web technologies for desktop development

node-webkit

● Chromium + node.js● Fast development (Intel)

– Chromium 30– node.js 0.10.18

● HTML5 + node.js● Distribution: Executable file

Page 11: Web technologies for desktop development

node-webkit

Getting started

Page 12: Web technologies for desktop development

• What is needed– node-webkit– manifest– HTML, JS

Hello world!

Page 13: Web technologies for desktop development

Running & testing

● running– nw is in the Terminal path– nw .

● testing– Chromedriver– Selenium

Page 14: Web technologies for desktop development

Debugging

● Chrome Developer Tools● DevTools jail● remote debugging● Sublime Text 2 console

Page 15: Web technologies for desktop development

Packaging & distribution

● package.nw or package.json in the same folder as the node-webkit executable

● Packaging into the executable file– Windows and Linux

● Make the node-webkit package● Windows: copy /b nw.exe+app.nw app.exe● Linux: cat /usr/bin/nw app.nw > app && chmod +x app

– OS X● Copy the app into the Contents/Resources folder

of the node-webkit app

Page 16: Web technologies for desktop development

Native elements

● file dialogs– Files and folders

● Opening URLs in the default browser● Opening files in the default app or in the file

manager● menu bar / status bar● Clipboard access● kiosk mode

Page 17: Web technologies for desktop development

Tech stuff

Page 18: Web technologies for desktop development

Node.js changes

● global → window● Chromium console instead of node.js

console● conflicts

– node.js require and require.js● Solution: rename window.require befor loading

the require.js– node.js crypto and Chromium crypto

Page 19: Web technologies for desktop development

Node.js modules

● builtin– require

● JavaScript– Local install– node_modules

● C/C++– nw-gyp– Platform dependent– Node-webkit version dependent

Page 20: Web technologies for desktop development

DOM changes

● iframe– Disabled security features– Enabled node.js– Developer Tools

Page 21: Web technologies for desktop development

● v8 snapshot– Can hide a part (tens of KB) of the code into a binary

file– Platform dependent– Little slower than the regular code– Loaded before the regular code

Code protection

Page 22: Web technologies for desktop development

Who uses node-webkit

And what interesting features

Page 23: Web technologies for desktop development

Who uses node-webkit

● Infinum :)– 3 projects (Windows and OSX)– Crypto

● about 50x faster than Adobe Air– Optical media access

● Detection and reading

Page 24: Web technologies for desktop development

Who uses node-webkit

● Gifrocket– Creating gif animations from videos

● Ambiance– code editor with modules (npm)

● Arduinoscope– oscilloscope for Arduino– Hardware access

● Everytime– video bookmarking– Communicates with the VLC player

Page 25: Web technologies for desktop development

What can be done?

● Node.js + Chromium

Page 26: Web technologies for desktop development

Thank you for your attention