Code: Select all
class MyClass
{
async myMethodAsync()
{
; awesome job
}
}
MyClass.myMethodAsync()
; do other job without waiting MyClass.myMethodAsync() ...
Code: Select all
class MyClass
{
async myMethodAsync()
{
; awesome job
}
}
MyClass.myMethodAsync()
; do other job without waiting MyClass.myMethodAsync() ...
Code: Select all
any_method() ;
{
}
; ...
; ... some code
SetTimer Func("any_method"), -1 ; it calls async
; ...
Code: Select all
class Program
{
Main(args)
{
this.tt := "k"
req := ComObjCreate("Msxml2.XMLHTTP")
; Open a request with async enabled.
req.open("GET", "https://autohotkey.com/download/1.1/version.txt", true)
; Set our callback function [requires v1.1.17+].
; req.onreadystatechange := Func("_AHK.Program.Ready").Bind("", req)
req.onreadystatechange := this.Ready.Bind(this, req)
req.send()
; do other dirty job without waiting...
; ...
}
Ready(req)
{
if (req.readyState != 4) ; Not done yet.
print(req.readyState)
, return
if (req.status == 200) ; OK.
print(this)
, print("Latest AutoHotkey version: " req.responseText)
else
print("Status " req.status)
ExitApp
}
}
Users browsing this forum: No registered users and 36 guests