frostney / flockn

:video_game: Leightweight declarative game engine for JavaScript
The Unlicense
16 stars 0 forks source link

Proposal: Future API #14

Closed frostney closed 3 years ago

frostney commented 8 years ago

I'm thinking of changing the recommendation of using the API. I've seen that this can be confusing, while the context would still be passed through (for now) and the individual methods should be used.

Game(({addScene}) => {
  addScene(({addGameObject}) => {
    addGameObject(function() {
      /* ... */
    });
  });
});
frostney commented 3 years ago

Hi, this is frostney from the future. this can be quite confusing and should be avoided. Unfortunately if destructed, you might loose the context if keeping on a class-based mechanism. While it can be achieved with closures, it's quite hard to keep that maintainable and testable.