|
@@ -154,24 +154,23 @@ implementation
|
|
function JOBCallTJSHTMLClickEventHandler(const aMethod: TMethod; Args: PByte
|
|
function JOBCallTJSHTMLClickEventHandler(const aMethod: TMethod; Args: PByte
|
|
): PByte;
|
|
): PByte;
|
|
var
|
|
var
|
|
- p: TJOBCallbackHelper;
|
|
|
|
|
|
+ h: TJOBCallbackHelper;
|
|
Event: IJSMouseEvent;
|
|
Event: IJSMouseEvent;
|
|
begin
|
|
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;
|
|
end;
|
|
|
|
|
|
function JOBCallTJSEventHandler(const aMethod: TMethod; Args: PByte
|
|
function JOBCallTJSEventHandler(const aMethod: TMethod; Args: PByte
|
|
): PByte;
|
|
): PByte;
|
|
var
|
|
var
|
|
- p: TJOBCallbackHelper;
|
|
|
|
|
|
+ h: TJOBCallbackHelper;
|
|
Event: IJSEventListenerEvent;
|
|
Event: IJSEventListenerEvent;
|
|
begin
|
|
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;
|
|
end;
|
|
|
|
|
|
{ TJSEventTarget }
|
|
{ TJSEventTarget }
|
|
@@ -179,13 +178,13 @@ end;
|
|
procedure TJSEventTarget.addEventListener(const aName: UnicodeString;
|
|
procedure TJSEventTarget.addEventListener(const aName: UnicodeString;
|
|
const aListener: TJSEventHandler);
|
|
const aListener: TJSEventHandler);
|
|
var
|
|
var
|
|
- cb1: TJOB_JSValueMethod;
|
|
|
|
|
|
+ m: TJOB_JSValueMethod;
|
|
begin
|
|
begin
|
|
- cb1:=TJOB_JSValueMethod.Create(TMethod(aListener),@JOBCallTJSEventHandler);
|
|
|
|
|
|
+ m:=TJOB_JSValueMethod.Create(TMethod(aListener),@JOBCallTJSEventHandler);
|
|
try
|
|
try
|
|
- InvokeJSNoResult('addEventListener',[aName,cb1]);
|
|
|
|
|
|
+ InvokeJSNoResult('addEventListener',[aName,m]);
|
|
finally
|
|
finally
|
|
- cb1.Free;
|
|
|
|
|
|
+ m.Free;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|