darkf / darkfo

DarkFO, a post-nuclear RPG remake (of Fallout 2)
Apache License 2.0
136 stars 12 forks source link

Work towards using ES6 #24

Open darkf opened 8 years ago

darkf commented 8 years ago

ES6 is becoming more and more supported, and it offers some very nice features (const, let, destructuring, Map, Set, etc.)

TypeScript transpiles a lot of these, but the codebase doesn't use much of them (in particular I recall wrapping some blocks in lambdas to mimic let.)

const should be defaulted to when making bindings we won't change, and let otherwise.

We may also use for(let x of xs) ... for loops over arrays, and Object.assign for cloning/mass-assigning objects.

darkf commented 7 years ago

Arrow functions are some of the most useful for this. I ported worldmap.ts to ES6. The other files still remain.

darkf commented 6 years ago

Like I said in #101:

A lot of the callback hell spaghetti can be replaced with promises (which as a huge benefit makes our asynchronous code composable, and will replace monsters like the image loading stuff -- we can use Promise.all instead).

darkf commented 6 years ago

We might also want to target ES6 natively (since it's supported by a large majority of modern browsers) in TypeScript ("target": "ES6"} and use ES6 libs.)