generated from treeform/nimtemplate
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from guzba/master
win32 http request
- Loading branch information
Showing
7 changed files
with
995 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import windy | ||
|
||
# HTTP requests do not block. | ||
|
||
# All callbacks are called on the main thread. | ||
|
||
# You can have many requests in-flight at the same time. | ||
|
||
# Calling startHttpRequest never fails. If there is any error, onError will | ||
# be called during the next pollEvents (or later). | ||
|
||
let req = startHttpRequest("https://www.google.com") | ||
|
||
req.onError = proc(msg: string) = | ||
echo "onError: " & msg | ||
|
||
req.onResponse = proc(response: HttpResponse) = | ||
echo "onResponse: code=", $response.code, ", len=", response.body.len | ||
|
||
# Closing the window exits the demo | ||
let window = newWindow("Windy Basic", ivec2(1280, 800)) | ||
while not window.closeRequested: | ||
pollEvents() |
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
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
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
Oops, something went wrong.