Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.www.
wechaty
提交
aae06e85
W
wechaty
项目概览
.www.
/
wechaty
与 Fork 源项目一致
Fork自
wechaty / wechaty
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wechaty
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aae06e85
编写于
10月 18, 2017
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add on() event typing
上级
2325bc69
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
11 deletion
+13
-11
src/wechaty.ts
src/wechaty.ts
+13
-11
未找到文件。
src/wechaty.ts
浏览文件 @
aae06e85
...
...
@@ -232,16 +232,18 @@ export class Wechaty extends EventEmitter implements Sayable {
return
}
public
on
(
event
:
'
error
'
,
listener
:
string
|
((
this
:
Wechaty
,
error
:
Error
)
=>
void
)):
this
public
on
(
event
:
'
friend
'
,
listener
:
string
|
((
this
:
Wechaty
,
friend
:
Contact
,
request
?:
FriendRequest
)
=>
void
)):
this
public
on
(
event
:
'
heartbeat
'
,
listener
:
string
|
((
this
:
Wechaty
,
data
:
any
)
=>
void
)):
this
public
on
(
event
:
'
logout
'
,
listener
:
string
|
((
this
:
Wechaty
,
user
:
Contact
)
=>
void
)):
this
public
on
(
event
:
'
login
'
,
listener
:
string
|
((
this
:
Wechaty
,
user
:
Contact
)
=>
void
)):
this
public
on
(
event
:
'
message
'
,
listener
:
string
|
((
this
:
Wechaty
,
message
:
Message
)
=>
void
)):
this
public
on
(
event
:
'
room-join
'
,
listener
:
string
|
((
this
:
Wechaty
,
room
:
Room
,
inviteeList
:
Contact
[],
inviter
:
Contact
)
=>
void
)):
this
public
on
(
event
:
'
room-leave
'
,
listener
:
string
|
((
this
:
Wechaty
,
room
:
Room
,
leaverList
:
Contact
[])
=>
void
)):
this
public
on
(
event
:
'
room-topic
'
,
listener
:
string
|
((
this
:
Wechaty
,
room
:
Room
,
topic
:
string
,
oldTopic
:
string
,
changer
:
Contact
)
=>
void
)):
this
public
on
(
event
:
'
scan
'
,
listener
:
string
|
((
this
:
Wechaty
,
url
:
string
,
code
:
number
)
=>
void
)):
this
public
on
(
event
:
'
error
'
,
listener
:
string
|
((
this
:
Wechaty
,
error
:
Error
)
=>
void
))
:
this
public
on
(
event
:
'
friend
'
,
listener
:
string
|
((
this
:
Wechaty
,
friend
:
Contact
,
request
?:
FriendRequest
)
=>
void
))
:
this
public
on
(
event
:
'
heartbeat
'
,
listener
:
string
|
((
this
:
Wechaty
,
data
:
any
)
=>
void
))
:
this
public
on
(
event
:
'
logout
'
,
listener
:
string
|
((
this
:
Wechaty
,
user
:
Contact
)
=>
void
))
:
this
public
on
(
event
:
'
login
'
,
listener
:
string
|
((
this
:
Wechaty
,
user
:
Contact
)
=>
void
))
:
this
public
on
(
event
:
'
message
'
,
listener
:
string
|
((
this
:
Wechaty
,
message
:
Message
)
=>
void
))
:
this
public
on
(
event
:
'
room-join
'
,
listener
:
string
|
((
this
:
Wechaty
,
room
:
Room
,
inviteeList
:
Contact
[],
inviter
:
Contact
)
=>
void
))
:
this
public
on
(
event
:
'
room-leave
'
,
listener
:
string
|
((
this
:
Wechaty
,
room
:
Room
,
leaverList
:
Contact
[])
=>
void
))
:
this
public
on
(
event
:
'
room-topic
'
,
listener
:
string
|
((
this
:
Wechaty
,
room
:
Room
,
topic
:
string
,
oldTopic
:
string
,
changer
:
Contact
)
=>
void
))
:
this
public
on
(
event
:
'
scan
'
,
listener
:
string
|
((
this
:
Wechaty
,
url
:
string
,
code
:
number
)
=>
void
))
:
this
public
on
(
event
:
'
start
'
,
listener
:
string
|
((
this
:
Wechaty
)
=>
void
))
:
this
public
on
(
event
:
'
stop
'
,
listener
:
string
|
((
this
:
Wechaty
)
=>
void
))
:
this
// guard for the above event: make sure it includes all the possible values
public
on
(
event
:
never
,
listener
:
any
):
this
...
...
@@ -251,7 +253,6 @@ export class Wechaty extends EventEmitter implements Sayable {
* @property {string} error - When the bot get error, there will be a Wechaty error event fired.
* @property {string} login - After the bot login full successful, the event login will be emitted, with a Contact of current logined user.
* @property {string} logout - Logout will be emitted when bot detected log out, with a Contact of the current login user.
* @property {string} scan - A scan event will be emitted when the bot needs to show you a QR Code for scanning.
* @property {string} heartbeat - Get bot's heartbeat.
* @property {string} friend - When someone sends you a friend request, there will be a Wechaty friend event fired.
* @property {string} message - Emit when there's a new message.
...
...
@@ -259,6 +260,7 @@ export class Wechaty extends EventEmitter implements Sayable {
* @property {string} room-topic - Get topic event, emitted when someone change room topic.
* @property {string} room-leave - Emit when anyone leave the room.<br>
* If someone leaves the room by themselves, wechat will not notice other people in the room, so the bot will never get the "leave" event.
* @property {string} scan - A scan event will be emitted when the bot needs to show you a QR Code for scanning.
*/
/**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录