<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-38059331</id><updated>2024-09-09T00:45:20.167-07:00</updated><category term="javascript"/><category term="C#"/><category term="api"/><category term="asp.net"/><category term="angular"/><category term="framework"/><category term="linguagem"/><category term="react.JS"/><category term=".NET"/><category term="array"/><category term="componentes"/><category term="consulta"/><category term="consultas"/><category term="desenvolvimento"/><category term="frontend"/><category term="novidades"/><category term="post"/><category term="tecnologia"/><category term="twitter"/><category term="vue.js"/><category term="windows phone 7"/><category term="wp7"/><category term="BI"/><category term="Business Intelligence"/><category term="DLL"/><category term="Data Mining"/><category term="Deserialize"/><category term="IOT"/><category term="Object"/><category term="Serialize"/><category term="TC39"/><category term="TypeScript"/><category term="android"/><category term="aplicativos"/><category term="aprender"/><category term="big data"/><category term="boas praticas"/><category term="caracteres"/><category term="class"/><category term="cli"/><category term="curso"/><category term="delegates"/><category term="dinamico"/><category term="dinheiro"/><category term="doker"/><category term="ecma script"/><category term="empreenderorismo"/><category term="es2018"/><category term="filter"/><category term="firebase"/><category term="funcional"/><category term="ganhar"/><category term="garantia"/><category term="geolitecity"/><category term="geolitedity.dat"/><category term="get"/><category term="gmaps"/><category term="gmaps.dll"/><category term="google"/><category term="hibrido"/><category term="html5"/><category term="iguais"/><category term="integração"/><category term="inteligência Artificial"/><category term="ios"/><category term="lambda"/><category term="lambda expressions"/><category term="maps"/><category term="maxmind"/><category term="metodos extenções"/><category term="micro Serviços"/><category term="microsoft"/><category term="negócios"/><category term="online"/><category term="processos"/><category term="programação"/><category term="propriedades automaticas"/><category term="rede social"/><category term="sequencia"/><category term="servidor"/><category term="string"/><category term="subgurim"/><category term="tendências"/><category term="visual studio"/><category term="web developer"/><category term="webmethod"/><title type='text'>PROJETO TI</title><subtitle type='html'>O seu mundo, o seu lugar (blog OO)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-38059331.post-4184912397132078463</id><published>2019-01-22T04:32:00.000-08:00</published><updated>2019-01-22T04:32:31.763-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="aplicativos"/><category scheme="http://www.blogger.com/atom/ns#" term="aprender"/><category scheme="http://www.blogger.com/atom/ns#" term="curso"/><category scheme="http://www.blogger.com/atom/ns#" term="dinheiro"/><category scheme="http://www.blogger.com/atom/ns#" term="ganhar"/><category scheme="http://www.blogger.com/atom/ns#" term="garantia"/><category scheme="http://www.blogger.com/atom/ns#" term="hibrido"/><category scheme="http://www.blogger.com/atom/ns#" term="html5"/><category scheme="http://www.blogger.com/atom/ns#" term="ios"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="negócios"/><category scheme="http://www.blogger.com/atom/ns#" term="online"/><category scheme="http://www.blogger.com/atom/ns#" term="visual studio"/><title type='text'>CRIANDO APLICATIVOS DO ZERO E FÁCIL!</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://criaraplicativos.com/img/ebook.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;534&quot; data-original-width=&quot;800&quot; height=&quot;266&quot; src=&quot;https://criaraplicativos.com/img/ebook.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2&gt;
O QUE VOCÊ VAI APRENDER?&lt;/h2&gt;
&lt;h3&gt;
SÃO MAIS DE 10 HORAS DE CONTEÚDO PURO E MATERIAIS EXTRAS:&lt;/h3&gt;
&lt;h3&gt;
&lt;ul&gt;
&lt;li&gt;CRIAR APLICATIVOS&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;Mesmo sendo um total iniciante vamos explicar para você como criar aplicativos profissionais. Utilizaremos a linguagem HTML, CSS, Javascript em união com Apache Cordova.&lt;/span&gt;&lt;/ul&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;ul&gt;
&lt;li&gt;MODELO DE NEGÓCIO&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Vamos ensinar como ganhar dinheiro* fazendo aplicativos. Apresentamos os 4 pilares básicos para a monetização de um aplicativos e como fazer para ser bem-sucedido.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/h3&gt;
&lt;h3&gt;
&lt;ul&gt;
&lt;li&gt;ATENDIMENTO AO CLIENTE -&lt;br /&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Vamos dar atenção também a parte humana do processo. Como técnicas de atendimento e precificação, para você convencer seus futuros clientes a fechar negócio com você.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/h3&gt;
&lt;h2 style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://criaraplicativos.com/?ref=J10867540J&quot; target=&quot;_blank&quot;&gt;Veja os módulos do curso aqui&lt;/a&gt;&lt;/h2&gt;
&lt;h2&gt;
&lt;br /&gt;POR QUE FAZER ESTE CURSO?&lt;/h2&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;img src=&quot;https://criaraplicativos.com/img/certificado.png&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;CERTIFICAÇÃO PROFISSIONAL&lt;br /&gt;&lt;br /&gt;A conclusão deste curso oferece certificação profissional válida em todo território nacional. Podendo portanto ser colocado no seu curriculum, com duração total de 10 horas.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://criaraplicativos.com/img/garantia.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;296&quot; data-original-width=&quot;340&quot; height=&quot;276&quot; src=&quot;https://criaraplicativos.com/img/garantia.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;GARANTIA&lt;br /&gt;&lt;br /&gt;Se por algum motivo você achar que este curso não é o que você queria, basta entrar em contato para em até 7 dias receber um reembolso. Tudo o que vou exigir é que você seja honesto em relação aos seus esforços, ok?&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;img src=&quot;https://criaraplicativos.com/img/online.png&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;ONLINE &amp;amp; PERPÉTUO&lt;br /&gt;&lt;br /&gt;Faça as aulas no seu ritmo e onde estiver. O curso é inteiro com vídeo aulas e materiais extras. Sempre haverá novas aulas e atualizações. Seu acesso é perpétuo ao curso.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://go.hotmart.com/J10867540J&quot; target=&quot;_blank&quot;&gt;Inscriões aqui&lt;/a&gt;&lt;/h2&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/4184912397132078463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/4184912397132078463' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4184912397132078463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4184912397132078463'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2019/01/criando-aplicativos-do-zero-e-facil.html' title='CRIANDO APLICATIVOS DO ZERO E FÁCIL!'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-2735968070677874640</id><published>2019-01-08T04:36:00.000-08:00</published><updated>2019-01-08T04:36:38.897-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="array"/><category scheme="http://www.blogger.com/atom/ns#" term="componentes"/><category scheme="http://www.blogger.com/atom/ns#" term="dinamico"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>Criando pequenos componentes dinâmicos com Javascript puro</title><content type='html'>&lt;h3&gt;
Porque nem sempre precisaremos de um framework&lt;/h3&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://playrtech.files.wordpress.com/2016/03/javascript.png?w=863&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;800&quot; height=&quot;178&quot; src=&quot;https://playrtech.files.wordpress.com/2016/03/javascript.png?w=863&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;h3&gt;
Substituir o React? Tá maluco?!&lt;/h3&gt;
&lt;br /&gt;Sabe aquela velha historia de que não precisamos utilizar um canhão pra matar um passarinho? Como já devem ter lido muitas vezes, nem sempre precisamos sobrecarregar um projeto com todos os recursos que uma lib oferece, nesse caso podemos optar por alternativas mais leves e com objetivos mais direcionados (como o Preact em relação ao React). Mas e quando o projeto é tão pequeno que nem mesmo a alternativa mais leve vale o esforço?&lt;div&gt;
&lt;h3&gt;
ES6 Rocks!&lt;/h3&gt;
&lt;br /&gt;O ES6 nos trouxe uma lista enorme de novos e fantásticos recursos além de bons upgrades na sintaxe de alguns recursos já existentes. Um desses novos recursos em particular é extremamente util na criação de componentes dinâmicos: Template Literals (ou Template Strings) e é ele que iremos utilizar nos exemplos a seguir.&lt;br /&gt;&lt;h3&gt;
O que vamos precisar?&lt;/h3&gt;
&lt;br /&gt;Meu objetivo nesse post é que seja simples o suficiente pra que não precisemos de nenhum tipo de configuração prévia (Nada de babel, Webpack, Gulp, etc). Utilizaremos constantes, arrow functions e template literals que já tem um suporte bastante decente nos browsers modernos. Vocês podem conferir mais sobre o suporte clicando &lt;a href=&quot;http://kangax.github.io/compat-table/es6/&quot;&gt;aqui&lt;/a&gt;&lt;br /&gt;&lt;h3&gt;
O que criaremos?&lt;/h3&gt;
&lt;br /&gt;Nada de muito especial, apenas uma lista simples de nomes que será gerada a partir de um array de objetos. Vamos começar?&lt;br /&gt;&lt;br /&gt;Primeiro definimos nosso modelo de dados:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;const data = [&lt;br /&gt; {name: &#39;João&#39;,id: &#39;1&#39;},&lt;br /&gt; {name: &#39;Manuel&#39;,id: &#39;2&#39;},&lt;br /&gt; {name: &#39;Pedro&#39;,id: &#39;3&#39;},&lt;br /&gt; {name: &#39;José&#39;,id: &#39;4&#39;}&lt;br /&gt;]&lt;/b&gt;&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
Criamos então um elemento de referência em nosso HTML:&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&amp;lt;ul data-list&amp;gt;&amp;lt;/ul&amp;gt;&lt;/b&gt;&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
E este será nosso componente dinâmico:&lt;div&gt;
&lt;br /&gt;&lt;div&gt;
&lt;b&gt;const listComponent = (data) =&amp;gt; {&lt;br /&gt; return data.map((item) =&amp;gt; {&lt;br /&gt; return (&lt;br /&gt; `&amp;lt;li&amp;gt;&amp;lt;span&amp;gt;${ item.id }&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;${ item.name }&amp;lt;/span&amp;gt;&amp;lt;/li&amp;gt;`&lt;br /&gt; )&lt;br /&gt; }).join(&#39;&#39;)&lt;br /&gt;}&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;O que fizemos? Primeiro atribuímos a nossa constante uma &lt;b&gt;arrow function &lt;/b&gt;que recebe o argumento &lt;b&gt;data&lt;/b&gt;. Em seguida invocamos o método &lt;b&gt;map &lt;/b&gt;de nosso argumento que por sua vez invocará uma função de &lt;b&gt;callback &lt;/b&gt;para cada item em nosso array, como nosso array contém quatro objetos, teremos então quatro elementos de lista em forma de template strings. Utilizamos então um recurso chamado &lt;b&gt;string interpolation (${ data.value }) &lt;/b&gt;para inserir os dados de nossos objetos em nossa template. Por fim note acima que utilizamos o método&lt;b&gt; join()&lt;/b&gt; após o &lt;b&gt;map&lt;/b&gt;, fizemos isso para evitar algumas virgulas indesejadas na conversão do array em string.&lt;br /&gt;&lt;br /&gt;Para prosseguir armazenamos nosso elemento HTML em uma constante:&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;const el = document.querySelector(&#39;[data-list]&#39;)&lt;/b&gt;&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
E pra finalizar invocamos o método &lt;b&gt;innerHTML &lt;/b&gt;chamando a função&lt;b&gt; listComponent()&lt;/b&gt;, que receberá nosso &lt;b&gt;array &lt;/b&gt;data como argumento:&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;el.innerHTML = listComponent(data)&lt;/b&gt;&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;Esse tipo de abordagem na criação de componentes simples pode ser bastante útil quando precisamos, por exemplo, popular as options de um select dinamicamente ou criar listas de qualquer tipo.&lt;br /&gt;&lt;br /&gt;Um ponto importante: Diferentemente do React e outras UI libs modernas que, em resumo, utilizam um DOM virtual absurdamente veloz, o componente que criamos será inserido no DOM real, que é muito mais lento, por isso recomendo fortemente que utilize-o com moderação.&lt;br /&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/2735968070677874640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/2735968070677874640' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/2735968070677874640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/2735968070677874640'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2019/01/criando-pequenos-componentes-dinamicos.html' title='Criando pequenos componentes dinâmicos com Javascript puro'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-5076933694051996830</id><published>2018-12-27T03:42:00.001-08:00</published><updated>2018-12-27T04:05:10.492-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="angular"/><category scheme="http://www.blogger.com/atom/ns#" term="desenvolvimento"/><category scheme="http://www.blogger.com/atom/ns#" term="empreenderorismo"/><category scheme="http://www.blogger.com/atom/ns#" term="frontend"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="linguagem"/><category scheme="http://www.blogger.com/atom/ns#" term="novidades"/><category scheme="http://www.blogger.com/atom/ns#" term="react.JS"/><category scheme="http://www.blogger.com/atom/ns#" term="tecnologia"/><category scheme="http://www.blogger.com/atom/ns#" term="vue.js"/><category scheme="http://www.blogger.com/atom/ns#" term="web developer"/><title type='text'>Principais tendências JavaScript para procurar em 2019</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/1200/1*rjUML9TK5Pb8u6bM3N9CSw.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;800&quot; height=&quot;180&quot; src=&quot;https://cdn-images-1.medium.com/max/1200/1*rjUML9TK5Pb8u6bM3N9CSw.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Como sabemos que o mundo digital está em multicamadas, várias tecnologias se juntam para oferecer a você uma experiência através de uma tela inteligente.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Se você já pensou em como as páginas da web e os sites estão dando um impulso à sua empresa, há muitas coisas por trás da cortina, incluindo as principais empresas de desenvolvimento web de pilha completa.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O desenvolvimento do JavaScript está mudando rapidamente, especialmente nos últimos doze meses. 2018 foi um ano com muita ação, mudanças e novas iniciativas no desenvolvimento web de front-end.&amp;nbsp;A corrida para se tornar a estrutura preferida do JavaScript se aqueceu, à medida que mais projetos começaram a optar pela React js, incluindo o Vue por cima do Angular.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Se você é uma startup ou uma pequena empresa, vale a pena dar uma olhada em todas as novas tendências que surgiram no ano passado. Estas novas estruturas e integrações podem ser a chave para colocar o pé na porta de novos projetos inovadores.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Vamos dar uma olhada nas principais tendências em JavaScript para que você esteja atualizado e à frente do jogo:&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
1) GraphQL&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*06BrarH17nDchDAB5PQItA.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;409&quot; data-original-width=&quot;800&quot; height=&quot;163&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*06BrarH17nDchDAB5PQItA.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #252525; font-family: &amp;quot;roboto&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
Muitos consideram que o GraphQL é o substituto das APIs REST no futuro. No entanto, REST e GraphQL não precisam necessariamente ser concorrentes, e um não é melhor que o outro para todos os aplicativos.&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;color: #252525; font-family: &amp;quot;roboto&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
GraphQL é uma linguagem de consulta que permite aos desenvolvedores fazer solicitações mais específicas do servidor e empacotá-las de uma maneira simples.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O GraphQL integra-se ao React através da Relay framwork. É uma tendência importante para solicitações de servidor e APIs JavaScript para avançar, e é outra linguagem que vale a pena tentar.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
2) Reason&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*77K4g_1Qh7gzd6Uh1CcvYg.jpeg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;389&quot; data-original-width=&quot;800&quot; height=&quot;155&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*77K4g_1Qh7gzd6Uh1CcvYg.jpeg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O Facebook está usando o Reason em produção para impulsionar o aplicativo da web do Messenger. O motivo é uma compilação da linguagem JavaScript. Ele também inclui um wrapper Reason React que permite que você escreva o código do Reason que é compilado no React JS.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O motivo é uma linguagem de programação do tipo funcional e estático que pode direcionar aplicativos da Web em uma única página. Ele permite que você escreva código de segurança do tipo que funciona bem com JavaScript e OCaml.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Esta é definitivamente uma tendência emergente que vale a pena ver (e talvez alguma experimentação com um projeto paralelo) se você for um desenvolvedor de JavaScript.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
3) Vue.js&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*H4uJnCQuAfIlqJGekzYffw.jpeg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;391&quot; data-original-width=&quot;800&quot; height=&quot;155&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*H4uJnCQuAfIlqJGekzYffw.jpeg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O Vue.js se tornou um dos frameworks JavaScript mais populares atualmente. Sua aplicação e potencial atrai muita atenção e leva a longas discussões. É uma biblioteca JavaScript para construir interfaces web.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O maior benefício do Vue é a ausência de pedigree. É fresco e tem pouca bagagem. Tem aprendido com os erros e sucessos de React &amp;amp; Angular. Do jeito que vemos, o Vue é leve e fácil de aprender.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Recursos para procurar em 2019:&lt;/h2&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Ótimo desempenho com o Vue.js 2.x&lt;/li&gt;
&lt;li&gt;animações SVG&lt;/li&gt;
&lt;li&gt;Produto de código aberto&lt;/li&gt;
&lt;li&gt;Vuetify&amp;nbsp;para implementar ótimas idéias de interface de usuário&lt;/li&gt;
&lt;li&gt;Nuxt tool&amp;nbsp;para substituição de módulos&lt;/li&gt;
&lt;li&gt;Proxy support&lt;/li&gt;
&lt;li&gt;Stable API&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;h2&gt;
4) Next.js&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*I8aiGzTqygDJja5eLjb8rQ.jpeg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;800&quot; height=&quot;180&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*I8aiGzTqygDJja5eLjb8rQ.jpeg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Next.js é uma estrutura minimalista para aplicativos JavaScript. Ajuda a simplificar a experiência de implementação de um aplicativo. Quando combinado com o React, você pode obter toda a poderosa funcionalidade React ao mesmo tempo em que obtém uma experiência simples semelhante ao Vue em termos de ferramentas, divisão de código, roteamento, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
Next.js trabalha para fazer seu JavaScript funcionar universalmente, seja em um servidor, computador ou dispositivo móvel. Isso ajuda a criar aplicativos universais representados no servidor com um código mínimo e uma curva de aprendizado.&lt;/div&gt;
&lt;div&gt;
Vale a pena aprender se você ainda não o fez, especialmente porque ele funciona bem com o React para criar poderosas aplicações universais. &lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;color: #252525; font-family: &amp;quot;roboto&amp;quot; , &amp;quot;arial&amp;quot; , sans-serif; font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2&gt;
5) ReactJS&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*EVqCcmCPgpNKxU1wzcTHgw.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;351&quot; data-original-width=&quot;800&quot; height=&quot;140&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*EVqCcmCPgpNKxU1wzcTHgw.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
React é uma biblioteca JavaScript&amp;nbsp;&amp;nbsp;mantidas pelo Facebook&amp;nbsp;para criar interfaces de usuário. É ideal para grandes aplicações web que usam dados e permitem alterações ao longo do tempo sem recarregar a página.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O React simplifica a criação de interfaces de usuário interativas e pode ser usado em combinação com outras bibliotecas ou estruturas JS, como o AngularJS. React tem o apoio do Facebook e sua comunidade cresceu junto com sua popularidade.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
6) De AngularJS a Angular 7&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*XXApOUsrFw-xMWseUZp9MQ.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;339&quot; data-original-width=&quot;800&quot; height=&quot;135&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*XXApOUsrFw-xMWseUZp9MQ.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Há alguns anos, o Google iniciou o Angular, um framework que é um visionário de futuras mudanças nas APIs da web e é receptivo a ele. Depois de aprender com sua experiência em Angular 1, eles criaram Angular 2 para Angular 7 e alcançaram uma grande melhoria.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Como uma visão de longo prazo, o Google aponta para a plataforma web agora com Angular e a cada seis meses ele lançará uma versão principal do Angular.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O Angular fornece injeção de dependência, particularmente útil para a montagem de serviços de dados para aplicativos, juntamente com o uso de um modelo HTML para compor componentes. Portanto, é o melhor momento para começar com o Angular 7 para desenvolvedores.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Os recursos que distinguem o Angular 7 das versões angulares anteriores incluem o seguinte:&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Os componentes do Angular Elements agora suportam projeção de conteúdo via slots.&lt;/li&gt;
&lt;li&gt;Ele melhora o desempenho geral do aplicativo adicionando ou removendo automaticamente o polyfill de metadados de reflexão.&lt;/li&gt;
&lt;li&gt;O Angular CLI pode solicitar aos usuários o recurso de Prompts do CLI para ajudá-los a tomar decisões.&lt;/li&gt;
&lt;li&gt;A documentação da CLI foi integrada nos principais documentos do Angular.io.&lt;/li&gt;
&lt;li&gt;The CLI documentation has been integrated into the main Angular.io docs.&lt;/li&gt;
&lt;li&gt;Ao usar os orçamentos de pacote padrão, os usuários serão avisados ​​sempre que o app exceder 2 MB. No entanto, haverá um erro se o pacote inicial exceder 5 MB.&lt;/li&gt;
&lt;/ul&gt;
Qualquer que seja a conclusão, você deve admitir que o AngularJS (mantido pelo Google) tem a capacidade de criar aplicativos da Web como nenhum outro. Com um ritmo acelerado de desenvolvimento, fácil integração de código, a disponibilidade para os testes unitários do AngulatJS (versões atuais) certamente pode ser sua escolha para o próximo projeto.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Conclusão:&lt;/h2&gt;
Até agora, cobrimos algumas das muitas tendências emergentes no desenvolvimento de JavaScript e aplicativos da Web front-end neste blog. Felizmente, você encontrou algo novo para o seu negócio, seja ele de inicialização ou de grande porte.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O JavaScript está em constante mudança, e é provável que haja novas tecnologias líderes para esta data no próximo ano. Ficar à frente da curva é um desafio, mas é importante para os desenvolvedores de front-end que querem trabalhar com as melhores tendencias nos projetos mais interessantes.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://go.hotmart.com/M10783897H&quot; target=&quot;_blank&quot;&gt;Quer aprender sobre Vue.JS? Aqui está um bom curso para você.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://go.hotmart.com/I10867453W&quot; target=&quot;_blank&quot;&gt;Você quer fazer aplicativos? Aprenda a criar apps para Android e iOS - Curso de React Native, o framework incrível do Facebook. Nosso objetivo é trazer ao desenvolvedor recém-chegado no mundo mobile, um conteúdo mais direcionado à produtividade imediata, reduzindo a curva de aprendizado nesse novo ambiente. Nosso primeiro foco está na tecnologia disponibilizada pelo Facebook denominada React Native. Com o aprendizado deste curso, você consegue criar apps profissionais de uma maneira prática. O curso é baseado nas mais recentes literaturas sobre o assunto, e já te entrega o conteúdo mastigado, te habilitando a construir um aplicativo do início ao fim.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;a href=&quot;https://go.hotmart.com/J10867540J&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;90&quot; src=&quot;https://genialcursos.com.br/divulgacao/banner728x90.jpg&quot; width=&quot;728&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/5076933694051996830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/5076933694051996830' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/5076933694051996830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/5076933694051996830'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2018/12/principais-tendencias-javascript-para.html' title='Principais tendências JavaScript para procurar em 2019'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-4758412952134814814</id><published>2018-12-21T07:41:00.000-08:00</published><updated>2018-12-21T07:43:10.160-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="desenvolvimento"/><category scheme="http://www.blogger.com/atom/ns#" term="linguagem"/><category scheme="http://www.blogger.com/atom/ns#" term="microsoft"/><category scheme="http://www.blogger.com/atom/ns#" term="novidades"/><title type='text'>Novidades do C# 8</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/1600/1*oPQEeS9zK-8OlF6kqFzPIQ.jpeg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;378&quot; data-original-width=&quot;800&quot; height=&quot;151&quot; src=&quot;https://cdn-images-1.medium.com/max/1600/1*oPQEeS9zK-8OlF6kqFzPIQ.jpeg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Em um video do Channel9, Mads Torgersen demonstra &lt;a href=&quot;https://channel9.msdn.com/Blogs/Seth-Juarez/A-Preview-of-C-8-with-Mads-Torgersen&quot;&gt;as primeiras quatro features do C# 8&lt;/a&gt;.&lt;br /&gt;
&lt;h2&gt;
Nullable Reference Types&lt;/h2&gt;
&lt;div&gt;
Já falamos sobre nullable references types no passado, mas resumindo: a idéia é que reference types (os tipos de referência) não seriam mais nulos por padrão. Em vez disso, você deve explicitamente marcá-los como nulos (anuláveis) usando a mesma sintaxe &quot;Tipo?&quot; Que você usa para nullable value types (tipos de valor anuláveis).&lt;/div&gt;
&lt;div&gt;
Atribuir um null a um tipo non-nullable resultará em um aviso de compilação. Da mesma forma, ao buscar um tipo null teremos um aviso de compilação, a menos que a variável em questão fosse explicitamente verificada por nulo previamente. Então, teoricamente, a única mudança que os desenvolvedores precisam fazer é não utilizar a sintaxe &quot;Tipo?&quot;, quando apropriado.&lt;br /&gt;
&lt;br /&gt;
Desde o nosso report, a nova sintaxe foi adicionada a esse recurso. Porém, pode haver um cenário onde você sabe que a variável nullable x não é realmente nula, mas você não pode provar isso para o compilador.&lt;br /&gt;
&lt;br /&gt;
Neste caso, você pode usar x!.Method () para suprimir o aviso do compilador sobre possíveis exceções de referência nula.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;h2&gt;
Async Streams (também conhecidos como foreach async)&lt;/h2&gt;
Async stream é equivalente assíncronos ao IEnumerable. Como reportado antes, &lt;a href=&quot;https://www.infoq.com/news/2017/05/async-streams&quot;&gt;async streams&lt;/a&gt; é utilizado desde 2015. Depois de muito debate a sintaxe estabelecida é:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;foreach await (string s in asyncStream)&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Ao definir um objeto async, usamos a seguinte assinatura:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;async IAsyncEnumerable&amp;lt;T&amp;gt; MethodName()&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
Assim como em métodos IEnumerable, pode ser usado &quot;yield return&quot; para construir stream de objetos em uma lazy fashion.&lt;br /&gt;
&lt;br /&gt;
O benefício de usar Async em vez de IObservable &amp;lt;T&amp;gt; de Extensões Reativas, é que o consumidor controla a taxa de fluxo. Isso é referido como um &quot;pull model&quot;. Já o IObservable &amp;lt;T&amp;gt; é um &quot;push mode&quot;, o que significa que o &quot;Producer&quot; pode inundar o &quot;Consumer&quot; com uma taxa de fluxo maior do que ele pode manipular.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;h2&gt;
Implementação de Interface Padrão&lt;/h2&gt;
As implementações de interface padrão são essencialmente uma forma limitada de herança múltipla. Isso permitirá que interfaces abstratas definam completamente métodos, como classes abstratas. No entanto, as interfaces abstratas ainda não poderão declarar construtores ou atributos.&lt;br /&gt;
&lt;br /&gt;
Nota: Você pode simular campos em uma interface usando &lt;a href=&quot;https://www.infoq.com/news/2015/05/CSharp-7-extension-classes&quot;&gt;ConditionalWeakTable&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
O principal benefício das implementações de interface padrão é que você pode adicionar novos métodos a uma interface existente sem quebrar a compatibilidade inversa. Porém, isso não é garantido, pois só funcionaria quando um método padrão adequado for planejado.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;h2&gt;
Extension Everything&lt;/h2&gt;
Um solicitação de longo tempo é ter a possibilidade de escrever métodos de extensão (extension methods) em C#, não somente propriedades de extensão. Na verdade, não há como sequer definir uma propriedade ou evento de extensão usando o padrão atual. Além disso, colocar métodos de extensão em classes estáticas parece &quot;estranho&quot; para muitas pessoas.&lt;br /&gt;
&lt;br /&gt;
Sob o novo design, existe uma nova construção chamada &quot;extension&quot;. Por exemplo, se você quiser criar métodos de extensão e propriedades para uma classe de Cliente, você escreveria:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;extension CustomerExt extends Customer {&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;//methods and properties go here&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;}&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Tal como acontece com as interfaces, não é possível definir campos de instância em extension, mas é possível simular usando ConditionalWeakTable. Também podem ser definidos campos estáticos.&lt;br /&gt;
&lt;br /&gt;
Além de propriedades, eventos e sobrecargas de operadores, está sendo considerado permitir construtores de extensão (extension constructors). Os construtores de extensão seriam muito interessantes em factory e em cenários de pooling de objetos.&lt;br /&gt;
&lt;br /&gt;
Extensions interfaces permitem adicionar novas interfaces em classes já existentes, também é uma tido como uma novidade. Esta, provavelmente, não será uma nova funcionalidade do C# 8, já que isso requer alterações no runtime.&lt;/div&gt;
&lt;div&gt;
Para maiores informações sobre o futuro do C#, acesse o &lt;a href=&quot;https://github.com/dotnet/csharplang&quot;&gt;C# Language Design Repo.&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/4758412952134814814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/4758412952134814814' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4758412952134814814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4758412952134814814'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2018/12/novidades-do-c-8.html' title='Novidades do C# 8'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-2954465192372011532</id><published>2018-12-20T04:45:00.000-08:00</published><updated>2018-12-20T08:14:20.958-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="array"/><category scheme="http://www.blogger.com/atom/ns#" term="filter"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="funcional"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>Criando um filtro de busca customizável com JavaScript funcional</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://i.ytimg.com/vi/4_iT6EGkQfk/maxresdefault.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;800&quot; height=&quot;180&quot; src=&quot;https://i.ytimg.com/vi/4_iT6EGkQfk/maxresdefault.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Tutoriais utilizando bibliotecas e frameworks para state management se tornaram comuns. Apesar disso, já que muita gente usa muitos frameworks diferentes, muitas vezes precisamos falar sobre a plataforma que permite isso tudo: a odiadíssima ferramenta que é o JavaScript, na sua forma mais pura — conforme descrito com documentações excelentes como a da &lt;a href=&quot;https://developer.mozilla.org/&quot;&gt;MDN&lt;/a&gt;.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Esse tutorial também pode ser útil para quem está iniciando em JavaScript e desenvolvimento em geral já começar com alguma ideia do que é programação funcional. O termo está se tornando popular e quem não subir nesse barco pode ficar para trás em pouco tempo.&lt;br /&gt;
&lt;br /&gt;
Não vamos adentrar nos detalhes do que é programação funcional neste artigo — isso é assunto para outras horas de conversa. Aqui, ficaremos no rápido e simples: alcançar nosso objetivo, evitando mutações dos dados e estado global.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;h2&gt;
Iniciando o projeto&lt;/h2&gt;
Pelo bem da simplicidade, vamos manter tudo num único arquivo, que vai ter essa cara:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;!DOCTYPE HTML&amp;gt; &amp;lt;html lang=&#39;pt&#39;&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;head&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;meta charset=&#39;utf-8&#39;&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;title&amp;gt;Um simples exemplo de filtro de busca.&amp;lt;/title&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;/head&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;body&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;h1&amp;gt;Um simples exemplo de filtro de busca.&amp;lt;/h1&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;input type=&#39;text&#39; id=&#39;search-filter&#39; placeholder=&#39;Filtre sua busca por aqui.&#39;&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;div id=&#39;options&#39;&amp;gt;&amp;lt;/div&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;script&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;// Code goes here&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;/script&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;/body&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&amp;lt;/html&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Antes de qualquer coisa, vamos criar um scope wrapper, uma pequena camada de encapsulamento que impede que o nosso código fique visível fora do escopo do nosso filtro. É simplesmente uma função sem nome, executada no momento em que é definida:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&amp;lt;body&amp;gt; &amp;lt;h1&amp;gt;Um simples exemplo de filtro de busca.&amp;lt;/h1&amp;gt; &lt;br /&gt;&amp;lt;input type=&#39;text&#39; id=&#39;search-filter&#39; placeholder=&#39;Filtre sua busca por aqui.&#39;&amp;gt; &lt;br /&gt;&amp;lt;div id=&#39;options&#39;&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;&amp;lt;script&amp;gt; &lt;br /&gt;;(() =&amp;gt; { &lt;br /&gt;// safe coding! &lt;br /&gt;})() &lt;br /&gt;&amp;lt;/script&amp;gt; &lt;br /&gt;&amp;lt;/body&amp;gt; &lt;/b&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;a href=&quot;https://stackoverflow.com/questions/17058606/why-using-self-executing-function&quot;&gt;Essa resposta no StackOverflow&lt;/a&gt; (em inglês) explica resumidamente por que devemos usar scope wrappers, ou self-executing functions, as funções autoexecutantes.&lt;h2 style=&quot;text-align: justify;&quot;&gt;
Selecionando os elementos&lt;/h2&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
O arquivo que nós criamos não tem nada demais: um título, nosso elemento de entrada — no qual digitaremos para filtrar os resultados — e uma área para incluir as opções, que é o que vamos fazer em seguida.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Primeiro, selecionaremos os elementos que queremos:&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*MDKYdchI_KxN4jVo_PpuLQ.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;320&quot; data-original-width=&quot;800&quot; height=&quot;128&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*MDKYdchI_KxN4jVo_PpuLQ.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Sempre gosto de imprimir algo dinamicamente nas áreas, só para garantir — não leva nem trinta segundos!&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Adicionamos isso…&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*NEvIVB_YNstvNZwyD8aT-g.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;401&quot; data-original-width=&quot;800&quot; height=&quot;160&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*NEvIVB_YNstvNZwyD8aT-g.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
E vemos esse resultado:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*Jm0G6saoJ5g1lSW1paFpHg.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;131&quot; data-original-width=&quot;547&quot; height=&quot;76&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*Jm0G6saoJ5g1lSW1paFpHg.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Agora que sabemos que o DOM está sendo manipulado como esperado, vamos pensar em algumas melhorias para esse código simples. Mas ele tem só 4 linhas, você me pergunta. A resposta, ao melhor estilo de filme de kung fu dos anos 70, é que fazemos agora para não ter que fazer no futuro.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para começar, já dá para ver um problema aí: toda vez que eu quiser selecionar num novo elemento, vou ter que digitar &lt;b&gt;document.querySelector.&lt;/b&gt; Já que não pretendo usar jQuery, vamos criar uma função que encurta esse nosso caminho.&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Ela não deve ser usada mais muitas vezes neste tutorial, mas pode ser usada no futuro, o que possivelmente justifica aplicar os princípios &lt;b&gt;DRY &lt;/b&gt;nesse pequeno &lt;b&gt;snippet&lt;/b&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*TL0fdEvNzIM3HxX26vVGVQ.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;549&quot; data-original-width=&quot;800&quot; height=&quot;219&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*TL0fdEvNzIM3HxX26vVGVQ.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
O que a função &lt;b&gt;$&lt;/b&gt; faz aqui é simples: ela recebe um parâmetro, &lt;b&gt;selector&lt;/b&gt;, e retorna o elemento, da mesma forma que &lt;b&gt;document.querySelector&lt;/b&gt;. E assim, caso um dia queiramos adicionar &lt;b&gt;jQuery &lt;/b&gt;(por favor, não…), ele não conflitará com nosso código graças ao &lt;b&gt;scope wrapper&lt;/b&gt; que definimos mais cedo.&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: justify;&quot;&gt;
Criando a lista modificável&lt;/h2&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Se você usa um framework de monitoramento de estado como React ou Vue, já sabe como criar uma lista que se atualize conforme você alterar um objeto JavaScript. Esse seria o cenário ideal — onde só criamos ou removemos itens de um array para atualizar o DOM, mas, pela simplicidade do nosso código, vamos criar uma função que recria a parte específica do documento em que vamos trabalhar.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
A função poderia acessar um array definido no nosso escopo atual e atualizar acessa os elementos selecionados usando nossa recém criada função &lt;b&gt;$&lt;/b&gt;, atualizando a vista do usuário a partir desses elementos. Essencialmente, nós queremos fazer isso, mas se o código crescer, um array definido fora do escopo da função pode tornar as coisas confusas. Compare:&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*7NFuN60DyFByVXVvI1I_-w.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;738&quot; data-original-width=&quot;800&quot; height=&quot;295&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*7NFuN60DyFByVXVvI1I_-w.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Neste exemplo, nosso trabalho é cumprido. Definimos uma lista de opções, e uma função que me permite atualizá-la. Qual é o problema?&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
O primeiro é que dependemos do objeto global &lt;b&gt;list &lt;/b&gt;e o segundo, de&lt;b&gt; $&lt;/b&gt;. Se um desses objetos mudar, teremos uma função quebrada. Em outro caso problemático, &lt;b&gt;list &lt;/b&gt;é alterado e nos esquecemos de chamar&lt;b&gt; updateElements&lt;/b&gt;. &lt;b&gt;updateElements&lt;/b&gt; também pode simplesmente não estar acessível do escopo atual, caso &lt;b&gt;list &lt;/b&gt;seja movido.&lt;/div&gt;
&lt;h2 style=&quot;text-align: justify;&quot;&gt;
Entrem pureza e iteradores&lt;/h2&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Vamos criar uma função que solucione esses problemas.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para isso, precisaremos utilizar dois conceitos: um específico das linguagens de programação modernas, outro do conceito de programação funcional: iteradores e pureza.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Iteráveis são objetos que contêm zero ou mais elementos e podem ser iterados — isto é, ter seus itens trabalhados individualmente. Uma função ou método que trabalhe sobre um iterável é um iterador. Iteradores em JavaScript são métodos como &lt;b&gt;find, filter, map, reduce, forEach&lt;/b&gt;.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*Asz-wID9Ok7HkqX8uwfg6w.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;800&quot; data-original-width=&quot;747&quot; height=&quot;320&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*Asz-wID9Ok7HkqX8uwfg6w.png&quot; width=&quot;298&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Espera aí, o que exatamente aconteceu ali?! Vamos por etapas.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
A função &lt;b&gt;elementList&lt;/b&gt;:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Recebe um parâmetro, &lt;b&gt;itemList&lt;/b&gt;;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Aplica &lt;b&gt;map &lt;/b&gt;a &lt;b&gt;itemList&lt;/b&gt;, transformando cada item em um elemento &lt;b&gt;&amp;lt;li&amp;gt;&lt;/b&gt;;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Aplica &lt;b&gt;reduce &lt;/b&gt;ao resultado da transformação, reduzindo o array de &lt;b&gt;&amp;lt;li&amp;gt;&lt;/b&gt;a um elemento &lt;b&gt;&amp;lt;ul&amp;gt;&lt;/b&gt; contendo os &lt;b&gt;&amp;lt;li&amp;gt;&lt;/b&gt;s;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Retorna o valor reduzido.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Fora da função, adicionamos o novo elemento&lt;b&gt; elementList(optionList)&lt;/b&gt; ao DOM.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
A primeira vantagem desse método é a pureza: em programação funcional, pureza de uma função é a característica de que&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
1) ela não faz uso de, nem altera, nenhum elemento externo a ela, e 2) dados os mesmos parâmetros, retorna sempre o mesmo resultado. &lt;b&gt;elementList&lt;/b&gt;, ao exigir &lt;b&gt;itemList &lt;/b&gt;(em vez de alterar um objeto global, como no primeiro exemplo), respeita esse princípio.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Outro princípio que era violado e não é mais é a imutabilidade, adquirida, nesse caso, graças aos iteradores: um valor é imutável quando, após definido, não pode ser alterado. No primeiro exemplo, confiávamos na alteração do array list para atualizar a visão do usuário; no segundo, recebemos a lista cada vez que precisamos atualizar a visão.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Já que a função não tem efeitos colaterais (não altera nada alheio a ela), não há necessidade de nomeá-la como um verbo, afinal, não aplica uma ação: o relevante para o mundo externo é o valor retornado, que é um objeto, e não a ação praticada. Por isso, a função foi nomeada &lt;b&gt;elementList&lt;/b&gt;, e não &lt;b&gt;createElementList &lt;/b&gt;ou algo parecido.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Respeitando a esses dois princípios, diminuimos as chances de passarmos o valor errado para uma função, recebendo resultados inesperados.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Nos dois casos, o resultado é o mesmo:&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*APkA9IOT75Y_Jlugbc1VBA.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;162&quot; data-original-width=&quot;547&quot; height=&quot;94&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*APkA9IOT75Y_Jlugbc1VBA.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Beleza! Perfeito. Agora só precisamos que o filtro funcione.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para referência, este é o código que temos até agora:&lt;/div&gt;
&lt;br /&gt;&lt;b&gt;&amp;lt;!DOCTYPE HTML&amp;gt; &amp;lt;html lang=&#39;pt&#39;&amp;gt; &lt;br /&gt;&amp;lt;head&amp;gt; &lt;br /&gt;&amp;lt;meta charset=&#39;utf-8&#39;&amp;gt; &lt;br /&gt;&amp;lt;title&amp;gt;Um simples exemplo de filtro de busca.&amp;lt;/title&amp;gt; &lt;br /&gt;&amp;lt;/head&amp;gt; &lt;br /&gt;&amp;lt;body&amp;gt; &lt;br /&gt;&amp;lt;h1&amp;gt;Um simples exemplo de filtro de busca.&amp;lt;/h1&amp;gt; &lt;br /&gt;&amp;lt;input type=&#39;text&#39; id=&#39;search-filter&#39; placeholder=&#39;Filtre sua busca por aqui.&#39;&amp;gt; &lt;br /&gt;&amp;lt;div id=&#39;options&#39;&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;&amp;lt;script&amp;gt; &lt;br /&gt;;(() =&amp;gt; { &lt;br /&gt;const $ = &lt;br /&gt;selector =&amp;gt; &lt;br /&gt;document.querySelector(selector) &lt;br /&gt;const filterInput = $(&#39;#search-filter&#39;) &lt;br /&gt;const filteredOptions = $(&#39;#options&#39;) &lt;br /&gt;const elementList = &lt;br /&gt;itemList =&amp;gt; &lt;br /&gt;itemList &lt;br /&gt;.map(item =&amp;gt; { &lt;br /&gt;const li = document.createElement(&#39;li&#39;) &lt;br /&gt;li.textContent = item &lt;br /&gt;return li &lt;br /&gt;}) &lt;br /&gt;.reduce((ul, item) =&amp;gt; { &lt;br /&gt;ul.appendChild(item) &lt;br /&gt;return ul &lt;br /&gt;}, document.createElement(&#39;ul&#39;)) &lt;br /&gt; &lt;br /&gt;const optionList = [&#39;foo&#39;, &#39;bar&#39;, &#39;baz&#39;] &lt;br /&gt; &lt;br /&gt;const optionsArea = $(&#39;#options&#39;) &lt;br /&gt; &lt;br /&gt;optionsArea.appendChild(elementList(optionList)) &lt;br /&gt; &lt;br /&gt;})() &lt;br /&gt;&amp;lt;/script&amp;gt; &lt;br /&gt;&amp;lt;/body&amp;gt; &lt;br /&gt;&amp;lt;/html&amp;gt; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;
Fazendo a lista reagir à entrada de dados&lt;/h2&gt;
&lt;br /&gt;
Agora que a lista já aparece a partir de um objeto, precisamos fazer com que ela seja filtrada pelo &amp;lt;input&amp;gt; que criamos mais cedo.&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para isso, vamos precisar de algumas ferramentas do JavaScript e do DOM: do primeiro, a API String, e especificamente seus métodos includes e &lt;b&gt;indexOf&lt;/b&gt;; do segundo, a parte mais básica da API de eventos, &lt;b&gt;Element.addEventListener&lt;/b&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Acontece que toda vez que você pratica uma ação de entrada de dados em um elemento de formulário, o evento &lt;b&gt;input &lt;/b&gt;é emitido. Usando ele, podemos extrair o novo valor a cada atualização. Vamos experimentar:&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*6wIwkdX56_B36r8fkhoZsg.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;395&quot; data-original-width=&quot;800&quot; height=&quot;158&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*6wIwkdX56_B36r8fkhoZsg.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Experimente adicionar o código acima à página . Cada vez que um valor for inserido na caixinha, um alerta nativo do navegador aparecerá na tela e esperará pelo seu OK. Além de irritante, exemplifica o que queremos fazer — manipular o valor inserido na caixa.&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Agora vamos usar a função que definimos mais cedo, &lt;b&gt;elementList&lt;/b&gt;, para renderizar a lista cada vez que o evento &lt;b&gt;input &lt;/b&gt;for ouvido. Copie a linha usada para criar a lista para dentro do monitor de evento. Não se esqueça, também, de remover a lista anterior, ou você vai acabar com dezenas de listas:&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*4epottTNGJ5JSbOyYGo_7w.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;297&quot; data-original-width=&quot;800&quot; height=&quot;118&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*4epottTNGJ5JSbOyYGo_7w.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Aqui, a &lt;b&gt;elementList &lt;/b&gt;e o &lt;b&gt;optionList &lt;/b&gt;estão acessíveis pois foram declarados anteriormente. O próximo passo é, simplesmente, passar algo diferente como parâmetro para &lt;b&gt;elementList &lt;/b&gt;— uma versão filtrada de &lt;b&gt;optionList&lt;/b&gt;.&lt;/div&gt;
&lt;h2 style=&quot;text-align: justify;&quot;&gt;
Criando o filtro de busca&lt;/h2&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Para isso, vamos novamente recorrer aos iteradores — neste caso, &lt;b&gt;filter &lt;/b&gt;e &lt;b&gt;sort&lt;/b&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Por enquanto, vamos fazer um filtro básico: exibir os elementos da lista que contêm a string inserida no campo de filtro.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*inpCGNDDoTZAOZOoS7v4Yg.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;444&quot; data-original-width=&quot;800&quot; height=&quot;177&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*inpCGNDDoTZAOZOoS7v4Yg.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: justify;&quot;&gt;
O resultado&lt;/h2&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*irslqINNai45gPzf3lV2hw.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;141&quot; data-original-width=&quot;551&quot; height=&quot;81&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*irslqINNai45gPzf3lV2hw.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*gi--y_50JEXN5hku6cuqgw.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;112&quot; data-original-width=&quot;549&quot; height=&quot;65&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*gi--y_50JEXN5hku6cuqgw.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Boom! O básico da missão já foi cumprido — e em menos de 50 linhas! Por fim, vamos colocar uma lista com itens que signifiquem algo:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*RzDD9p2d1iSjM9en13knkw.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;268&quot; data-original-width=&quot;543&quot; height=&quot;157&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*RzDD9p2d1iSjM9en13knkw.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
Após reorganizar alguns detalhes do código, finalizamos a primeira parte do tutorial com o seguinte código:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&amp;lt;!DOCTYPE HTML&amp;gt; &amp;lt;html lang=&#39;pt&#39;&amp;gt; &lt;br /&gt;&amp;lt;head&amp;gt; &lt;br /&gt;&amp;lt;meta charset=&#39;utf-8&#39;&amp;gt; &lt;br /&gt;&amp;lt;title&amp;gt;Um simples exemplo de filtro de busca.&amp;lt;/title&amp;gt; &lt;br /&gt;&amp;lt;/head&amp;gt; &lt;br /&gt;&amp;lt;body&amp;gt; &lt;br /&gt;&amp;lt;h1&amp;gt;Um simples exemplo de filtro de busca.&amp;lt;/h1&amp;gt; &lt;br /&gt;&amp;lt;input type=&#39;text&#39; id=&#39;search-filter&#39; placeholder=&#39;Filtre sua busca por aqui.&#39;&amp;gt; &lt;br /&gt;&amp;lt;div id=&#39;options&#39;&amp;gt;&amp;lt;/div&amp;gt; &lt;br /&gt;&amp;lt;script&amp;gt; &lt;br /&gt;;(() =&amp;gt; { &lt;br /&gt;const theFellowship = [ &lt;br /&gt;&#39;Frodo Baggins&#39;, &lt;br /&gt;&#39;Samwise Gamgee&#39;, &lt;br /&gt;&#39;Pippin Took&#39;, &lt;br /&gt;&#39;Merry Brandybuck&#39;, &lt;br /&gt;&#39;Aragorn&#39;, &lt;br /&gt;&#39;Legolas&#39;, &lt;br /&gt;&#39;Gimli&#39;, &lt;br /&gt;&#39;Boromir&#39;, &lt;br /&gt;&#39;Gandalf the Grey&#39; &lt;br /&gt;] &lt;br /&gt;const $ = &lt;br /&gt;selector =&amp;gt; &lt;br /&gt;document.querySelector(selector) &lt;br /&gt;const elementList = &lt;br /&gt;itemList =&amp;gt; &lt;br /&gt;itemList &lt;br /&gt;.map(item =&amp;gt; { &lt;br /&gt;const li = document.createElement(&#39;li&#39;) &lt;br /&gt;li.textContent = item &lt;br /&gt;return li &lt;br /&gt;}) &lt;br /&gt;.reduce((ul, item) =&amp;gt; { &lt;br /&gt;ul.appendChild(item) &lt;br /&gt;return ul &lt;br /&gt;}, document.createElement(&#39;ul&#39;)) &lt;br /&gt;&lt;br /&gt;const optionsArea = $(&#39;#options&#39;) &lt;br /&gt;optionsArea.appendChild(elementList(theFellowship)) &lt;br /&gt;&lt;br /&gt;const filterInput = $(&#39;#search-filter&#39;) &lt;br /&gt;filterInput.addEventListener(&#39;input&#39;, event =&amp;gt; { &lt;br /&gt;const query = event.target.value &lt;br /&gt;const filteredItems = &lt;br /&gt;theFellowship &lt;br /&gt;.filter(item =&amp;gt; item.includes(query)) &lt;br /&gt;&lt;br /&gt;optionsArea.firstChild &amp;amp;&amp;amp; optionsArea.removeChild(optionsArea.firstChild) &lt;br /&gt;optionsArea.appendChild(elementList(filteredItems)) &lt;br /&gt;}) &lt;br /&gt;})() &lt;br /&gt;&amp;lt;/script&amp;gt; &lt;br /&gt;&amp;lt;/body&amp;gt; &lt;br /&gt;&amp;lt;/html&amp;gt; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Obrigado por ter lido até aqui!&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Aprenda javaScript : &lt;a href=&quot;http://compre.vc/v2/3543dc1ef42&quot; target=&quot;_blank&quot;&gt;use a cabeça&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Quer entender sobre VUE js? &lt;a href=&quot;https://www.especializati.com.br/curso-vue-js-2?ref=D6939895Y&quot; target=&quot;_blank&quot;&gt;aqui esta um bom curos para aprender a desenvolver aplicações com vue&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/2954465192372011532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/2954465192372011532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/2954465192372011532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/2954465192372011532'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2018/12/criando-um-filtro-de-busca-customizavel.html' title='Criando um filtro de busca customizável com JavaScript funcional'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-685047237717276456</id><published>2018-12-17T10:11:00.002-08:00</published><updated>2018-12-17T10:11:46.167-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="angular"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="frontend"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="react.JS"/><category scheme="http://www.blogger.com/atom/ns#" term="vue.js"/><title type='text'>Vue.js, React.js ou angular. O que escolher?</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://i.ytimg.com/vi/xDhzYQ4VyCw/maxresdefault.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;800&quot; height=&quot;180&quot; src=&quot;https://i.ytimg.com/vi/xDhzYQ4VyCw/maxresdefault.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
As estruturas JavaScript estão se desenvolvendo em um ritmo extremamente rápido, o que significa que hoje temos versões atualizadas frequentemente do Angular, ReactJS e de outro player neste mercado - Vue.js.&lt;/div&gt;
&lt;div&gt;
Analisando o número de posições abertas em todo o mundo que exigem um conhecimento específico de um determinado framework. Como fonte, &lt;a href=&quot;http://indeed.com/&quot;&gt;Indeed.com&lt;/a&gt;&amp;nbsp;chegando a seguinte distribuição de acordo com mais de 60.000 ofertas de emprego.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://cdn-images-1.medium.com/max/800/1*fLvLBaoQ4FIt7xf5bY8CBg.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;494&quot; data-original-width=&quot;800&quot; height=&quot;197&quot; src=&quot;https://cdn-images-1.medium.com/max/800/1*fLvLBaoQ4FIt7xf5bY8CBg.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Levando em conta os dados a seguir, será apresentado as principais vantagens e desvantagens de cada framework frontend para ajudar os profissionais de tecnologia ou engenheiros a escolher o melhor para suas necessidades de desenvolvimento.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Prós e contras do angular&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Angular é uma estrutura de MVVM super-heróica de JavaScript, fundada em 2009, que é incrível para a criação de aplicativos da Web altamente interativos.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Benefícios do Angular&amp;nbsp;&lt;/h3&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Novos recursos como RXJS aprimorado, compilação mais rápida (em menos de 3 segundos), novo lançamento do HttpClient.&lt;/li&gt;
&lt;li&gt;Documentação detalhada que permite obter todas as informações necessárias para o desenvolvedor individual. No entanto, isso requer mais tempo para a educação.&lt;/li&gt;
&lt;li&gt;Ligação de dados bidirecional que permite um comportamento singular para o aplicativo, minimizando os riscos de possíveis erros.&lt;/li&gt;
&lt;li&gt;MVVM (Model-View-ViewModel) que permite aos desenvolvedores trabalharem separadamente na mesma seção do aplicativo usando o mesmo conjunto de dados.&lt;/li&gt;
&lt;li&gt;Injeção de dependência dos recursos relacionados aos componentes com módulos e modularidade em geral.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Desvantagens do Angular&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;A sintaxe complexa que vem da primeira versão do Angular. No entanto, o Angular 5 usa o TypeScript 2.4, que é o menos difícil de aprender em comparação.&lt;/li&gt;
&lt;li&gt;Problemas de migração que podem aparecer ao passar da versão mais antiga para as mais recentes.&lt;/li&gt;
&lt;/ul&gt;
Empresas que usam o Angular 5: Upwork, Freelancer, Udemy, YouTube, Paypal, Nike, Google, Telegrama, Tempo, Stockphoto, AWS, Crunchbase.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Prós e contras do ReactJS&lt;/h2&gt;
O ReactJS é uma biblioteca JavaScript, aberta pelo Facebook em 2013, o que é ótimo para criar grandes aplicativos da Web onde os dados podem ser alterados regularmente.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Benefícios do ReactJS&lt;/h3&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Fácil de aprender. Reagir é muito mais fácil de aprender devido à sua simplicidade em termos de sintaxe. Os engenheiros só precisam lembrar de suas habilidades de escrita em HTML, e é isso. Não há necessidade de aprender profundamente o TypeScript como no Angular.&lt;/li&gt;
&lt;li&gt;Alto nível de flexibilidade e máximo de capacidade de resposta.&lt;/li&gt;
&lt;li&gt;DOM virtual (modelo de objeto de documento) que permite organizar documentos em formatos HTML, XHTML ou XML em uma árvore a partir da qual é mais aceitável pelos navegadores da Web ao analisar diferentes elementos do aplicativo da web.&lt;/li&gt;
&lt;li&gt;Combinado com o ES6 / 7, o ReactJS pode trabalhar com a alta carga de maneira fácil.&lt;/li&gt;
&lt;li&gt;Ligação de dados descendente, o que significa que, com esse tipo de fluxo de dados, os elementos filhos não podem afetar os dados pai.&lt;/li&gt;
&lt;li&gt;100% de biblioteca JavaScript de código aberto que recebe muitas atualizações diárias e melhorias de acordo com as contribuições de desenvolvedores de todo o mundo.&lt;/li&gt;
&lt;li&gt;Absolutamente leve, porque os dados que atuam no lado do usuário podem ser facilmente representados no lado do servidor simultaneamente.&lt;/li&gt;
&lt;li&gt;A migração entre versões é geralmente muito fácil, com o Facebook fornecendo “codemods” para automatizar grande parte do processo.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Desvantagens do ReactJS&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Falta de documentação oficial - o desenvolvimento super rápido do ReactJS não deixa lugar para a documentação apropriada, o que é um pouco caótico agora, já que muitos desenvolvedores o contribuem individualmente, sem qualquer abordagem sistemática;&lt;/li&gt;
&lt;li&gt;Os desenvolvedores tem escolha de mais, isso significa que fica mais difícil tomar decisões durante o desenvolvimento.&lt;/li&gt;
&lt;li&gt;Muito tempo para dominar, o que significa que o React JS requer um profundo conhecimento de como integrar a interface do usuário na estrutura do MVC.&lt;/li&gt;
&lt;/ul&gt;
Empresas que utilizam o ReactJS: Facebook, Instagram, Netflix, New York Times, Yahoo, Khan Academy, WhatsApp, Codecademy, Dropbox, Airbnb, Asana, Atlassian, Intercom, Microsoft.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Prós e contras do Vue.js&lt;/h2&gt;
O Vue.js é um framework JavaScript, lançado em 2013, que se encaixa perfeitamente na criação de interfaces de usuário altamente adaptáveis ​​e sofisticados aplicativos de página única.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Benefícios do Vue.js:&lt;/h3&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;HTML capacitado. Isso significa que o Vue.js tem muitas características semelhantes ao Angular e isso pode ajudar a otimizar o manuseio de blocos HTML com o uso de diferentes componentes.&lt;/li&gt;
&lt;li&gt;Documentação detalhada. O Vue.js possui uma documentação muito circunstancial que pode prender a curva de aprendizado para os desenvolvedores e economizar muito tempo para desenvolver um aplicativo usando apenas os conhecimentos básicos de HTML e JavaScript.&lt;/li&gt;
&lt;li&gt;Grande escala. O Vue.js pode ajudar a desenvolver modelos reutilizáveis ​​bastante grandes que podem ser feitos sem nenhum tempo extra alocado para isso de acordo com sua estrutura simples.&lt;/li&gt;
&lt;li&gt;Tamanho minúsculo. O Vue.js pode pesar cerca de 20KB mantendo sua velocidade e flexibilidade, o que permite alcançar um desempenho muito melhor em comparação com outros frameworks.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Desvantagens do Vue.js:&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;Falta de recursos. O Vue.js ainda tem uma participação de mercado muito pequena em comparação com o React ou o Angular, o que significa que o compartilhamento de conhecimento nesse framework ainda está na fase inicial.&lt;/li&gt;
&lt;li&gt;Risco de flexibilidade excessiva. Às vezes, o Vue.js pode ter problemas ao se integrar em grandes projetos e ainda não há experiência com possíveis soluções, mas eles definitivamente virão em breve.&lt;/li&gt;
&lt;li&gt;Risco de flexibilidade excessiva. Às vezes, o Vue.js pode ter problemas ao se integrar em grandes projetos e ainda não há experiência com possíveis soluções, mas eles definitivamente virão em breve.&lt;/li&gt;
&lt;li&gt;Falta de documentação completa em inglês. Isso leva a uma complexidade parcial em alguns estágios de desenvolvimento, no entanto, mais e mais materiais estão sendo traduzidos para o inglês.&lt;/li&gt;
&lt;/ul&gt;
Empresas que usam o Vue.js: Xiaomi, Alibaba, WizzAir, Euronews, Grammarly, Gitlab e Laracasts, Adobe, Behance, Codeship, Reuters.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Conclusão&lt;/h2&gt;
Para um engenheiro de verdade, não há diferença substancial em qual estrutura escolher, porque leva algum tempo para se acostumar com a nova. Em nossa empresa, aumentamos nossa expertise principalmente no ReactJS e no Angular 2/4/5, mas o Vue.js também está a bordo. Cada estrutura tem suas próprias vantagens e desvantagens, o que significa que deve haver apenas uma escolha certa para cada caso durante o desenvolvimento do produto.</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/685047237717276456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/685047237717276456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/685047237717276456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/685047237717276456'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2018/12/vuejs-reactjs-ou-angular-o-que-escolher.html' title='Vue.js, React.js ou angular. O que escolher?'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-8509035806560354231</id><published>2018-12-14T02:34:00.001-08:00</published><updated>2018-12-17T10:12:56.513-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="angular"/><category scheme="http://www.blogger.com/atom/ns#" term="cli"/><category scheme="http://www.blogger.com/atom/ns#" term="componentes"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>Novidades Angular 7</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://ravitambade.files.wordpress.com/2018/10/ng7.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;350&quot; data-original-width=&quot;800&quot; height=&quot;140&quot; src=&quot;https://ravitambade.files.wordpress.com/2018/10/ng7.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3&gt;
A nova versão do Angular trouxe melhorias de desempenho e mudanças interessantes no&amp;nbsp;&lt;a href=&quot;https://www.devmedia.com.br/angular-cli-como-criar-e-executar-um-projeto-angular/38246&quot;&gt;Angular CLI&lt;/a&gt;, a sua principal interface de linha de comando. Neste artigo falaremos sobre as principais novidades do Angular 7.&lt;/h3&gt;
&lt;h3&gt;
Melhor performance&lt;/h3&gt;
Uma aplicação SPA consiste de alguns poucos arquivos, após ser construída para publicação. Nesses arquivos é concentrado/compactado todo o código necessário para fazer o cliente funcionar. Assim, no primeiro acesso precisamos aguardar que tudo seja baixado de uma única vez para que a aplicação possa ser utilizada. Isso pode ser um problema quando lembramos que grande parte do tráfego na internet vem de dispositivos móveis que, em geral, costumam acessar a internet em baixa velocidade de conexão.&lt;br /&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; outline: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Para mantermos o tamanho da nossa aplicação sobre controle, o Angular conta com a função de Bundle Budgets. Isto é, quando construímos nossa aplicação, recebemos alertas quando o seu tamanho excede um limite pré-determinado. Este recurso já existia no Angular e agora se tornou padrão. Na construção de uma aplicação que ultrapasse 2 MB receberemos um alerta e em aplicações que ultrapassem 5 MB seremos impedidos de prosseguir com a construção. É claro que esses valores são personalizáveis, e podemos modificá-los no arquivo&amp;nbsp;&lt;b&gt;angular.json&lt;/b&gt;&amp;nbsp;do nosso projeto:&lt;br /&gt;
&lt;div class=&quot;code-area&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; margin: 60px 0px; outline: none;&quot;&gt;
&lt;div class=&quot;pre_js code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;div class=&quot;syntaxhighlighter nogutter  js&quot; id=&quot;highlighter_644487&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: rgb(38, 50, 56) !important; border-radius: 10px; box-sizing: border-box; outline: none; overflow-x: auto !important; padding: 20px; width: 747px;&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;-webkit-tap-highlight-color: transparent; border-collapse: initial; border: none; font-size: inherit; line-height: 1; margin: 0px; outline: none;&quot;&gt;&lt;tbody style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&lt;td class=&quot;code&quot; style=&quot;-webkit-tap-highlight-color: transparent; border: none; outline: none; padding: 0px;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin-left: auto; margin-right: auto; outline: none; width: 208px;&quot;&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;budgets&quot;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;: [&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number2 index1 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;{&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number3 index2 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;type&quot;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;: &lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;initial&quot;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;,&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number4 index3 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;maximumWarning&quot;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;: &lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;2mb&quot;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;,&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number5 index4 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;maximumError&quot;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;: &lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;5mb&quot;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number6 index5 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;}&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number7 index6 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;]&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;maximumWarning: Tamanho da aplicação que, se excedido, disparará um alerta.&lt;/li&gt;
&lt;li&gt;maximumError: Tamanho da aplicação que, se excedido, causará um erro e interromperá a construção.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Novidades para templates&lt;/h3&gt;
Embora pouca coisa tenha mudado no Angular Material, a biblioteca de componentes que implementa o Material Design, alguns novos elementos interessantes foram adicionados ao CDK da biblioteca.&lt;br /&gt;
&lt;div&gt;
O CDK, ou kit de componente, possui diversos componentes que oferecem funcionalidades para nossas aplicações sem a definição de estilos, como textareas que são redimensionados automaticamente e ferramentas de acessibilidade para o uso de teclas de atalho e mais.&lt;br /&gt;
&lt;div&gt;
Com o Angular 7 foram lançados outros dois componentes: Drag and Drop e Virtual Scrolling, que veremos com mais detalhes a seguir.&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
Drag and Drop&lt;/h3&gt;
O novo componente de Drag and Drop facilita o desenvolvimento de funcionalidades “arrasta e solta”. Com ele podemos criar desde elementos que podem ser arrastados livremente a listas verticais e horizontais reordenáveis.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;figure style=&quot;-webkit-tap-highlight-color: transparent; margin: 60px auto; outline: none;&quot;&gt;&lt;span style=&quot;color: #253a44; font-family: &amp;quot;source&amp;quot; serif &amp;quot;pro&amp;quot; , serif;&quot;&gt;&lt;span style=&quot;-webkit-tap-highlight-color: transparent; font-size: 18px; margin: auto; outline-color: initial; outline-width: initial;&quot;&gt;&lt;img alt=&quot;Componente de Drag and Drop do Angular Material CDK&quot; class=&quot;imagem_artigo&quot; src=&quot;https://arquivo.devmedia.com.br/naoexclusivo/CaioRolla/ng-elasticsearch/Artigo/imagens/gif-drag.gif&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: auto; max-width: 100%; outline: none;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;figcaption style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: Montserrat; font-size: 16px; line-height: 35px; outline: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;source serif pro&amp;quot; , serif; font-size: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/figcaption&gt;E a implementação é tão simples quanto qualquer outro componente:&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;code-area&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; margin: 60px 0px; outline: none;&quot;&gt;
&lt;div class=&quot;pre_js code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;div class=&quot;syntaxhighlighter nogutter  js&quot; id=&quot;highlighter_74287&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: rgb(38, 50, 56) !important; border-radius: 10px; box-sizing: border-box; outline: none; overflow-x: auto !important; padding: 20px; width: 747px;&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;-webkit-tap-highlight-color: transparent; border-collapse: initial; border: none; font-size: inherit; line-height: 1; margin: 0px; outline: none;&quot;&gt;&lt;tbody style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&lt;td class=&quot;code&quot; style=&quot;-webkit-tap-highlight-color: transparent; border: none; outline: none; padding: 0px;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin-left: auto; margin-right: auto; outline: none; width: 610px;&quot;&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;lt;div cdkDropList class=&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;example-list&quot;&lt;/code&gt; &lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;(cdkDropListDropped)=&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;drop($event)&quot;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number2 index1 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;lt;div class=&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;example-box&quot;&lt;/code&gt; &lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;*ngFor=&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;let filme of filmes&quot;&lt;/code&gt; &lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;cdkDrag&amp;gt;{{filme}}&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number3 index2 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Linha 1: Com o atributo (cdkDropListDropped) podemos executar o método drop sempre que um item da lista for arrastado para outra posição.&lt;/li&gt;
&lt;li&gt;Linha 2: Identificamos os atributos como “arrastáveis” com o atributo cdkDrag.&lt;/li&gt;
&lt;/ul&gt;
Dessa forma, na classe drop podemos capturar a posição do item antes e depois de ter sido arrastado:&lt;br /&gt;
&lt;div class=&quot;code-area&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; margin: 60px 0px; outline: none;&quot;&gt;
&lt;div class=&quot;pre_js code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;div class=&quot;syntaxhighlighter nogutter  js&quot; id=&quot;highlighter_527577&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: rgb(38, 50, 56) !important; border-radius: 10px; box-sizing: border-box; outline: none; overflow-x: auto !important; padding: 20px; width: 747px;&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;-webkit-tap-highlight-color: transparent; border-collapse: initial; border: none; font-size: inherit; line-height: 1; margin: 0px; outline: none;&quot;&gt;&lt;tbody style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&lt;td class=&quot;code&quot; style=&quot;-webkit-tap-highlight-color: transparent; border: none; outline: none; padding: 0px;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin-left: auto; margin-right: auto; outline: none; width: 278px;&quot;&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;drop(event: CdkDragDrop&amp;lt;string[]&amp;gt;) {&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number2 index1 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;console.log(event.previousIndex)&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number3 index2 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;console.log(event.currentIndex)&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number4 index3 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;}&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;
Virtual Scrolling&lt;/h3&gt;
Com o componente de Virtual Scrolling podemos construir grandes listas roláveis sem nenhuma perda de desempenho. Para isso, o componente renderiza apenas os elementos que estão na parte visível da lista e destrói aqueles que já saíram da parte visível.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;figure style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; margin: 60px auto; outline: none; text-align: center;&quot;&gt;&lt;img alt=&quot;Componente de Scroll do Angular Material CDK&quot; class=&quot;imagem_artigo&quot; src=&quot;https://arquivo.devmedia.com.br/naoexclusivo/CaioRolla/ng-elasticsearch/Artigo/imagens/scroll.gif&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: auto; max-width: 100%; outline: none;&quot; /&gt;&lt;figcaption style=&quot;-webkit-tap-highlight-color: transparent; font-family: Montserrat; font-size: 16px; line-height: 35px; outline: none;&quot;&gt;&lt;br /&gt;&lt;/figcaption&gt;&lt;figcaption style=&quot;-webkit-tap-highlight-color: transparent; font-family: Montserrat; font-size: 16px; line-height: 35px; outline: none; text-align: left;&quot;&gt;Podemos utilizar o componente diretamente no template das nossas páginas:&lt;/figcaption&gt;&lt;/figure&gt;&lt;br /&gt;
&lt;div class=&quot;code-area&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; margin: 60px 0px; outline: none;&quot;&gt;
&lt;div class=&quot;pre_js code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;div class=&quot;syntaxhighlighter nogutter  js&quot; id=&quot;highlighter_376009&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: rgb(38, 50, 56) !important; border-radius: 10px; box-sizing: border-box; outline: none; overflow-x: auto !important; padding: 20px; width: 747px;&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;-webkit-tap-highlight-color: transparent; border-collapse: initial; border: none; font-size: inherit; line-height: 1; margin: 0px; outline: none;&quot;&gt;&lt;tbody style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&lt;td class=&quot;code&quot; style=&quot;-webkit-tap-highlight-color: transparent; border: none; outline: none; padding: 0px;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin-left: auto; margin-right: auto; outline: none; width: 594px;&quot;&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;lt;cdk-virtual-scroll-viewport itemSize=&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;50&quot;&lt;/code&gt; &lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;class=&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;example-viewport&quot;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number2 index1 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;lt;div *cdkVirtualFor=&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;let item of items&quot;&lt;/code&gt; &lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;class=&lt;/code&gt;&lt;code class=&quot;js string&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(156, 230, 110) !important; outline: none;&quot;&gt;&quot;example-item&quot;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;gt;{{item}}&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number3 index2 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;lt;/cdk-virtual-scroll-viewport&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;
Angular CLIA&amp;nbsp;&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
ferramenta de linha de comando também mudou. Agora, sempre que criamos um novo projeto, o CLI pergunta se desejamos adicionar o módulo de rotas e se desejamos utilizar algum processador CSS, como SASS ou LESS. Veja a seguir o processo de criação de uma aplicação.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
1. Instalando o Angular CLI&lt;/h3&gt;
Para instalar o Angular CLI utilizamos o NPM, o gerenciador de pacotes de Node.js:&lt;br /&gt;
&lt;div class=&quot;code-area&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; margin: 60px 0px; outline: none;&quot;&gt;
&lt;div class=&quot;pre_js code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;div class=&quot;syntaxhighlighter nogutter  js&quot; id=&quot;highlighter_899986&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: rgb(38, 50, 56) !important; border-radius: 10px; box-sizing: border-box; outline: none; overflow-x: auto !important; padding: 20px; width: 747px;&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;-webkit-tap-highlight-color: transparent; border-collapse: initial; border: none; font-size: inherit; line-height: 1; margin: 0px; outline: none;&quot;&gt;&lt;tbody style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&lt;td class=&quot;code&quot; style=&quot;-webkit-tap-highlight-color: transparent; border: none; outline: none; padding: 0px;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin-left: auto; margin-right: auto; outline: none; width: 208px;&quot;&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;npm install -g @angular/cli&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;
2. Criando um projeto Angular utilizando o CLI&lt;/h3&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Após a instalação já poderemos utilizar o CLI para criar nosso projeto:&lt;br /&gt;
&lt;div class=&quot;code-area&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; margin: 60px 0px; outline: none;&quot;&gt;
&lt;div class=&quot;pre_js code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;div class=&quot;syntaxhighlighter nogutter  js&quot; id=&quot;highlighter_824266&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: rgb(38, 50, 56) !important; border-radius: 10px; box-sizing: border-box; outline: none; overflow-x: auto !important; padding: 20px; width: 747px;&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;-webkit-tap-highlight-color: transparent; border-collapse: initial; border: none; font-size: inherit; line-height: 1; margin: 0px; outline: none;&quot;&gt;&lt;tbody style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&lt;td class=&quot;code&quot; style=&quot;-webkit-tap-highlight-color: transparent; border: none; outline: none; padding: 0px;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin-left: auto; margin-right: auto; outline: none; width: 140px;&quot;&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;ng &lt;/code&gt;&lt;code class=&quot;js keyword&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(111, 198, 255) !important; outline: none;&quot;&gt;new&lt;/code&gt; &lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;meu-projeto&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;
3. Criando o módulo de rotas automaticamente&lt;/h3&gt;
O Angular CLI perguntará se desejamos utilizar o módulo de rotas do Angular. Se dissermos que sim, o CLI fará toda a configuração necessária e não precisaremos ter esse trabalho:&lt;br /&gt;
&lt;div class=&quot;code-area&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; margin: 60px 0px; outline: none;&quot;&gt;
&lt;div class=&quot;pre_js code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;div class=&quot;syntaxhighlighter nogutter  js&quot; id=&quot;highlighter_773460&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: rgb(38, 50, 56) !important; border-radius: 10px; box-sizing: border-box; outline: none; overflow-x: auto !important; padding: 20px; width: 747px;&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;-webkit-tap-highlight-color: transparent; border-collapse: initial; border: none; font-size: inherit; line-height: 1; margin: 0px; outline: none;&quot;&gt;&lt;tbody style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&lt;td class=&quot;code&quot; style=&quot;-webkit-tap-highlight-color: transparent; border: none; outline: none; padding: 0px;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin-left: auto; margin-right: auto; outline: none; width: 355px;&quot;&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;? Would you like to add Angular routing? (y/N)&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;
4. Escolhendo o pré-processador CSS&lt;/h3&gt;
Na segunda pergunta escolhemos o processador de CSS que queremos utilizar ou se desejamos utilizar CSS puro no nosso projeto. Para responder utilize as setas do teclado e aperte enter:&lt;br /&gt;
&lt;div class=&quot;code-area&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; margin: 60px 0px; outline: none;&quot;&gt;
&lt;div class=&quot;pre_js code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;div class=&quot;syntaxhighlighter nogutter  js&quot; id=&quot;highlighter_318314&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: rgb(38, 50, 56) !important; border-radius: 10px; box-sizing: border-box; outline: none; overflow-x: auto !important; padding: 20px; width: 747px;&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;-webkit-tap-highlight-color: transparent; border-collapse: initial; border: none; font-size: inherit; line-height: 1; margin: 0px; outline: none;&quot;&gt;&lt;tbody style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;
&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&lt;td class=&quot;code&quot; style=&quot;-webkit-tap-highlight-color: transparent; border: none; outline: none; padding: 0px;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin-left: auto; margin-right: auto; outline: none; width: 370px;&quot;&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;? Which stylesheet format would you like to use?&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number2 index1 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;&amp;gt; CSS&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number3 index2 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;SCSS&amp;nbsp;&amp;nbsp; [ http:&lt;/code&gt;&lt;code class=&quot;js comments&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(135, 138, 133) !important; outline: none;&quot;&gt;//sass-lang.com&amp;nbsp;&amp;nbsp; ]&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number4 index3 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;SASS&amp;nbsp;&amp;nbsp; [ http:&lt;/code&gt;&lt;code class=&quot;js comments&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(135, 138, 133) !important; outline: none;&quot;&gt;//sass-lang.com&amp;nbsp;&amp;nbsp; ]&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number5 index4 alt2&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;LESS&amp;nbsp;&amp;nbsp; [ http:&lt;/code&gt;&lt;code class=&quot;js comments&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(135, 138, 133) !important; outline: none;&quot;&gt;//lesscss.org&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ]&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number6 index5 alt1&quot; style=&quot;-webkit-tap-highlight-color: transparent; background-color: transparent !important; font-family: &amp;quot;Roboto Mono&amp;quot; !important; font-size: 14px !important; line-height: 19px !important; outline: none; white-space: pre;&quot;&gt;
&lt;code class=&quot;js spaces&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;js plain&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(238, 255, 255) !important; outline: none;&quot;&gt;Stylus [ http:&lt;/code&gt;&lt;code class=&quot;js comments&quot; style=&quot;-webkit-tap-highlight-color: transparent; color: rgb(135, 138, 133) !important; outline: none;&quot;&gt;//stylus-lang.com ]&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;code class=&quot;code-sample&quot; style=&quot;-webkit-tap-highlight-color: transparent; outline: none; position: relative; z-index: 2;&quot;&gt;
&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
O Angular CLI ficará responsável por criar a estrutura inicial da aplicação.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
Dependências&lt;/h3&gt;
&lt;div style=&quot;-webkit-tap-highlight-color: transparent; color: #253a44; font-family: &amp;quot;Source Serif Pro&amp;quot;, serif; font-size: 18px; outline: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Algumas dependências utilizadas pelo Angular também foram atualizadas:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;TypeScript: A versão do TypeScript, o Superset do JavaScript utilizado pelo Angular foi atualizada para a versão 3.1, que conta apenas com algumas pequenas mudanças em relação a declaração de propriedades em funções.&lt;/li&gt;
&lt;li&gt;RxJS: O RxJS, a biblioteca que provem ao Angular, dentre outras coisas, Observables, foi atualizada para a versão 6.3. Essa nova versão implementou apenas correções.&lt;/li&gt;
&lt;li&gt;NodeJS: Agora é possível utilizar o Angular e o Angular CLI na versão 10 do Node.js, embora ainda seja totalmente compatível com a versão 8.&lt;/li&gt;
&lt;/ul&gt;
Curtiu este artigo e quer ler mais sobre as novidades do mundo da tecnologia? Deixe um joinha! Se você já utilizou o Angular, deixe nos comentários como foi sua experiência.&lt;br /&gt;
&lt;br /&gt;
Quer entender mais sobre Desenvolvimento web? Aqui estão algumas indicações de livros:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://compre.vc/v2/348c5de8a4e&quot; target=&quot;_blank&quot;&gt;Livro - Use A Cabeça ! Javascript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://compre.vc/v2/3487092ccaf&quot; target=&quot;_blank&quot;&gt;Livro - Desenvolvimento&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://compre.vc/v2/348047f5489&quot; target=&quot;_blank&quot;&gt;Livro - Fundamentos de HTML5 e CSS3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/8509035806560354231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/8509035806560354231' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/8509035806560354231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/8509035806560354231'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2018/12/a-nova-versao-do-angular-trouxe.html' title='Novidades Angular 7'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-3613455970431307508</id><published>2018-12-12T05:35:00.004-08:00</published><updated>2018-12-12T05:42:36.288-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ecma script"/><category scheme="http://www.blogger.com/atom/ns#" term="es2018"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="TC39"/><title type='text'>Três novidades no ES2018 que você precisa conhecer</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://i.ytimg.com/vi/bHdWvK2k6H0/maxresdefault.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;800&quot; height=&quot;180&quot; src=&quot;https://i.ytimg.com/vi/bHdWvK2k6H0/maxresdefault.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
O JavaScript não para de evoluir. Desde a primeira grande atualização na linguagem, em 2015 com o ES6 (depois rebatizado para ES2015), temos lançamentos anuais com correções, melhorias e novas funcionalidades.&lt;br /&gt;
O processo de atualização é coordenado pelo &lt;a href=&quot;https://github.com/tc39&quot;&gt;TC39&lt;/a&gt;, um comitê que conta com membros da comunidade e representantes de grandes empresas.&lt;br /&gt;
Um fato muito legal sobre o TC39: temos um brasileiro que é membro ativo do comitê, o &lt;a href=&quot;https://twitter.com/leobalter&quot;&gt;LEO BALTER&lt;/a&gt;.&lt;br /&gt;
Temos aqui no portal uma &lt;a href=&quot;https://braziljs.org/blog/brasil-tc39-e-guitarras-um-brasileiro-por-tras-da-evolucao-do-javascript/&quot;&gt;ENTREVISTA&lt;/a&gt; que fizemos com o Leo em 2016, na qual ele conta um pouco como o comitê funciona.&lt;br /&gt;
&lt;br /&gt;
O ES2018 nos traz algumas novidades e melhorias bem interessantes.&lt;br /&gt;
Em junho de 2018 já devemos ter a versão oficializada pela &lt;a href=&quot;https://www.ecma-international.org/&quot;&gt;ECMA INTERNATIONAL&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Agora, vamos conhecer três das funcionalidades oferecidas&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;roboto mono&amp;quot; , monospace; font-size: 0.875rem; text-transform: uppercase;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
&lt;span style=&quot;font-family: &amp;quot;roboto mono&amp;quot; , monospace; font-size: 0.875rem; text-transform: uppercase;&quot;&gt;ASYNCHRONOUS ITERATION&lt;/span&gt;&lt;/h3&gt;
O ES2015 trouxe muitas novidades. Uma delas foi o iterator (iterador), um objeto que oferece a funcionalidade de navegar entre os itens de uma lista ou estrutura – um a um – em sequência. Este objeto oferece o método next, o qual retornará o próximo item da lista no seguinte formato:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre class=&quot; language-json&quot; style=&quot;background: rgb(245, 242, 240); box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 0.875rem; hyphens: none; line-height: 1.5; margin-bottom: 1.5em; margin-top: 0.5em; overflow-wrap: normal; overflow: auto; padding: 1.5em 1em; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal;&quot;&gt;&lt;code class=&quot; language-json&quot; style=&quot;background: 0px 0px; box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 1em; hyphens: none; line-height: 1.5; margin: 0px; overflow-wrap: normal; padding: 0px; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal; word-spacing: normal;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt;
  value&lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt; Mixed&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt;
  done&lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt; Boolean
&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
Você pode saber mais sobre Iterators no post &lt;a href=&quot;https://braziljs.org/blog/generators-yield-e-iterators/&quot;&gt;GENERATORS, YIELD E ITERATORS&lt;/a&gt;, aqui no portal.&lt;br /&gt;
Iterators são muito legais e nos dão N possibilidades, porém, Iterators somente funcionam em dados síncronos.&lt;br /&gt;
Veja um exemplo:&lt;br /&gt;
&lt;pre class=&quot; language-javascript&quot; style=&quot;background: rgb(245, 242, 240); box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 0.875rem; hyphens: none; line-height: 1.5; margin-bottom: 1.5em; margin-top: 0.5em; overflow-wrap: normal; overflow: auto; padding: 1.5em 1em; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal;&quot;&gt;&lt;code class=&quot; language-javascript&quot; style=&quot;background: 0px 0px; box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 1em; hyphens: none; line-height: 1.5; margin: 0px; overflow-wrap: normal; padding: 0px; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal; word-spacing: normal;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;let&lt;/span&gt; arr &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;let&lt;/span&gt; it &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt; arr&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;[&lt;/span&gt;Symbol&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;iterator&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;
console&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;it&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;value&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// 1&lt;/span&gt;
console&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;it&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;value&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// 2&lt;/span&gt;
console&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;it&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;value&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// 3&lt;/span&gt;
console&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;it&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;value&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// 4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
A novidade no ES2018 é a sua possibilidade assíncrona.&lt;br /&gt;
Um iterator assíncrono, basicamente, é um iterator. Entretanto, o método nextretorna uma Promise.&lt;br /&gt;
&lt;pre class=&quot; language-javascript&quot; style=&quot;background: rgb(245, 242, 240); box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 0.875rem; hyphens: none; line-height: 1.5; margin-bottom: 1.5em; margin-top: 0.5em; overflow-wrap: normal; overflow: auto; padding: 1.5em 1em; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal;&quot;&gt;&lt;code class=&quot; language-javascript&quot; style=&quot;background: 0px 0px; box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 1em; hyphens: none; line-height: 1.5; margin: 0px; overflow-wrap: normal; padding: 0px; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal; word-spacing: normal;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; done &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt; syncIterator&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;
asyncIterator&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt; value&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; done &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;/* ... */&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
Para fazer a iteração, agora temos o for await of, que faz exatamente o que parece, itera objetos iteráveis assincronamente. Legal, né?&lt;br /&gt;
&lt;pre class=&quot; language-javascript&quot; style=&quot;background: rgb(245, 242, 240); box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 0.875rem; hyphens: none; line-height: 1.5; margin-bottom: 1.5em; margin-top: 0.5em; overflow-wrap: normal; overflow: auto; padding: 1.5em 1em; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal;&quot;&gt;&lt;code class=&quot; language-javascript&quot; style=&quot;background: 0px 0px; box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 1em; hyphens: none; line-height: 1.5; margin: 0px; overflow-wrap: normal; padding: 0px; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal; word-spacing: normal;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;const&lt;/span&gt; line &lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;readLines&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;filePath&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt;
  console&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;line&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
Veja mais na &lt;a href=&quot;https://github.com/tc39/proposal-async-iteration&quot;&gt;DOCUMENTAÇÃO DA PROPOSTA&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
OBJECT REST/SPREAD PROPERTIES&lt;/h3&gt;
rest e spread também entraram no ES2015.&lt;br /&gt;
A sintaxe chamada de “destructuring assignment” é uma expressão JavaScript que torna possível descompactar valores de arrays ou propriedades de objetos e atribuir a variáveis novas.&lt;/div&gt;
&lt;div&gt;
Vejamos um exemplo:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre class=&quot; language-javascript&quot; style=&quot;background: rgb(245, 242, 240); box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 0.875rem; hyphens: none; line-height: 1.5; margin-bottom: 1.5em; margin-top: 0.5em; overflow-wrap: normal; overflow: auto; padding: 1.5em 1em; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal;&quot;&gt;&lt;code class=&quot; language-javascript&quot; style=&quot;background: 0px 0px; box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 1em; hyphens: none; line-height: 1.5; margin: 0px; overflow-wrap: normal; padding: 0px; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal; word-spacing: normal;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;var&lt;/span&gt; a&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; b&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; rest&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;[&lt;/span&gt;a&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; b&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;

console&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;a&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// expected output: 10&lt;/span&gt;

console&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;b&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// expected output: 20&lt;/span&gt;

&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;[&lt;/span&gt;a&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; b&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;...&lt;/span&gt;rest&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;40&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;

console&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;rest&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// expected output: [30,40,50]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
Veja mais sobre destructuring na &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment&quot;&gt;MDN&lt;/a&gt;.&lt;br /&gt;
Basicamente, o ES2018 introduz a mesma possibilidade para objetos.&lt;br /&gt;
Rest:&lt;br /&gt;
&lt;pre class=&quot; language-javascript&quot; style=&quot;background: rgb(245, 242, 240); box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 0.875rem; hyphens: none; line-height: 1.5; margin-bottom: 1.5em; margin-top: 0.5em; overflow-wrap: normal; overflow: auto; padding: 1.5em 1em; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal;&quot;&gt;&lt;code class=&quot; language-javascript&quot; style=&quot;background: 0px 0px; box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 1em; hyphens: none; line-height: 1.5; margin: 0px; overflow-wrap: normal; padding: 0px; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal; word-spacing: normal;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt; x&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; y&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;...&lt;/span&gt;z &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt; x&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; y&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; a&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; b&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token number&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;4&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;
x&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// 1&lt;/span&gt;
y&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// 2&lt;/span&gt;
z&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// { a: 3, b: 4 }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
Spread:&lt;br /&gt;
&lt;pre class=&quot; language-javascript&quot; style=&quot;background: rgb(245, 242, 240); box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 0.875rem; hyphens: none; line-height: 1.5; margin-bottom: 1.5em; margin-top: 0.5em; overflow-wrap: normal; overflow: auto; padding: 1.5em 1em; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal;&quot;&gt;&lt;code class=&quot; language-javascript&quot; style=&quot;background: 0px 0px; box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 1em; hyphens: none; line-height: 1.5; margin: 0px; overflow-wrap: normal; padding: 0px; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal; word-spacing: normal;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;let&lt;/span&gt; n &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt; x&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; y&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;...&lt;/span&gt;z &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;
n&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;token comment&quot; spellcheck=&quot;true&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;// { x: 1, y: 2, a: 3, b: 4 }&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
Veja mais na documentação da &lt;a href=&quot;https://github.com/tc39/proposal-object-rest-spread&quot;&gt;PROPOSTA OFICIAL&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
PROMISE.PROTOTYPE.FINALLY()&lt;/h3&gt;
Promises já estão no nosso dia a dia há um bom tempo.&lt;br /&gt;
Desenvolvedores JavaScript já vinham utilizando Promises antes mesmo de se tornar parte da linguagem (usando bibliotecas), também no ES2015.&lt;br /&gt;
A novidade do ES2018 é que agora Promises terão o finally.&lt;br /&gt;
Muitas bibliotecas existentes implementam o método finally, que é um callback para quando uma Promise está pronta, seja como fulfilled ou rejected.&lt;br /&gt;
Podemos pensar no finally como o já conhecido try/catch/finally, no qual o finallyserá sempre executado.&lt;br /&gt;
&lt;pre class=&quot; language-javascript&quot; style=&quot;background: rgb(245, 242, 240); box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 0.875rem; hyphens: none; line-height: 1.5; margin-bottom: 1.5em; margin-top: 0.5em; overflow-wrap: normal; overflow: auto; padding: 1.5em 1em; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal;&quot;&gt;&lt;code class=&quot; language-javascript&quot; style=&quot;background: 0px 0px; box-sizing: border-box; font-family: Consolas, Monaco, &amp;quot;Andale Mono&amp;quot;, &amp;quot;Ubuntu Mono&amp;quot;, monospace; font-size: 1em; hyphens: none; line-height: 1.5; margin: 0px; overflow-wrap: normal; padding: 0px; tab-size: 4; text-shadow: rgb(255, 255, 255) 0px 1px; word-break: normal; word-spacing: normal;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;promise
&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;result &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt;···&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;error &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt;···&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token keyword&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token operator&quot; style=&quot;background: rgba(255, 255, 255, 0.5); box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;{&lt;/span&gt;···&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;box-sizing: border-box; margin: 0px; padding: 0px;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
Veja mais na &lt;a href=&quot;https://github.com/tc39/proposal-promise-finally&quot;&gt;PROPOSTA&lt;/a&gt; oficial.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
CONCLUSÃO&lt;/h3&gt;
O ES2018 ainda traz outras novidades e melhorias, como novas funcionalidades para expressões regulares (RegExp) e uma revisão nos template literals.&lt;br /&gt;
O Dr. Axel Rauschmayer faz um excelente trabalho em seu blog &lt;a href=&quot;http://2ality.com/&quot;&gt;2ALITY&lt;/a&gt;, e lá ele escreveu sobre todas as novidades no post &lt;a href=&quot;http://2ality.com/2017/02/ecmascript-2018.html&quot;&gt;ECMASCRIPT 2018: THE FINAL FEATURE SET&lt;/a&gt;.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/3613455970431307508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/3613455970431307508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/3613455970431307508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/3613455970431307508'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2018/12/tres-novidades-no-es2018-que-voce.html' title='Três novidades no ES2018 que você precisa conhecer'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-7865063870556377945</id><published>2018-12-10T09:49:00.000-08:00</published><updated>2018-12-14T12:16:39.792-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BI"/><category scheme="http://www.blogger.com/atom/ns#" term="big data"/><category scheme="http://www.blogger.com/atom/ns#" term="Business Intelligence"/><category scheme="http://www.blogger.com/atom/ns#" term="Data Mining"/><category scheme="http://www.blogger.com/atom/ns#" term="doker"/><category scheme="http://www.blogger.com/atom/ns#" term="inteligência Artificial"/><category scheme="http://www.blogger.com/atom/ns#" term="IOT"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="linguagem"/><category scheme="http://www.blogger.com/atom/ns#" term="micro Serviços"/><category scheme="http://www.blogger.com/atom/ns#" term="programação"/><category scheme="http://www.blogger.com/atom/ns#" term="react.JS"/><category scheme="http://www.blogger.com/atom/ns#" term="tecnologia"/><category scheme="http://www.blogger.com/atom/ns#" term="tendências"/><category scheme="http://www.blogger.com/atom/ns#" term="TypeScript"/><title type='text'>Tendências da tecnologia em 2018</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blog.toccato.com.br/wp-content/uploads/2017/09/119989-entenda-o-que-e-big-data-analytics-e-como-ele-interage-com-as-empresas.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;450&quot; data-original-width=&quot;800&quot; height=&quot;179&quot; src=&quot;https://blog.toccato.com.br/wp-content/uploads/2017/09/119989-entenda-o-que-e-big-data-analytics-e-como-ele-interage-com-as-empresas.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Na indústria da tecnologia a evolução é constante, tudo se transforma muito rápido e frequentemente você pode sentir que está sendo deixado para trás.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
As tendências mudam, novas técnicas e metodologias surgem e você tem que estar sempre atualizado. Apresentaremos nesse pequeno artigo algumas tendências em tecnologia, na área de desenvolvimento e arquitetura de software. Considere um auto-update nos seus skills com as dicas da nossa #TechTrendingTopics&lt;br /&gt;&lt;br /&gt;
&lt;h2&gt;
Áreas de destaque em Tecnologia&lt;/h2&gt;
&lt;h2&gt;
IoT big data&lt;/h2&gt;
&lt;br /&gt;
Com a explosão do número de dispositivos usados atualmente, a montanha dos dados que são gerados tem crescido de forma exponencial.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Apesar de estar apenas começando, a Internet of Things (IoT) – ou Internet das coisas – já produz bilhões de dispositivos conectados a internet e outros bilhões ainda estão por vir. A consequência disso é a multiplicação dos dados gerados. Em consequência são demandadas mais ferramentas para explorar os dados e obter os insights.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Business intelligence&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
Como mencionamos antes, captar um volume enorme de dados é importante. Porém, analisar esses dados é a parte fundamental. Nesse aspecto é que o Business Intelligence – BI – se encaixa.&lt;br /&gt;
&lt;br /&gt;
O BI fornece uma variedade de ferramentas, aplicações e metodologias que ajudam na interpretação dos dados.&lt;br /&gt;
&lt;br /&gt;
As duas principais tendências no BI são o data-driven decision-making e o Analytics.&lt;br /&gt;
&lt;br /&gt;
Uma corrente cada vez mais presente é o processo de decisão dirigido a dados ou data-driven decision-making. É o processo capaz de gerar, analisar e visualizar os dados para guiar o gerenciamento dos negócios.&lt;br /&gt;
&lt;br /&gt;
Na prática são gerados relatórios, dashboards e outras visualizações dos dados que facilitam e clarificam o processo de tomada de decisão das empresas.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
O resultado muitas vezes é a otimização dos processos, tornando as áreas mais eficientes – gerando assim vantagens competitivas.&lt;br /&gt;
&lt;br /&gt;
A outra vertente em alta do BI é conhecida como Analytics, seu foco maior está em responder perguntas específicas do negócio e da sua operação. Por exemplo: Quais produtos mais vendidos em determinadas regiões?&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Data mining&lt;/h2&gt;
&lt;div&gt;
Data mining são as práticas responsáveis pelas pesquisas das informações no Big Data, procurando por padrões e tendências usando algoritmos que ajudam a segmentar os dados.&lt;br /&gt;
&lt;br /&gt;
Buscar as respostas quando a fonte de informação não está estruturada é o grande desafio. Para isso é necessário interpretar e “desmistificar” os dados na busca de padrões e respostas conclusivas.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;
Inteligência artificial&lt;/h2&gt;
Quando falamos sobre Inteligência Artificial, nós falamos sobre máquinas que são capazes de executar o que os humanos fazem através de sua própria inteligência.&lt;br /&gt;
&lt;br /&gt;
Para 2018 é previsto que mais da metade das empresas estejam usando analytics e algoritmos para serem mais competitivas. A ciência que está por trás desses algoritmos é a Inteligência Artificial.&lt;br /&gt;
&lt;br /&gt;
Cada vez mais as máquinas são capazes de interpretar os dados e gerar melhores previsões.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Tendências em desenvolvimento de software&lt;/h2&gt;
&lt;h2&gt;
JavaScript e TypeScript&lt;/h2&gt;
O JavaScript é uma das linguagens mais populares e poderosas do mundo. Ela pode ser usada para gerar interfaces mais interativas, adicionando efeitos visuais, criando games, animações e também por aplicações que podem renderizar em qualquer plataforma – web ou mobile – por exemplo.&lt;br /&gt;
&lt;br /&gt;
A plataforma pode ser usada tanto no back-end como principalmente no front-end. JavaScript é usado por mais de 80% das aplicações web.&lt;br /&gt;
&lt;br /&gt;
O TypeScript é uma ótima linguagem capaz de compilar para qualquer navegador facilmente em qualquer ambiente. A curva de aprendizagem também não é alta, pois todos os componentes são classes. Como a linguagem mantém as propriedades do JavaScript é simples criar aplicações JavaScript com TypeScript.&lt;br /&gt;
&lt;br /&gt;
O TypeScript é uma das linguagens que vem se popularizando, baseado na evolução do ranking do GitHub.&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;
Java&lt;/h2&gt;
O Java é uma linguagem open source, é considerada como uma das linguagens mais adotadas ao redor do mundo. Uma das razões é o fato da linguagem ser bastante legível e consequentemente simples.&lt;br /&gt;
&lt;br /&gt;
A linguagem é capaz de rodar em quaisquer dispositivos. A plataforma é aplicada para o desenvolvimento de soluções de software para computadores, smartphones, televisores e para o desenvolvimento de aplicações mobile nativas Android.&lt;br /&gt;
&lt;br /&gt;
O Java está hoje na versão 9. A próxima versão – Java 10 – receberá a nova convenção de versionamento da Oracle. Nessa nova convenção o padrão será YY.M, no qual YY corresponde ao ano e M corresponde ao mês do lançamento. Prepare-se em 2018 para o Java nas versões 18.3 em Março e 18.9 em Setembro.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;
Swift&lt;/h2&gt;
Swift é uma linguagem de programação desenvolvida pela Apple. A linguagem é principalmente usada para criação de soluções para dispositivos da Apple como iOS, macOS, watchOS, tvOS.&lt;br /&gt;
&lt;br /&gt;
O uso da linguagem cresceu bastante nos últimos anos. Ela adota padrões seguros de programação e introduz funcionalidades modernas que tornam o desenvolvimento mais simples e flexível, podendo ser considerada bastante produtiva e interativa.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Python&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;
Python é conhecida por sua flexibilidade, performance e a incrível legibilidade do código. Grandes players como YouTube, Reddit e Instagram usam a linguagem nos seus websites e mobile apps.&lt;br /&gt;
&lt;br /&gt;
O rápido crescimento da Inteligência Artificial é algo que todos desejamos. E Python é considerada como o futuro do machine learning.&lt;br /&gt;
&lt;br /&gt;
Python também já é usada para tornar a experiência do usuário mais atrativa e intuitiva em empresas como Spotify, Evernote, Booking.com.&lt;br /&gt;
&lt;h2&gt;
Angular&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
O Angular é um framework JavaScript mantido pela Google. O framework é open source e completamente gratuito.&lt;br /&gt;
&lt;br /&gt;
A arquitetura é baseada no Single Page Application estendendo o HTML DOM. Com Angular é possível criar web apps robustas, responsivas e performáticas.&lt;br /&gt;
&lt;br /&gt;
A versão 4 é escrita com TypeScript 2.1. As mudanças introduzidas nesta versão reduzem o tamanho do código que é gerado até pela metade.&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;
React.Js&lt;/h2&gt;
O React.Js tem se tornado cada dia mais popular. A biblioteca é principalmente utilizada para construção do front-end das aplicações, com atualização da interface de forma prática e rápida já que ele renderiza automaticamente quando um novo dado está disponível.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
Spring&lt;/h2&gt;
&lt;br /&gt;
Spring é um padrão utilizado na construção de aplicações Java. Atualmente é um dos frameworksmais maduros e completos para o desenvolvimento na plataforma Java.&lt;br /&gt;
&lt;br /&gt;
O Spring é decomposto em vários módulos, cada um deles especialista em uma determinada funcionalidade. Por exemplo, Spring Data na camada de acesso a Dados, Spring MVC para a camada de apresentação, dentre muitos outros.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Tendências em arquitetura de software&lt;/h2&gt;
&lt;br /&gt;
&lt;h2&gt;
 Micro serviços&lt;/h2&gt;
A arquitetura de micro serviços é dirigida ao design de aplicações de software baseado em serviços que são independentes, autônomos no ponto de vista do deploy e sobretudo escaláveis. Cada serviço está rodando sobre seu próprio processo e é construído em função das capacidades e necessidades de negócio.&lt;br /&gt;
&lt;br /&gt;
Cada componente tem seu processo de deploy independente e completamente automatizado através de uma engine com toda infra-estrutura necessária ao deploy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Os micro serviços podem ser escritos em diferentes linguagens de programação e podem usar diferentes tecnologias no armazenamento dos dados. Sendo assim, cada um deles pode também ser gerenciado por diferentes times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
São muitas as vantagens desse tipo de arquitetura, dentre elas:&lt;/h3&gt;
Cada micro serviço é pequeno, simples e se destina a uma funcionalidade específica. Portanto, é mais fácil para entender, desenvolver e manter.&lt;br /&gt;
&lt;br /&gt;
O processo desacoplado de deploy torna mais simples o processo de deployment, é mais rápido e seguro publicar novas versões do componente. Assim, há simplificação do processo que conhecemos como Continuous Deploy e Continuous Delivery.&lt;br /&gt;
&lt;br /&gt;
Esse modelo promove escalabilidade. A administração pode personalizar cada serviço segundo as necessidades de processamento, memória, espaço em disco, etc. O gerenciamento do micro serviço vai permitir que cada item seja alocado com um time diferente – de forma independente e paralela.&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;
Docker&lt;/h2&gt;
Docker é uma plataforma open source que fornece contêineres. A ideia é criar, publicar e rodar aplicações em laptops, data center ou mesmo em um ambiente em nuvem (on-cloud). Tudo isso é feito através de contêineres onde é possível empacotar uma aplicação completa com todos seus componentes e todas as suas configurações. Ao final essa imagem pode ser embarcada com tudo na máquina virtual.&lt;br /&gt;
&lt;br /&gt;
Além disso, com Doker é possível definir todo o processo através de scripts, automatizando todas as tarefas com poucas linhas de comando. Assim, também é possível integrar o Docker junto com às suas práticas do DevOps.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
Conclusão&lt;/h2&gt;
Estas são algumas das principais tendências da tecnologia em 2018 na indústria do software. Este é um ambiente que evolui e cresce super rápido. O importante é sempre estar atualizado. Se você conhece alguma outra tendência, compartilhe com os seus comentários.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/7865063870556377945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/7865063870556377945' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/7865063870556377945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/7865063870556377945'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2018/12/tendencias-da-tecnologia-em-2018.html' title='Tendências da tecnologia em 2018'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-4722330567147681497</id><published>2018-12-06T09:58:00.003-08:00</published><updated>2018-12-14T12:04:39.402-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="consulta"/><category scheme="http://www.blogger.com/atom/ns#" term="consultas"/><category scheme="http://www.blogger.com/atom/ns#" term="firebase"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>Como filtrar consultas no firebase</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://firebase.google.com/images/social.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;400&quot; data-original-width=&quot;800&quot; height=&quot;160&quot; src=&quot;https://firebase.google.com/images/social.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Para filtrar dados, combine um dos métodos de limite ou de intervalo com um método de ordenação ao criar uma consulta.&lt;span style=&quot;color: #212121; font-family: &amp;quot;roboto&amp;quot; , sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;table style=&quot;border-collapse: collapse; border-spacing: 0px; border: 0px; box-sizing: inherit; color: #212121; font-family: Roboto, sans-serif; font-size: 14px; font-stretch: normal; line-height: 20px; margin: 0px; width: 657.333px;&quot;&gt;&lt;tbody style=&quot;box-sizing: inherit;&quot;&gt;
&lt;tr style=&quot;background: rgb(120, 144, 156); border-bottom-color: initial; border-bottom-style: initial; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: rgb(207, 216, 220); border-top-style: solid; border-width: 1px 0px 0px; box-sizing: inherit;&quot;&gt;&lt;th style=&quot;border: 0px; box-sizing: inherit; color: white; font-size: 16px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 500; height: 48px; line-height: 24px; margin: 0px; padding: 8px; text-align: left; vertical-align: middle;&quot;&gt;Método&lt;/th&gt;&lt;th style=&quot;border: 0px; box-sizing: inherit; color: white; font-size: 16px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: 500; height: 48px; line-height: 24px; margin: 0px; padding: 8px; text-align: left; vertical-align: middle;&quot;&gt;Uso&lt;/th&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: rgb(120, 144, 156); border-bottom-color: initial; border-bottom-style: initial; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: rgb(207, 216, 220); border-top-style: solid; border-width: 1px 0px 0px; box-sizing: inherit;&quot;&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;&lt;code style=&quot;-webkit-font-smoothing: auto; background: 0px center; box-sizing: inherit; font-family: &amp;quot;Roboto Mono&amp;quot;, monospace; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: 1; margin-bottom: 0px; margin-top: 0px; padding: 0px; word-break: normal;&quot;&gt;limitToFirst()&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;Definir o número máximo de itens para retornar a partir do início da lista ordenada de resultados.&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: rgb(120, 144, 156); border-bottom-color: initial; border-bottom-style: initial; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: rgb(207, 216, 220); border-top-style: solid; border-width: 1px 0px 0px; box-sizing: inherit;&quot;&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;&lt;code style=&quot;-webkit-font-smoothing: auto; background: 0px center; box-sizing: inherit; font-family: &amp;quot;Roboto Mono&amp;quot;, monospace; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: 1; margin-bottom: 0px; margin-top: 0px; padding: 0px; word-break: normal;&quot;&gt;limitToLast()&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;Definir o número máximo de itens para retornar a partir do fim da lista ordenada de resultados.&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: rgb(120, 144, 156); border-bottom-color: initial; border-bottom-style: initial; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: rgb(207, 216, 220); border-top-style: solid; border-width: 1px 0px 0px; box-sizing: inherit;&quot;&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;&lt;code style=&quot;-webkit-font-smoothing: auto; background: 0px center; box-sizing: inherit; font-family: &amp;quot;Roboto Mono&amp;quot;, monospace; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: 1; margin-bottom: 0px; margin-top: 0px; padding: 0px; word-break: normal;&quot;&gt;startAt()&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;Retornar itens maiores ou iguais à chave ou ao valor especificado, dependendo do método de ordenação escolhido.&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: rgb(120, 144, 156); border-bottom-color: initial; border-bottom-style: initial; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: rgb(207, 216, 220); border-top-style: solid; border-width: 1px 0px 0px; box-sizing: inherit;&quot;&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;&lt;code style=&quot;-webkit-font-smoothing: auto; background: 0px center; box-sizing: inherit; font-family: &amp;quot;Roboto Mono&amp;quot;, monospace; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: 1; margin-bottom: 0px; margin-top: 0px; padding: 0px; word-break: normal;&quot;&gt;endAt()&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;Retornar itens menores ou iguais à chave ou ao valor especificado, dependendo do método de ordenação escolhido.&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: rgb(120, 144, 156); border-bottom-color: initial; border-bottom-style: initial; border-image: initial; border-left-color: initial; border-left-style: initial; border-right-color: initial; border-right-style: initial; border-top-color: rgb(207, 216, 220); border-top-style: solid; border-width: 1px 0px 0px; box-sizing: inherit;&quot;&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;&lt;code style=&quot;-webkit-font-smoothing: auto; background: 0px center; box-sizing: inherit; font-family: &amp;quot;Roboto Mono&amp;quot;, monospace; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: 1; margin-bottom: 0px; margin-top: 0px; padding: 0px; word-break: normal;&quot;&gt;equalTo()&lt;/code&gt;&lt;/td&gt;&lt;td style=&quot;background: rgba(255, 255, 255, 0.98); border: 0px; box-sizing: inherit; margin: 0px; padding: 7px 8px 8px; vertical-align: top;&quot;&gt;Retornar itens iguais à chave ou ao valor especificado, dependendo do método de ordenação escolhido.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;box-sizing: inherit; margin-bottom: 16px; margin-top: 16px; padding: 0px;&quot;&gt;
Ao contrário dos métodos de ordenação, você pode combinar várias funções de limite ou&lt;span style=&quot;color: #212121; font-family: &amp;quot;roboto&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;de&lt;span style=&quot;color: #212121; font-family: &amp;quot;roboto&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;intervalo. Por exemplo, combine os&amp;nbsp;métodos &lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;startAt()&lt;/span&gt;&lt;/span&gt; e &lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;endAt()&lt;/span&gt;&lt;/span&gt; para limitar os resultados a um intervalo especificado de valores.&lt;/div&gt;
Mesmo quando há apenas uma correspondência para a consulta, o instantâneo ainda é uma lista, mas contém somente um item. Para acessar o item, é necessário retornar o resultado:&lt;br /&gt;
// My top posts by number of stars&lt;/div&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;span class=&quot;pln&quot;&gt;myTopPostsQuery&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;addValueEventListener&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;ValueEventListener&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;@Override&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; onDataChange&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DataSnapshot&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; dataSnapshot&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DataSnapshot&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; postSnapshot&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; dataSnapshot&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getChildren&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;())&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;com&quot;&gt;// TODO: handle the post&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;@Override&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; onCancelled&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DatabaseError&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; databaseError&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;com&quot;&gt;// Getting Post failed, log a message&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Log&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;TAG&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;loadPost:onCancelled&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; databaseError&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;toException&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;());&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;com&quot;&gt;// ...&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;});&lt;/span&gt;&lt;div class=&quot;devsite-github-link nocode&quot;&gt;
&lt;/div&gt;
&lt;/pre&gt;
&lt;h3&gt;
Limitar o número de resultados&lt;/h3&gt;
&lt;br /&gt;
Use os métodos &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;limitToFirst()&lt;/span&gt; e &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;limitToLast()&lt;/span&gt; para definir um número máximo de &lt;br /&gt;
filhos a serem sincronizados para determinado retorno de chamada. Por exemplo, &lt;br /&gt;
se você usar &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;limitToFirst()&lt;/span&gt; para definir um limite de 100, inicialmente receberá &lt;br /&gt;
até 100 retornos de chamada &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;onChildAdded()&lt;/span&gt;. &lt;br /&gt;
Se você tiver menos de 100 itens armazenados no seu banco de dados do Firebase, um &lt;br /&gt;
retorno de chamada &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;onChildAdded()&lt;/span&gt; será acionado para cada item.&lt;br /&gt;
Conforme os itens são alterados, você recebe retornos de chamada &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;onChildAdded()&lt;/span&gt; para os &lt;br /&gt;
itens presentes na consulta e retornos de chamada &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;onChildRemoved()&lt;/span&gt; para os itens que &lt;br /&gt;
saem da consulta para que o número total permaneça 100.
Veja a seguir uma demonstração de como o exemplo do app de blog define uma consulta para &lt;br /&gt;
recuperar uma lista das 100 postagens mais recentes de todos os usuários:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;var recentPostsRef = firebase.database().ref(&#39;posts&#39;).limitToLast(100);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
Esse exemplo define somente uma consulta. Para sincronizar os dados, é necessário ter um &lt;br /&gt;
listener anexado.
Filtrar por chave ou valor &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;startAt()&lt;/span&gt;&lt;/span&gt;, &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;endAt()&lt;/span&gt; e &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;equalTo()&lt;/span&gt; para escolher pontos arbitrários de início, fim e &lt;br /&gt;
equivalência para consultas. Isso pode ser útil para paginar dados ou encontrar itens &lt;br /&gt;
com filhos que tenham um valor específico.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;h3&gt;
Como os dados de consultas são ordenados &lt;/h3&gt;
Nesta seção, explicamos como os dados são classificados por cada um dos métodos de &lt;br /&gt;
ordenação na classe &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;Query&lt;/span&gt;.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;h3&gt;
orderByChild&lt;/h3&gt;
&lt;br /&gt;
Ao usar orderByChild(), os dados que contêm a chave filha especificada são ordenados &lt;br /&gt;
desta maneira:&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li style=&quot;box-sizing: inherit; margin: 8px 0px; padding: 0px;&quot;&gt;Filhos com valor &lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;null &lt;/span&gt;&lt;/span&gt;para a chave filha especificada vêm primeiro.&lt;/li&gt;
&lt;li style=&quot;box-sizing: inherit; margin: 8px 0px; padding: 0px;&quot;&gt;Filhos com&amp;nbsp;um valor &lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;false &lt;/span&gt;&lt;/span&gt;para a chave filha especificada são os próximos.Se vários 
filhos tiverem o&amp;nbsp;valor &lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;false&lt;/span&gt;&lt;/span&gt;, eles serão classificados lexicograficamente por chave.&lt;/li&gt;
&lt;li style=&quot;box-sizing: inherit; margin: 8px 0px; padding: 0px;&quot;&gt;Filhos com um&amp;nbsp;valor &lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;true &lt;/span&gt;&lt;/span&gt;para a chave filha especificada são os próximos. Se vários 
filhos tiverem um valor &lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;true&lt;/span&gt;&lt;/span&gt;, eles serão classificados&amp;nbsp;lexicograficamente pela chave.&lt;/li&gt;
&lt;li style=&quot;box-sizing: inherit; margin: 8px 0px; padding: 0px;&quot;&gt;Filhos com um valor numérico são os próximos,&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;color: #212121; font-family: &amp;quot;roboto&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;classificados em ordem crescente. 
Se vários filhos tiverem o mesmo valor numérico para o node filho especificado,&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;color: #212121; font-family: &amp;quot;roboto&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;eles 
serão classificados por chave.&lt;/li&gt;
&lt;li style=&quot;box-sizing: inherit; margin: 8px 0px; padding: 0px;&quot;&gt;Strings vêm depois dos números e são classificadas lexicograficamente em ordem 
crescente. Se vários filhos tiverem 
o mesmo valor para o node filho especificado,&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;color: #212121; font-family: &amp;quot;roboto&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;eles serão ordenados lexicograficamente 
por chave.&lt;/li&gt;
&lt;li style=&quot;box-sizing: inherit; margin: 8px 0px; padding: 0px;&quot;&gt;Objetos são os últimos e são classificados lexicograficamente pela chave em ordem&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;color: #212121; font-family: &amp;quot;roboto&amp;quot; , sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;crescente.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
orderByKey &lt;/h3&gt;
Ao usar &lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;color: magenta;&quot;&gt;orderByKey()&lt;/span&gt;&lt;/span&gt; para classificar seus dados, os dados são retornados &lt;br /&gt;
em ordem ascendente pelo nome da chave.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li style=&quot;box-sizing: inherit; margin: 8px 0px; padding: 0px;&quot;&gt;Filhos com uma chave que possa ser analisada como um número inteiro de 
32 bits vêm primeiro, classificados em ordem ascendente.&lt;/li&gt;
&lt;li style=&quot;box-sizing: inherit; margin: 8px 0px; padding: 0px;&quot;&gt;Filhos com um valor de string como chave são os próximos, classificados de modo 
lexicográfico em ordem&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;color: #212121; font-family: &amp;quot;roboto&amp;quot; , sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;ascendente&lt;span class=&quot;pun&quot;&gt;&lt;span style=&quot;color: #212121; font-family: &amp;quot;roboto&amp;quot; , sans-serif;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
 orderByValue&lt;/h3&gt;
Ao usar &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;orderByValue()&lt;/span&gt;, os filhos são ordenados pelo valor deles. Os critérios de ordenação são os mesmos que os em &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;orderByChild()&lt;/span&gt;, mas o valor do node é usado em vez do valor de uma chave filho especificada.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3&gt;
Desanexar listener&amp;nbsp;&lt;/h3&gt;
&lt;div&gt;
Retornos de chamada são removidos chamando o método &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;off()&lt;/span&gt; na sua referência ao &lt;br /&gt;
banco de dados do Firebase. &lt;br /&gt;
&lt;br /&gt;
Você pode remover um único listener ao transmiti-lo como um parâmetro para &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;off()&lt;/span&gt;. &lt;br /&gt;
Chamar &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;off()&lt;/span&gt; no local sem argumentos remove todos os listeners desse local.&lt;br /&gt;
&lt;div&gt;
Chamar &lt;span style=&quot;background-color: #f3f3f3; color: magenta;&quot;&gt;off()&lt;/span&gt; em um listener pai não remove automaticamente os listeners registrados&amp;nbsp;&lt;/div&gt;
nos nodes filho dele.&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;off()&lt;/span&gt;&lt;/span&gt; também precisa ser chamado nos listeners filho para remover &lt;br /&gt;
o retorno de chamada.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/4722330567147681497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/4722330567147681497' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4722330567147681497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4722330567147681497'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2018/12/como-filtrar-consultas-no-firebase.html' title='Como filtrar consultas no firebase'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-7595602843253946359</id><published>2011-04-18T04:42:00.000-07:00</published><updated>2011-04-18T06:08:21.086-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="processos"/><category scheme="http://www.blogger.com/atom/ns#" term="servidor"/><category scheme="http://www.blogger.com/atom/ns#" term="webmethod"/><title type='text'>Exibindo processo que ocorrem durante o program para o usuário</title><content type='html'>Hoje veremos como exibir para o usuário quais os passos que o programa faz durante um processo referente a regra de negocio.&lt;br /&gt;
A finalidade é mostrar o que esta sendo feito pois as vezes o program pode demorar um pouco para responder devido a um processo na maquina ou até um envio de e-mail.&lt;br /&gt;
Crie um novo WebApplication no &lt;a href=&quot;http://www.microsoft.com/express/Web/&quot;&gt;visual Studio&lt;/a&gt;.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://picasaweb.google.com/lh/photo/AAKqC7wUVXcH8xf32_S2MZAWWY8h2UP7Wu41rWHHa34?feat=directlink&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXTByot4nemF7EXL03-3co_Qu3UabaxK96-J2eSAfKYJcNAikewl1zbi9dAH5YRXCRRoj8EAJ8jAqlVgTL1TQUH738nIjnBb_cFtiKtyrrLrUtP273eZHZyITBT0rdSLXTcQjs/s320/NewWebApp.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Na pagina Default.aspx da aplicação vamos colocar alguns campos simples para simular um&amp;nbsp;formulário.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Ex:&lt;/div&gt;&lt;pre class=&quot;css&quot; name=&quot;code&quot;&gt;&amp;lt;style type=&quot;text/css&quot;&amp;gt;
   &amp;nbsp;.campo{&lt;/pre&gt;&lt;pre class=&quot;css&quot; name=&quot;code&quot;&gt;padding:5px;
        float:left;    
    }
&amp;lt;/style&amp;gt;    
&lt;/pre&gt;&lt;pre class=&quot;javascript&quot; name=&quot;code&quot;&gt;&amp;lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&amp;gt;
    
    function RespostaServidor(ResultString) {
        var result = document.getElementById(&quot;result&quot;);
        result.innerHTML = ResultString;
    }

    function SalvarDados() {
        var form = new GetForm()
        PageMethods.Salvar(form, RespostaServidor);
        PageMethods.EnviarEmail(RespostaServidor);
        PageMethods.Concluir(RespostaServidor);
    }

    function GetForm() {
        this.Nome = $get(&quot;txbNome&quot;).value;
        this.Telefone = $get(&quot;txbTelefone&quot;).value;
        this.Email = $get(&quot;txbEmail&quot;).value;
    } 
&amp;lt;/script&amp;gt;
&lt;/pre&gt;&lt;pre class=&quot;html&quot; name=&quot;code&quot;&gt;&amp;lt;div class=&quot;campo&quot;&amp;gt;
Nome
&amp;lt;input id=&quot;txbNome&quot; type=&quot;text&quot; /&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;div class=&quot;campo&quot;&amp;gt;
Telefone
&amp;lt;input id=&quot;txbTelefone&quot; type=&quot;text&quot; /&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;div class=&quot;campo&quot;&amp;gt;
E-mail
&amp;lt;input id=&quot;txbEmail&quot; type=&quot;text&quot; /&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;div&amp;gt;
&amp;lt;input onclick=&quot;SalvarDados();&quot; type=&quot;button&quot; value=&quot;Salvar&quot; /&amp;gt;
        &amp;lt;span id=&quot;result&quot;&amp;gt;&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;A classe JavaScript &lt;b&gt;&quot;GetForm()&quot;&lt;/b&gt;&amp;nbsp;é um modelo para capturar os dados do formulário, e é recebida pelo C# no tipo &lt;b&gt;&quot;Dictionary&amp;lt;string,string&amp;gt;&quot;.&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Criei um &lt;b&gt;WebMethod&lt;/b&gt;&amp;nbsp;para cada ação que será&amp;nbsp;executada pelo servidor e as utilizei na função javascript &quot;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;SalvarDados()&quot; que por sua vez armazena a resposta do servidor em uma outra função &quot;RespostaServidor(ResultString)&quot; apresentando a resposta do webMethod na tag &amp;lt;span id=&quot;result&quot;&amp;gt;&amp;lt;/span&amp;gt;.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;Para simular o tempo de processo no servidor utilizei &lt;b&gt;Thread.Sleep(3000);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace; white-space: pre;&quot;&gt;Veja na listagem a baixo como ficaram os webMethods:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Web.Services;

namespace TesteAssincronoMetodos
{
    public partial class _Default : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
           
           
        }
        public string PublicRetorno(Dictionary&lt;string, string=&quot;&quot;&gt; form, string text)
     {

            switch (text)
            { 
                case &quot;Inicio&quot; : text = &quot;Salvando dados do usuário &quot;+form[&quot;Nome&quot;]; break;
                case &quot;Enviando Email...&quot;: text = &quot;Enviando Email &quot; + form[&quot;Email&quot;] + &quot;...&quot;; Thread.Sleep(3000); break;
                case &quot;Concluido&quot;: Thread.Sleep(3000); break;
            }
           
            return text;
     }

        #region WebMethods
        [WebMethod]
        public static string Salvar(Dictionary&lt;string,string&gt; jsForm)
        {
            Form_ = jsForm;
            string msg = new TesteAssincronoMetodos._Default().PublicRetorno(jsForm,&quot;Inicio&quot;);
            return msg;
        }
        [WebMethod]
        public static string EnviarEmail()
        {

            string msg = new TesteAssincronoMetodos._Default().PublicRetorno(Form_, &quot;Enviando Email...&quot;);
            return msg;
        }
        [WebMethod]
        public static string Concluir()
        {
            string msg = new TesteAssincronoMetodos._Default().PublicRetorno(null,&quot;Concluido&quot;);
            return msg;
        }
        #endregion

        public static Dictionary&lt;string, string=&quot;&quot;&gt; Form_ { get; set; }

    }
}
&lt;/string,&gt;&lt;/string,string&gt;&lt;/string,&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;É isso ai galera qualquer duvida ou sugestão basta entrar com contato.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/7595602843253946359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/7595602843253946359' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/7595602843253946359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/7595602843253946359'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2011/04/exibindo-processo-que-ocorrem-durante-o.html' title='Exibindo processo que ocorrem durante o program para o usuário'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXTByot4nemF7EXL03-3co_Qu3UabaxK96-J2eSAfKYJcNAikewl1zbi9dAH5YRXCRRoj8EAJ8jAqlVgTL1TQUH738nIjnBb_cFtiKtyrrLrUtP273eZHZyITBT0rdSLXTcQjs/s72-c/NewWebApp.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-1998766689290849391</id><published>2010-12-28T10:54:00.000-08:00</published><updated>2010-12-29T05:01:41.666-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="class"/><category scheme="http://www.blogger.com/atom/ns#" term="Deserialize"/><category scheme="http://www.blogger.com/atom/ns#" term="Object"/><category scheme="http://www.blogger.com/atom/ns#" term="Serialize"/><title type='text'>Criar XML a partir de uma classe modelo utilizando Serialize e Deserialize</title><content type='html'>Neste post vou mostrar como montar um XML a partir de uma classe modelo utilizando o Serilize do c#.&lt;br /&gt;
&lt;blockquote&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cccccc;&quot;&gt;Dica: pode ser utilizado em uma aplicação que tenha um formulário e por algum motivo desconhecido o usuário não esta conseguindo salvar os dados, logo no tratamento da&amp;nbsp;exceção&amp;nbsp;&amp;nbsp;da aplicação pode-se armazenar os dados do formulário em um arquivo xml utilizando o Serialize e enviar por e-mail para equipe&amp;nbsp;de desenvolvimento, que por sua vez com os dados do usuário fica mais&amp;nbsp;fácil&amp;nbsp;simular o erro e&amp;nbsp;corrigi-lo mais rapidamente.&lt;/span&gt;&lt;/blockquote&gt;Crie um novo projeto no Visual Studio do tipo ASP.NET Web Application (C#), monte uma pagina de acordo com os elementos da imagem abaixo&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmPPyNjvVruz6MbcfFr7V7OrQbF8WZRGzVu5NhSbSQRINgsEjKxLBsOeX_XWgOP8FDKvg-Lmu_KaM498EoVnndQ9gyVmu94wHEt_pHYArXxRWSQPrkLnc6C3drM8JFIbn54FlE/s1600/Form.jpg&quot; imageanchor=&quot;1&quot; style=&quot;cursor: pointer; margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;179&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmPPyNjvVruz6MbcfFr7V7OrQbF8WZRGzVu5NhSbSQRINgsEjKxLBsOeX_XWgOP8FDKvg-Lmu_KaM498EoVnndQ9gyVmu94wHEt_pHYArXxRWSQPrkLnc6C3drM8JFIbn54FlE/s320/Form.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;No evento do botão que ira salvar os dados do formulário vou capturar os dados do informados pelo usuário e armazena-los utilizando minha classe modelo com as seguintes propriedades.&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace XML_Serialize
{
    public class USUARIO
    {
        public string NOME{get;set;}
        public int SEXO{get;set;}
        public DateTime DATA_NASCIMENTO{get;set;}
        public string TELEFONE{get;set;}
    }
}
&lt;/pre&gt;Vou criar também uma classe com os&amp;nbsp;métodos que executaram a serialização e deserialização.&lt;br /&gt;
Ao executar a deserialização é&amp;nbsp;necessário&amp;nbsp;fechar o arquivo, pois se o usuário abrir o mesmo arquivo de novo não será&amp;nbsp;possível&amp;nbsp;pois o mesmo já esta aberto.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using System.IO;
using System.Xml.Serialization;
using System.Xml;

namespace XML_Serialize
{
    public class Ferramenta_serialize
    {
        internal string SerializeObject(USUARIO user,string caminhoServidor)
        {
            StringBuilder xm = new StringBuilder();

            MemoryStream memoryStream = new MemoryStream();
            XmlSerializer xs = new XmlSerializer(user.GetType());
            XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);

            xs.Serialize(xmlTextWriter, user);
            memoryStream = (MemoryStream)xmlTextWriter.BaseStream;
            xm.Append(UTF8ByteArrayToString(memoryStream.ToArray()));

            //cria o arquivo mesmo que não exista
            string file_ =  user.NOME + &quot;.xml&quot;;
            StreamWriter valor = new StreamWriter(caminhoServidor + &quot;\\&quot; + file_);
            valor.Write(xm.ToString().Trim());
            valor.Close();
            return file_;
        }

        internal USUARIO DeserializeObject(System.Web.UI.WebControls.FileUpload fu_XML)
        {
            XmlSerializer xs = new XmlSerializer(typeof(USUARIO));
            FileStream fs = new FileStream(fu_XML.PostedFile.FileName, FileMode.Open);
            XmlReader reader = new XmlTextReader(fs);

            USUARIO user = xs.Deserialize(reader)as USUARIO;
            reader.Close();

            return user;
        }
        /// &amp;lt;summary&amp;gt;
        /// converte um Array de Byte Unicode (UTF-8 encoded) para uma String.
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name=&quot;characters&quot;&amp;gt;Unicode Array de Byte&#39;s para comverter em String&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;String formada por Array de Byte&#39;s&amp;lt;/returns&amp;gt;
        private String UTF8ByteArrayToString(Byte[] characters)
        {
            UTF8Encoding encoding = new UTF8Encoding();
            String constructedString = encoding.GetString(characters);
            return (constructedString);
        }
        /// &amp;lt;summary&amp;gt;
        /// Converte uma String em Array de Byte&#39;s UTF-8
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;param name=&quot;XMLString&quot;&amp;gt;&amp;lt;/param&amp;gt;
        /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
        private Byte[] StringToUTF8ByteArray(String XMLString)
        {
            UTF8Encoding encoding = new UTF8Encoding();
            Byte[] byteArray = encoding.GetBytes(XMLString);
            return byteArray;
        }
    }
}
&lt;/pre&gt;&lt;br /&gt;
Agora no evento do botão salvar vou capturar os dados do formulário e utilizar o metodo &lt;b&gt;SerializeObject&lt;/b&gt;&amp;nbsp;passando para o mesmo o objeto do tipo USUARIO, preenchido com os dados do formulário.&lt;br /&gt;
O mentodo &lt;b&gt;SerializeObject&lt;/b&gt;&amp;nbsp;ira retornar o nome do arquivo xml que foi criado e disponibiliza-lo para download utilizando o comando Response.TransmitFile() e&amp;nbsp;Response.End() para abrir o arquivo correto.&lt;br /&gt;
No evento do botão que captura o arquivo do componente FileUpload vou chamar o metodo &lt;b&gt;DeserilizeObject&lt;/b&gt;&amp;nbsp;que ira receber o componente FileUpload, abrir o arquivo xml, deserilizar e salvar os dados no objeto do tipo USUARIO.&lt;br /&gt;
Vou criar também um método para limpar os dados do formulário, por&amp;nbsp;estética&amp;nbsp;apenas, deixando o code-behind assim.&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;

namespace XML_Serialize
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            btnSalvar.Click += new EventHandler(btnSalvar_Click);
            btnCarregaArquivo.Click += new EventHandler(btnCarregaArquivo_Click);
        }
        void btnCarregaArquivo_Click(object sender, EventArgs e)
        {
            try
            {
                USUARIO user = new Ferramenta_serialize().DeserializeObject(fu_XML);
                txbNome.Text = user.NOME;
                rblSexo.SelectedValue = user.SEXO.ToString();
                txbDataNascimento.Text = user.DATA_NASCIMENTO.ToShortDateString();
                txbTelefone.Text = user.TELEFONE;

                fu_XML.Dispose();
            }
            catch(Exception ex) {
                lblMensage.Text = ex.Message;
            }
        }
        void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                USUARIO user = new USUARIO()
                {
                    NOME = txbNome.Text.Trim(),
                    SEXO = int.Parse(rblSexo.SelectedValue),
                    DATA_NASCIMENTO = DateTime.Parse(txbDataNascimento.Text.Trim()),
                    TELEFONE = txbTelefone.Text.Trim()
                };
                string rs = new Ferramenta_serialize().SerializeObject(user, Server.MapPath(string.Empty));
                Response.ContentType = &quot;file/xml&quot;;
                Response.AppendHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=&quot;+rs);
                Response.TransmitFile(rs);
                Response.End();
                limpaFormulario();

            }
            catch (Exception ex)
            {
                lblMensage.Text = ex.Message;
            }
        }
        private void limpaFormulario()
        {
            txbNome.Text = string.Empty;
            rblSexo.SelectedValue = null;
            txbDataNascimento.Text = string.Empty;
            txbTelefone.Text = string.Empty;
        }
    }
}
&lt;/pre&gt;O retorno do nosso XML será algo do tipo;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaq89Y7ipwuXS4LFCNlZDfbLcthe21OuBXObUd_3LO0CjG3BW51bl22PbUe7tgKqf0H0L_B73K6Qbpppl4hCK9VL8R8Pd8P7liGW51D5RWPYHqQOUCAU0n5v7SHNX2MdwtvOVL/s1600/XML_Retorno.jpg&quot; imageanchor=&quot;1&quot; style=&quot;cursor: pointer; margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;55&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaq89Y7ipwuXS4LFCNlZDfbLcthe21OuBXObUd_3LO0CjG3BW51bl22PbUe7tgKqf0H0L_B73K6Qbpppl4hCK9VL8R8Pd8P7liGW51D5RWPYHqQOUCAU0n5v7SHNX2MdwtvOVL/s400/XML_Retorno.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/1998766689290849391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/1998766689290849391' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/1998766689290849391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/1998766689290849391'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2010/12/cirar-xml-partir-de-uma-classe-modelo.html' title='Criar XML a partir de uma classe modelo utilizando Serialize e Deserialize'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmPPyNjvVruz6MbcfFr7V7OrQbF8WZRGzVu5NhSbSQRINgsEjKxLBsOeX_XWgOP8FDKvg-Lmu_KaM498EoVnndQ9gyVmu94wHEt_pHYArXxRWSQPrkLnc6C3drM8JFIbn54FlE/s72-c/Form.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-4127577773961395099</id><published>2010-12-20T04:53:00.000-08:00</published><updated>2010-12-28T09:07:27.327-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="consultas"/><category scheme="http://www.blogger.com/atom/ns#" term="get"/><category scheme="http://www.blogger.com/atom/ns#" term="post"/><category scheme="http://www.blogger.com/atom/ns#" term="twitter"/><category scheme="http://www.blogger.com/atom/ns#" term="windows phone 7"/><category scheme="http://www.blogger.com/atom/ns#" term="wp7"/><title type='text'>Posts e consultas no twitter pelo windows phone 7 part 2 de 2</title><content type='html'>No artigo anterior (&lt;a href=&quot;http://http//oicram-projeto.blogspot.com/2010/12/posts-e-consultas-no-twitter-pelo.html&quot;&gt;Posts e consultas no twitter pelo windows phone 7 part 1 de 2&lt;/a&gt;) no vimos como construir uma aplicação no windows phone 7 que faça consultas no twitter utilizando o api do twitter; Neste artigo vamos tentar construir nesta mesma aplicação algo que o usuário possa fazer o login no twitter, visualize seus posts e adicione novos.&lt;br /&gt;
No passo anterior no menu da aplicação nos deixamos um item chamado &quot;login&quot; que servira pra redirecionar para uma tela que o usuário possa efetuar o login no twiter;&lt;br /&gt;
Para que essa parte da aplicação funcione &amp;nbsp;precisamos registrar nossa aplicação no twitter; Acesse &lt;a href=&quot;http://dev.twitter.com/&quot;&gt;dev.twitter.com&lt;/a&gt;.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/lh/photo/4Iati2dTexGx8bHcKejoU5AWWY8h2UP7Wu41rWHHa34?feat=directlink&quot; style=&quot;cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7nOL1S_Kvr29OM_ioYCbwsv_cBNqnSLDEpI2nTRJagvRhOFOCYIZ5MP3y9kguhMmC2afw7nSRJ0SKFfUT75HNLzfBo6hMDI8QQgmUXfr9cjX8UaVO-9Yervs75xymQ2vyyzeN/s320/DevTwitterRegister.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/lh/photo/dnueHXlp7PQ3gu0gaTsfrpAWWY8h2UP7Wu41rWHHa34?feat=directlink&quot; style=&quot;cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;254&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGiy8nWWsRHjKWeKaNLdfgYnWldGA0tZ9eT4LZNQBzlcFCtLs_U6XqeJzBaiTSjhjv-ZT2cR_CQrZVG8Ph4pb4sZ_5N5qzjanYIlmu94Yk2FTbpqELVcppr71ZviVShujT5nh7/s320/FormAppTwitter.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
A aplicação deve ser to tipo Browser e a Callback URL informada, essa é uma das&amp;nbsp;exigências&amp;nbsp;do twitter, como nos vamos utilizar a URL do google( http://www.google.com ).&lt;br /&gt;
Apos o registro da aplicação &amp;nbsp;o twitter retorna as url&#39;s&amp;nbsp;necessárias&amp;nbsp;para as&amp;nbsp;transações.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/lh/photo/yj6CpdDVB2ukrOuRPi24rZAWWY8h2UP7Wu41rWHHa34?feat=directlink&quot; style=&quot;cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;252&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP91Qb-ASbOjEEJfAGKEHjtli4r7tfdKuwvIViGTLZvVkJk_03v04eV3Jj7e_jtKRww0TP7xchdYkYQG4HN61UldrQoK1ax8lDJZ4oTGXKmJbito1mANml7U9ZcZgJ6dnw3vrl/s320/AppTwitterRegistred.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Para conseguirmos buscar e enviar informações no twitter vamos utilizar a api de autorizaçao &lt;a href=&quot;http://www.oauth.net/&quot;&gt;oAuth&amp;nbsp;&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Agora vamos construir nossas classes com estas informações.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;b&gt;TwitterSettings.cs&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace WindowsPhoneApplication1
{
    public class TwitterSettings
    {
        public static string RequestTokenUri = &quot;https://api.twitter.com/oauth/request_token&quot;;
        public static string AuthorizeUri = &quot;https://api.twitter.com/oauth/authorize&quot;;
        public static string AccessTokenUri = &quot;https://api.twitter.com/oauth/access_token&quot;;

        public static string CallbackUri = &quot;http://www.google.com&quot;;

        public static string StatusUpdateUrl { get { return &quot;http://api.twitter.com&quot;; } }

        //#error Adicione as respectivas cheves do Twitter aqui
        public static string consumerKey = &quot;consumerKey&quot;;
        public static string consumerKeySecret = &quot;consumerKeySecret&quot;;

        public static string oAuthVersion = &quot;1.0a&quot;;
    }
}

&lt;/pre&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;pedido&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;Token&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;e&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;secreto&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;pedido&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;token&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;são&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;conjunto temporário de&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;credenciais&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;que&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;lhe permitem&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;adquirir&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;tokens&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;de acesso&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;OAuth&lt;/span&gt;&lt;span title=&quot;Clique para mostrar traduções alternativas&quot;&gt;.&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;O&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;token de acesso&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;e&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;secreto&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;token de acesso&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;são necessários para acessar&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;os tweets&lt;/span&gt;&amp;nbsp;&lt;span class=&quot;hps&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;de um usuário&lt;/span&gt;&lt;span class=&quot;&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;span class=&quot;&quot; title=&quot;Clique para mostrar traduções alternativas&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Agora vamos montar a classe de tratamento que utiliza as dll&#39;s&lt;a href=&quot;http://1u41ja.blu.livefilestore.com/y1pecOlVoTdoqbEnSsT8wtlnhHRVhqhO-fbwb3OtarpGZ3Z9bXODjAnGEGXXqsK298sRxxNla9s7kmx8VTXg_98bOaeO90VOJ6f/Hommock_ICSharpCode.zip?download&amp;amp;psid=1&quot;&gt; Hammock.WindowsPhone e ICSharpCode.SharpZipLib.WindowsPhone&lt;/a&gt;&amp;nbsp;que disponibilizei na primeira parte deste tutorial.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;oAuthHelper.cs&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Hammock.Authentication.OAuth;
using Hammock.Web;

namespace WindowsPhoneApplication1
{
    public class oAuthHelper
    {
        internal static OAuthWebQuery GetRequestTokenQuery()
        {
            var oauth = new OAuthWorkflow
            {
                ConsumerKey = TwitterSettings.consumerKey,
                ConsumerSecret = TwitterSettings.consumerKeySecret,
                SignatureMethod = OAuthSignatureMethod.HmacSha1,
                ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
                RequestTokenUrl = TwitterSettings.RequestTokenUri,
                Version = TwitterSettings.oAuthVersion,
                CallbackUrl = TwitterSettings.CallbackUri
            };

            var info = oauth.BuildRequestTokenInfo(WebMethod.Get);
            var objOAuthWebQuery = new OAuthWebQuery(info);
            objOAuthWebQuery.HasElevatedPermissions = true;
            objOAuthWebQuery.SilverlightUserAgentHeader = &quot;Hammock&quot;;
            objOAuthWebQuery.SilverlightMethodHeader = &quot;GET&quot;;
            return objOAuthWebQuery;
        }

        internal static OAuthWebQuery GetAccessTokenQuery(string requestToken, string RequestTokenSecret, string oAuthVerificationPin)
        {
            var oauth = new OAuthWorkflow
            {
                AccessTokenUrl = TwitterSettings.AccessTokenUri,
                ConsumerKey = TwitterSettings.consumerKey,
                ConsumerSecret = TwitterSettings.consumerKeySecret,
                ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
                SignatureMethod = OAuthSignatureMethod.HmacSha1,
                Token = requestToken,
                Verifier = oAuthVerificationPin,
                Version = TwitterSettings.oAuthVersion
            };

            var info = oauth.BuildAccessTokenInfo(WebMethod.Post);
            var objOAuthWebQuery = new OAuthWebQuery(info);
            objOAuthWebQuery.HasElevatedPermissions = true;
            objOAuthWebQuery.SilverlightUserAgentHeader = &quot;Hammock&quot;;
            objOAuthWebQuery.SilverlightMethodHeader = &quot;GET&quot;;
            return objOAuthWebQuery;
        }

    }
}

&lt;/pre&gt;Ok, agora que temos nessas classes para trabalho vamos montar uma tela (InTwitter.axml);&lt;br /&gt;
A idéia é utilizar o componente browser do wp7 para acessar a pagina de login da nossa aplicação que o twitter nos retorna, assim que o usuário informar login, senha de clicar no botão &quot;Allow&quot;, assim que autenticação for feita nos vamos ocultar o browser e exibir em um ListBox os post do usuário e também disponibilizar a visualização de um TextBox e um botão para novos posts que serão feitos, deixando a tela mais ou menos assim:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxwLMuKrmlDKFLBnaswReN2dK9eXESUIh2CADQZ_hMQIrMQOz42WeQG5FVQaXHoBfmgFAQzK2kMsQBrzgLjM-DjargieunU0LYLvg_EAQRcLthETzHT1wB8lLLRHHunseMwQK0/s1600/appTwitterWP7BrowserLogin.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;287&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxwLMuKrmlDKFLBnaswReN2dK9eXESUIh2CADQZ_hMQIrMQOz42WeQG5FVQaXHoBfmgFAQzK2kMsQBrzgLjM-DjargieunU0LYLvg_EAQRcLthETzHT1wB8lLLRHHunseMwQK0/s320/appTwitterWP7BrowserLogin.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;Vamos criar as seguintes variáveis publicas no nosso InTwitter.axml.cs&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;string OAuthTokenKey = string.Empty;
string tokenSecret = string.Empty;

string accessToken = string.Empty;
string accessTokenSecret = string.Empty;

string userID = string.Empty;
string userScreenName = string.Empty;
&lt;/pre&gt;&lt;br /&gt;
Abaixo do metodo InitializeComponent(); que fica no construtor da classe vamos resgatar as nossas chaves que o twitter nos forneceu e faremos um tratamento das mesmas se estiver tudo ok vamos registrar um evento no browser e no botão de posts:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;accessToken = HelperMethods.GetKeyValue&amp;lt;string&amp;gt;(&quot;AccessToken&quot;);
            accessTokenSecret = HelperMethods.GetKeyValue&amp;lt;string&amp;gt;(&quot;AccessTokenSecret&quot;);
            userScreenName = HelperMethods.GetKeyValue&amp;lt;string&amp;gt;(&quot;ScreenName&quot;);


            if (string.IsNullOrEmpty(accessToken) || string.IsNullOrEmpty(accessTokenSecret))
            {
                var requestTokenQuery = oAuthHelper.GetRequestTokenQuery();
                requestTokenQuery.RequestAsync(TwitterSettings.RequestTokenUri, null);
                requestTokenQuery.QueryResponse += new EventHandler&amp;lt;WebQueryResponseEventArgs&amp;gt;(requestTokenQuery_QueryResponse);
            }
            else
            {
                GetUserTimeLine(userScreenName);
                Dispatcher.BeginInvoke(() =&amp;gt;
                {

                    var tweetButton = (Microsoft.Phone.Shell.ApplicationBarIconButton)this.ApplicationBar.Buttons[0];
                    tweetButton.IsEnabled = true;
                    PageTitle.Visibility = Visibility.Visible;
                    listboxMyTimeline.Visibility = Visibility.Visible;
                    txtBoxNewTweet.Visibility = Visibility.Visible;
                    btnPostTweet.Visibility = Visibility.Visible;
                });
                
            }

            webBrowser1.Navigated += new EventHandler&amp;lt;System.Windows.Navigation.NavigationEventArgs&amp;gt;(webBrowser1_Navigated);
            webBrowser1.Navigating += new EventHandler&amp;lt;NavigatingEventArgs&amp;gt;(webBrowser1_Navigating);
            btnPostTweet.Click += new RoutedEventHandler(btnPostTweet_Click);
&lt;/pre&gt;Nos evento &lt;b&gt;requestTokenQuery_QueryResponse&lt;/b&gt;&amp;nbsp;vamos tentar capturar&amp;nbsp;autorização&amp;nbsp;utilizando nossa chave&amp;nbsp;OAuthTokenKey&amp;nbsp;&amp;nbsp;e acionar nosso browser passando a url de autorização.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;void requestTokenQuery_QueryResponse(object sender, WebQueryResponseEventArgs e)
        {
            try
            {
                var parameters = HelperMethods.GetQueryParameters(e.Response);
                OAuthTokenKey = parameters[&quot;oauth_token&quot;];
                tokenSecret = parameters[&quot;oauth_token_secret&quot;];
                var authorizeUrl = TwitterSettings.AuthorizeUri + &quot;?oauth_token=&quot; + OAuthTokenKey;

                Dispatcher.BeginInvoke(() =&amp;gt;
                {
                    this.webBrowser1.Navigate(new Uri(authorizeUrl));
                });
            }
            catch (Exception ex)
            {
                Dispatcher.BeginInvoke(() =&amp;gt;
                {
                    MessageBox.Show(ex.Message);
                });
            }

        }
&lt;/pre&gt;No evento&amp;nbsp;&amp;nbsp;&lt;b&gt;webBrowser1_Navigating&lt;/b&gt;&amp;nbsp;&amp;nbsp;recebemos o resultado da autorização, armazenamos nossa web query na variavel&amp;nbsp;&lt;b&gt;AccessTokenQuery&lt;/b&gt;, registramos um enveto &lt;b&gt;AccessTokenQuery_QueryResponse&lt;/b&gt;&amp;nbsp;e utilizamos uma requisisão assincrona, disando o evento assim:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;void webBrowser1_Navigating(object sender, NavigatingEventArgs e)
        {
            if (e.Uri.ToString().StartsWith(TwitterSettings.CallbackUri))
            {
                var AuthorizeResult = HelperMethods.GetQueryParameters(e.Uri.ToString());
                var VerifyPin = AuthorizeResult[&quot;oauth_verifier&quot;];
                this.webBrowser1.Visibility = Visibility.Collapsed;

                var AccessTokenQuery = oAuthHelper.GetAccessTokenQuery(
                                                                         OAuthTokenKey,
                                                                         tokenSecret,
                                                                         VerifyPin
                                                                        );

                AccessTokenQuery.QueryResponse += new EventHandler&amp;lt;WebQueryResponseEventArgs&amp;gt;(AccessTokenQuery_QueryResponse);
                AccessTokenQuery.RequestAsync(TwitterSettings.AccessTokenUri, null);
            }
        }
&lt;/pre&gt;No evento&amp;nbsp;&lt;b&gt;webBrowser1_Navigated &lt;/b&gt;alteramos a visualização do browser e removemos o evento para o usuário ver seus posts&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;void webBrowser1_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
        {
            this.webBrowser1.Visibility = Visibility.Visible;
            this.webBrowser1.Navigated -= webBrowser1_Navigated;
        }
&lt;/pre&gt;&lt;br /&gt;
No evento &lt;b&gt;AccessTokenQuery_QueryResponse&lt;/b&gt;&amp;nbsp;tentamos armazenar os&amp;nbsp;parâmetros&amp;nbsp;na&amp;nbsp;variável&amp;nbsp;&lt;b&gt;parameters,&lt;/b&gt;&amp;nbsp;capturar&amp;nbsp;os valores&amp;nbsp;traves&amp;nbsp;destes&amp;nbsp;parâmetros&amp;nbsp;e habilitar o menu para o usuário fazer o logoff do twitter.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;void AccessTokenQuery_QueryResponse(object sender, WebQueryResponseEventArgs e)
        {
            try
            {
                var parameters = HelperMethods.GetQueryParameters(e.Response);
                accessToken = parameters[&quot;oauth_token&quot;];
                accessTokenSecret = parameters[&quot;oauth_token_secret&quot;];
                userID = parameters[&quot;user_id&quot;];
                userScreenName = parameters[&quot;screen_name&quot;];


                HelperMethods.SetKeyValue&amp;lt;string&amp;gt;(&quot;AccessToken&quot;, accessToken);
                HelperMethods.SetKeyValue&amp;lt;string&amp;gt;(&quot;AccessTokenSecret&quot;, accessTokenSecret);
                HelperMethods.SetKeyValue&amp;lt;string&amp;gt;(&quot;ScreenName&quot;, userScreenName);

                Dispatcher.BeginInvoke(() =&amp;gt;
                {
                    var AtualizarMenuItem = (Microsoft.Phone.Shell.ApplicationBarMenuItem)this.ApplicationBar.MenuItems[1];
                    AtualizarMenuItem.IsEnabled = true;
                    
                });
                GetUserTimeLine(userScreenName);
            }
            catch (Exception ex)
            {
                Dispatcher.BeginInvoke(() =&amp;gt;
                {
                    MessageBox.Show(ex.Message);
                });
            }
        }
&lt;/pre&gt;&lt;br /&gt;
No evento&amp;nbsp;&lt;b&gt;btnPostTweet_Click&lt;/b&gt;&amp;nbsp;precisamos pegar todas as credenciais que foram preenchidas durante o&amp;nbsp;processo&amp;nbsp;dos outros eventos acima e enviar para o twitter e já receber os posts atualizados do usuário.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;void btnPostTweet_Click(object sender, RoutedEventArgs e)
        {
            if (txtBoxNewTweet.Text.Trim().Length == 0) { return; }

            var credentials = new OAuthCredentials
            {
                Type = OAuthType.ProtectedResource,
                SignatureMethod = OAuthSignatureMethod.HmacSha1,
                ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
                ConsumerKey = TwitterSettings.consumerKey,
                ConsumerSecret = TwitterSettings.consumerKeySecret,
                Token = this.accessToken,
                TokenSecret = this.accessTokenSecret,
                Version = &quot;1.0&quot;
            };

            var restClient = new RestClient
            {
                Authority = TwitterSettings.StatusUpdateUrl,
                HasElevatedPermissions = true,
                Credentials = credentials,
                Method = WebMethod.Post
            };

            restClient.AddHeader(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;);

            var restRequest = new RestRequest
            {
                Path = &quot;1/statuses/update.xml?status=&quot; + txtBoxNewTweet.Text
            };

            var ByteData = Encoding.UTF8.GetBytes(txtBoxNewTweet.Text);
            restRequest.AddPostContent(ByteData);
            restClient.BeginRequest(restRequest, new RestCallback(PostTweetRequestCallback));
        }
&lt;/pre&gt;No evento&amp;nbsp;&lt;b&gt;PostTweetRequestCallback&lt;/b&gt;&amp;nbsp;atualizamos o post do usuário utilizando o&amp;nbsp;método&amp;nbsp;&lt;b&gt;GetUserTimeLine(usuário_logado).&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;private void PostTweetRequestCallback(RestRequest request, Hammock.RestResponse response, object obj)
        {
            GetUserTimeLine(userScreenName);
        }
&lt;/pre&gt;&lt;br /&gt;
Podemos também criar um botão no menu do WP7 que atualize os post enviados pelo usuário e neste botão no invocamos o evento &lt;b&gt;TweetButton_Click&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;private void TweetButton_Click(object sender, EventArgs e)
        {
            GetUserTimeLine(userScreenName);
        }
&lt;/pre&gt;No metodo &lt;b&gt;GetUserTimeLine(usuario_logado)&lt;/b&gt; nos temos que registrar o evento &lt;b&gt;wcTwitterTimeline_DownloadStringCompleted&lt;/b&gt;.&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;private void GetUserTimeLine(string userName)
        {
            
            WebClient wcTwitterTimeline = new WebClient();
            wcTwitterTimeline.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wcTwitterTimeline_DownloadStringCompleted);
            wcTwitterTimeline.DownloadStringAsync(new System.Uri(&quot;http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=&quot; + userName));
        }
&lt;/pre&gt;&lt;br /&gt;
No evento &lt;b&gt;wcTwitterTimeline_DownloadStringCompleted&lt;/b&gt; nos atualizamos nosso listbox de acordo com com as informações retornadas da API do twiter, que retorna um XML com os posts do usuário que esta logado na nossa aplicação .&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;void wcTwitterTimeline_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
            { return; }
            XElement Tweets = XElement.Parse(e.Result);
            listboxMyTimeline.ItemsSource = from tweet in Tweets.Descendants(&quot;status&quot;)
                                            select new TwitterItem
                                            {
                                                UserName = tweet.Element(&quot;user&quot;).Element(&quot;screen_name&quot;).Value,
                                                Tweet = tweet.Element(&quot;text&quot;).Value,
                                                ImageSource = tweet.Element(&quot;user&quot;).Element(&quot;profile_image_url&quot;).Value
                                            };
            Dispatcher.BeginInvoke(() =&amp;gt;
            {
                listboxMyTimeline.Visibility = Visibility.Visible;
                txtBoxNewTweet.Visibility = Visibility.Visible;
                btnPostTweet.Visibility = Visibility.Visible;
            });
        }
&lt;/pre&gt;&lt;br /&gt;
No menu da aplicação podemos invocar o vento &lt;b&gt;MenuItemSignOut_Click&lt;/b&gt; que limpara os dados do usuário logado e efetuar o redirecionamento para a tela principal da aplicação.&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;private void MenuItemSignOut_Click(object sender, EventArgs e)
        {
            HelperMethods.SetKeyValue&amp;lt;string&amp;gt;(&quot;AccessToken&quot;, string.Empty);
            HelperMethods.SetKeyValue&amp;lt;string&amp;gt;(&quot;AccessTokenSecret&quot;, string.Empty);
           
            NavigationService.Navigate(new Uri(&quot;/MainPage.xaml&quot;, UriKind.Relative));
        }
&lt;/pre&gt;&lt;br /&gt;
Se precisar entender melhor esta aplicação o download da mesma pode ser feito &lt;a href=&quot;http://cid-8acc7e260beff10a.office.live.com/self.aspx/.Public/WP7%20integracao%20nas%20redes%20sociais/WindowsPhoneApplication1.rar&quot; style=&quot;cursor:pointer;&quot;&gt;aqui &lt;/a&gt;lembrando que estou deixando esta aplicação preparada para para integração de outras redes sociais.</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/4127577773961395099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/4127577773961395099' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4127577773961395099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4127577773961395099'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2010/12/posts-e-consultas-no-twitter-pelo_20.html' title='Posts e consultas no twitter pelo windows phone 7 part 2 de 2'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7nOL1S_Kvr29OM_ioYCbwsv_cBNqnSLDEpI2nTRJagvRhOFOCYIZ5MP3y9kguhMmC2afw7nSRJ0SKFfUT75HNLzfBo6hMDI8QQgmUXfr9cjX8UaVO-9Yervs75xymQ2vyyzeN/s72-c/DevTwitterRegister.jpg" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-5130373188124588806</id><published>2010-12-13T08:19:00.000-08:00</published><updated>2010-12-13T08:24:56.855-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="consulta"/><category scheme="http://www.blogger.com/atom/ns#" term="integração"/><category scheme="http://www.blogger.com/atom/ns#" term="post"/><category scheme="http://www.blogger.com/atom/ns#" term="rede social"/><category scheme="http://www.blogger.com/atom/ns#" term="twitter"/><category scheme="http://www.blogger.com/atom/ns#" term="windows phone 7"/><category scheme="http://www.blogger.com/atom/ns#" term="wp7"/><title type='text'>Posts e consultas no twitter pelo windows phone 7 part 1 de 2</title><content type='html'>Vamos criar uma aplicação no wp7 (windows phone 7) que &amp;nbsp;busque post de outros usuários pelo nome e envie post para o twitter. Para se familiarizar melhor com a tecnologia entre na pagina da msnd &lt;a href=&quot;http://msdn.microsoft.com/pt-br/ff380145.aspx&quot;&gt;desenvolvendo para celular&lt;/a&gt;&amp;nbsp;e veja os artigos e tutoriais.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Adquirindo as Ferramentas&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
Primeiro vamos baixar o template do wp7 para o Visual&amp;nbsp;Studio&amp;nbsp;&lt;a href=&quot;http://msdn.microsoft.com/pt-br/ff380145.aspx&quot;&gt;aqui&lt;/a&gt;, e execute a instalação do&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;b&gt;vm_web.exe.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif;&quot;&gt;Agora as dlls &lt;a href=&quot;http://1u41ja.blu.livefilestore.com/y1pecOlVoTdoqbEnSsT8wtlnhHRVhqhO-fbwb3OtarpGZ3Z9bXODjAnGEGXXqsK298sRxxNla9s7kmx8VTXg_98bOaeO90VOJ6f/Hommock_ICSharpCode.zip?download&amp;amp;psid=1&quot;&gt;Hammock.WindowsPhone e ICSharpCode.SharpZipLib.WindowsPhone&lt;/a&gt;&amp;nbsp;&amp;nbsp;necessárias&amp;nbsp;para trabalhar com a api do twitter.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;b&gt;Criando a aplicação&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif;&quot;&gt;Agora nos temos os&amp;nbsp;Templates&amp;nbsp;para criar as aplicações no V.S. e o emulador do Windows Phone instalados.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif;&quot;&gt;Crie um novo projeto no V.S. e selecione o template Windows Phone Application.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxC6HSXoNx-yBiQAQteIcJ_WnsTciZs4m1yRHdHD1UZXoB2YJwiXUK_ljdS15N13ViM9QLxfoA0OLLmvkt4_jiXY3ZMEdhb9Tg5DQUfiM3Xp0cFHHvay2kMdHutLccRss3d0QF/s800/NovoProjetoWP7.jpg&quot; style=&quot;cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;203&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxC6HSXoNx-yBiQAQteIcJ_WnsTciZs4m1yRHdHD1UZXoB2YJwiXUK_ljdS15N13ViM9QLxfoA0OLLmvkt4_jiXY3ZMEdhb9Tg5DQUfiM3Xp0cFHHvay2kMdHutLccRss3d0QF/s320/NovoProjetoWP7.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Na &amp;nbsp;primeira tela vamos criar algo parecido com um menu, para&amp;nbsp;adicionarmos outras funcionalidades no futuro, deixando a tela assim.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnVZicQmcfAOWS2GnuSOzYPXtZAIEE3N0xqd2a6FtPEMtO6ck-WbQA26fGVpKlllHqmNZNQmfo1t7sDDy8zXk4XoLJgQ2BUBNA04bQDqNH2LkXZiw_bxPbHlJPbFTY6p2nbc5I/s1600/Tela1WP7.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnVZicQmcfAOWS2GnuSOzYPXtZAIEE3N0xqd2a6FtPEMtO6ck-WbQA26fGVpKlllHqmNZNQmfo1t7sDDy8zXk4XoLJgQ2BUBNA04bQDqNH2LkXZiw_bxPbHlJPbFTY6p2nbc5I/s320/Tela1WP7.jpg&quot; width=&quot;175&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Nossa MainPage.axml fica assim:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/lh/photo/NLqU2a4KXSuTr6jyDM806JAWWY8h2UP7Wu41rWHHa34?feat=directlink&quot; style=&quot;cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivbKqkFOUHEi-7ls54T6gjFTGgsAUhkmiVCdu8eIsmWc-waUwwV_MwudF2sZ9mca4Opk4OojoCmmnAuERD5mQs-TYJKAt3epwjGN6t0nGrPaL_xQyiUk9DA4V014tR0NOqP_xq/s320/AxmlMailPageWP7.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;agora vamos criar uma tela de consulta onde podemos informar o nome do usuário no twitter e visualizar todos os seus respectivos posts.&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;De acordo com a documentação da api do twitter para buscar os posts nos utilizamos na URL a&amp;nbsp;variável&amp;nbsp;&lt;b&gt;screen_name&lt;/b&gt;. Na nossa aplicação precisamos utilizar a classe&amp;nbsp;&lt;b&gt;WebClient &lt;/b&gt;e&amp;nbsp;capturar&amp;nbsp;o retorno do twitter&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd9Tgm5sQcLK2lcUE__L6iEmDZfL2HydGV5SecXMJnn9J-6d81Leq8GP1bF51uCnNWl7noGejXMUaKDJW1hYC0DPO871ktypA0phBQLgAyVks1svl6Y2zpLWN-qgEvMFRnPz6o/s320/Tela2WP7.jpg&quot; width=&quot;175&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;A baixo do campo de texto e do botão vamos adicionar um ListBox com as seguintes&amp;nbsp;características:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/lh/photo/wpXy2kKeuHzKoFhfQ81Tm5AWWY8h2UP7Wu41rWHHa34?feat=directlink&quot; style=&quot;cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;94&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTXYpZaRnb0aQXeglYN4JXtEoqJw15zCdIGkGOVkyKmU4tXnfgjlDFn7TloVAySPdZpzb8dSeGtDd7qZUQpqvnGXl7zTiqrVMEV1micnfCZusFjvr-PfTesQ1tWLO-bMJ5LqxW/s320/ListBoxWP7.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Agora vamos montar nossa classe modelo para armazenar os valores retornado do twitter:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfgMamuPEOEDFqR0EesRnoFQaLsOeRIx2-71oj72CdBiWxHOdHiv5tWRKoSdjR5E-dMVe7V59EXEaTLZFPSbxy0KcKJj7x8RsqyICddgQkbYyuB9QpMD4qeWhOxuQlm62Xhv7j/s1600/ModeloTwitterWP7.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfgMamuPEOEDFqR0EesRnoFQaLsOeRIx2-71oj72CdBiWxHOdHiv5tWRKoSdjR5E-dMVe7V59EXEaTLZFPSbxy0KcKJj7x8RsqyICddgQkbYyuB9QpMD4qeWhOxuQlm62Xhv7j/s320/ModeloTwitterWP7.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;No evento click do botão buscar precisamos criar um objeto do tipo webclient e registrarmos o evento&amp;nbsp;&lt;b&gt;DownloadStringCompleted &lt;/b&gt;neste objeto, logo depois passamos a url da APIdo twiter juntamente com o valor informado no campo de texto para o&amp;nbsp;método&amp;nbsp;&lt;b&gt;DownloadStringAsync, &lt;/b&gt;&amp;nbsp;no evento&amp;nbsp;&lt;b&gt;DownloadStringCompleted &lt;/b&gt;&amp;nbsp;vamos ferificar o retorno da url e salvar os dados em um objeto do tipo&amp;nbsp;&lt;b&gt;XElement&amp;nbsp;&lt;/b&gt;através&amp;nbsp;deste vamos popular nosso ListBox desta forma.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/lh/photo/IKoErSoGpkBKnFtJiQvFXJAWWY8h2UP7Wu41rWHHa34?feat=directlink&quot; style=&quot;cursor: pointer;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;158&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCdutpLyvB5tLxWHVyLJP7Px0PSPV-d2PyulOjzWQnZKMRiSWYoufnKddbD6ryHRMnOILW_JnyQheweizQRJ78GikGMxCpk8fEOqAce5bGvtunEGeC70nxlibIt_C5gHqCtrwT/s400/EventoPopulaListBoxWP7.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;a primeira parte de nossa&amp;nbsp;aplicação&amp;nbsp;esta completa:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;ao debugar nos teremos um resultado&amp;nbsp;semelhante&amp;nbsp;a este:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZoMglJLwQ5pnT5WDG7mrrVsp_tzzHsprfUd8HJCe6yn2JRi9hzzblR2Ul-GtZOZhw30vFHn-53NGvWHRtxU-WKPD-SsB6QulN-PBPVvEMZUzQujuf6lNwuPNUv767h47yqlJk/s1600/ResultPostUserWP7.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZoMglJLwQ5pnT5WDG7mrrVsp_tzzHsprfUd8HJCe6yn2JRi9hzzblR2Ul-GtZOZhw30vFHn-53NGvWHRtxU-WKPD-SsB6QulN-PBPVvEMZUzQujuf6lNwuPNUv767h47yqlJk/s320/ResultPostUserWP7.jpg&quot; width=&quot;174&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/5130373188124588806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/5130373188124588806' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/5130373188124588806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/5130373188124588806'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2010/12/posts-e-consultas-no-twitter-pelo.html' title='Posts e consultas no twitter pelo windows phone 7 part 1 de 2'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxC6HSXoNx-yBiQAQteIcJ_WnsTciZs4m1yRHdHD1UZXoB2YJwiXUK_ljdS15N13ViM9QLxfoA0OLLmvkt4_jiXY3ZMEdhb9Tg5DQUfiM3Xp0cFHHvay2kMdHutLccRss3d0QF/s72-c/NovoProjetoWP7.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-8901079760761158221</id><published>2010-11-16T08:06:00.000-08:00</published><updated>2010-11-17T02:45:51.172-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="DLL"/><category scheme="http://www.blogger.com/atom/ns#" term="geolitecity"/><category scheme="http://www.blogger.com/atom/ns#" term="geolitedity.dat"/><category scheme="http://www.blogger.com/atom/ns#" term="gmaps"/><category scheme="http://www.blogger.com/atom/ns#" term="gmaps.dll"/><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="maps"/><category scheme="http://www.blogger.com/atom/ns#" term="maxmind"/><category scheme="http://www.blogger.com/atom/ns#" term="subgurim"/><title type='text'>Localização do usuario por IP com API do google maps</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Bem hoje vou mostrar como localizar o estado e a cidade do usuário pelo IP utilizando a api do google maps.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Vamos supor que você tenha que redirecionar o usuário uma determinada URL caso o mesmo esteja acessando de determinado estado ou apenas exibir onde ele está.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 16px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Graças a &lt;a href=&quot;http://www.maxmind.com/&quot;&gt;MaxMind&lt;/a&gt; temos a geolocalização por número de IP: a partir de um número IP, teremos dados sobre a localização, como latitude, longitude e outros.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;Mãos a obra:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Faça o download da base de dados da MaxMind.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.maxmind.com/app/geolitecity&quot;&gt;MaxMind DataBase(pelo site)&lt;/a&gt;&amp;nbsp;ou &lt;a href=&quot;http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz&quot;&gt;GeoLiteCity.dat&amp;nbsp;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Este arquivo é atualizado quase que mensalmente, assim você pode entrar la no site e atualizar sua base.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Agora faça o&amp;nbsp;download do &lt;a href=&quot;http://en.googlemaps.subgurim.net/descargar.aspx&quot;&gt;GMaps.dll&lt;/a&gt;. Esta DLL possui um conjunto de&amp;nbsp;componentes&amp;nbsp;que a google disponibilizou para utilizarmos os mapas de diversas formas.&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Crie um novo webSite e copie o arquivo&amp;nbsp;&lt;a href=&quot;http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz&quot;&gt;GeoLiteCity.dat&amp;nbsp;&lt;/a&gt;&amp;nbsp;para dentro da pasta App_data de&amp;nbsp;preferência, depois coloque o arquivo&amp;nbsp;&lt;a href=&quot;http://en.googlemaps.subgurim.net/descargar.aspx&quot;&gt;GMaps.dll&lt;/a&gt;&amp;nbsp;dentro da pasta bin, fazendo a referência.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;crie uma nova aba com o nome que preferir no Toolbox do visual&amp;nbsp;Studio&amp;nbsp;para&amp;nbsp;adicionar&amp;nbsp;os componentes do Gmaps, clique com o botão direito, &amp;nbsp;&quot;Choose items...&quot;, na aba &quot;.NET Framwork Componentes&quot; &amp;nbsp;clique no botão &quot;Browser&quot; e selecione o arquivo &amp;nbsp;&lt;a href=&quot;http://en.googlemaps.subgurim.net/descargar.aspx&quot;&gt;GMaps.dll&lt;/a&gt;&amp;nbsp;que você colocou na pasta bin do seu projeto. Os componentes serão carregados.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Clique no componente&amp;nbsp;GMap e arraste para para onde deseja que apareça o mapa.&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;div&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtxBYhtrQXZ535HROtqVZo8Ijp5XCZDWHvUjh6CtaEMlJYmYbrgbpwQZqJNDilOq7ZsnlcV7AjeNQebdcm1LKqrCK202t-isvb66C4rp6PE_IL4-FTZ4thnvXPwJz0j9fVFr2A/s1024/RerefenciaSubgurim.jpg&quot; style=&quot;cursor: pointer; margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;168&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtxBYhtrQXZ535HROtqVZo8Ijp5XCZDWHvUjh6CtaEMlJYmYbrgbpwQZqJNDilOq7ZsnlcV7AjeNQebdcm1LKqrCK202t-isvb66C4rp6PE_IL4-FTZ4thnvXPwJz0j9fVFr2A/s320/RerefenciaSubgurim.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Use a referência &quot;&lt;b&gt;using Subgurim.Controles;&quot; &lt;/b&gt;e escreva o código a baixo. Utilize este método dentro do PageLoad.&lt;div&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdfgMLZExRvRf6uoELUP08-gymf4at0YmzV-cgyBvkJWdzUbgbxvpmtY1k_u8utOKbRBY1Nrr1TYicKJ2E-8dUlwLhs-KIH1UD7260Oi2Lumv-6P4L7hURWBzjiew-vfzIIDex/&quot; style=&quot;cursor: pointer; margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;158&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdfgMLZExRvRf6uoELUP08-gymf4at0YmzV-cgyBvkJWdzUbgbxvpmtY1k_u8utOKbRBY1Nrr1TYicKJ2E-8dUlwLhs-KIH1UD7260Oi2Lumv-6P4L7hURWBzjiew-vfzIIDex/&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;li&gt;No webConfig você tem que&amp;nbsp;adicionar&amp;nbsp;a chave do subgurim para funcionar. Entre na&amp;nbsp;&lt;a href=&quot;http://code.google.com/intl/pt-BR/apis/maps/signup.html&quot;&gt;Família da Google Maps API&lt;/a&gt;, digite o&amp;nbsp;domínio&amp;nbsp;que você ira utilizar e clique no botão &quot;Gerar chave da API&quot;. Copie a chave e cole no web config.&lt;div&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU77HIUd9A6CnxFPCe_wSCv9yUp4IGVunZINw40q64FyeKiO4BMeM0UpIzfvux9kp5UROoHULzU7r61PRDiMuYurwP3QiNi8dxuYISouUW7MLTqtMuV-8aat7OMiacmT_p-DHq/&quot; style=&quot;cursor: pointer; margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;55&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU77HIUd9A6CnxFPCe_wSCv9yUp4IGVunZINw40q64FyeKiO4BMeM0UpIzfvux9kp5UROoHULzU7r61PRDiMuYurwP3QiNi8dxuYISouUW7MLTqtMuV-8aat7OMiacmT_p-DHq/&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;Se você estiver testando local não vai funcionar por que o &quot;Request.UserHostAddress&quot; vai retornar 127.0.0.1 para saber seu ip externo você pode entrar no &lt;a href=&quot;http://meuip.datahouse.com.br/&quot;&gt;MEU IP&lt;/a&gt;&amp;nbsp;e&amp;nbsp;substituir&amp;nbsp;a&amp;nbsp;&amp;nbsp;variavel&amp;nbsp;&lt;b&gt;User_ip &lt;/b&gt;pelo seu IP externo.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/8901079760761158221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/8901079760761158221' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/8901079760761158221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/8901079760761158221'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2010/11/localizacao-do-usuario-por-ip.html' title='Localização do usuario por IP com API do google maps'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtxBYhtrQXZ535HROtqVZo8Ijp5XCZDWHvUjh6CtaEMlJYmYbrgbpwQZqJNDilOq7ZsnlcV7AjeNQebdcm1LKqrCK202t-isvb66C4rp6PE_IL4-FTZ4thnvXPwJz0j9fVFr2A/s72-c/RerefenciaSubgurim.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-1831066477118851194</id><published>2010-11-08T04:00:00.000-08:00</published><updated>2010-11-08T10:51:47.214-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net"/><category scheme="http://www.blogger.com/atom/ns#" term="boas praticas"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="delegates"/><category scheme="http://www.blogger.com/atom/ns#" term="lambda"/><category scheme="http://www.blogger.com/atom/ns#" term="lambda expressions"/><category scheme="http://www.blogger.com/atom/ns#" term="metodos extenções"/><category scheme="http://www.blogger.com/atom/ns#" term="propriedades automaticas"/><title type='text'>C# 3.5 boas praticas</title><content type='html'>As propriedades automáticas permitem a criação de propriedades nas classes sem a necessidade de criarmos métodos de GET e SET, também não precisamos criar um CAMPO para armazenar o valor, reduzindo a quantidade de  código necessário para a criação de uma propriedade.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: auto;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj64qxWIZ4v_Q8QRlE4apa2XiE4hBQqcWF0Pvo6zV7P9hesuQtNdEB5Y6IFcewbYKIZCBemu83QQ-8LsDy76whi8r6oNoPHiZZto6tQ1-Qx1DJbcISfgasPSv15LHvlFlE8XK6e/&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj64qxWIZ4v_Q8QRlE4apa2XiE4hBQqcWF0Pvo6zV7P9hesuQtNdEB5Y6IFcewbYKIZCBemu83QQ-8LsDy76whi8r6oNoPHiZZto6tQ1-Qx1DJbcISfgasPSv15LHvlFlE8XK6e/s400/PropriedadesAutomaticas.jpg&quot; width=&quot;400&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537157709586641234&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: auto;&quot;&gt;Com os métodos de extensão nós podemos adicionar métodos a tipos já existentes, sem precisar modificar, criar um tipo derivado ou tipo original&lt;/div&gt;&lt;div style=&quot;text-align: auto;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUoPPtzhUhhyMlCqM2GmrxOaUu62n_usVd9hQm6rVqG-f6Ew5ziYl61XqtXC_g8R9SnVOCyfw-TjHuXBPfmS0LYeBg9Yq3yRUYHYEmeKwaAC6GvJBY3AG_KpheTp7TfvOlPY8N/&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUoPPtzhUhhyMlCqM2GmrxOaUu62n_usVd9hQm6rVqG-f6Ew5ziYl61XqtXC_g8R9SnVOCyfw-TjHuXBPfmS0LYeBg9Yq3yRUYHYEmeKwaAC6GvJBY3AG_KpheTp7TfvOlPY8N/s400/MetodosExtencoes.jpg&quot; width=&quot;400&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537160364362252210&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Com os Inicializadores de Objetos nosso trabalho fica mais fácil quando precisamos criar uma classe e já definir os valores das suas propriedades. Reduzindo a quantidade de código necessário para as definições dos valores.&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEind3loFMhccZF0SzC0iKxYW8n_t6Y4VhqQJOroUeDd8uVYiP7z_akNjrFCb3qKGxko8D_jOIlWxW5AUCXiHq7d4uAtCFSUjqtIkHAPEYCaGzs950yCc2ifuTEF7aBI7wQ8yP2d/&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEind3loFMhccZF0SzC0iKxYW8n_t6Y4VhqQJOroUeDd8uVYiP7z_akNjrFCb3qKGxko8D_jOIlWxW5AUCXiHq7d4uAtCFSUjqtIkHAPEYCaGzs950yCc2ifuTEF7aBI7wQ8yP2d/s400/InicializarObjeto.jpg&quot; width=&quot;400&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537164784113106146&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Agora no C# 3.0 temos a palavra-chave var, podemos criar uma variável onde o tipo é determinado implicitamente pela inicialização da mesma. o tipo é determinado em tempo de compilação.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6fCqQFAmBrq6b-rjJdGJgyR7y_S5GCLIhzfUtKyF940NttCAH2KHmeebpduFjVBfbx26U0_IiYUohvA3NIdNpl37MDB2-KQIh7hxvycR1SmKgqcwpirKtPRRe9IBf6ibfFmcA/&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6fCqQFAmBrq6b-rjJdGJgyR7y_S5GCLIhzfUtKyF940NttCAH2KHmeebpduFjVBfbx26U0_IiYUohvA3NIdNpl37MDB2-KQIh7hxvycR1SmKgqcwpirKtPRRe9IBf6ibfFmcA/s400/var.jpg&quot; width=&quot;400&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537167272748216898&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Uma expressão Lambda é uma função anônima que pode conter expressões e declarações, e pode ser usada para criar delegates.&lt;/div&gt;&lt;div&gt;As expressões Lambda usam o operador =&gt;. O lado esquerdo do operador  Lambda especifica os parâmetros de entrada e o lado direito especifica a expressão.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf_UKzka024Se61twsSZaHivSy8v0k-FYWxxPBaROw0q1vIizUMIuH_rrsPd6VA48XyIEN7c5F6zJ4BoTDPJJuCo0xkD48ixrY2mFIUjuvHql4RtDDNqKg0SrXiOoRF8gTfh3k/&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgf_UKzka024Se61twsSZaHivSy8v0k-FYWxxPBaROw0q1vIizUMIuH_rrsPd6VA48XyIEN7c5F6zJ4BoTDPJJuCo0xkD48ixrY2mFIUjuvHql4RtDDNqKg0SrXiOoRF8gTfh3k/s400/Lambda.jpg&quot; width=&quot;400&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537170535444927730&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;  &lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/1831066477118851194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/1831066477118851194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/1831066477118851194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/1831066477118851194'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2010/11/c-35-boas-praticas.html' title='C# 3.5 boas praticas'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj64qxWIZ4v_Q8QRlE4apa2XiE4hBQqcWF0Pvo6zV7P9hesuQtNdEB5Y6IFcewbYKIZCBemu83QQ-8LsDy76whi8r6oNoPHiZZto6tQ1-Qx1DJbcISfgasPSv15LHvlFlE8XK6e/s72-c/PropriedadesAutomaticas.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38059331.post-4416066817015398743</id><published>2010-10-21T12:18:00.000-07:00</published><updated>2010-11-04T09:13:38.284-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="caracteres"/><category scheme="http://www.blogger.com/atom/ns#" term="iguais"/><category scheme="http://www.blogger.com/atom/ns#" term="sequencia"/><category scheme="http://www.blogger.com/atom/ns#" term="string"/><title type='text'>Verificar sequencia de caracteres iguais em uma string c#</title><content type='html'>&lt;p&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;white-space: normal; font-family:arial;&quot;&gt;Neste post vamos ver como explorar uma string e verificar se existe uma seqüencia de caracteres iguais dentro da string. Utilizaremos a tabela ASCII para verificar letras e números, se você precisar verificar mais caracteres basta consultar a tabela e colocar o número referente na condição.&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;white-space: normal; &quot;&gt; &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;Neste exemplo vou verificar se existe na string uma seqüencia quatro(4) números iguais e o mesmo para uma seqüencia de três(3) letras, pois acho que em números de documentos ou nomes isto não pode acontecer.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt; &lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;&lt;b&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxI4mobnBk0Ci3mr2kUNgXwLtRgl1YPBU5TllIcXFYr55BYusEhQUoCDErmDGZSh0zy5wzVy9es5UWeydiEwizXmP-fl7JwMa_35aLygQ6iCMaxhehZ7tPSNBAIXaksAHgBsZk/&quot;&gt;Tabela de decimal ASCII&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;blockquote&gt;public static bool ValidaTexto(this string txt) {&lt;br /&gt;        &lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;bool flag = true;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;if (txt.Length &amp;lt; 3)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;flag = false;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;else&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;int contLetras = 0;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;int contNumeros = 0;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;int tmp = (int)txt.ToCharArray()[0];&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;foreach (char c in txt.ToCharArray())&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;if (((int)c &amp;lt; 127 &amp;amp;&amp;amp; (int)c &amp;gt;= 65))&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;if (tmp == (int)c)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;contLetras++;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;if (contLetras &amp;gt;= 3) { break; }&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;tmp = (int)c;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;//inicia novamente o armazenador&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;tmp = (int)txt.ToCharArray()[0];&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;foreach (char c in txt.ToCharArray())&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;if (((int)c &amp;lt; 57 &amp;amp;&amp;amp; (int)c &amp;gt;= 48))&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;if (tmp == (int)c)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;contNumeros++;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;if (contNumeros &amp;gt;= 4) { break; }&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;tmp = (int)c;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;if (contLetras &amp;gt;= 3 || contNumeros &amp;gt;= 4)&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;{&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;flag = false;&lt;br /&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;br /&gt;          }&lt;br /&gt;        &lt;br /&gt;          return flag;&lt;br /&gt;      }&lt;/blockquote&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://1u41ja.blu.livefilestore.com/y1pGP3grHBACF6OukWtX0lEWWshgm05-X5PmEfxysy3XMGmqktZuBpNReFw9bx4nJ0scYrwrn32meiE6ecomnxkTSACB4GRPute/ValidaTexto.txt?download&amp;amp;psid=1&quot;&gt;Baixar função&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;&lt;b&gt;Utilizando função:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;using  &quot;namespace onde esta o seu metodo(funcão)&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;if(txbCampo.Texte.ValidaTexto()){&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;...&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;white-space: normal; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:arial;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://oicram-projeto.blogspot.com/feeds/4416066817015398743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/38059331/4416066817015398743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4416066817015398743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38059331/posts/default/4416066817015398743'/><link rel='alternate' type='text/html' href='http://oicram-projeto.blogspot.com/2010/10/verificar-sequencia-de-caracteres.html' title='Verificar sequencia de caracteres iguais em uma string c#'/><author><name>Márcio Sena</name><uri>http://www.blogger.com/profile/12784849271445830730</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEha4Q83Ld2ynY9iVZ7Q1JxhNdjHlEhoTipMgXd6U4mbhWReaE3Euq46TESjCDJDqpkcLevjh32E-14E178zGz_F3XPURcsF3B7QD43QSqYwCN9-oCq7s6JoQUKyB_oaRjY/s220/744b9555-f7f3-4299-87e7-f98b66e42b58.jpg'/></author><thr:total>0</thr:total></entry></feed>