SlideShare une entreprise Scribd logo
1  sur  29
Introduction DOM Storage and Inside Ex DOM Storage library Toru Yamaguchi id:ZIGOROu <zigorou@cpan.org>
アジェンダ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DOM Storage とは ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
localStorage ,[object Object],[object Object],if  (localStorage.foo)  {   // 2 回目以降のアクセス console.log(localStorage.foo);  }   else   {   //  初回のアクセス localStorage.foo = “bar”;  }
sessionStorage ,[object Object],[object Object],[object Object]
Storage interface ,[object Object],interface  Storage  { readonly attribute unsigned long  length ; [IndexGetter] DOMString  key (in unsigned long index); [NameGetter] DOMString  getItem (in DOMString key); [NameSetter] void  setItem (in DOMString key, in DOMString data); [XXX] void  removeItem (in DOMString key); void  clear (); };
StorageEvent interface ,[object Object],interface  Storage  { readonly attribute unsigned long  length ; [IndexGetter] DOMString  key (in unsigned long index); [NameGetter] DOMString  getItem (in DOMString key); [NameSetter] void  setItem (in DOMString key, in DOMString data); [XXX] void  removeItem (in DOMString key); void  clear (); };
Storage interface ,[object Object],interface  StorageEvent  : Event {  readonly attribute DOMString  key ;  readonly attribute DOMString  oldValue ; readonly attribute DOMString newValue; readonly attribute DOMString  url ; readonly attribute  Window   source ; void  initStorageEvent ( in DOMString typeArg, in boolean canBubbleArg,  in boolean cancelableArg, in DOMString keyArg,  in DOMString oldValueArg, in DOMString newValueArg,  in DOMString urlArg, in Window sourceArg);  void  initStorageEventNS ( in DOMString namespaceURI, in DOMString typeArg,  in boolean canBubbleArg, in boolean cancelableArg,  in DOMString keyArg, in DOMString oldValueArg,  in DOMString newValueArg, in DOMString urlArg,  in Window sourceArg);  };
Storage event (1) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Storage event (2) ,[object Object],var  l =  function (evt)  {   console.log(“key: ” + evt.key); console.log(“oldValue: ” + evt.oldValue); console.log(“newValue: “ + evt.newValue);  } ;  window .addEventListener( &quot;storage&quot; , l,  false );
Cookie vs DOM Storage (1) ,[object Object],[object Object],[object Object],[object Object]
Cookie vs DOM Storage (2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Cookie vs DOM Storage (3) ,[object Object],same host ( domain, path は設定してない状態 )  Window 1 Window 2 Window 3 Window 4 Window 5 localStorage / Cookie sessionStorage
IE6, 7 で使えない?Ex DOM Storage で出来るよ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Ex DOM Storage の中身の概略 ,[object Object],[object Object],[object Object],[object Object]
Behavior の基礎知識 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
userData Behavior (1)  ,[object Object],[object Object],[object Object],element.addBehavior( &quot;#default#userData&quot; );  element.load( “my Storage ” ); //  読み込み element.setAttribute( “myData” ,  “blah blah” ); //  値の設定  element.save( “my Storage ” );  //  書き込み
userData Behavior (2) ,[object Object],[object Object],[object Object],[object Object],[object Object]
userData Behavior (3) ,[object Object],Window (1) Window (2) load(skey) setAttribute(key, value) save(skey) load(skey) この時点で、 value  には  JSON  データが入る。 { foo: “blah” }  とかそういう値。 Window (1) の load() 前のデータが取れてしまう。以下略><
HTML Component Behavior (1)  ,[object Object],<?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; standalone=&quot;yes&quot;?> <public:component  xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xmlns:public=&quot;urn:HTMLComponent&quot;> <script type=&quot;text/javascript“ src=“/path/to/src.jp”></script> <public:attach  event=&quot;oncontentready&quot;  onevent=&quot;handlers.contentready(event);“ for=&quot;element&quot; /> <public:attach  event=&quot;onresize“ onevent=&quot;handlers.resize(event);“ for=&quot;window&quot; /> </public:component>
HTC Component Behavior (2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
HTML Component Behavior (3) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
HTML Component Behavior (4) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Ex DOM Storage の HTC ファイル (1) ,[object Object],<!DOCTYPE html> <public:component xmlns=&quot;http://www.w3.org/1999/xhtml“ xmlns:public=&quot;urn:HTMLComponent&quot;> <public:property name=&quot;length&quot; get=&quot;getLength&quot; /> <public:property name=&quot;remainingSpace&quot; get=&quot;getRemainingSpace&quot; /> <public:method name=&quot;clear&quot; /> <public:method name=&quot;getItem&quot; /> <public:method name=&quot;key&quot; /> <public:method name=&quot;removeItem&quot; /> <public:method name=&quot;setItem&quot; /> <public:attach  event=&quot;onreadystatechange&quot; for=&quot;element&quot; onevent=&quot;initialize();&quot; /> <public:attach  event=&quot;onpropertychange&quot; for=&quot;element&quot; onevent=&quot;syncronize(window.event);&quot; /> <script type=&quot;text/javascript&quot; src=&quot;../src/json2.js&quot;></script> <script type=&quot;text/javascript&quot; src=&quot;../src/exdomstorage_impl.js&quot;></script> </public:component>
Ex DOM Storage の HTC ファイル (2) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Ex DOM Storage の HTC 実装部 ,[object Object],/* * Implementation Storage Interface * storage.length  と言うアクセスの際に *  必ず  getLength()  が呼ばれる  */  function getLength() {  var length = 0;  for (var p in storage)  length++;  return length;  }
onpropertychange  イベント ,[object Object],[object Object],[object Object],[object Object]
Ex DOM Storage Known Issue ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
まとめ ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Contenu connexe

Tendances

DOM Scripting & jQuery
DOM Scripting & jQueryDOM Scripting & jQuery
DOM Scripting & jQuery
smallworkshop
 
G*workshop sendai 20100424(v2)
G*workshop sendai 20100424(v2)G*workshop sendai 20100424(v2)
G*workshop sendai 20100424(v2)
Nobuhiro Sue
 
はじめてのCouch db
はじめてのCouch dbはじめてのCouch db
はじめてのCouch db
Eiji Kuroda
 

Tendances (18)

Active Directoryデータの "大きい整数"
Active Directoryデータの "大きい整数"Active Directoryデータの "大きい整数"
Active Directoryデータの "大きい整数"
 
DOM Scripting & jQuery
DOM Scripting & jQueryDOM Scripting & jQuery
DOM Scripting & jQuery
 
Jetpack Library 事始め
Jetpack Library 事始めJetpack Library 事始め
Jetpack Library 事始め
 
Lt 111119
Lt 111119Lt 111119
Lt 111119
 
非同期処理の基礎
非同期処理の基礎非同期処理の基礎
非同期処理の基礎
 
JJUG CCC 2012 Real World Groovy/Grails
JJUG CCC 2012 Real World Groovy/GrailsJJUG CCC 2012 Real World Groovy/Grails
JJUG CCC 2012 Real World Groovy/Grails
 
Mongodb
MongodbMongodb
Mongodb
 
BindableProperty 書くのクソダリーんだけど、 あいつなんやねん(仮)
BindableProperty書くのクソダリーんだけど、あいつなんやねん(仮)BindableProperty書くのクソダリーんだけど、あいつなんやねん(仮)
BindableProperty 書くのクソダリーんだけど、 あいつなんやねん(仮)
 
規格書で読むC++11のスレッド
規格書で読むC++11のスレッド規格書で読むC++11のスレッド
規格書で読むC++11のスレッド
 
G*workshop sendai 20100424(v2)
G*workshop sendai 20100424(v2)G*workshop sendai 20100424(v2)
G*workshop sendai 20100424(v2)
 
Javaでトランザクショナルメモリを使う
Javaでトランザクショナルメモリを使うJavaでトランザクショナルメモリを使う
Javaでトランザクショナルメモリを使う
 
はじめてのCouch db
はじめてのCouch dbはじめてのCouch db
はじめてのCouch db
 
C++ マルチスレッド 入門
C++ マルチスレッド 入門C++ マルチスレッド 入門
C++ マルチスレッド 入門
 
Flight入門
Flight入門Flight入門
Flight入門
 
BDD by Jasmine (jscafe 13)
BDD by Jasmine (jscafe 13)BDD by Jasmine (jscafe 13)
BDD by Jasmine (jscafe 13)
 
xUTP Chapter26. Dependency Injection
xUTP Chapter26. Dependency InjectionxUTP Chapter26. Dependency Injection
xUTP Chapter26. Dependency Injection
 
OSC京都2011
OSC京都2011OSC京都2011
OSC京都2011
 
mod_auth_ticket - Bringing Single-Sign-On to lighttpd
mod_auth_ticket - Bringing Single-Sign-On to lighttpdmod_auth_ticket - Bringing Single-Sign-On to lighttpd
mod_auth_ticket - Bringing Single-Sign-On to lighttpd
 

En vedette (7)

Yapc asia 2011_zigorou
Yapc asia 2011_zigorouYapc asia 2011_zigorou
Yapc asia 2011_zigorou
 
The Security of OpenID Authentication 2.0
The Security of OpenID Authentication 2.0The Security of OpenID Authentication 2.0
The Security of OpenID Authentication 2.0
 
AndApp開発における全て #denatechcon
AndApp開発における全て #denatechconAndApp開発における全て #denatechcon
AndApp開発における全て #denatechcon
 
その後のDeNAのネイティブアプリ開発 #denatechcon
その後のDeNAのネイティブアプリ開発 #denatechconその後のDeNAのネイティブアプリ開発 #denatechcon
その後のDeNAのネイティブアプリ開発 #denatechcon
 
DeNAのAIとは #denatechcon
DeNAのAIとは #denatechconDeNAのAIとは #denatechcon
DeNAのAIとは #denatechcon
 
これからの Microservices
これからの Microservicesこれからの Microservices
これからの Microservices
 
サービスの成長を支えるフロントエンド開発 #denatechcon
サービスの成長を支えるフロントエンド開発 #denatechconサービスの成長を支えるフロントエンド開発 #denatechcon
サービスの成長を支えるフロントエンド開発 #denatechcon
 

Similaire à Client Side Cache

Html5 Web Applications
Html5  Web ApplicationsHtml5  Web Applications
Html5 Web Applications
totty jp
 
FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -
Akio Katayama
 
東京Node学園#3 Domains & Isolates
東京Node学園#3 Domains & Isolates東京Node学園#3 Domains & Isolates
東京Node学園#3 Domains & Isolates
koichik
 
Web リソースを活用した簡単アプリケーション開発(Windows Phone)
Web リソースを活用した簡単アプリケーション開発(Windows Phone)Web リソースを活用した簡単アプリケーション開発(Windows Phone)
Web リソースを活用した簡単アプリケーション開発(Windows Phone)
Akira Onishi
 

Similaire à Client Side Cache (20)

Html5 Web Applications
Html5  Web ApplicationsHtml5  Web Applications
Html5 Web Applications
 
HTML5最新動向
HTML5最新動向HTML5最新動向
HTML5最新動向
 
Chrome Developer Toolsを使いこなそう!
Chrome Developer Toolsを使いこなそう!Chrome Developer Toolsを使いこなそう!
Chrome Developer Toolsを使いこなそう!
 
HTML5&API総まくり
HTML5&API総まくりHTML5&API総まくり
HTML5&API総まくり
 
Web Component概要
Web Component概要Web Component概要
Web Component概要
 
Java Script4
Java Script4Java Script4
Java Script4
 
Chrome DevTools.next
Chrome DevTools.nextChrome DevTools.next
Chrome DevTools.next
 
FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -
 
FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -FxUG in Toyama - ASphalt2 container -
FxUG in Toyama - ASphalt2 container -
 
東京Node学園#3 Domains & Isolates
東京Node学園#3 Domains & Isolates東京Node学園#3 Domains & Isolates
東京Node学園#3 Domains & Isolates
 
Inside mobage platform
Inside mobage platformInside mobage platform
Inside mobage platform
 
「html5 boilerplate」から考える、これからのマークアップ
「html5 boilerplate」から考える、これからのマークアップ「html5 boilerplate」から考える、これからのマークアップ
「html5 boilerplate」から考える、これからのマークアップ
 
WebComponentsとPolymerを使ってみた
WebComponentsとPolymerを使ってみたWebComponentsとPolymerを使ってみた
WebComponentsとPolymerを使ってみた
 
HTML5でオフラインWebアプリケーションを作ろう
HTML5でオフラインWebアプリケーションを作ろうHTML5でオフラインWebアプリケーションを作ろう
HTML5でオフラインWebアプリケーションを作ろう
 
About kitakat
About kitakatAbout kitakat
About kitakat
 
Chrome Extensionsの基本とデザインパターン
Chrome Extensionsの基本とデザインパターンChrome Extensionsの基本とデザインパターン
Chrome Extensionsの基本とデザインパターン
 
Web リソースを活用した簡単アプリケーション開発(Windows Phone)
Web リソースを活用した簡単アプリケーション開発(Windows Phone)Web リソースを活用した簡単アプリケーション開発(Windows Phone)
Web リソースを活用した簡単アプリケーション開発(Windows Phone)
 
Sc2009autumn s2robot
Sc2009autumn s2robotSc2009autumn s2robot
Sc2009autumn s2robot
 
Android4.2徹底解剖!
Android4.2徹底解剖!Android4.2徹底解剖!
Android4.2徹底解剖!
 
Devtools.next
Devtools.nextDevtools.next
Devtools.next
 

Plus de Toru Yamaguchi

JSON Based Web Services
JSON Based Web ServicesJSON Based Web Services
JSON Based Web Services
Toru Yamaguchi
 
Inside mbga Open Platform API architecture
Inside mbga Open Platform API architectureInside mbga Open Platform API architecture
Inside mbga Open Platform API architecture
Toru Yamaguchi
 
Introduction OpenID Authentication 2.0 Revival
Introduction OpenID Authentication 2.0 RevivalIntroduction OpenID Authentication 2.0 Revival
Introduction OpenID Authentication 2.0 Revival
Toru Yamaguchi
 
Customization of DBIC::Schema::Loader
Customization of DBIC::Schema::LoaderCustomization of DBIC::Schema::Loader
Customization of DBIC::Schema::Loader
Toru Yamaguchi
 

Plus de Toru Yamaguchi (18)

OAuth 2.0 Web Messaging Response Mode - OpenID Summit Tokyo 2015
OAuth 2.0 Web Messaging Response Mode - OpenID Summit Tokyo 2015OAuth 2.0 Web Messaging Response Mode - OpenID Summit Tokyo 2015
OAuth 2.0 Web Messaging Response Mode - OpenID Summit Tokyo 2015
 
Mobage Connect と Identity 関連技術への取り組み - OpenID Summit Tokyo 2015
Mobage Connect と Identity 関連技術への取り組み - OpenID Summit Tokyo 2015Mobage Connect と Identity 関連技術への取り組み - OpenID Summit Tokyo 2015
Mobage Connect と Identity 関連技術への取り組み - OpenID Summit Tokyo 2015
 
革新的ブラウザゲームを支えるプラットフォーム技術
革新的ブラウザゲームを支えるプラットフォーム技術革新的ブラウザゲームを支えるプラットフォーム技術
革新的ブラウザゲームを支えるプラットフォーム技術
 
技術選択とアーキテクトの役割 (要約版)
技術選択とアーキテクトの役割 (要約版)技術選択とアーキテクトの役割 (要約版)
技術選択とアーキテクトの役割 (要約版)
 
技術選択とアーキテクトの役割
技術選択とアーキテクトの役割技術選択とアーキテクトの役割
技術選択とアーキテクトの役割
 
How to bake delicious cookie (RESTful Meetup #03)
How to bake delicious cookie (RESTful Meetup #03)How to bake delicious cookie (RESTful Meetup #03)
How to bake delicious cookie (RESTful Meetup #03)
 
JSON Based Web Services
JSON Based Web ServicesJSON Based Web Services
JSON Based Web Services
 
ngCore engine for mobage platform
ngCore engine for mobage platformngCore engine for mobage platform
ngCore engine for mobage platform
 
mbga Open Platform and Perl
mbga Open Platform and Perlmbga Open Platform and Perl
mbga Open Platform and Perl
 
Inside mbga Open Platform API architecture
Inside mbga Open Platform API architectureInside mbga Open Platform API architecture
Inside mbga Open Platform API architecture
 
Introduction OpenID Authentication 2.0 Revival
Introduction OpenID Authentication 2.0 RevivalIntroduction OpenID Authentication 2.0 Revival
Introduction OpenID Authentication 2.0 Revival
 
OpenID Mobile Profile
OpenID Mobile ProfileOpenID Mobile Profile
OpenID Mobile Profile
 
Introduction OpenID Authentication 2.0
Introduction OpenID Authentication 2.0Introduction OpenID Authentication 2.0
Introduction OpenID Authentication 2.0
 
OpenID 2009
OpenID 2009OpenID 2009
OpenID 2009
 
Mobile Openid
Mobile OpenidMobile Openid
Mobile Openid
 
Customization of DBIC::Schema::Loader
Customization of DBIC::Schema::LoaderCustomization of DBIC::Schema::Loader
Customization of DBIC::Schema::Loader
 
Yadis/XRI and OpenID
Yadis/XRI and OpenIDYadis/XRI and OpenID
Yadis/XRI and OpenID
 
OpenID 2.0 Quick Note
OpenID 2.0 Quick NoteOpenID 2.0 Quick Note
OpenID 2.0 Quick Note
 

Dernier

Dernier (10)

Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 

Client Side Cache

  • 1. Introduction DOM Storage and Inside Ex DOM Storage library Toru Yamaguchi id:ZIGOROu <zigorou@cpan.org>
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.