Slide 1

Slide 1 text

Christian Liebel @christianliebel Consultant Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 2

Slide 2 text

Hello, it’s me. Superkräfte für Produktivitäts-PWAs – Project Fugu Christian Liebel Twitter: @christianliebel Email: christian.liebel @thinktecture.com Angular & PWA Slides: thinktecture.com /christian-liebel

Slide 3

Slide 3 text

The image part with relationship ID rId3 was not found in the file. The image part with relationship ID rId3 was not found in the file. The image part with relationship ID rId3 was not found in the file. Special Day “Modern Business Applications” Thema Sprecher Datum, Uhrzeit Blazor in .NET 5: Single-Page-Applications mit C# & WebAssembly Christian Weyer DI, 16. Februar 2021, 11.00 bis 12.00 Realtime Cross-Plattform-Applikationen mit Angular, ASP.NET Core und SignalR Fabian Gosebrink DI, 16. Februar 2021, 12.15 bis 13.15 Superkräfte für Produktivitäts-PWAs – Project Fugu Christian Liebel DI, 16. Februar 2021, 14.30 bis 15.30 Schneller ans Ziel: Web-Apps mit Ionic Max Schulte DI, 16. Februar 2021, 16.00 bis 17.00

Slide 4

Slide 4 text

Superkräfte für Produktivitäts-PWAs – Project Fugu Web App Manifest Service Worker

Slide 5

Slide 5 text

✅ Offline capability ✅ Push messages ✅ Webcam/microphone access File System Access Raw Clipboard Access Font Table Access Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 6

Slide 6 text

Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 7

Slide 7 text

Cross-Vendor Initiative Led By… Superkräfte für Produktivitäts-PWAs – Project Fugu Project Fugu – A More Capable Web »Let’s bring the web back – API by API« Thomas Steiner, Google

Slide 8

Slide 8 text

Superkräfte für Produktivitäts-PWAs – Project Fugu Project Fugu https://goo.gle/fugu-api-tracker

Slide 9

Slide 9 text

Process – Write an Explainer (https://github.com/WICG/native-file- system/blob/master/EXPLAINER.md) – Discuss capability with developers, browser vendors, standard orgs – Iterate – Compile a design document – W3C TAG Review (https://github.com/w3ctag/design- reviews/issues/390) – Formal spec within Web Incubator Community Group (WICG, https://wicg.github.io/native-file-system/) Superkräfte für Produktivitäts-PWAs – Project Fugu Project Fugu

Slide 10

Slide 10 text

Process – Implementation in Chromium – Launches behind a flag (chrome://flags/#enable-experimental-web- platform-features) – Origin Trial (https://developers.chrome.com/origintrials/) – Transfer to W3C Working Group + Recommendation? Superkräfte für Produktivitäts-PWAs – Project Fugu Project Fugu

Slide 11

Slide 11 text

Superkräfte für Produktivitäts-PWAs – Project Fugu Project Fugu navigator.share({ url: 'http://example.com' }); ShareIntent DataTransferManager … NSSharingServicePicker

Slide 12

Slide 12 text

Progressive Enhancement if ('share' in navigator) { navigator.share({ text: 'Hi!' }); } else { // Fallback method } Superkräfte für Produktivitäts-PWAs – Project Fugu Project Fugu

Slide 13

Slide 13 text

Badging API Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 14

Slide 14 text

Motivation - Communicate updates without distracting the user (in constrast to push notifications) - Typically displays a badge on the home screen, task bar or dock - Appearance varies from platform to platform Superkräfte für Produktivitäts-PWAs – Project Fugu Badging API

Slide 15

Slide 15 text

API Set the badge navigator.setAppBadge(5); Clear the badge navigator.clearAppBadge(); Superkräfte für Produktivitäts-PWAs – Project Fugu Badging API

Slide 16

Slide 16 text

Shortcuts Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 17

Slide 17 text

Provide secondary entry points for your application, now also for Progressive Web Apps added to the home screen Windows: Jump List iOS: Home Screen Quick Actions Superkräfte für Produktivitäts-PWAs – Project Fugu Shortcuts

Slide 18

Slide 18 text

Web App Manifest Extension { "shortcuts": [ { "name": "Direct Messages", "url": "/mails/new", "icons": [] }, { "name": "Notifications", "url": "/appointments/new", "icons": [] } ] } Superkräfte für Produktivitäts-PWAs – Project Fugu Shortcuts

Slide 19

Slide 19 text

Screen Wake Lock Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 20

Slide 20 text

Motivation - Devices go to sleep in order to reduce energy consumption - However, this can get bothersome in some situations (e.g. while watching a movie, while cooking, etc.) - The Screen Wake Lock API prevents the device from turning of the screen while the application has the wake lock Superkräfte für Produktivitäts-PWAs – Project Fugu Screen Wake Lock API

Slide 21

Slide 21 text

API let wakeLockObj; if ('wakeLock' in navigator) { try { wakeLockObj = await navigator.wakeLock.request('screen'); console.log('👍', 'Screen Wake Lock', wakeLockObj); } catch (err) { console.error('👎', 'Screen Wake Lock', err); } } Superkräfte für Produktivitäts-PWAs – Project Fugu Screen Wake Lock API https://web.dev/wake-lock/

Slide 22

Slide 22 text

https://paint.js.org LIVE DEMO Superkräfte für Produktivitäts-PWAs – Project Fugu Async Clipboard & FS Access

Slide 23

Slide 23 text

Async Clipboard API Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 24

Slide 24 text

API Copy Content await navigator.clipboard.writeText('foo'); await navigator.clipboard.write(/* data */); Paste Content const content = await navigator.clipboard.readText(); const content = await navigator.clipboard.read(); Superkräfte für Produktivitäts-PWAs – Project Fugu Async Clipboard API

Slide 25

Slide 25 text

File System Access API Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 26

Slide 26 text

Motivation - Currently, websites only have very limited access to the file system - Some applications heavily rely on working with files (e.g. Visual Studio Code) - Wouldn’t it be great if your web application could open files or folders from the native file system? Superkräfte für Produktivitäts-PWAs – Project Fugu File System Access API

Slide 27

Slide 27 text

API if ('showOpenFilePicker' in window) { const [handle] = await window.showOpenFilePicker(); const file = await handle.getFile(); // do something with the file } else { // use fallback API or disable feature in app } Superkräfte für Produktivitäts-PWAs – Project Fugu File System Access API

Slide 28

Slide 28 text

API const [handle] = await self.showOpenFilePicker({ multiple: true, types: [{ description: 'PNG files', accept: {'image/png': ['.png']} }] }); Superkräfte für Produktivitäts-PWAs – Project Fugu File System Access API

Slide 29

Slide 29 text

File System Handling API Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 30

Slide 30 text

Motivation Register your PWA as a handler for file extensions Requires installing the application first Declare supported extensions in Web App Manifest and add imperative code to your application logic Superkräfte für Produktivitäts-PWAs – Project Fugu File System Handling API

Slide 31

Slide 31 text

Manifest Extension { "file_handlers": [{ "action": "/", "accept": { "image/png": [".png"] } }] } Superkräfte für Produktivitäts-PWAs – Project Fugu File System Handling API

Slide 32

Slide 32 text

API if ('launchQueue' in window) { launchQueue.setConsumer(async params => { const [handle] = params.files; // do something with the handle }); } Superkräfte für Produktivitäts-PWAs – Project Fugu File System Handling API

Slide 33

Slide 33 text

Superkräfte für Produktivitäts-PWAs – Project Fugu Summary

Slide 34

Slide 34 text

New powerful APIs regularly ship with new releases of Chromium-based browsers Some only add minor finishing touches, others enable whole application categories as productivity apps to finally make the shift to the web Some APIs already made their way into other browsers (e.g., Web Share) Fugu process makes sure that capabilities are implemented in a secure, privacy-preserving manner Let’s make the web a more capable platform! Superkräfte für Produktivitäts-PWAs – Project Fugu Summary

Slide 35

Slide 35 text

Q&A Superkräfte für Produktivitäts-PWAs – Project Fugu

Slide 36

Slide 36 text

Thank you for your kind attention! Christian Liebel @christianliebel [email protected]