ES6 in Knockout

https://lorefnon.me/2015/08/24/smarter-knockout-applications-with-es-next.html

Advertisements
ES6 in Knockout

Pattern advancements in JS

I’m currently working on a different type of JS app: a game. It’s a very simple game: the sliding tiles puzzle. I was playing with the idea of making one for fun since seeing it every day on my daughters new favorite TV show, and when I saw an article about implementing the game in JS (https://www.smashingmagazine.com/2016/02/javascript-ai-html-sliding-tiles-puzzle/), I started on tinkering with it. The article also explains how to write an AI to solve these puzzles, which tickled my fancy even more.

However, once I got into the code of the article, I noticed it wasn’t very cleanly separated. For example, jQuery calls to animate tiles were performed in the same function as checking for the validity of a move. So, I thought about writing my own game engine before tackling the AI part. After all, it would be nice to swap out different input devices (Adafruit Trello, Wii Nunchuck, computer vision-instructued robots (what?)) and have a separated output, so that a game could be played with a arbitrary photo.

After I started separating the code, I ended up with a browser app which separated presentation (using jQuery) and logic (using a knockout viewmodel). Not quite sufficient: handling input from hardware devices would remain difficult. Off to node! This would allow me to make games persistent, handle multiple games, etc. However, this could make the simple functionality slow, so caching is needed. In the end, I try to learn about:

  • factories
  • commands
  • singleton
Pattern advancements in JS

Cordova

Apache Cordova laat toe om native mobile apps te schrijven in HTML + JS. Sounds like my cup of tea…

http://cordova.apache.org

Adafruit gebruikt dit in bluetooth tutorials:

Vooral die laatste lijkt zeer interessant: een sensor wordt ingelezen op een pro trinket, die dan via een SPI bluetooth module de data naar de iPhone stuurt. Interessant voor bvb de Canon trigger?

Cordova