Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ecossistema Front-End

Ecossistema Front-End

Thiago Alves Luiz

May 20, 2016
Tweet

More Decks by Thiago Alves Luiz

Other Decks in Programming

Transcript

  1. Conjunto de elementos que interagem a fim de estruturar informações

    visuais que permitam a comunicação de usuários com aplicações web
  2. jQuery var $myList = $('#my-list'); $.ajax({ url: 'https://api.domain.com/some-list', success: function

    (resp) { var data = resp.data; data.map(function (value) { var $myListItem = $('<li>').html(value.title); $myList.append($myListItem); }); } });
  3. HTML Resultante <!DOCTYPE html> ... <body> <ul id="my-list"> <li>Item 1</li>

    <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> </ul> </body> </html>
  4. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head>

    <body> <ul id="my-list"><!-- empty --></ul> <script id="template" type="text/template"> {{#each data}} <li>{{ title }}</li> {{/each}} </script> <script src="template-engine.js"></script> </body> </html>
  5. Sem template engine var $myList = $('#my-list'); $.ajax({ url: 'https://api.domain.com/some-list',

    success: function (resp) { var data = resp.data; data.map(function (value) { var $myListItem = $('<li>').html(value.title); $myList.append($myListItem); }); } });
  6. Com template engine var $myList = $('#my-list'); var source =

    $("#template").html(); var template = TemplateEngine.compile(source); $.ajax({ url: 'https://api.domain.com/some-list', success: function (resp) { $myList(template(resp)); } });
  7. ... <link rel="stylesheet" href="style-1.css"> <link rel="stylesheet" href="style-2.css"> <link rel="stylesheet" href="style-3.css">

    <link rel="stylesheet" href="style-4.css"> <link rel="stylesheet" href="style-5.css"> <link rel="stylesheet" href="style-6.css"> ... <script src="script-1"></script> <script src="script-2"></script> <script src="script-3"></script> <script src="script-4"></script> <script src="script-5"></script> <script src="script-6"></script> <script src="script-7"></script> <script src="script-8"></script> <script src="script-9"></script> <script src="script-10"></script> <script src="script-11"></script> <script src="script-12"></script> <script src="script-13"></script> <script src="script-14"></script> <script src="script-15"></script> ...
  8. // Antes var fn = function (x) { return x

    + 1; }; // Depois const fn = (x) => x + 1