mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-09-15 08:09:24 +02:00
* Fix error in async handling
This commit is contained in:
parent
65d5d05d67
commit
0b325c5195
@ -75,6 +75,7 @@ Type
|
|||||||
procedure SetTemplate(const aName : String; const AValue: String);
|
procedure SetTemplate(const aName : String; const AValue: String);
|
||||||
procedure SetPreload(AValue: TPreLoadTemplateItemList);
|
procedure SetPreload(AValue: TPreLoadTemplateItemList);
|
||||||
Protected
|
Protected
|
||||||
|
procedure NotifyEvents(aName: string);
|
||||||
function CheckTemplateResource(const aName: string): string; virtual;
|
function CheckTemplateResource(const aName: string): string; virtual;
|
||||||
Procedure TemplateLoaded(const aName,aTemplate : String); virtual;
|
Procedure TemplateLoaded(const aName,aTemplate : String); virtual;
|
||||||
Procedure Loaded; override;
|
Procedure Loaded; override;
|
||||||
@ -138,7 +139,10 @@ Function GlobalTemplates : TCustomTemplateLoader;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
if _loader=Nil then
|
if _loader=Nil then
|
||||||
|
begin
|
||||||
_loader:=TCustomTemplateLoader.Create(Nil);
|
_loader:=TCustomTemplateLoader.Create(Nil);
|
||||||
|
_loader.Name:='GlobalTemplates';
|
||||||
|
end;
|
||||||
Result:=_Loader;
|
Result:=_Loader;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -288,13 +292,20 @@ end;
|
|||||||
|
|
||||||
procedure TCustomTemplateLoader.TemplateLoaded(const aName, aTemplate: String);
|
procedure TCustomTemplateLoader.TemplateLoaded(const aName, aTemplate: String);
|
||||||
|
|
||||||
Var
|
|
||||||
Idx : Integer;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
FTemplates[LowerCase(aName)]:=aTemplate;
|
FTemplates[LowerCase(aName)]:=aTemplate;
|
||||||
if Assigned(FOnLoad) then
|
if Assigned(FOnLoad) then
|
||||||
FOnLoad(Self,aName);
|
FOnLoad(Self,aName);
|
||||||
|
NotifyEvents(aName);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomTemplateLoader.NotifyEvents(aName : string);
|
||||||
|
|
||||||
|
Var
|
||||||
|
Idx : Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
Idx:=IndexOfTemplateEvent(aName);
|
Idx:=IndexOfTemplateEvent(aName);
|
||||||
While Idx<>-1 do
|
While Idx<>-1 do
|
||||||
begin
|
begin
|
||||||
@ -356,11 +367,14 @@ begin
|
|||||||
if Templates[aName]<>'' then
|
if Templates[aName]<>'' then
|
||||||
aEvent(Self,aName)
|
aEvent(Self,aName)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
N.Name:=aname;
|
N.Name:=aName;
|
||||||
N.Event:=aEvent;
|
N.Event:=aEvent;
|
||||||
FNotifications:=Concat(FNotifications,[N]);
|
FNotifications:=Concat(FNotifications,[N]);
|
||||||
end;
|
// Can happen
|
||||||
|
if Templates[aName]<>'' then
|
||||||
|
NotifyEvents(aName)
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomTemplateLoader.RemoveRemplate(const aName: String);
|
procedure TCustomTemplateLoader.RemoveRemplate(const aName: String);
|
||||||
|
Loading…
Reference in New Issue
Block a user