SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
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/

Mais conteúdo relacionado

Mais procurados

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 jQueryjeresig
 
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 ApplicationsRebecca Murphey
 
An Introduction to Jquery
An Introduction to JqueryAn Introduction to Jquery
An Introduction to JqueryPhil Reither
 
How Kris Writes Symfony Apps
How Kris Writes Symfony AppsHow Kris Writes Symfony Apps
How Kris Writes Symfony AppsKris Wallsmith
 
How kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonHow kris-writes-symfony-apps-london
How kris-writes-symfony-apps-londonKris 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 DevsRebecca Murphey
 
Advanced jQuery
Advanced jQueryAdvanced jQuery
Advanced jQuerysergioafp
 
jQuery Namespace Pattern
jQuery Namespace PatternjQuery Namespace Pattern
jQuery Namespace PatternDiego Fleury
 
DOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryDOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryRemy 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-adminOlaf Lindström
 

Mais procurados (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
 

Destaque

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 08artsalliance
 
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 LeadershipLinked 2 Leadership
 
Transformational Leadership
Transformational LeadershipTransformational Leadership
Transformational LeadershipAvishek 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 TrainingJames 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 skillsYodhia 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 KawasakiBrian Downard
 

Destaque (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
 

Semelhante a 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 2014Amazon 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 Browsergarbles
 
PHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにPHPUnit でよりよくテストを書くために
PHPUnit でよりよくテストを書くためにYuya Takeyama
 
"Coffee Script" in Brief
"Coffee Script" in Brief"Coffee Script" in Brief
"Coffee Script" in BriefNat Weerawan
 
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 CracowKacper 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 YieldJason Myers
 
Crazy things done on PHP
Crazy things done on PHPCrazy things done on PHP
Crazy things done on PHPTaras Kalapun
 
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 - PHPCE18Rafael Dohms
 

Semelhante a 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
 

Último

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central BankingThe Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central BankingSelcen Ozturkcan
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Último (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central BankingThe Evolution of Money: Digital Transformation and CBDCs in Central Banking
The Evolution of Money: Digital Transformation and CBDCs in Central Banking
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

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