Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.Veneno.
wechaty
提交
3ae7a4a9
W
wechaty
项目概览
.Veneno.
/
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,发现更多精彩内容 >>
提交
3ae7a4a9
编写于
10月 17, 2016
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code clean
上级
04cd6e17
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
41 deletion
+8
-41
src/puppet-web/bridge.ts
src/puppet-web/bridge.ts
+4
-37
src/puppet-web/puppet-web.ts
src/puppet-web/puppet-web.ts
+1
-1
src/puppet.ts
src/puppet.ts
+1
-1
src/wechaty.ts
src/wechaty.ts
+2
-2
未找到文件。
src/puppet-web/bridge.ts
浏览文件 @
3ae7a4a9
...
...
@@ -46,45 +46,11 @@ class Bridge {
log
.
silly
(
'
PuppetWebBridge
'
,
'
init() inject() exception: %s
'
,
e
&&
e
.
message
||
e
)
throw
e
})
// const max = 15
// const backoff = 100
// max = (2*totalTime/backoff) ^ (1/2)
// timeout = 11,250 for {max: 15, backoff: 100}
// timeout = 45,000 for {max: 30, backoff: 100}
// timeout = 30,6250 for {max: 35, backoff: 500}
// const timeout = max * (backoff * max) / 2
// return retryPromise({ max: max, backoff: backoff }, attempt => {
// log.silly('PuppetWebBridge', 'init() retryPromise: attampt %s/%s times for timeout %s'
// , attempt, max, timeout)
// return this.inject()
// .then(r => {
// log.silly('PuppetWebBridge', 'init() inject() return %s at attempt %d', r, attempt)
// return this
// })
// .catch(e => {
// log.silly('PuppetWebBridge', 'init() inject() attempt %d exception: %s', attempt, e.message)
// throw e
// })
// })
// .then(_ => {
// log.silly('PuppetWebBridge', 'init()-ed')
// return this
// })
// .catch(e => {
// log.warn('PuppetWebBridge', 'init() inject FINAL fail: %s', e.message)
// throw e
// })
}
public
async
inject
():
Promise
<
any
>
{
log
.
verbose
(
'
PuppetWebBridge
'
,
'
inject()
'
)
// return co.call(this, function* () {
try
{
const
injectio
=
this
.
getInjectio
()
...
...
@@ -112,7 +78,7 @@ class Bridge {
log
.
silly
(
'
PuppetWebBridge
'
,
'
inject() ding success
'
)
return
true
// }).catch (e => {
}
catch
(
e
)
{
log
.
verbose
(
'
PuppetWebBridge
'
,
'
inject() exception: %s. stack: %s
'
,
e
.
message
,
e
.
stack
)
throw
e
...
...
@@ -347,8 +313,9 @@ class Bridge {
)
`
.
replace
(
/
[\n\s]
+/
,
'
'
)
// log.silly('PuppetWebBridge', 'proxyWechaty(%s, ...args) %s', wechatyFunc, wechatyScript)
// console.log('proxyWechaty wechatyFunc args[0]: ')
// console.log(args[0])
// console.log('proxyWechaty wechatyFunc args[0]: ')
// console.log(args[0])
/**
*
* WechatyBro method named end with "Async", will be treated as a Async function
...
...
src/puppet-web/puppet-web.ts
浏览文件 @
3ae7a4a9
...
...
@@ -358,7 +358,7 @@ export class PuppetWeb extends Puppet {
})
}
public
logined
()
{
return
!!
(
this
.
user
)
}
public
ding
(
data
?:
any
):
Promise
<
any
>
{
public
ding
(
data
?:
any
):
Promise
<
string
>
{
if
(
!
this
.
bridge
)
{
return
Promise
.
reject
(
new
Error
(
'
ding fail: no bridge(yet)!
'
))
}
...
...
src/puppet.ts
浏览文件 @
3ae7a4a9
...
...
@@ -82,7 +82,7 @@ export abstract class Puppet extends EventEmitter implements Sayable {
public
abstract
reset
(
reason
?:
string
)
public
abstract
logout
():
Promise
<
any
>
public
abstract
quit
():
Promise
<
any
>
public
abstract
ding
(
data
?:
string
):
Promise
<
any
>
public
abstract
ding
(
):
Promise
<
string
>
/**
* FriendRequest
...
...
src/wechaty.ts
浏览文件 @
3ae7a4a9
...
...
@@ -296,12 +296,12 @@ export class Wechaty extends EventEmitter implements Sayable {
})
}
public
ding
(
data
:
string
)
{
public
ding
()
{
if
(
!
this
.
puppet
)
{
return
Promise
.
reject
(
new
Error
(
'
wechaty cant ding coz no puppet
'
))
}
return
this
.
puppet
.
ding
(
data
)
return
this
.
puppet
.
ding
(
)
// should return 'dong'
.
catch
(
e
=>
{
log
.
error
(
'
Wechaty
'
,
'
ding() exception: %s
'
,
e
.
message
)
throw
e
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录