SlideShare une entreprise Scribd logo
1  sur  19
© Gofore Oy 2016 •
Synchronizing Application State
Using Virtual DOM Trees
Jari-Pekka Voutilainen,
Tommi Mikkonen and
Kari Systä
Jari-Pekka Voutilainen
Me
• PHD student at Tampere University of Technology
• Researched Browser applications since 2011
• Currently working at Gofore Ltd.
• Finnish software consultation company
• @zharktas in twitter
• Jari.Voutilainen@iki.fi
Jari-Pekka Voutilainen 2
Agenda
• Background
• Liquid applications
• Browser application state
• Virtual DOM
• Serializing browser state
• Demos
Jari-Pekka Voutilainen 3
Background
• Multiple devices
• Applications need to be installed multiple times
• Applications might be in different states
• Applications require large scale backend for storing state
• Transferring application between devices is not currently feasible.
Jari-Pekka Voutilainen 4
Liquid Applications
• Defined as applications that can flow from device to device.
• Three subsystems were identified:
• User interface
• Persistent data and content
• State of the application
Jari-Pekka Voutilainen 5
Liquid applications
• This study focuses on the state of the applications.
• Multiple options for migrating browser application state:
• Complete memory space of the browser
• Pre-defined set of variables
• Determining relevant state from the application
Jari-Pekka Voutilainen 6
Liquid Application Framework
• The goal is to make developing liquid applications simple.
• Developers had to implement specific APIs for application transfer.
• Application should not be designed to be liquid.
• Basis should be in existing browser implementations.
• Liquid applications do not need to be installed everywhere, therefore they
should not require custom browser.
• Application should be device agnostic.
Jari-Pekka Voutilainen 7
Browser application state
• Our previous studies:
• Largely focused on JavaScript variables
• Lively3D had pre-defined variables which were serialized
• Backend-as-a-Service projects which stored variables to cloud database
• HTML5 Mobile Agents allowed user defined variables which were serialized
with the agent.
Jari-Pekka Voutilainen 8
Browser application state
• JavaScript variables are not the only state in applications that is relevant.
• Most modern web applications store some of the state to the DOM tree.
• Dynamically created elements, styles and so on..
• Most modern JavaScript frameworks do this behind the scenes.
Jari-Pekka Voutilainen 9
Virtual DOM
• Popularized by React.js.
• Novel technology, multiple implementations.
• Abstract version of the DOM tree.
• Usually consists of the following algorithms:
• Creation
• Manipulation
• Comparison
• Applying to DOM tree
Jari-Pekka Voutilainen 10
Proof of Concept
• Our proof of concept focuses on the state synchronization.
• Requires minimal implementation from the developer.
• Main contribution is in the browser side
• Server side is minimal implementation to enable migration
• Could be implemented numerous ways, currently using WebSockets.
Jari-Pekka Voutilainen 11
Proof of concept
• Our Proof of Concept is based on the initial state of the application.
• Virtualized from DOM tree after the application has loaded.
• Can be used as a comparison point to whatever state the DOM tree has.
• Virtual DOM library used in the PoC, provides comparison algorithm which
creates a set of operations needed to execute for DOM tree to change from
a to b.
Jari-Pekka Voutilainen 12
State transfer
• Our PoC creates required set of operations to migrate from initial state to the
current state.
• Can not be migrated as such since JavaScript object prototypes are not
serialized.
• Some of the prototype information is stored with the object so that the
prototypes can be recreated in the next browser.
• Receiving browser applies the operations to its initial state and applies this to
the actual DOM.
• Application DOM is migrated from browser to browser.
Jari-Pekka Voutilainen 13
Issues
• Only data present in the DOM is migrated.
• Functions bound to the DOM elements are actually in JavaScript namespace
• Bindings are lost when DOM is migrated.
• To compensate PoC has means for developers to register functions and how
they are bound in DOM
• These are serialized and rebound after migration.
Jari-Pekka Voutilainen 14
Demos
• Example application: Todo list
• User can add items, mark them done and remove them
• All of the state of application is stored to the DOM for the sake of demo
• TODO app
Jari-Pekka Voutilainen 15
Minimal implementation
• To enable state migration, developer needs minimal implementation.
Jari-Pekka Voutilainen 16
State transfer
var Liquid = require(‘@zharktas/liquid.js');
var liquid = new Liquid();
Binding dynamic functions
• To transfer dynamic functions, developer needs to register the functions and
note them in the DOM
Jari-Pekka Voutilainen 17
Bound functions
var checkbox = document.createElement('input');
checkbox.addEventListener('click', someFunction);
checkbox.setAttribute('data-handler', 'toggleClick');
liquid.registerHandler('toggleClick', {'click': someFunction});
Examples online
• All code is available at Github and NPM
• https://github.com/Zharktas/Liquid-Todo
• https://github.com/Zharktas/liquid.js
• https://www.npmjs.com/package/@zharktas/liquid.js
Jari-Pekka Voutilainen 18
Questions ?
@zharktas
Jari-Pekka Voutilainen
+358 40 553 8558
jari.voutilainen@iki.fi

Contenu connexe

Tendances

Blazor certification training - Dot Net Tricks
Blazor certification training - Dot Net TricksBlazor certification training - Dot Net Tricks
Blazor certification training - Dot Net TricksGaurav Singh
 
Documentum: where do we go from here
Documentum: where do we go from hereDocumentum: where do we go from here
Documentum: where do we go from hereJacquetteConsulting
 
Project archive what to do with those projects that have completed or place...
Project archive   what to do with those projects that have completed or place...Project archive   what to do with those projects that have completed or place...
Project archive what to do with those projects that have completed or place...p6academy
 
Project archive what to do with those projects that have completed or place...
Project archive   what to do with those projects that have completed or place...Project archive   what to do with those projects that have completed or place...
Project archive what to do with those projects that have completed or place...p6academy
 
Web flowpresentation
Web flowpresentationWeb flowpresentation
Web flowpresentationRoman Brovko
 
MongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with FlowableMongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with FlowableFlowable
 
Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Derek Gusoff
 

Tendances (7)

Blazor certification training - Dot Net Tricks
Blazor certification training - Dot Net TricksBlazor certification training - Dot Net Tricks
Blazor certification training - Dot Net Tricks
 
Documentum: where do we go from here
Documentum: where do we go from hereDocumentum: where do we go from here
Documentum: where do we go from here
 
Project archive what to do with those projects that have completed or place...
Project archive   what to do with those projects that have completed or place...Project archive   what to do with those projects that have completed or place...
Project archive what to do with those projects that have completed or place...
 
Project archive what to do with those projects that have completed or place...
Project archive   what to do with those projects that have completed or place...Project archive   what to do with those projects that have completed or place...
Project archive what to do with those projects that have completed or place...
 
Web flowpresentation
Web flowpresentationWeb flowpresentation
Web flowpresentation
 
MongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with FlowableMongoDB and Machine Learning with Flowable
MongoDB and Machine Learning with Flowable
 
Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2Share point saturday presentation 9 29-2012-2
Share point saturday presentation 9 29-2012-2
 

En vedette

Intro to Web Map APIs
Intro to Web Map APIsIntro to Web Map APIs
Intro to Web Map APIsYos Riady
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to ReactYos Riady
 
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX -projektin tarina
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX  -projektin tarina Digitaalisesti vaikuttavaksi. @HelsinkiUniUX  -projektin tarina
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX -projektin tarina University of Helsinki
 
Why and How to Use Virtual DOM
Why and How to Use Virtual DOMWhy and How to Use Virtual DOM
Why and How to Use Virtual DOMDaiwei Lu
 
React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMJimit Shah
 
ReactNativeを語る勉強会
ReactNativeを語る勉強会ReactNativeを語る勉強会
ReactNativeを語る勉強会yohei sugigami
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyKhor SoonHin
 
React Native - Workshop
React Native - WorkshopReact Native - Workshop
React Native - WorkshopFellipe Chagas
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJSHoang Long
 
React.js in real world apps.
React.js in real world apps. React.js in real world apps.
React.js in real world apps. Emanuele DelBono
 
[@NaukriEngineering] Git Basic Commands and Hacks
[@NaukriEngineering] Git Basic Commands and Hacks[@NaukriEngineering] Git Basic Commands and Hacks
[@NaukriEngineering] Git Basic Commands and HacksNaukri.com
 
An Introduction to ReactJS
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJSAll Things Open
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentationThanh Tuong
 
Intro to react native
Intro to react nativeIntro to react native
Intro to react nativeModusJesus
 
React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016
React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016
React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016Codemotion
 

En vedette (20)

Repaint & reflow
Repaint & reflowRepaint & reflow
Repaint & reflow
 
Intro to Web Map APIs
Intro to Web Map APIsIntro to Web Map APIs
Intro to Web Map APIs
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
React entry
React entryReact entry
React entry
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX -projektin tarina
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX  -projektin tarina Digitaalisesti vaikuttavaksi. @HelsinkiUniUX  -projektin tarina
Digitaalisesti vaikuttavaksi. @HelsinkiUniUX -projektin tarina
 
Why and How to Use Virtual DOM
Why and How to Use Virtual DOMWhy and How to Use Virtual DOM
Why and How to Use Virtual DOM
 
React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOM
 
ReactNativeを語る勉強会
ReactNativeを語る勉強会ReactNativeを語る勉強会
ReactNativeを語る勉強会
 
Pjax 深入淺出
Pjax 深入淺出Pjax 深入淺出
Pjax 深入淺出
 
React
ReactReact
React
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React Family
 
React Native - Workshop
React Native - WorkshopReact Native - Workshop
React Native - Workshop
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
React.js in real world apps.
React.js in real world apps. React.js in real world apps.
React.js in real world apps.
 
[@NaukriEngineering] Git Basic Commands and Hacks
[@NaukriEngineering] Git Basic Commands and Hacks[@NaukriEngineering] Git Basic Commands and Hacks
[@NaukriEngineering] Git Basic Commands and Hacks
 
An Introduction to ReactJS
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJS
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
Intro to react native
Intro to react nativeIntro to react native
Intro to react native
 
React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016
React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016
React - render() to DOM - Boris Dinkevich - Codemotion Milan 2016
 

Similaire à Synchronizing application state using Virtual DOM trees

React + Mobile
React + MobileReact + Mobile
React + Mobileantriss
 
AD114 -- Beyond the Mobile Browser? Building Rich Mobile Applications for IBM...
AD114 -- Beyond the Mobile Browser? Building Rich Mobile Applications for IBM...AD114 -- Beyond the Mobile Browser? Building Rich Mobile Applications for IBM...
AD114 -- Beyond the Mobile Browser? Building Rich Mobile Applications for IBM...ddrschiw
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with reduxMike Melusky
 
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsTools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsVMware Tanzu
 
Application Developmet lecture for backend
Application Developmet lecture for backendApplication Developmet lecture for backend
Application Developmet lecture for backendSobicaNoor
 
Transforming to Microservices
Transforming to MicroservicesTransforming to Microservices
Transforming to MicroservicesKyle Brown
 
Create a Windows 8 App in minutes
Create a Windows 8 App in minutesCreate a Windows 8 App in minutes
Create a Windows 8 App in minutesFrank La Vigne
 
Chapter 11:Understanding Client-Side Technologies
Chapter 11:Understanding Client-Side TechnologiesChapter 11:Understanding Client-Side Technologies
Chapter 11:Understanding Client-Side TechnologiesIt Academy
 
Datasheet weblogicpluginforrd
Datasheet weblogicpluginforrdDatasheet weblogicpluginforrd
Datasheet weblogicpluginforrdMidVision
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Jeremy Likness
 
O365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - MaterialO365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - MaterialThomas Daly
 
Angular Or React – Don’t Roll The Dice
Angular Or React – Don’t Roll The DiceAngular Or React – Don’t Roll The Dice
Angular Or React – Don’t Roll The DiceSynerzip
 
Build 12-Factor apps with Docker
Build 12-Factor apps with DockerBuild 12-Factor apps with Docker
Build 12-Factor apps with DockerJohn Zaccone
 

Similaire à Synchronizing application state using Virtual DOM trees (20)

Meteor + React
Meteor + ReactMeteor + React
Meteor + React
 
React js
React jsReact js
React js
 
React + Mobile
React + MobileReact + Mobile
React + Mobile
 
AD114 -- Beyond the Mobile Browser? Building Rich Mobile Applications for IBM...
AD114 -- Beyond the Mobile Browser? Building Rich Mobile Applications for IBM...AD114 -- Beyond the Mobile Browser? Building Rich Mobile Applications for IBM...
AD114 -- Beyond the Mobile Browser? Building Rich Mobile Applications for IBM...
 
Meteor meetup
Meteor meetupMeteor meetup
Meteor meetup
 
Introduction to react native with redux
Introduction to react native with reduxIntroduction to react native with redux
Introduction to react native with redux
 
Fluxible
FluxibleFluxible
Fluxible
 
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsTools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
 
Application Developmet lecture for backend
Application Developmet lecture for backendApplication Developmet lecture for backend
Application Developmet lecture for backend
 
Transforming to Microservices
Transforming to MicroservicesTransforming to Microservices
Transforming to Microservices
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Create a Windows 8 App in minutes
Create a Windows 8 App in minutesCreate a Windows 8 App in minutes
Create a Windows 8 App in minutes
 
Chapter 11:Understanding Client-Side Technologies
Chapter 11:Understanding Client-Side TechnologiesChapter 11:Understanding Client-Side Technologies
Chapter 11:Understanding Client-Side Technologies
 
Datasheet weblogicpluginforrd
Datasheet weblogicpluginforrdDatasheet weblogicpluginforrd
Datasheet weblogicpluginforrd
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
 
O365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - MaterialO365 Developer Bootcamp NJ 2018 - Material
O365 Developer Bootcamp NJ 2018 - Material
 
Servlet programming
Servlet programmingServlet programming
Servlet programming
 
Angular Or React – Don’t Roll The Dice
Angular Or React – Don’t Roll The DiceAngular Or React – Don’t Roll The Dice
Angular Or React – Don’t Roll The Dice
 
Micro Frontends
Micro FrontendsMicro Frontends
Micro Frontends
 
Build 12-Factor apps with Docker
Build 12-Factor apps with DockerBuild 12-Factor apps with Docker
Build 12-Factor apps with Docker
 

Dernier

Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .Poonam Aher Patil
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Cherry
 
Concept of gene and Complementation test.pdf
Concept of gene and Complementation test.pdfConcept of gene and Complementation test.pdf
Concept of gene and Complementation test.pdfCherry
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bSérgio Sacani
 
module for grade 9 for distance learning
module for grade 9 for distance learningmodule for grade 9 for distance learning
module for grade 9 for distance learninglevieagacer
 
Genetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditionsGenetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditionsbassianu17
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Cherry
 
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxANSARKHAN96
 
biology HL practice questions IB BIOLOGY
biology HL practice questions IB BIOLOGYbiology HL practice questions IB BIOLOGY
biology HL practice questions IB BIOLOGY1301aanya
 
Role of AI in seed science Predictive modelling and Beyond.pptx
Role of AI in seed science  Predictive modelling and  Beyond.pptxRole of AI in seed science  Predictive modelling and  Beyond.pptx
Role of AI in seed science Predictive modelling and Beyond.pptxArvind Kumar
 
Plasmid: types, structure and functions.
Plasmid: types, structure and functions.Plasmid: types, structure and functions.
Plasmid: types, structure and functions.Cherry
 
Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.Cherry
 
Cyanide resistant respiration pathway.pptx
Cyanide resistant respiration pathway.pptxCyanide resistant respiration pathway.pptx
Cyanide resistant respiration pathway.pptxCherry
 
Site specific recombination and transposition.........pdf
Site specific recombination and transposition.........pdfSite specific recombination and transposition.........pdf
Site specific recombination and transposition.........pdfCherry
 
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIACURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIADr. TATHAGAT KHOBRAGADE
 
FS P2 COMBO MSTA LAST PUSH past exam papers.
FS P2 COMBO MSTA LAST PUSH past exam papers.FS P2 COMBO MSTA LAST PUSH past exam papers.
FS P2 COMBO MSTA LAST PUSH past exam papers.takadzanijustinmaime
 
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRingsTransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRingsSérgio Sacani
 
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptxClimate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptxDiariAli
 

Dernier (20)

Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.Reboulia: features, anatomy, morphology etc.
Reboulia: features, anatomy, morphology etc.
 
Concept of gene and Complementation test.pdf
Concept of gene and Complementation test.pdfConcept of gene and Complementation test.pdf
Concept of gene and Complementation test.pdf
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
 
Site Acceptance Test .
Site Acceptance Test                    .Site Acceptance Test                    .
Site Acceptance Test .
 
module for grade 9 for distance learning
module for grade 9 for distance learningmodule for grade 9 for distance learning
module for grade 9 for distance learning
 
Genetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditionsGenetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditions
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
 
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
 
biology HL practice questions IB BIOLOGY
biology HL practice questions IB BIOLOGYbiology HL practice questions IB BIOLOGY
biology HL practice questions IB BIOLOGY
 
Role of AI in seed science Predictive modelling and Beyond.pptx
Role of AI in seed science  Predictive modelling and  Beyond.pptxRole of AI in seed science  Predictive modelling and  Beyond.pptx
Role of AI in seed science Predictive modelling and Beyond.pptx
 
Plasmid: types, structure and functions.
Plasmid: types, structure and functions.Plasmid: types, structure and functions.
Plasmid: types, structure and functions.
 
PATNA CALL GIRLS 8617370543 LOW PRICE ESCORT SERVICE
PATNA CALL GIRLS 8617370543 LOW PRICE ESCORT SERVICEPATNA CALL GIRLS 8617370543 LOW PRICE ESCORT SERVICE
PATNA CALL GIRLS 8617370543 LOW PRICE ESCORT SERVICE
 
Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.
 
Cyanide resistant respiration pathway.pptx
Cyanide resistant respiration pathway.pptxCyanide resistant respiration pathway.pptx
Cyanide resistant respiration pathway.pptx
 
Site specific recombination and transposition.........pdf
Site specific recombination and transposition.........pdfSite specific recombination and transposition.........pdf
Site specific recombination and transposition.........pdf
 
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIACURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
CURRENT SCENARIO OF POULTRY PRODUCTION IN INDIA
 
FS P2 COMBO MSTA LAST PUSH past exam papers.
FS P2 COMBO MSTA LAST PUSH past exam papers.FS P2 COMBO MSTA LAST PUSH past exam papers.
FS P2 COMBO MSTA LAST PUSH past exam papers.
 
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRingsTransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
TransientOffsetin14CAftertheCarringtonEventRecordedbyPolarTreeRings
 
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptxClimate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
Climate Change Impacts on Terrestrial and Aquatic Ecosystems.pptx
 

Synchronizing application state using Virtual DOM trees

  • 1. © Gofore Oy 2016 • Synchronizing Application State Using Virtual DOM Trees Jari-Pekka Voutilainen, Tommi Mikkonen and Kari Systä Jari-Pekka Voutilainen
  • 2. Me • PHD student at Tampere University of Technology • Researched Browser applications since 2011 • Currently working at Gofore Ltd. • Finnish software consultation company • @zharktas in twitter • Jari.Voutilainen@iki.fi Jari-Pekka Voutilainen 2
  • 3. Agenda • Background • Liquid applications • Browser application state • Virtual DOM • Serializing browser state • Demos Jari-Pekka Voutilainen 3
  • 4. Background • Multiple devices • Applications need to be installed multiple times • Applications might be in different states • Applications require large scale backend for storing state • Transferring application between devices is not currently feasible. Jari-Pekka Voutilainen 4
  • 5. Liquid Applications • Defined as applications that can flow from device to device. • Three subsystems were identified: • User interface • Persistent data and content • State of the application Jari-Pekka Voutilainen 5
  • 6. Liquid applications • This study focuses on the state of the applications. • Multiple options for migrating browser application state: • Complete memory space of the browser • Pre-defined set of variables • Determining relevant state from the application Jari-Pekka Voutilainen 6
  • 7. Liquid Application Framework • The goal is to make developing liquid applications simple. • Developers had to implement specific APIs for application transfer. • Application should not be designed to be liquid. • Basis should be in existing browser implementations. • Liquid applications do not need to be installed everywhere, therefore they should not require custom browser. • Application should be device agnostic. Jari-Pekka Voutilainen 7
  • 8. Browser application state • Our previous studies: • Largely focused on JavaScript variables • Lively3D had pre-defined variables which were serialized • Backend-as-a-Service projects which stored variables to cloud database • HTML5 Mobile Agents allowed user defined variables which were serialized with the agent. Jari-Pekka Voutilainen 8
  • 9. Browser application state • JavaScript variables are not the only state in applications that is relevant. • Most modern web applications store some of the state to the DOM tree. • Dynamically created elements, styles and so on.. • Most modern JavaScript frameworks do this behind the scenes. Jari-Pekka Voutilainen 9
  • 10. Virtual DOM • Popularized by React.js. • Novel technology, multiple implementations. • Abstract version of the DOM tree. • Usually consists of the following algorithms: • Creation • Manipulation • Comparison • Applying to DOM tree Jari-Pekka Voutilainen 10
  • 11. Proof of Concept • Our proof of concept focuses on the state synchronization. • Requires minimal implementation from the developer. • Main contribution is in the browser side • Server side is minimal implementation to enable migration • Could be implemented numerous ways, currently using WebSockets. Jari-Pekka Voutilainen 11
  • 12. Proof of concept • Our Proof of Concept is based on the initial state of the application. • Virtualized from DOM tree after the application has loaded. • Can be used as a comparison point to whatever state the DOM tree has. • Virtual DOM library used in the PoC, provides comparison algorithm which creates a set of operations needed to execute for DOM tree to change from a to b. Jari-Pekka Voutilainen 12
  • 13. State transfer • Our PoC creates required set of operations to migrate from initial state to the current state. • Can not be migrated as such since JavaScript object prototypes are not serialized. • Some of the prototype information is stored with the object so that the prototypes can be recreated in the next browser. • Receiving browser applies the operations to its initial state and applies this to the actual DOM. • Application DOM is migrated from browser to browser. Jari-Pekka Voutilainen 13
  • 14. Issues • Only data present in the DOM is migrated. • Functions bound to the DOM elements are actually in JavaScript namespace • Bindings are lost when DOM is migrated. • To compensate PoC has means for developers to register functions and how they are bound in DOM • These are serialized and rebound after migration. Jari-Pekka Voutilainen 14
  • 15. Demos • Example application: Todo list • User can add items, mark them done and remove them • All of the state of application is stored to the DOM for the sake of demo • TODO app Jari-Pekka Voutilainen 15
  • 16. Minimal implementation • To enable state migration, developer needs minimal implementation. Jari-Pekka Voutilainen 16 State transfer var Liquid = require(‘@zharktas/liquid.js'); var liquid = new Liquid();
  • 17. Binding dynamic functions • To transfer dynamic functions, developer needs to register the functions and note them in the DOM Jari-Pekka Voutilainen 17 Bound functions var checkbox = document.createElement('input'); checkbox.addEventListener('click', someFunction); checkbox.setAttribute('data-handler', 'toggleClick'); liquid.registerHandler('toggleClick', {'click': someFunction});
  • 18. Examples online • All code is available at Github and NPM • https://github.com/Zharktas/Liquid-Todo • https://github.com/Zharktas/liquid.js • https://www.npmjs.com/package/@zharktas/liquid.js Jari-Pekka Voutilainen 18
  • 19. Questions ? @zharktas Jari-Pekka Voutilainen +358 40 553 8558 jari.voutilainen@iki.fi