第49回html5勉強会 google i/o 2014サマリー

69
Google I/O 2014サマリー agektmr@の代理のtakoratta@

Upload: takuya-oikawa

Post on 08-Sep-2014

3.362 views

Category:

Technology


2 download

DESCRIPTION

Google I/O 2014サマリー

TRANSCRIPT

Page 1: 第49回HTML5勉強会 Google I/O 2014サマリー

Google I/O 2014サマリー

agektmr@の代理のtakoratta@

Page 2: 第49回HTML5勉強会 Google I/O 2014サマリー

Google I/Oとは

ご存知だと思うので、駆け足で。

Page 3: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Google I/O 2014● 6月25日、26日にサンフランシスコで開催

● 約6,000人が参加

● 約75のセッション

Page 4: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 5: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 6: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 7: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 8: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 9: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 10: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 11: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Questions ?Ok, now go build something awesome!

https://plus.google.com/u/0/+AkihitoFujii/posts/Lyu5wRYHd9d?pid=6029333485917463794&oid=104976800917577721821

Page 12: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 13: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Google I/Oの基調講演を現地で参加出来ない開発者の方がライブストリームで見れるイベントを世界中で開催

Page 14: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 15: 第49回HTML5勉強会 Google I/O 2014サマリー

Google I/OでのHTML5関連のセッション

いくつか紹介

Page 16: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Chrome/HTML5関連の話

● Perf Culture● Polymer and the Web Components revolution● Polymer and Web Components change everything you know about

Web development● Bridging the gap between the web and apps● How we built Chrome Dev Editor with the Chrome platform● Making the mobile web fast, feature-rich, and beautiful● Mobile Web performance auditing● Making music mobile with the Web● Developing across Devices - Chrome DevTools in 2014

Page 17: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Chrome/HTML5関連の話

● Perf Culture● Polymer and the Web Components revolution● Polymer and Web Components change everything you know about

Web development● Bridging the gap between the web and apps● How we built Chrome Dev Editor with the Chrome platform● Making the mobile web fast, feature-rich, and beautiful● Mobile Web performance auditing● Making music mobile with the Web● Developing across Devices - Chrome DevTools in 2014

次の2つのセッションをお聴きください。

Polymer Web Components

Page 18: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Chrome/HTML5関連の話

● Perf Culture● Polymer and the Web Components revolution● Polymer and Web Components change everything you know about

Web development● Bridging the gap between the web and apps● How we built Chrome Dev Editor with the Chrome platform● Making the mobile web fast, feature-rich, and beautiful● Mobile Web performance auditing● Making music mobile with the Web● Developing across Devices - Chrome DevTools in 2014

ServiceWorker

Page 19: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Chrome/HTML5関連の話

● Perf Culture● Polymer and the Web Components revolution● Polymer and Web Components change everything you know about

Web development● Bridging the gap between the web and apps● How we built Chrome Dev Editor with the Chrome platform● Making the mobile web fast, feature-rich, and beautiful● Mobile Web performance auditing● Making music mobile with the Web● Developing across Devices - Chrome DevTools in 2014

Chrome Dev Editor

Page 20: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Chrome/HTML5関連の話

● Perf Culture● Polymer and the Web Components revolution● Polymer and Web Components change everything you know about

Web development● Bridging the gap between the web and apps● How we built Chrome Dev Editor with the Chrome platform● Making the mobile web fast, feature-rich, and beautiful● Mobile Web performance auditing● Making music mobile with the Web● Developing across Devices - Chrome DevTools in 2014

DevTools

Page 21: 第49回HTML5勉強会 Google I/O 2014サマリー

Bridging the gap between the web and apps オフラインファースト ServiceWorker

Page 22: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

話者

Page 23: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

I/O Bytes - The ServiceWorker: The network layer is yours to own

Page 24: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

動機

Page 25: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

ネットワークの効率的な活用

Page 26: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

オフラインって言っても

Page 27: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

完全にオフラインという場合だけではなくて

Page 28: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

不安定(辺境の地とか)

Page 29: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

しょっちゅう切れる

(お金のない地下鉄とか)

Page 30: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

なぜかわからないけど自分だけつながらない(呪われているとか)

Page 31: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

とか、あるわけですが、

Page 32: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

今はそのような異なる状況に対応したWebアプリを書くのがとても難しい

Page 33: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

ネイティブアプリの振る舞い

ネットワーク接続が必要なアプリであったとしても、

● キャッシュからリソースをフェッチし、即座に表示

● その間/その後すぐにネットワークに接続

● たとえ、ネットワークに接続できなかったとしても、ユーザーに気づかせないで動作するアプリさえある(=ユーザーの操作を邪魔しない)

Page 34: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

オフラインファースト

Page 35: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Application Cache (AppCache) というものがありますが、

Page 36: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 37: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

AppCacheの問題点

● 複雑

● きめ細かい処理が不得手

● JavaScriptからの制御が面倒

Page 38: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 39: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

ServiceWorker

● 高度なオフライン機能

● WebサイトからインストールされたJavaScriptが独立したWorkerスレッドとして動作し、Webサイトからのイベントハンドリングを実現○ Webページを閉じてもバックグラウンドで動作○ ただし、HTTPSが必須

● 頭の良い(+JSから制御可能な)“In-browser HTTP proxy”

Page 40: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

ServiceWorker

Browser

ServiceWorker Caches

Page PagePage

Internet

Page 41: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

インストール(アプリ側 / app.js)

if (‘serviceWorker’ in navigator) {

navigator.serviceWorker.register(

‘/trained-to-thrill/static/js/sw.js’,

{scope: ‘/trained-to-thrill/*’}

).then(success, failure);

}

Page 42: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

sw.jsの役割

Browser

ServiceWorker Caches

Page PagePage

Internet

● 別スレッドで動作● DOMアクセスは無し● ページとは独立した処理を

行う● ローディングの制御● 1つのServiceWorkderで複

数のページの制御が可能● キャッシュの制御

頭の良い(+JSから制御可能な)“In-browser HTTP proxy”

Page 43: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

インストール(ServiceWorker側 / sw.js)

this.addEventListener('install', function(event) {

event.waitUntil(somePromise);

});

Page 44: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

インストール(ServiceWorker側 / sw.js)

this.addEventListener('install', function(event) { event.waitUntil( caches.create('static-v1').then(function(cache) { return cache.add({ ‘/trained-to-thrill/’, ‘/trained-to-thrill/fallback.html’, ‘/trained-to-thrill/static/all.css’, ‘/trained-to-thrill/static/all.js’, ‘/trained-to-thrill/static/lego.svg’ }); }) );});

Page 45: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Fetchイベントの処理(ServiceWorker側 / sw.js)

this.addEventListener('fetch’, function(event) { console.log(event.request);});

i.e)event.request.urlevent.request.methodevent.request.headers

Page 46: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Fetchイベントの処理(ServiceWorker側 / sw.js)

this.addEventListener('fetch’, function(event) { event.respondWith(response);});

Page 47: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Fetchイベントの処理(ServiceWorker側 / sw.js)

this.addEventListener('fetch’, function(event) { event.respondWith( new Response(‘Hello ServiceWorker!’) );});

Page 48: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

キャッシュの利用(ServiceWorker側 / sw.js)

this.addEventListener('fetch’, function(event) { event.respondWith( caches.match(event.request) );});

Page 49: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

キャッシュの利用(ServiceWorker側 / sw.js)

this.addEventListener('fetch’, function(event) { event.respondWith( caches.match(event.request).catch(function() return event.default(); }) );});

Page 50: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

キャッシュの利用(ServiceWorker側 / sw.js)

this.addEventListener('fetch’, function(event) { event.respondWith( caches.match(event.request).catch(function() return event.default(); }).catch(function() { return caches.match( ‘/trained-to-thrill/fallback.html’);...

Page 51: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

AppCacheで同じことを行った場合

CACHE MANIFEST/trained-to-thrill/static/all.css/trained-to-thrill/static/all.js/trained-to-thrill/static/lego.svg

NETWORK:*

FALLBCK:/trained-to-thrill/fallback.html

Page 52: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

AppCacheで同じことを行った場合

CACHE MANIFEST/trained-to-thrill/static/all.css/trained-to-thrill/static/all.js/trained-to-thrill/static/lego.svg

NETWORK:*

FALLBCK:/trained-to-thrill/fallback.html

Page 53: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

ネットワークの接続状況に応じた処理

navigator.onLineに頼らない、ServiceWorkerによるキャッシュの有効活用が必要。

Page 54: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

参考資料

ブラウザの対応状況 → is ServiceWorker ready?

Chromiumプロジェクトページ → http://www.chromium.org/blink/serviceworker

Page 55: 第49回HTML5勉強会 Google I/O 2014サマリー

How we built Chrome Dev Editor with the Chrome platform

Chrome Dev Editor (CDE)

Page 56: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 57: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Page 58: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Chrome Dev Editor● Dart / Polymerで開発されたChrome上で動作するエ

ディタ● Chrome Webストアから入手可能● オープンソース

○ https://github.com/dart-lang/chromedeveditor/ ● Gitとの連携可能

○ git clone○ git branch○ git checkout○ など

● ダイレクトモバイルデバッグ

Page 59: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Chrome Dev Editor

● Dart Webアプリ、JavaScript Webアプリ、JavaScript/Polymer Webアプリ、Web Starter Kit, JavaScript Chromeアプリ、JavaScript Polymer CustomElementの開発が可能(テンプレートが用意されている)

● 作成したChrome WebアプリをChrome Webストアに登録可能

● ビルトインWebサーバー● マークダウンプレビュー

Page 60: 第49回HTML5勉強会 Google I/O 2014サマリー

Developing across Devices - Chrome DevTools in 2014

DevTools

Page 61: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

モバイルWeb開発に役立つ!Chrome DevToolsの新機能「デバイスモード」 | HTML5Experts.jp

Page 62: 第49回HTML5勉強会 Google I/O 2014サマリー

Graphic by Luke W. Used with permission.

Page 63: 第49回HTML5勉強会 Google I/O 2014サマリー
Page 64: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Design Develop Iterate

Page 65: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Design Responsive Layout

Page 66: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Develop Rich Emulation

Page 67: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Iterate Remote Debugging

Page 68: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

• Plug & Play

• Same powerful features

• Screencast your device

• Port forwarding· for local development

• Device Presets for most popular devices

• Rich viewport emulation

• Sensor emulation· Touch, Geolocation,

Accelerometer

• Network throttling and offline

• Rich representation of media queries

• Style filtering

• Media query editing

• Plays well with inline emulation

Responsive layouts Rich Emulation Remote debugging

Page 69: 第49回HTML5勉強会 Google I/O 2014サマリー

Google Confidential and Proprietary

Google I/O

THANK YOU