Falaí. Tem uma coisa que eu curto muito que é Javascript. Gosto mesmo! Fiquei um tempão sem programar nele, infelizmente, mas agora to voltando com tudo e em boa época: tá pra sair uma nova especificação da linguagem e dessa vez com muita mudança. Mano, to pra te dizer que vai ser demais. Por isso que estou estudando e escrevendo sobre. Nesse artigo vamos ver como você pode fazer para começar a usar hoje o ES6 nos seus projetos com a ajuda do Babel.
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class HelloWorld | |
| def say | |
| yield ("World") if block_given? | |
| end | |
| end | |
| man = HelloWorld.new | |
| man.say do |who| | |
| p "Hello #{who}" | |
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | public class Entidade { | |
| private long mId; | |
| private String mNome; | |
| public long getId() { | |
| return mId; | |
| } | |
| public String getNome() { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function just_a_test() { | |
| console.log(this); | |
| this[arguments[0]] = arguments[1]; | |
| } | |
| just_a_test('a', true); | |
| console.log(window.a); | |
| var obj = {'well': true, 'that_is': [1, 2, 3]} | |
| just_a_test.call(obj, 'that_is', 'hu3'); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // O gulp é um script Node, a grosso modo, então tu acesso aos módulos node do NPM | |
| var gulp = require('gulp') | |
| , browserify = require('browserify') | |
| , babelify = require('babelify') | |
| , source = require('vinyl-source-stream') | |
| , stylus = require('gulp-stylus') | |
| , concat = require('gulp-concat') | |
| , webserver = require('gulp-webserver') | |
| , opn = require('opn') | |
| ; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | @keyframes fadeIn { | |
| from { | |
| opacity: 0; | |
| } | |
| to { | |
| opacity: 1; | |
| } | |
| } | |
| .class { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | var React = require('react'); | |
| var Parse = require('parse').Parse; | |
| var ParseReact = require('parse-react'); | |
| // Inicia o Parse com as credenciais da tua app | |
| Parse.initialize('foo', 'bar'); | |
| var App = React.createClass({ | |
| mixins: [ParseReact.Mixin], | 
- /app- Onde ficará o seu código. Trabalhe aqui dentro.- css- Onde ficará o seu código SASS. Organize a sua maneira respeitando o- main.scsscomo o principal;
- js- Onde ficará o seu código JS e React. Respeite o arquivo- app.jsxcomo o principal;
- index.html- a base do seu HTML. Seguir o snippet do gist;
 
- /dist- É auto gerado pelo- Gulp. Não se preocupe em alterar aqui. Não deve ser versionado.
- package.json- no gist tem as dependências base que precisa.
- gulpfile.js- arquivo para automatizar os processamentos e auxiliar o desenvolvimento.
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'babel-core/register'; | |
| import 'babel-polyfill'; | |
| function getRandom(from, to, callback) { | |
| setTimeout(() => { | |
| const value = Math.floor((Math.random() * (to - from + 1)) + from); | |
| callback(value); | |
| }, 500); | |
| } | 
OlderNewer