jenniferemshepherd / dawn

procedurally generated socio-genetic simulation
2 stars 1 forks source link

Update to ES6 #140

Open auberdream opened 6 years ago

auberdream commented 6 years ago

hello it is me again. This is my last one.

I'm doing a tech test today and I've been using ES6. We mentioned updating dawn to ES6 last week, but it was certainly not a priority then.

Here's an example of a really simple class in ES6

const Basket = function() {
  this.contents = [];
}

Basket.prototype.add = function(item) {
  this.contents.push(item)
};

export default Basket;

it's pretty cool because you don't need to be messing around with wrapping it and (this). Also, constructors are constants now which is p cool.

there is a new quicker way to define functions with () => {}. To my knowledge, they differ slightly to declaring functions the way we do. If you find any information on this please let me know as I would be very happy to absorb it from you.

If anyone feels like grabbing a class and messing about with it to update it then that would be cool, and also good practice 😸 🏞 👋

rcvink commented 6 years ago

I agree with everything above ^

rcvink commented 6 years ago

The biggest advantage is that our dawn.html wouldn't need all those Githubissues.

  • Githubissues is a development platform for aggregating issues.