Last active
August 29, 2015 14:22
-
-
Save JoshEngebretson/d347b4a82ecc515ad3cc to your computer and use it in GitHub Desktop.
Web Request
This file contains 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
// 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