SlideShare una empresa de Scribd logo
1 de 14
Descargar para leer sin conexión
Backbone.js a través de un caso práctico



     Presentación basada en el curso
 Introducción a Backbone.js de easynube




Consíguelo gratis en easynube.com
Backbone.js a través de un caso práctico




Backbone.js a travé s
 de un caso práctico
Backbone.js a través de un caso práctico




Aplicación

                       Una tienda de libros
                       en la cual se pueden
                       examinar los
                       detalles de cada libro
                       y añadirlos a una
                       lista de deseos.

                       Dentro de la lista
                       será posible visitar
                       los libros con un click
                       así como eliminarlos
                       de la lista.
Backbone.js a través de un caso práctico




Aplicación

                       Una tienda de libros
                       en la cual se pueden
                       examinar los
                       detalles de cada libro
                       y añadirlos a una
                       lista de deseos.

                       Dentro de la lista
                       será posible visitar
                       los libros con un click
                       así como eliminarlos
                       de la lista.
Backbone.js a través de un caso práctico




                  Backbone.Model


“Models are the heart of any      Los Modelos son el corazón de
JavaScript application,           cualquier aplicación javascript;
containing the interactive data   contienen la información con la
as well as a large part of the    cual se interactúa y una gran
logic surrounding it:             parte de la lógica que la rodea:
conversions, validations,         conversiones, validaciones,
computed properties, and          propiedades y control de
access control.”                  acceso.
Backbone.js a través de un caso práctico




             Backbone.Model
En la práctica:

                  Título: Programming Python
                  Autor: Mark Lutz
                  Resumen: ...


                  Backbone.Model.extend({
                      título: 'Programming Python',
                      autor: 'Mark Lutz',
                      sumario: '…'
                  });
Backbone.js a través de un caso práctico




              Backbone.Collection


Collections are ordered sets of   Las colecciones son grupos
models. You can bind "change"     ordenados de modelos. Puedes
events to be notified when        ligar los eventos 'change' para
any model in the collection has   notificar cuando se produzca un
been modified, listen for "add"   cambio en un modelo, escuchar
and "remove" events, fetch        eventos 'add' y 'remove',
the collection from the server    recuperar la colección del
[ ...]                            servidor [...]
Backbone.js a través de un caso práctico




          Backbone.Collection
En la práctica:
                  // Inicializar
                  Backbone.Collection.reset({
                       título: 'Programming Python',
                       autor: 'Mark Lutz',
                       sumario: '…'
                  });

                  // desde servidor
                  Backbone.Collection.fetch();

                  // ops
                  Backbone.Collection.get(id)

                  // eventos [add, remove, reset...]
                  Backbone.Collection.bind('add'
                  function() {});
Backbone.js a través de un caso práctico




                   Backbone.View


The general idea is to organize   La idea principal es organizar tu
your interface into logical       interfaz en vistas lógicas,
views, backed by models, each     conectadas a sus respectivos
of which can be updated           modelos, y que cada una de las
independently when the model      cuáles pueda actualizarse
changes, without having to        independientemente cuando su
redraw the page.                  modelo cambie, sin tener que
                                  actualizar la página completa.
Backbone.js a través de un caso práctico




                Backbone.View




Backbone.View.extend({                        Backbone.View.extend({
    el: $('#detail'),                             className: 'book',
    Events: {                                     render: function() {
          “click #corazon”: “add_wishlist”             $(this.el).html(
    },                                                      _.template(
    add_wishlist: function() {                                     this.model.toJSON()
          Wishlist.add(this.model);                         ))
    }                                             };
});                                           });
Backbone.js a través de un caso práctico




                   Backbone.View
      Una vista (view) de Backbone siempre tiene un elemento DOM,
                     se haya insertado en la página o no.



Backbone.view.el                   El elemento por defecto es
                                   <div>
Backbone.view.el = $               Se puede definir un elemento
('#sidebar')                       existente
Backbone.view.tagName =            Se puede elegir el tipo de elemento
“ span”
Backbone.view.className =          Se puede definir un elemento con clase
“ book”                            (<div class=”book”>)


Backbone.view.id =                 Se puede definir un elemento con id
“ book”                            (<div id=”book”>)
Backbone.js a través de un caso práctico




                 Backbone.Router


Backbone.Router provides          Backbone.Router ofrece
methods for routing client-side   métodos para trabajar con rutas
pages, and connecting them to     en el lado del cliente,
actions and events.               conectándolas con acciones y
                                  eventos.
Backbone.js a través de un caso práctico




    Backbone.Router
    Backbone.Router.extend({
       routes: {
           '':        'index',
           ':book':   'see_detail'
       }
    })




                                     URL:
URL: /                               /#3

index()                       see_detail(book)
                              /* book = 3 */
Implementa esta aplicación a través del curso
Introducción a Backbone.js de easynube:




     Consíguelo gratis en easynube.com

Más contenido relacionado

Último

How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.FlorenciaCattelani
 
Avances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanaAvances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanamcerpam
 
Buenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptxBuenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptxFederico Castellari
 
redes informaticas en una oficina administrativa
redes informaticas en una oficina administrativaredes informaticas en una oficina administrativa
redes informaticas en una oficina administrativanicho110
 
Avances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estosAvances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estossgonzalezp1
 
Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21mariacbr99
 
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptxEVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptxJorgeParada26
 
investigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXIinvestigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXIhmpuellon
 
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...JohnRamos830530
 
Guia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos BasicosGuia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos BasicosJhonJairoRodriguezCe
 

Último (10)

How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.
 
Avances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanaAvances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvana
 
Buenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptxBuenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptx
 
redes informaticas en una oficina administrativa
redes informaticas en una oficina administrativaredes informaticas en una oficina administrativa
redes informaticas en una oficina administrativa
 
Avances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estosAvances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estos
 
Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21
 
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptxEVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
 
investigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXIinvestigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXI
 
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
 
Guia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos BasicosGuia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos Basicos
 

Destacado

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destacado (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Introducción a Backbone.js con un caso práctico - easynube

  • 1. Backbone.js a través de un caso práctico Presentación basada en el curso Introducción a Backbone.js de easynube Consíguelo gratis en easynube.com
  • 2. Backbone.js a través de un caso práctico Backbone.js a travé s de un caso práctico
  • 3. Backbone.js a través de un caso práctico Aplicación Una tienda de libros en la cual se pueden examinar los detalles de cada libro y añadirlos a una lista de deseos. Dentro de la lista será posible visitar los libros con un click así como eliminarlos de la lista.
  • 4. Backbone.js a través de un caso práctico Aplicación Una tienda de libros en la cual se pueden examinar los detalles de cada libro y añadirlos a una lista de deseos. Dentro de la lista será posible visitar los libros con un click así como eliminarlos de la lista.
  • 5. Backbone.js a través de un caso práctico Backbone.Model “Models are the heart of any Los Modelos son el corazón de JavaScript application, cualquier aplicación javascript; containing the interactive data contienen la información con la as well as a large part of the cual se interactúa y una gran logic surrounding it: parte de la lógica que la rodea: conversions, validations, conversiones, validaciones, computed properties, and propiedades y control de access control.” acceso.
  • 6. Backbone.js a través de un caso práctico Backbone.Model En la práctica: Título: Programming Python Autor: Mark Lutz Resumen: ... Backbone.Model.extend({ título: 'Programming Python', autor: 'Mark Lutz', sumario: '…' });
  • 7. Backbone.js a través de un caso práctico Backbone.Collection Collections are ordered sets of Las colecciones son grupos models. You can bind "change" ordenados de modelos. Puedes events to be notified when ligar los eventos 'change' para any model in the collection has notificar cuando se produzca un been modified, listen for "add" cambio en un modelo, escuchar and "remove" events, fetch eventos 'add' y 'remove', the collection from the server recuperar la colección del [ ...] servidor [...]
  • 8. Backbone.js a través de un caso práctico Backbone.Collection En la práctica: // Inicializar Backbone.Collection.reset({ título: 'Programming Python', autor: 'Mark Lutz', sumario: '…' }); // desde servidor Backbone.Collection.fetch(); // ops Backbone.Collection.get(id) // eventos [add, remove, reset...] Backbone.Collection.bind('add' function() {});
  • 9. Backbone.js a través de un caso práctico Backbone.View The general idea is to organize La idea principal es organizar tu your interface into logical interfaz en vistas lógicas, views, backed by models, each conectadas a sus respectivos of which can be updated modelos, y que cada una de las independently when the model cuáles pueda actualizarse changes, without having to independientemente cuando su redraw the page. modelo cambie, sin tener que actualizar la página completa.
  • 10. Backbone.js a través de un caso práctico Backbone.View Backbone.View.extend({ Backbone.View.extend({ el: $('#detail'), className: 'book', Events: { render: function() { “click #corazon”: “add_wishlist” $(this.el).html( }, _.template( add_wishlist: function() { this.model.toJSON() Wishlist.add(this.model); )) } }; }); });
  • 11. Backbone.js a través de un caso práctico Backbone.View Una vista (view) de Backbone siempre tiene un elemento DOM, se haya insertado en la página o no. Backbone.view.el El elemento por defecto es <div> Backbone.view.el = $ Se puede definir un elemento ('#sidebar') existente Backbone.view.tagName = Se puede elegir el tipo de elemento “ span” Backbone.view.className = Se puede definir un elemento con clase “ book” (<div class=”book”>) Backbone.view.id = Se puede definir un elemento con id “ book” (<div id=”book”>)
  • 12. Backbone.js a través de un caso práctico Backbone.Router Backbone.Router provides Backbone.Router ofrece methods for routing client-side métodos para trabajar con rutas pages, and connecting them to en el lado del cliente, actions and events. conectándolas con acciones y eventos.
  • 13. Backbone.js a través de un caso práctico Backbone.Router Backbone.Router.extend({ routes: { '': 'index', ':book': 'see_detail' } }) URL: URL: / /#3 index() see_detail(book) /* book = 3 */
  • 14. Implementa esta aplicación a través del curso Introducción a Backbone.js de easynube: Consíguelo gratis en easynube.com