Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
.Veneno.
wechaty
提交
dc5efba0
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,发现更多精彩内容 >>
提交
dc5efba0
编写于
6月 16, 2016
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
doc & handle more error in injectio
上级
6283434b
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
13 addition
and
8 deletion
+13
-8
src/puppet-web-injectio.js
src/puppet-web-injectio.js
+13
-8
未找到文件。
src/puppet-web-injectio.js
浏览文件 @
dc5efba0
...
...
@@ -21,7 +21,7 @@ return (function(port) {
* Wechaty injectio must return this object.
* PuppetWebBridge need this to decide if injection is successful.
*/
retObj
=
{
var
retObj
=
{
code
:
200
// 2XX ok, 4XX/5XX error. HTTP like
,
message
:
'
any message
'
,
port
:
port
...
...
@@ -98,23 +98,21 @@ return (function(port) {
function
init
()
{
if
(
!
initClog
())
{
// make console.log work (wxapp disabled the console.log)
retObj
.
code
=
50
1
retObj
.
code
=
50
3
// 503 Service Unavailable http://www.restapitutorial.com/httpstatuscodes.html
retObj
.
message
=
'
initClog fail
'
return
retObj
}
if
(
Wechaty
.
vars
.
inited
===
true
)
{
log
(
'
Wechaty.init() called twice: already inited
'
)
retObj
.
code
=
201
retObj
.
code
=
304
// 304 Not Modified https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5
retObj
.
message
=
'
init() already inited before. returned with do nothing
'
return
retObj
}
if
(
!
angularIsReady
())
{
clog
(
'
angular not ready. wait 500ms...
'
)
setTimeout
(
init
,
1000
)
retObj
.
code
=
202
retObj
.
message
=
'
init() entered waiting angular loop
'
// AngularJS not ready, wait 500ms then try again.
retObj
.
code
=
503
// 503 SERVICE UNAVAILABLE https://httpstatuses.com/503
retObj
.
message
=
'
init() without a ready angular env
'
return
retObj
}
...
...
@@ -225,11 +223,13 @@ return (function(port) {
*
*/
function
MMCgiLogined
()
{
return
!!
(
window
.
MMCgi
&&
window
.
MMCgi
.
isLogin
)
}
function
angularIsReady
()
{
return
!!
(
return
(
(
typeof
angular
)
!==
'
undefined
'
&&
angular
.
element
&&
angular
.
element
(
'
body
'
)
&&
angular
.
element
(
document
).
injector
()
)
}
...
...
@@ -246,6 +246,9 @@ return (function(port) {
function
glueToAngular
()
{
var
injector
=
angular
.
element
(
document
).
injector
()
if
(
!
injector
)
{
throw
new
Error
(
'
glueToAngular cant get injector(right now)
'
)
}
var
accountFactory
=
injector
.
get
(
'
accountFactory
'
)
var
appFactory
=
injector
.
get
(
'
appFactory
'
)
...
...
@@ -310,6 +313,8 @@ return (function(port) {
,
contentChatScope
:
contentChatScope
}
return
true
}
function
checkScan
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录