HTML5 provides the mechanism called “WebWorkers”. This feature is very nice and you can learn more about it here: http://www.html5rocks.com/en/tutorials/workers/basics/. There is also a new feature called “MessageChannel” which is meant to be used for the communication among the different origins (http://somedomain and https://somedomain:8080). I think this article is useful to learn more about it: http://www.webgranth.com/html5-web-messaging-fresh-tutorial-for-cross-document-messaging.
This post is going to create two WebWorkers and let them communicate with each other through a MessageChannel. Moreover, the WebWorkers implement the Producer-consumer-problem. The
WebWorker #1 is the producer. It generates Fibonacci numbers and posts the result to the
WebWorker #2. The
WebWorker #2 receives the numbers and removes some of them. When it’s done with the work it posts the result back to the
WebWorker #1. The
WebWorker #1 fills some numbers again and posts them back to the
WebWorker #2 and so on…
See it in action here: http://producer-consumer-webworker.herokuapp.com/index.html
Fork it on GitHub: https://github.com/jepetko/webworker
When it comes to writing comprehensive tests we always need a sort of “data provider” necessary to execute the tests several times with a different input. The test methods (like
it) should be written, of course, just once.
This post describes a workaround to get the triple jQuery + JsTestDriver + Jasmine working inside JetBrains WebStorm to be able to perform tests from the IDE.
This is the former implementation of palindrom (I know it’s not typical): Palindrom detection by building clusters.
In this article I propose a much simpler solution which builds two string and compares them by
There are 3 approaches:
- functional inheritance: is about mixing objects into other objects
- classical inheritance: IMHO, this approach doesn’t exist. It can be simulated but it’s not real.