Dominik Lubański
JavaScript Expert, Frontend Architect, and Team Leader with 10+ years of experience in web development. Taking roles in a wide range of projects with software houses, media agencies, rising startups, and other technology companies.
Understanding
Data Binding
Dominik Lubański
github.com/smalluban
Backbone.js in angular way
Smart change detection library
Contribute!
Give a star!
What is it?
Data binding is the process that establishes a connection between the application UI (User Interface) and business logic. If the settings and notifications are correctly set, the data reflects changes when made.
Definition from Wikipedia.
It can also mean that when the UI is changed, the underlying data will reflect that change.
Definition from Wikipedia.
What does it mean?
DATA
LOGIC
UI
LOGIC
DATA
UI
MODEL
VIEW
CONTROLLER
Change detection connects all the parts together.
How is it implemented?
CHANGE DETECTION
Backbone.Model
.set()
Template expressions
$scope.$apply(), $scope.$digest()
Virtual DOM
.setState()
FRAMEWORK
UI
Backbone.Model
Backbone.Collection
Backbone.View
trigger
update event
.listenTo(model,'update', ...)
.render() {
... $el.html( _.template...
}
.set('property', ...)
UI events callbacks
TRIGGER
UI
$scope
UI events callbacks
{{ someProperty }}
View (template)
$watchers
$scope expressions
$scope.$watch(...)
$digest loop
$scope.$apply()
Controller / Directive
TRIGGER
UI
React Component
this.state, this.props
this.setState({
...newState...
})
this.render()
UI events callbacks
Virtual DOM
Reconciliation*
* Reconciliation is the process by which React updates the DOM with each new render pass.
Definition from React docs.
TRIGGER
How can it be used?
Simple forecast application
Forecast shared API
Forecast demo application - edit on plunker
Forecast demo application - edit on plunker
Forecast demo application - edit on plunker
Do you have any questions?
Thank you.
By Dominik Lubański
This presentation covers various implementations of data binding process in JavaScript frameworks.
JavaScript Expert, Frontend Architect, and Team Leader with 10+ years of experience in web development. Taking roles in a wide range of projects with software houses, media agencies, rising startups, and other technology companies.