Async Await Chaining

Async Await Chaining

Creating synchronously chained functions is straight forward. Codepen.

const UserCollectionSync = {  
  find(id=''){
    document.writeln('1');
    return this;
  },
  update(){
    document.writeln('2');
    return this;
  },
  save(){
    document.writeln('3');
    return this;
  }
}
UserCollectionSync  
  .find()
  .update()
  .save();

But when we decide to just throw some async await flags on those functions everything doesn't work. FOLLOWING CODE IS WRONG: Codepen.

// delay is used to represent some asynchronous work
function delay(ms){  
  return new Promise(resolve => setTimeout(resolve, ms));
} //end delay()

const UserCollectionAsync = {  
  async find(id=''){
    await delay(1000)
    document.writeln('1');
    return this;
  },
  async update(){
    await delay(50);
    document.writeln('2');
    return

Read More

When A* Mobile Pathing Fails

When A* Mobile Pathing Fails

Recently implementing a super easy JS library for A* pathfinding called easystar, I discovered an interesting issue: All the mobiles would collide in certain locations or "hotspots" on the maps.

There are two main reasons I can see for this:
1. The map itself is most easily traversed through certain spots.
2. The map is ONLY traversable from one side to another through certain locations.

What's likely exacerbating the issue is I'm allowing a mobile to pick a random spot on the map (apparently they know all things,) and then A* pathfind to that location (yep, they're super smart like

Read More

Angular was dead on arrival

Angular was dead on arrival

I'm commonly asked why more people don't choose "angular2" which in my head I correct to "angular". (we're on angular 3 alread.. no, 4,... no.) Quite simply, the answer is Typescript. Whether we like it or not the majority of javascript developers in our field are new or mediocre developers who don't have the time or cognitive ease to attempt to learn another language.

It was a huge mistake for the team to release the library with the small amount of constantly outdated documentation entirely in Typescript. Most stackoverflow searches for angular aren't even relevant or accurate given the constantly

Read More

Coterie

Coterie

Aug 3, 2016 Update: Coterie is now playable on mobile or touch devices as well.

Play Coterie

Growing up I deeply enjoyed two specific cards games: Triple Triad in Final Fantasy VIII and Tetra Master in Final Fantasy IX. Having some extra time this past week I developed a simple card game variant called Coterie. What started as an excuse to get more familiar with flexbox in css ended up actually being fun to play!

This two player game starts with each player having a different colored set of 8 cards. Each card will have random points distributed around its

Read More