ASync ===== High level functions that run a task such as an HTTP request which run in the background on another thread. ``` procedure ThisIsCalledWhenFinished(constref Result: TASyncHTTPResult); begin WriteLn(Result.Response); WriteLn(Result.Data); end; begin ASync.HTTPGet('httpbin.org/get', @ThisIsCalledWhenFinished); Sleep(5000); // give some time to complete end; ``` ----- ASync.HTTPGet ------------- ``` procedure ASync.HTTPGet(URL: String; OnFinish: TASyncHTTPFinishEvent; OnProgress: TASyncHTTPProgressEvent = nil); static; procedure ASync.HTTPGet(URL: String; RequestHeaders: TStringArray; OnFinish: TASyncHTTPFinishEvent; OnProgress: TASyncHTTPProgressEvent = nil); static; ``` ----- ASync.HTTPGetFile ----------------- ``` procedure ASync.HTTPGetFile(URL: String; DestFile: String; OnFinish: TASyncHTTPFinishEvent; OnProgress: TASyncHTTPProgressEvent = nil); static; procedure ASync.HTTPGetFile(URL: String; RequestHeaders: TStringArray; DestFile: String; OnFinish: TASyncHTTPFinishEvent; OnProgress: TASyncHTTPProgressEvent = nil); static; ``` ----- ASync.HTTPPost -------------- ``` procedure ASync.HTTPPost(URL, Data: String; OnFinish: TASyncHTTPFinishEvent); static; procedure ASync.HTTPPost(URL: String; RequestHeaders: TStringArray; Data: String; RequestHeaders: TStringArray; OnFinish: TASyncHTTPFinishEvent); static; ``` ----- TASyncMouse.Construct --------------------- ``` function TASyncMouse.Construct(Target: TTarget): TASyncMouse; static; ``` Construct a ASyncMouse for a target. The `new` keyword is used like so: ``` m := new TASyncMouse(Target); ``` ----- TASyncMouse.Move ---------------- ``` procedure TASyncMouse.Move(Dest: TPoint; Accuracy: Single = 1); ``` ----- TASyncMouse.MouseChangeDest --------------------------- ``` property TASyncMouse.Destination(Value: TPoint); property TASyncMouse.Destination: TPoint; ``` ----- TASyncMouse.IsMoving -------------------- ``` property TASyncMouse.IsMoving: Boolean; ``` ----- TASyncMouse.Wait ---------------- ``` function TASyncMouse.Wait(Timeout: Integer = -1): Boolean ``` ----- TASyncMouse.Stop ---------------- ``` procedure TASyncMouse.Stop; ``` ----- ASync.FileUnzip --------------- ``` procedure ASync.FileUnzip(ZipFile, DestPath: String; OnFinish: TASyncUnzipFinishEvent; OnProgress: TASyncUnzipProgressEvent = nil); static; ``` ----- ASync.Schedules --------------- ``` function ASync.Schedules: TStringArray; static; ``` Returns all running schedules. ----- ASync.ScheduleEvery ------------------- ``` function ASync.ScheduleEvery(Name: String; Method: procedure of object; Interval: Integer); static; ``` Schedule a method to be called every `interval` (in milliseconds). ----- ASync.ScheduleEvery ------------------- ``` function ASync.ScheduleEvery(Name: String; Method: procedure(Params: TPointerArray) of object; Params: TPointerArray; Interval: Integer); static; ``` ScheduleEvery with passing parameters to the method (as TPointerArray). ----- ASync.ScheduleStop ------------------ ``` procedure ASync.ScheduleStop(Name: String); static; ``` Stop a scheduled method.