From 471d1ee1e473d0deabecc135353e0a7ca73c5e57 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 29 May 2022 11:02:01 +0200 Subject: [PATCH] wasi: job: clean up --- demo/wasienv/dom/job_web.pas | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/demo/wasienv/dom/job_web.pas b/demo/wasienv/dom/job_web.pas index 2afbed1..4945674 100644 --- a/demo/wasienv/dom/job_web.pas +++ b/demo/wasienv/dom/job_web.pas @@ -154,24 +154,23 @@ implementation function JOBCallTJSHTMLClickEventHandler(const aMethod: TMethod; Args: PByte ): PByte; var - p: TJOBCallbackHelper; + h: TJOBCallbackHelper; Event: IJSMouseEvent; begin - writeln('JOBCallTHTMLClickEventHandler '); - p.Init(Args); - Event:=p.GetObject(TJSMouseEvent) as IJSMouseEvent; - Result:=p.AllocBool(TJSHTMLClickEventHandler(aMethod)(Event)); + h.Init(Args); + Event:=h.GetObject(TJSMouseEvent) as IJSMouseEvent; + Result:=h.AllocBool(TJSHTMLClickEventHandler(aMethod)(Event)); end; function JOBCallTJSEventHandler(const aMethod: TMethod; Args: PByte ): PByte; var - p: TJOBCallbackHelper; + h: TJOBCallbackHelper; Event: IJSEventListenerEvent; begin - p.Init(Args); - Event:=p.GetObject(TJSEventListenerEvent) as IJSEventListenerEvent; - Result:=p.AllocBool(TJSEventHandler(aMethod)(Event)); + h.Init(Args); + Event:=h.GetObject(TJSEventListenerEvent) as IJSEventListenerEvent; + Result:=h.AllocBool(TJSEventHandler(aMethod)(Event)); end; { TJSEventTarget } @@ -179,13 +178,13 @@ end; procedure TJSEventTarget.addEventListener(const aName: UnicodeString; const aListener: TJSEventHandler); var - cb1: TJOB_JSValueMethod; + m: TJOB_JSValueMethod; begin - cb1:=TJOB_JSValueMethod.Create(TMethod(aListener),@JOBCallTJSEventHandler); + m:=TJOB_JSValueMethod.Create(TMethod(aListener),@JOBCallTJSEventHandler); try - InvokeJSNoResult('addEventListener',[aName,cb1]); + InvokeJSNoResult('addEventListener',[aName,m]); finally - cb1.Free; + m.Free; end; end;