Use remote threads on supported platforms
This commit is contained in:
parent
d249fa29bb
commit
336ae08cd0
1 changed files with 3 additions and 0 deletions
|
@ -18,6 +18,9 @@ func fetch(url: String, cbObj: Object, cbFn: String):
|
||||||
cbObj.call(cbFn, HTTPRequest.RESULT_SUCCESS, 200, [], buf)
|
cbObj.call(cbFn, HTTPRequest.RESULT_SUCCESS, 200, [], buf)
|
||||||
return
|
return
|
||||||
var req := HTTPRequest.new()
|
var req := HTTPRequest.new()
|
||||||
|
# On HTML5 we cannot use threaded requests
|
||||||
|
# On other platforms (such as Android), we *need* to!
|
||||||
|
req.use_threads = !OS.has_feature("HTML5")
|
||||||
add_child(req)
|
add_child(req)
|
||||||
req.connect("request_completed", self, "_request_completed", [url, cbObj, cbFn])
|
req.connect("request_completed", self, "_request_completed", [url, cbObj, cbFn])
|
||||||
req.request(url)
|
req.request(url)
|
||||||
|
|
Loading…
Reference in a new issue