SlideShare a Scribd company logo
1 of 29
Brendan Kowitz
                                                  @brendankowitz
                            Live Backchannel: #dddbrisbane #web03




Going Offline with JS
  and JavaScript Application Development
Overview
    • Introduction

1 • JavaScript on my Server!
    • Dependencies, Patterns, Templates
2   • Client-side JavaScript

3 • WinJS (Windows 8)
    • Wrap up
What are the issues?
• How to we reuse our own libraries?
• How do we tackle dependency / module
  management?
• How do we structure our projects?
• How do we test our projects?
• What tools do we use?
What can we gain?
• Vast open source community
• Mostly platform independent
• Some of the fastest Dynamic Language
  interpreters around*
• Reduce language ambiguity
What can we build?




                                                     Windows 8
Node.js + Railsway.js   jQuery Mobile + Spine.js
                                                   JavaScript Metro
Server-side
• Exploring Node.js
• Dependency Management
  – Node.js Package Manager
• Railway.js MVC
Dependency Management
• Downloading Dependent Libraries
  – .NET has Nuget (this also works for JS in .NET
    projects)
  – Ruby has Gems
  – Node.js uses NPM (Node.js Package Manager)
Dependency Management --cont
   • Using those libraries in your page
       – CommonJS specification
            • RequireJS
            • Node.js
            • When.js
       – Script Loaders (load scripts in parallel)
            • YepNope
            • Yabble
            • LABjs


http://lmgtfy.com/?q=commonjs
Railway.js
•   railway init blog && cd blog
•   npm install -l
•   railway generate crud post title content
•   railway server 8888
•   open http://127.0.0.1:8888/posts
Testing from the server
• Node.js
  – Zombie.js
  – Tobi.js
  – … many others
Server-side demo
Client-side JavaScript




     jQuery Mobile + Spine.js
Common Client-Side Patterns
    • Free for all




http://xkcd.com/292/
Common Client-Side Patterns
•   Namespaces
•   Module Pattern
•   Sandbox
•   .. MVC
JavaScript Refresher
(function(){
            var Person = function(firstName, lastName){
                       this.firstName = firstName;
                       this.lastName = lastName;
            };

           Person.find = function(id) {
                      console.log('Trying to find ' + id);
           };

           Person.fn = Person.prototype;
           Person.fn.fullName = function(){
                      return this.firstName + ' ' + this.lastName;
           };

           var john = new Person('John', 'Smith');

           console.log(john.fullName());
           Person.find(1);
}());
MVC: Spine.js




http://addyosmani.com/blog/building-apps-spinejs/
Testing Part 2
• Client-side
  – QUnit
  – Jasmine (BDD)
  – (Many others)
Spine.js demo
Windows 8 Metro - WinJs
• App starts like any web page - HTML page
  loads
• HTML page loads its files
  – WinJS script & styles
  – Your app’s scripts & styles
• Your code wires up to app lifetime events
• Start the app
• … and events happen
Windows 8 Metro - WinJs
Working with Async
   • Promise Pattern
   • jQuery 1.5+
            $.when($.ajax("http://www.example.org/somedata.json”))
              .then(myFunc, myFailure);


   • WinJS
            WinJS.xhr({
              url:"http://www.example.org/somedata.json"
            }).then(function (response) {
                updateDisplay(
                  JSON.parse(response.responseText));
            });


http://wiki.commonjs.org/wiki/Promises/A
Navigation
• Multi page (Not recommended in MSDN doco)
   –   Default behavior of browser
   –   Navigation loads a new page
   –   Drops script context
   –   Have to serialize state that gets passed across pages
       (use WinJS to help)
• Single Page
   –   One page as far as browser is concerned
   –   DOM elements changed programmatically
   –   Keeps script context and state for app lifetime
   –   Harder to design an app in a single HTML file
Fragments
• We want separate HTML files
  – Easier to design
  – Easier to maintain
• Fragments
  – Separate files, plus a loader that will bring them in
  – In ui.js: WinJS.UI.Fragments namespace
Navigation & Fragments
function navigated(e) {
  WinJS.UI.Fragments.clone(e.detail.location, e.detail.state)
    .then(function (frag) {
      var host = document.getElementById('contentHost');
      host.innerHTML = '';
      host.appendChild(frag);
    });
}

WinJS.Navigation.addEventListener("navigated", navigated);

WinJS.Navigation.navigate("/html/home.html");
demo
Further Reading
Mozilla Chromeless




   “The “Chromeless” project experiments with the idea of removing the current
   browser user interface and replacing it with a flexible platform which allows for the
   creation of new browser UI using standard web technologies such as HTML, CSS and
   JavaScript.”




http://mozillalabs.com/chromeless
Wrap up

     1                   2                      3



Problems with JS    JavaScript Patterns     Windows 8
CommonJS            Spine.js              JavaScript Metro
Node.js             PhoneGap
Railway.js          QUnit
Tobi.js
brendan.kowitz@readify.net

Thank you.                    http://www.kowitz.net

                              @brendankowitz




        http://hg.kowitz.net/ddd

More Related Content

What's hot

Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash CourseHaim Michael
 
Mean Stack for Beginners
Mean Stack for BeginnersMean Stack for Beginners
Mean Stack for BeginnersJEMLI Fathi
 
Node js - Enterprise Class
Node js - Enterprise ClassNode js - Enterprise Class
Node js - Enterprise ClassGlenn Block
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausWomen in Technology Poland
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to ReactYos Riady
 
Using Javascript in today's world
Using Javascript in today's worldUsing Javascript in today's world
Using Javascript in today's worldSudar Muthu
 
Sfd hanoi2012 nguyen ha duong yang node.js-intro
Sfd hanoi2012 nguyen ha duong yang   node.js-introSfd hanoi2012 nguyen ha duong yang   node.js-intro
Sfd hanoi2012 nguyen ha duong yang node.js-introVu Hung Nguyen
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013Ramesh Nair
 
Learnhowtotamethejavascriptmonsterwithvjetjside
LearnhowtotamethejavascriptmonsterwithvjetjsideLearnhowtotamethejavascriptmonsterwithvjetjside
LearnhowtotamethejavascriptmonsterwithvjetjsideJustin Early
 
JavaScript History
JavaScript HistoryJavaScript History
JavaScript HistoryRhio Kim
 
Javascript now and in the future
Javascript now and in the futureJavascript now and in the future
Javascript now and in the futureDenis Stoyanov
 
Web workers
Web workers Web workers
Web workers Ran Wahle
 
Lessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODMLessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODMValeri Karpov
 
Single Sign On in Ruby - Enterprise Ready!
Single Sign On in Ruby - Enterprise Ready!Single Sign On in Ruby - Enterprise Ready!
Single Sign On in Ruby - Enterprise Ready!Nikos Dimitrakopoulos
 
Dojo, from scratch to result
Dojo, from scratch to resultDojo, from scratch to result
Dojo, from scratch to resultNikolai Onken
 

What's hot (19)

Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash Course
 
Mean Stack for Beginners
Mean Stack for BeginnersMean Stack for Beginners
Mean Stack for Beginners
 
Node js - Enterprise Class
Node js - Enterprise ClassNode js - Enterprise Class
Node js - Enterprise Class
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
Node js crash course session 1
Node js crash course   session 1Node js crash course   session 1
Node js crash course session 1
 
Using Javascript in today's world
Using Javascript in today's worldUsing Javascript in today's world
Using Javascript in today's world
 
Sfd hanoi2012 nguyen ha duong yang node.js-intro
Sfd hanoi2012 nguyen ha duong yang   node.js-introSfd hanoi2012 nguyen ha duong yang   node.js-intro
Sfd hanoi2012 nguyen ha duong yang node.js-intro
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
 
Learnhowtotamethejavascriptmonsterwithvjetjside
LearnhowtotamethejavascriptmonsterwithvjetjsideLearnhowtotamethejavascriptmonsterwithvjetjside
Learnhowtotamethejavascriptmonsterwithvjetjside
 
JavaScript History
JavaScript HistoryJavaScript History
JavaScript History
 
Javascript now and in the future
Javascript now and in the futureJavascript now and in the future
Javascript now and in the future
 
Intro to nodejs
Intro to nodejsIntro to nodejs
Intro to nodejs
 
Aleact
AleactAleact
Aleact
 
Web workers
Web workers Web workers
Web workers
 
8 Most Effective Node.js Tools for Developers
8 Most Effective Node.js Tools for Developers8 Most Effective Node.js Tools for Developers
8 Most Effective Node.js Tools for Developers
 
Lessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODMLessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODM
 
Single Sign On in Ruby - Enterprise Ready!
Single Sign On in Ruby - Enterprise Ready!Single Sign On in Ruby - Enterprise Ready!
Single Sign On in Ruby - Enterprise Ready!
 
Dojo, from scratch to result
Dojo, from scratch to resultDojo, from scratch to result
Dojo, from scratch to result
 

Viewers also liked

Pantomime Scene Outline - Pairs
Pantomime Scene Outline - PairsPantomime Scene Outline - Pairs
Pantomime Scene Outline - Pairsrenee
 
Joseph C. Volpe Appointed Mortgage Loan Officer
Joseph C. Volpe Appointed Mortgage Loan OfficerJoseph C. Volpe Appointed Mortgage Loan Officer
Joseph C. Volpe Appointed Mortgage Loan OfficerHyperion Bank
 
Trade in ideas
Trade in ideasTrade in ideas
Trade in ideasSpringer
 
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)poponapolitica
 
정찬훈 강사 프로필 (사진관리)
정찬훈 강사 프로필 (사진관리)정찬훈 강사 프로필 (사진관리)
정찬훈 강사 프로필 (사진관리)찬훈 정
 
Laser drilling
Laser drillingLaser drilling
Laser drillingSpringer
 
El factor humano de la negociacion (lectura liviana)gaby
El factor humano de la negociacion (lectura liviana)gabyEl factor humano de la negociacion (lectura liviana)gaby
El factor humano de la negociacion (lectura liviana)gabygabyah1702
 
Handbook of healthcare operations management
Handbook of healthcare operations managementHandbook of healthcare operations management
Handbook of healthcare operations managementSpringer
 
Diabetic Retinopathy Detection
Diabetic Retinopathy DetectionDiabetic Retinopathy Detection
Diabetic Retinopathy DetectionSPb_Data_Science
 
Prominin new insights on stem & cancer stem cell biology
Prominin new insights on stem & cancer stem cell biologyProminin new insights on stem & cancer stem cell biology
Prominin new insights on stem & cancer stem cell biologySpringer
 
Electromagnetic Frequency Spectrum Presentation
Electromagnetic Frequency Spectrum PresentationElectromagnetic Frequency Spectrum Presentation
Electromagnetic Frequency Spectrum PresentationAndile Ngcaba
 
사진교육프로그램 8강
사진교육프로그램 8강사진교육프로그램 8강
사진교육프로그램 8강digitone
 
Non proliferative diabetic retinopathy by phaneendra akana
Non proliferative diabetic retinopathy by phaneendra akanaNon proliferative diabetic retinopathy by phaneendra akana
Non proliferative diabetic retinopathy by phaneendra akanaMohan Phaneendra Akana
 
디지털카메라강좌 제2강
디지털카메라강좌 제2강디지털카메라강좌 제2강
디지털카메라강좌 제2강tailofmoon
 

Viewers also liked (20)

Pantomime Scene Outline - Pairs
Pantomime Scene Outline - PairsPantomime Scene Outline - Pairs
Pantomime Scene Outline - Pairs
 
Joseph C. Volpe Appointed Mortgage Loan Officer
Joseph C. Volpe Appointed Mortgage Loan OfficerJoseph C. Volpe Appointed Mortgage Loan Officer
Joseph C. Volpe Appointed Mortgage Loan Officer
 
Presentación1
Presentación1Presentación1
Presentación1
 
El alcohol
El alcohol El alcohol
El alcohol
 
Some Poetic Delights
Some Poetic DelightsSome Poetic Delights
Some Poetic Delights
 
Larguiee ...77
Larguiee ...77Larguiee ...77
Larguiee ...77
 
Trade in ideas
Trade in ideasTrade in ideas
Trade in ideas
 
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
Resposta ao req. 49 2014 (informações sobre manutenção de calçada portugues)
 
정찬훈 강사 프로필 (사진관리)
정찬훈 강사 프로필 (사진관리)정찬훈 강사 프로필 (사진관리)
정찬훈 강사 프로필 (사진관리)
 
Grafica circular
Grafica circularGrafica circular
Grafica circular
 
Laser drilling
Laser drillingLaser drilling
Laser drilling
 
El factor humano de la negociacion (lectura liviana)gaby
El factor humano de la negociacion (lectura liviana)gabyEl factor humano de la negociacion (lectura liviana)gaby
El factor humano de la negociacion (lectura liviana)gaby
 
Handbook of healthcare operations management
Handbook of healthcare operations managementHandbook of healthcare operations management
Handbook of healthcare operations management
 
Diabetic Retinopathy Detection
Diabetic Retinopathy DetectionDiabetic Retinopathy Detection
Diabetic Retinopathy Detection
 
Prominin new insights on stem & cancer stem cell biology
Prominin new insights on stem & cancer stem cell biologyProminin new insights on stem & cancer stem cell biology
Prominin new insights on stem & cancer stem cell biology
 
Electromagnetic Frequency Spectrum Presentation
Electromagnetic Frequency Spectrum PresentationElectromagnetic Frequency Spectrum Presentation
Electromagnetic Frequency Spectrum Presentation
 
사진교육프로그램 8강
사진교육프로그램 8강사진교육프로그램 8강
사진교육프로그램 8강
 
Ecommerce Hotelero III
Ecommerce Hotelero IIIEcommerce Hotelero III
Ecommerce Hotelero III
 
Non proliferative diabetic retinopathy by phaneendra akana
Non proliferative diabetic retinopathy by phaneendra akanaNon proliferative diabetic retinopathy by phaneendra akana
Non proliferative diabetic retinopathy by phaneendra akana
 
디지털카메라강좌 제2강
디지털카메라강좌 제2강디지털카메라강좌 제2강
디지털카메라강좌 제2강
 

Similar to Going Offline with JS

Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jibanJibanananda Sana
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web ApplicationYakov Fain
 
A Journey Begin with Node.js
A Journey Begin with Node.jsA Journey Begin with Node.js
A Journey Begin with Node.jsKhalid Farhan
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJSJITENDRA KUMAR PATEL
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012Alexandre Morgaut
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.jsKasey McCurdy
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNaveen S.R
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsasync_io
 
PUG Challenge 2016 - The nativescript pug app challenge
PUG Challenge 2016 -  The nativescript pug app challengePUG Challenge 2016 -  The nativescript pug app challenge
PUG Challenge 2016 - The nativescript pug app challengeBronco Oostermeyer
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.jsYoann Gotthilf
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The WhenFITC
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesMark Roden
 
Java Script recruiting
Java Script recruitingJava Script recruiting
Java Script recruitingIhor Odynets
 

Similar to Going Offline with JS (20)

Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
A Journey Begin with Node.js
A Journey Begin with Node.jsA Journey Begin with Node.js
A Journey Begin with Node.js
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012End-to-end W3C APIs - tpac 2012
End-to-end W3C APIs - tpac 2012
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
 
Mini-Training: Node.js
Mini-Training: Node.jsMini-Training: Node.js
Mini-Training: Node.js
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Node.js
Node.jsNode.js
Node.js
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
PUG Challenge 2016 - The nativescript pug app challenge
PUG Challenge 2016 -  The nativescript pug app challengePUG Challenge 2016 -  The nativescript pug app challenge
PUG Challenge 2016 - The nativescript pug app challenge
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The When
 
jQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPagesjQuery - the world's most popular java script library comes to XPages
jQuery - the world's most popular java script library comes to XPages
 
Java Script recruiting
Java Script recruitingJava Script recruiting
Java Script recruiting
 
Express yourself
Express yourselfExpress yourself
Express yourself
 

Recently uploaded

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
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

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
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Going Offline with JS

  • 1. Brendan Kowitz @brendankowitz Live Backchannel: #dddbrisbane #web03 Going Offline with JS and JavaScript Application Development
  • 2. Overview • Introduction 1 • JavaScript on my Server! • Dependencies, Patterns, Templates 2 • Client-side JavaScript 3 • WinJS (Windows 8) • Wrap up
  • 3. What are the issues? • How to we reuse our own libraries? • How do we tackle dependency / module management? • How do we structure our projects? • How do we test our projects? • What tools do we use?
  • 4. What can we gain? • Vast open source community • Mostly platform independent • Some of the fastest Dynamic Language interpreters around* • Reduce language ambiguity
  • 5. What can we build? Windows 8 Node.js + Railsway.js jQuery Mobile + Spine.js JavaScript Metro
  • 6. Server-side • Exploring Node.js • Dependency Management – Node.js Package Manager • Railway.js MVC
  • 7. Dependency Management • Downloading Dependent Libraries – .NET has Nuget (this also works for JS in .NET projects) – Ruby has Gems – Node.js uses NPM (Node.js Package Manager)
  • 8. Dependency Management --cont • Using those libraries in your page – CommonJS specification • RequireJS • Node.js • When.js – Script Loaders (load scripts in parallel) • YepNope • Yabble • LABjs http://lmgtfy.com/?q=commonjs
  • 9. Railway.js • railway init blog && cd blog • npm install -l • railway generate crud post title content • railway server 8888 • open http://127.0.0.1:8888/posts
  • 10. Testing from the server • Node.js – Zombie.js – Tobi.js – … many others
  • 12. Client-side JavaScript jQuery Mobile + Spine.js
  • 13. Common Client-Side Patterns • Free for all http://xkcd.com/292/
  • 14. Common Client-Side Patterns • Namespaces • Module Pattern • Sandbox • .. MVC
  • 15. JavaScript Refresher (function(){ var Person = function(firstName, lastName){ this.firstName = firstName; this.lastName = lastName; }; Person.find = function(id) { console.log('Trying to find ' + id); }; Person.fn = Person.prototype; Person.fn.fullName = function(){ return this.firstName + ' ' + this.lastName; }; var john = new Person('John', 'Smith'); console.log(john.fullName()); Person.find(1); }());
  • 17. Testing Part 2 • Client-side – QUnit – Jasmine (BDD) – (Many others)
  • 19. Windows 8 Metro - WinJs • App starts like any web page - HTML page loads • HTML page loads its files – WinJS script & styles – Your app’s scripts & styles • Your code wires up to app lifetime events • Start the app • … and events happen
  • 20. Windows 8 Metro - WinJs
  • 21. Working with Async • Promise Pattern • jQuery 1.5+ $.when($.ajax("http://www.example.org/somedata.json”)) .then(myFunc, myFailure); • WinJS WinJS.xhr({ url:"http://www.example.org/somedata.json" }).then(function (response) { updateDisplay( JSON.parse(response.responseText)); }); http://wiki.commonjs.org/wiki/Promises/A
  • 22. Navigation • Multi page (Not recommended in MSDN doco) – Default behavior of browser – Navigation loads a new page – Drops script context – Have to serialize state that gets passed across pages (use WinJS to help) • Single Page – One page as far as browser is concerned – DOM elements changed programmatically – Keeps script context and state for app lifetime – Harder to design an app in a single HTML file
  • 23. Fragments • We want separate HTML files – Easier to design – Easier to maintain • Fragments – Separate files, plus a loader that will bring them in – In ui.js: WinJS.UI.Fragments namespace
  • 24. Navigation & Fragments function navigated(e) { WinJS.UI.Fragments.clone(e.detail.location, e.detail.state) .then(function (frag) { var host = document.getElementById('contentHost'); host.innerHTML = ''; host.appendChild(frag); }); } WinJS.Navigation.addEventListener("navigated", navigated); WinJS.Navigation.navigate("/html/home.html");
  • 25. demo
  • 27. Mozilla Chromeless “The “Chromeless” project experiments with the idea of removing the current browser user interface and replacing it with a flexible platform which allows for the creation of new browser UI using standard web technologies such as HTML, CSS and JavaScript.” http://mozillalabs.com/chromeless
  • 28. Wrap up 1 2 3 Problems with JS JavaScript Patterns Windows 8 CommonJS Spine.js JavaScript Metro Node.js PhoneGap Railway.js QUnit Tobi.js
  • 29. brendan.kowitz@readify.net Thank you. http://www.kowitz.net @brendankowitz http://hg.kowitz.net/ddd

Editor's Notes

  1. Javascript can have a lot of challenges in general
  2. Node's goal is to provide an easy way to build scalable network programs.Node tells the operating system that it should be notified when a new connection is made, and then it goes to sleep. If someone new connects, then it executes the callback. Each connection is only a small heap allocation.
  3. jQuery gives us a great api and it doesn’t restrict how we can structure out applications, this doesn’t mean that we shouldn’t have a nice structureDon’t use jQuery’s namespace, create your own, be your own app
  4. A pure js library that provides the windows metro style for js applicationsProvides the controlsStyle sheets (fonts, margins etc..)Touch interface for win8Helpers, PatternsDesigned for easy toolabilityWinJS is a library not a framework..load whatever pieces you require
  5. A pure js library that provides the windows metro style for js applicationsProvides the controlsStyle sheets (fonts, margins etc..)Touch interface for win8Helpers, PatternsDesigned for easy toolabilityWinJS is a library not a framework..load whatever pieces you requirePromises: Provides a mechanism to schedule work to be done on a value that has not yet been computed. It is an abstraction for managing interactions with asynchronous APIs.