SlideShare a Scribd company logo
Intro to Knockout
John Maxwell
jQuery Spaghetti
$usaMap = $("#usa-map")

$worldMap = $("#world-map")




activeMap = $worldMap

setActiveMap = (map) ->

activeMap = map




animateSwitchMaps = ($toShow, $toHide, animation) ->

$toHide.hide(animation).promise().done -> $toShow.show(animation)



switchMaps = ($toShow, $toHide) ->


animateSwitchMaps($toShow, $toHide, 'puff')

setActiveMap($toShow)

# other stuff




showWorldMap = ->

switchMaps $worldMap, $usaMap






showUsaMap = ->

switchMaps $usaMap, $worldMap

$usaMap.on 'click', '.international', showWorldMap

$worldMap.on 'click', '.region.usa', showUsaMap
Where are we going?
•

Knockout value proposition
and comparison

•

Knockout Basics

•

Example walkthrough
Where are we going?
•

Knockout value proposition
and comparison!

•

Knockout Basics

•

Example walkthrough
If work with traditional
web apps and want to
want to add “islands of
interactivity”, Knockout
is a great option.
Knockout sales pitch
•

Declarative Bindings

•

Automatic UI Refresh

•

Dependency Tracking

•

Templating

•

Supports old browsers
What it doesn’t do
•

Client-side routing / URL
management

•

Server synchronization

•

Rigid conventions
Where are we going?
•

Knockout value proposition
and comparison!

•

Knockout Basics

•

Example walkthrough
Where are we going?
•

Knockout value proposition
and comparison

•

Knockout Basics!

•

Example walkthrough
MVVM Framework
•

Model

•

View

•

ViewModel
The ViewModel




function AppViewModel() {

this.firstName = "John";

this.lastName = "Maxwell";

}

ko.applyBindings(new AppViewModel());
The View
<p>

First name: 

<strong data-bind="text: firstName"></strong>

</p>

<p>

Last name:

<strong data-bind="text: lastName"></strong>

</p>

Two-way Binding




<p>

First name: 

<strong data-bind="text: firstName"></strong>

</p>

<p>

Last name:

<strong data-bind="text: lastName"></strong>

</p>

<p>

First name:

<input data-bind="value: firstName" />

</p>

<p>

Last name: 

<input data-bind="value: lastName" />

</p>
View Model Revisited




function AppViewModel() {

this.firstName = "John";

this.lastName = "Maxwell";

}

ko.applyBindings(new AppViewModel());
Observables




function AppViewModel() {

this.firstName = ko.observable("John");

this.lastName = ko.observable("Maxwell");

}

ko.applyBindings(new AppViewModel());
Observable interaction




function AppViewModel() {

this.firstName = ko.observable("John");

this.lastName = ko.observable("Maxwell");

}

var viewModel = new AppViewModel();

viewModel.firstName(); // "John"

viewModel.firstName("Silver Hammer");

viewModel.firstName(); // "Silver Hammer"
Two-way Binding
<p>

First name: 

<strong data-bind="text: firstName"></strong>

</p>

<p>

Last name:

<strong data-bind="text: lastName"></strong>

</p>




<p>

First name:

<input data-bind="value: firstName" />

</p>

<p>

Last name: 

<input data-bind="value: lastName" />

</p>
Where are we going?
•

Knockout value proposition
and comparison

•

Knockout Basics!

•

Example walkthrough
Where are we going?
•

Knockout value proposition
and comparison

•

Knockout Basics

•

Example walkthrough
Todo list application
•

Load existing todos from localStorage

•

Edit existing todos

•

Add new todos

•

Save todos to localStorage

•

Remove individual todos

•

Clear all todos
Walkthrough Primer
•

TodoList is our ViewModel for managing an array of
Todo Models

•

ObservableArrays are like Observables, with some extra
support for managing collections

•

foreach is a binding that iterates over ObservableArrays

•

foreach shifts the binding context to elements of the
ObservableArray

•

Binding values can be arbitrary JavaScript expressions
Other useful bindings
•

css: Adds/removes class on element

•

attr: Adds/removes attributes of an element

•

disable/enable: Disables/enables form inputs

•

options: Adds/removes options in select box
Extra resources
•

http://learn.knockoutjs.com/

•

https://github.com/johnmaxwell/knockout-todo

•

Twitter: @greenagain

•

http://agileleague.com/

More Related Content

What's hot

Mulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development ToolkitMulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development ToolkitRebecca Murphey
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UIRebecca Murphey
 
History of jQuery
History of jQueryHistory of jQuery
History of jQuery
jeresig
 
Leveraging jQuery's Special Events API (JSConf 2012)
Leveraging jQuery's Special Events API (JSConf 2012)Leveraging jQuery's Special Events API (JSConf 2012)
Leveraging jQuery's Special Events API (JSConf 2012)
James Greene
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery Applications
Rebecca Murphey
 
An Introduction to Jquery
An Introduction to JqueryAn Introduction to Jquery
An Introduction to Jquery
Phil Reither
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
Kris Wallsmith
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
Constantin Titarenko
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
Kris Wallsmith
 
A New Baseline for Front-End Devs
A New Baseline for Front-End DevsA New Baseline for Front-End Devs
A New Baseline for Front-End Devs
Rebecca Murphey
 
Advanced jQuery
Advanced jQueryAdvanced jQuery
Advanced jQuery
sergioafp
 
Dojo Confessions
Dojo ConfessionsDojo Confessions
Dojo Confessions
Rebecca Murphey
 
jQuery
jQueryjQuery
jQuery Namespace Pattern
jQuery Namespace PatternjQuery Namespace Pattern
jQuery Namespace Pattern
Diego Fleury
 
DOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryDOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQuery
Remy Sharp
 
#wpbar 26/3 - Förenkla WP-admin
#wpbar 26/3 - Förenkla WP-admin#wpbar 26/3 - Förenkla WP-admin
#wpbar 26/3 - Förenkla WP-admin
Olaf Lindström
 

What's hot (20)

Mulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development ToolkitMulberry: A Mobile App Development Toolkit
Mulberry: A Mobile App Development Toolkit
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UI
 
History of jQuery
History of jQueryHistory of jQuery
History of jQuery
 
Leveraging jQuery's Special Events API (JSConf 2012)
Leveraging jQuery's Special Events API (JSConf 2012)Leveraging jQuery's Special Events API (JSConf 2012)
Leveraging jQuery's Special Events API (JSConf 2012)
 
Building Large jQuery Applications
Building Large jQuery ApplicationsBuilding Large jQuery Applications
Building Large jQuery Applications
 
An Introduction to Jquery
An Introduction to JqueryAn Introduction to Jquery
An Introduction to Jquery
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony Apps
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-london
 
A New Baseline for Front-End Devs
A New Baseline for Front-End DevsA New Baseline for Front-End Devs
A New Baseline for Front-End Devs
 
Advanced jQuery
Advanced jQueryAdvanced jQuery
Advanced jQuery
 
Bacbkone js
Bacbkone jsBacbkone js
Bacbkone js
 
Dojo Confessions
Dojo ConfessionsDojo Confessions
Dojo Confessions
 
jQuery
jQueryjQuery
jQuery
 
jQuery Namespace Pattern
jQuery Namespace PatternjQuery Namespace Pattern
jQuery Namespace Pattern
 
Mysql & Php
Mysql & PhpMysql & Php
Mysql & Php
 
DOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryDOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQuery
 
JavaScript patterns
JavaScript patternsJavaScript patterns
JavaScript patterns
 
#wpbar 26/3 - Förenkla WP-admin
#wpbar 26/3 - Förenkla WP-admin#wpbar 26/3 - Förenkla WP-admin
#wpbar 26/3 - Förenkla WP-admin
 

Viewers also liked

Time Management: The Rule Of 24
Time Management: The Rule Of 24Time Management: The Rule Of 24
Time Management: The Rule Of 24HaSan Petarian
 
Investing in Leadership: Planning For Succession 8 29 08
Investing in Leadership: Planning For Succession 8 29 08Investing in Leadership: Planning For Succession 8 29 08
Investing in Leadership: Planning For Succession 8 29 08
artsalliance
 
Piping materials v imp
Piping materials   v impPiping materials   v imp
Piping materials v imp
Mohmmad Hussain Hussain
 
Are Leaders Born? Or Are They Made? - Linked 2 Leadership
Are Leaders Born? Or Are They Made? -  Linked 2 LeadershipAre Leaders Born? Or Are They Made? -  Linked 2 Leadership
Are Leaders Born? Or Are They Made? - Linked 2 Leadership
Linked 2 Leadership
 
Transformational Leadership
Transformational LeadershipTransformational Leadership
Transformational Leadership
Avishek Das
 
Storage tanks basic training (rev 2)
Storage tanks basic training (rev 2)Storage tanks basic training (rev 2)
Storage tanks basic training (rev 2)ledzung
 
Leadership Training
Leadership TrainingLeadership Training
Leadership Training
James Chung
 
The Second Little Book of Leadership
The Second Little Book of LeadershipThe Second Little Book of Leadership
The Second Little Book of LeadershipPhil Dourado
 
Developing leadership skills
Developing leadership skillsDeveloping leadership skills
Developing leadership skills
Yodhia Antariksa
 
3 Powerful Leadership Lessons from Guy Kawasaki
3 Powerful Leadership Lessons from Guy Kawasaki3 Powerful Leadership Lessons from Guy Kawasaki
3 Powerful Leadership Lessons from Guy Kawasaki
Brian Downard
 

Viewers also liked (11)

Time Management: The Rule Of 24
Time Management: The Rule Of 24Time Management: The Rule Of 24
Time Management: The Rule Of 24
 
Investing in Leadership: Planning For Succession 8 29 08
Investing in Leadership: Planning For Succession 8 29 08Investing in Leadership: Planning For Succession 8 29 08
Investing in Leadership: Planning For Succession 8 29 08
 
Piping materials v imp
Piping materials   v impPiping materials   v imp
Piping materials v imp
 
19 Challenging Thoughts about Leadership
19 Challenging Thoughts about Leadership19 Challenging Thoughts about Leadership
19 Challenging Thoughts about Leadership
 
Are Leaders Born? Or Are They Made? - Linked 2 Leadership
Are Leaders Born? Or Are They Made? -  Linked 2 LeadershipAre Leaders Born? Or Are They Made? -  Linked 2 Leadership
Are Leaders Born? Or Are They Made? - Linked 2 Leadership
 
Transformational Leadership
Transformational LeadershipTransformational Leadership
Transformational Leadership
 
Storage tanks basic training (rev 2)
Storage tanks basic training (rev 2)Storage tanks basic training (rev 2)
Storage tanks basic training (rev 2)
 
Leadership Training
Leadership TrainingLeadership Training
Leadership Training
 
The Second Little Book of Leadership
The Second Little Book of LeadershipThe Second Little Book of Leadership
The Second Little Book of Leadership
 
Developing leadership skills
Developing leadership skillsDeveloping leadership skills
Developing leadership skills
 
3 Powerful Leadership Lessons from Guy Kawasaki
3 Powerful Leadership Lessons from Guy Kawasaki3 Powerful Leadership Lessons from Guy Kawasaki
3 Powerful Leadership Lessons from Guy Kawasaki
 

Similar to Intro to Knockout

(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
Amazon Web Services
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuerydeimos
 
Java script+mvc+with+emberjs
Java script+mvc+with+emberjsJava script+mvc+with+emberjs
Java script+mvc+with+emberjsji guang
 
React.js: Beyond the Browser
React.js: Beyond the BrowserReact.js: Beyond the Browser
React.js: Beyond the Browser
garbles
 
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにPHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くために
Yuya Takeyama
 
"Coffee Script" in Brief
"Coffee Script" in Brief"Coffee Script" in Brief
"Coffee Script" in Brief
Nat Weerawan
 
Min-Maxing Software Costs
Min-Maxing Software CostsMin-Maxing Software Costs
Min-Maxing Software Costs
Konstantin Kudryashov
 
Cyclejs introduction
Cyclejs introductionCyclejs introduction
Cyclejs introduction
Arye Lukashevski
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB jhchabran
 
Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!
Kacper Gunia
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Kacper Gunia
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryQConLondon2008
 
Generating Power with Yield
Generating Power with YieldGenerating Power with Yield
Generating Power with Yield
Jason Myers
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHPTaras Kalapun
 
Presentation1
Presentation1Presentation1
Presentation1
Rahadyan Gusti
 
mro-every.pdf
mro-every.pdfmro-every.pdf
mro-every.pdf
Workhorse Computing
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)
Win Yu
 
Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18
Rafael Dohms
 
AngularJs , How it works
AngularJs , How it worksAngularJs , How it works
AngularJs , How it works
Jayantha Sirisena
 

Similar to Intro to Knockout (20)

(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
(DEV305) Building Apps with the AWS SDK for PHP | AWS re:Invent 2014
 
Remy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQueryRemy Sharp The DOM scripting toolkit jQuery
Remy Sharp The DOM scripting toolkit jQuery
 
Java script+mvc+with+emberjs
Java script+mvc+with+emberjsJava script+mvc+with+emberjs
Java script+mvc+with+emberjs
 
React.js: Beyond the Browser
React.js: Beyond the BrowserReact.js: Beyond the Browser
React.js: Beyond the Browser
 
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにPHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くために
 
"Coffee Script" in Brief
"Coffee Script" in Brief"Coffee Script" in Brief
"Coffee Script" in Brief
 
Min-Maxing Software Costs
Min-Maxing Software CostsMin-Maxing Software Costs
Min-Maxing Software Costs
 
Cyclejs introduction
Cyclejs introductionCyclejs introduction
Cyclejs introduction
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB
 
Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!Forget about index.php and build you applications around HTTP!
Forget about index.php and build you applications around HTTP!
 
Forget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers CracowForget about Index.php and build you applications around HTTP - PHPers Cracow
Forget about Index.php and build you applications around HTTP - PHPers Cracow
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
Generating Power with Yield
Generating Power with YieldGenerating Power with Yield
Generating Power with Yield
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHP
 
Presentation1
Presentation1Presentation1
Presentation1
 
mro-every.pdf
mro-every.pdfmro-every.pdf
mro-every.pdf
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)PHP 良好實踐 (Best Practice)
PHP 良好實踐 (Best Practice)
 
Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18Writing code you won’t hate tomorrow - PHPCE18
Writing code you won’t hate tomorrow - PHPCE18
 
AngularJs , How it works
AngularJs , How it worksAngularJs , How it works
AngularJs , How it works
 

Recently uploaded

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 

Recently uploaded (20)

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 

Intro to Knockout

  • 2. jQuery Spaghetti $usaMap = $("#usa-map")
 $worldMap = $("#world-map")
 
 activeMap = $worldMap
 setActiveMap = (map) ->
 activeMap = map
 
 animateSwitchMaps = ($toShow, $toHide, animation) ->
 $toHide.hide(animation).promise().done -> $toShow.show(animation)
 
 switchMaps = ($toShow, $toHide) -> 
 animateSwitchMaps($toShow, $toHide, 'puff')
 setActiveMap($toShow)
 # other stuff
 
 showWorldMap = ->
 switchMaps $worldMap, $usaMap
 
 
 showUsaMap = ->
 switchMaps $usaMap, $worldMap
 $usaMap.on 'click', '.international', showWorldMap
 $worldMap.on 'click', '.region.usa', showUsaMap
  • 3. Where are we going? • Knockout value proposition and comparison • Knockout Basics • Example walkthrough
  • 4. Where are we going? • Knockout value proposition and comparison! • Knockout Basics • Example walkthrough
  • 5. If work with traditional web apps and want to want to add “islands of interactivity”, Knockout is a great option.
  • 6.
  • 7. Knockout sales pitch • Declarative Bindings • Automatic UI Refresh • Dependency Tracking • Templating • Supports old browsers
  • 8. What it doesn’t do • Client-side routing / URL management • Server synchronization • Rigid conventions
  • 9. Where are we going? • Knockout value proposition and comparison! • Knockout Basics • Example walkthrough
  • 10. Where are we going? • Knockout value proposition and comparison • Knockout Basics! • Example walkthrough
  • 12. The ViewModel 
 function AppViewModel() {
 this.firstName = "John";
 this.lastName = "Maxwell";
 }
 ko.applyBindings(new AppViewModel());
  • 13. The View <p>
 First name: 
 <strong data-bind="text: firstName"></strong>
 </p>
 <p>
 Last name:
 <strong data-bind="text: lastName"></strong>
 </p>

  • 14. Two-way Binding 
 <p>
 First name: 
 <strong data-bind="text: firstName"></strong>
 </p>
 <p>
 Last name:
 <strong data-bind="text: lastName"></strong>
 </p>
 <p>
 First name:
 <input data-bind="value: firstName" />
 </p>
 <p>
 Last name: 
 <input data-bind="value: lastName" />
 </p>
  • 15. View Model Revisited 
 function AppViewModel() {
 this.firstName = "John";
 this.lastName = "Maxwell";
 }
 ko.applyBindings(new AppViewModel());
  • 16. Observables 
 function AppViewModel() {
 this.firstName = ko.observable("John");
 this.lastName = ko.observable("Maxwell");
 }
 ko.applyBindings(new AppViewModel());
  • 17. Observable interaction 
 function AppViewModel() {
 this.firstName = ko.observable("John");
 this.lastName = ko.observable("Maxwell");
 }
 var viewModel = new AppViewModel();
 viewModel.firstName(); // "John"
 viewModel.firstName("Silver Hammer");
 viewModel.firstName(); // "Silver Hammer"
  • 18. Two-way Binding <p>
 First name: 
 <strong data-bind="text: firstName"></strong>
 </p>
 <p>
 Last name:
 <strong data-bind="text: lastName"></strong>
 </p>
 
 <p>
 First name:
 <input data-bind="value: firstName" />
 </p>
 <p>
 Last name: 
 <input data-bind="value: lastName" />
 </p>
  • 19. Where are we going? • Knockout value proposition and comparison • Knockout Basics! • Example walkthrough
  • 20. Where are we going? • Knockout value proposition and comparison • Knockout Basics • Example walkthrough
  • 21. Todo list application • Load existing todos from localStorage • Edit existing todos • Add new todos • Save todos to localStorage • Remove individual todos • Clear all todos
  • 22. Walkthrough Primer • TodoList is our ViewModel for managing an array of Todo Models • ObservableArrays are like Observables, with some extra support for managing collections • foreach is a binding that iterates over ObservableArrays • foreach shifts the binding context to elements of the ObservableArray • Binding values can be arbitrary JavaScript expressions
  • 23. Other useful bindings • css: Adds/removes class on element • attr: Adds/removes attributes of an element • disable/enable: Disables/enables form inputs • options: Adds/removes options in select box