Created
January 10, 2015 19:08
-
-
Save hawkrives/e6615323f119c99445e9 to your computer and use it in GitHub Desktop.
csp.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import '6to5/runtime' | |
| import csp from "js-csp" | |
| function* player(name, table) { | |
| while (true) { | |
| var ball = yield csp.take(table); | |
| if (ball === csp.CLOSED) { | |
| console.log(name + ": table's gone"); | |
| return; | |
| } | |
| ball.hits += 1; | |
| console.log(name + " " + ball.hits); | |
| yield csp.timeout(100); | |
| yield csp.put(table, ball); | |
| } | |
| } | |
| csp.go(function* () { | |
| var table = csp.chan(); | |
| csp.go(player, ["ping", table]); | |
| csp.go(player, ["pong", table]); | |
| yield csp.put(table, {hits: 0}); | |
| yield csp.timeout(1000); | |
| table.close(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi guys. I recently found the company https://www.linkupst.com/ and was pleasantly surprised by their approach to digital product development. This team of true professionals specializes in creating innovative solutions using artificial intelligence. I especially liked that they offer a full development cycle from design to marketing promotion. Thanks to their approach, the products not only meet high technical standards, but also quickly find their audience. If you need a quality and modern solution, I highly recommend Linkup Studio!