SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

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

En vedette

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
 

En vedette (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강
 

Similaire à 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
 

Similaire à 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
 

Dernier

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 

Dernier (20)

Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 

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

Notes de l'éditeur

  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.