Skip to content

Instantly share code, notes, and snippets.

@JoshEngebretson
Last active August 29, 2015 14:22
Show Gist options
  • Save JoshEngebretson/d347b4a82ecc515ad3cc to your computer and use it in GitHub Desktop.
Save JoshEngebretson/d347b4a82ecc515ad3cc to your computer and use it in GitHub Desktop.
Web Request
// get the network subsystem
var network = Atomic.getNetwork();
// non blocking http request runs on it's own thread
var request = network.makeHttpRequest("http://www.google.com");
// listen in to engine update
network.subscribeToEvent("Update", function () {
if (request.state == Atomic.HTTP_CLOSED) {
print(request.read());
Atomic.getEngine().exit();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment