SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
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/

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Kürzlich hochgeladen (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

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