惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
H
Help Net Security
Last Week in AI
Last Week in AI
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
Google DeepMind News
Google DeepMind News
B
Blog
C
Check Point Blog
T
Tailwind CSS Blog
云风的 BLOG
云风的 BLOG
D
Docker
Recent Announcements
Recent Announcements
Vercel News
Vercel News
博客园 - 聂微东
阮一峰的网络日志
阮一峰的网络日志
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
Stack Overflow Blog
Stack Overflow Blog
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
月光博客
月光博客
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
The Register - Security
The Register - Security
V
Visual Studio Blog
F
Full Disclosure
Hugging Face - Blog
Hugging Face - Blog
T
Threat Research - Cisco Blogs
Latest news
Latest news
PCI Perspectives
PCI Perspectives
Cisco Talos Blog
Cisco Talos Blog
博客园 - Franky
D
DataBreaches.Net
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
P
Palo Alto Networks Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
T
Tenable Blog
L
LINUX DO - 热门话题
Spread Privacy
Spread Privacy

博客园 - 万一

关于内存数据与 JSON 高亮 TRichEdit 当前行 使用 IntraWeb (45) - 活用 IntraWeb 使用 IntraWeb (44) - 测试读取 SqLite (三) 使用 IntraWeb (43) - 测试读取 SqLite (二) 使用 IntraWeb (42) - 测试读取 SqLite (一) 使用 IntraWeb (41) - 数据控件速查 使用 IntraWeb (40) - 自定义 Session 数据 使用 IntraWeb (39) - THttpRequest、THttpReply 使用 IntraWeb (38) - TIWAppForm、TIWForm、TIWBaseHTMLForm、TIWBaseForm 使用 IntraWeb (37) - TIWApplication 使用 IntraWeb (36) - TIWServerControllerBase 使用 IntraWeb (35) - TIWJQueryWidget 使用 IntraWeb (33) - Cookie 使用 IntraWeb (32) - Url 映射与 THandlers 使用 IntraWeb (31) - IntraWeb 的 Xml 操作使用的是 NativeXml 使用 IntraWeb (30) - TIWAppInfo、TIWMimeTypes、TIWAppCache 使用 IntraWeb (29) - 基本控件之 TIWAutherList、TIWAutherINI、TIWAutherEvent 使用 IntraWeb (28) - 基本控件之 TIWTemplateProcessorHTML、TIWLayoutMgrHTML、TIWLayoutMgrForm
使用 IntraWeb (34) - TIWAJAXNotifier
万一 · 2014-06-24 · via 博客园 - 万一

在异步事件中, 可以通过 TIWAJAXNotifier 发出一个通知(通过其 Notify 方法), 该通知会激发其 OnNotify 事件.

这一般用在: 当一个异步事件完成后, 立即处理随后的事情.


TIWAJAXNotifier 所在单元及继承链:
IWCompExtCtrls.TIWAJAXNotifier < TIWBaseHTML40Component < TIWBaseHTMLComponent < TIWBaseComponent < TComponent < TPersistent < TObject

主要成员:


property SendNotification: Boolean
property OnNotify: TNotifyEvent

procedure Notify

测试(需要 1 个 IWButton、4 个 IWLabel、3 个 IWAJAXNotifier):



{确保这是异步事件}
procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
  IWLabel1.Caption := TimeToStr(Time);
  IWAJAXNotifier1.Notify; //OnAsyncClick 执行到最后, 让 IWAJAXNotifier1 发出通知
end;

{IWAJAXNotifier1.OnNotify}
procedure TIWForm1.IWAJAXNotifier1Notify(Sender: TObject);
begin
  Sleep(1000);
  IWLabel2.Caption := TimeToStr(Time);
  IWAJAXNotifier2.Notify; //继续让 IWAJAXNotifier2 发出通知
end;

{IWAJAXNotifier2.OnNotify}
procedure TIWForm1.IWAJAXNotifier2Notify(Sender: TObject);
begin
  Sleep(1000);
  IWLabel3.Caption := TimeToStr(Time);
  IWAJAXNotifier3.Notify; //继续让 IWAJAXNotifier3 发出通知
end;

{IWAJAXNotifier3.OnNotify}
procedure TIWForm1.IWAJAXNotifier3Notify(Sender: TObject);
begin
  Sleep(1000);
  IWLabel4.Caption := TimeToStr(Time);
end;