main.js 377 B

1234567891011121314151617181920
  1. // get the network subsystem
  2. var network = Atomic.getNetwork();
  3. // non blocking http request runs on it's own thread
  4. var request = network.makeHttpRequest("http://www.google.com");
  5. // listen in to engine update
  6. network.subscribeToEvent("Update", function () {
  7. if (request.state == Atomic.HTTP_CLOSED) {
  8. print(request.read());
  9. Atomic.getEngine().exit();
  10. }
  11. });