@duanyubin
2015-09-02T10:01:38.000000Z
字数 1256
阅读 384
javascript
视频
LIGHTAPI.requestVideo(string videoSrc)
普通图片
LIGHTAPI.requestPhoto(JSON.stringify({
imgList: Array photos,
index: Number currentIndex,
position: {
top: Number top,
left: Number left,
width: Number width,
height: Number height
}
}))
photos
为当前页面中所有图片的路径
currentIndex
为当前显示的页面索引
查看原文,打开新的webview
LIGHTAPI.openWebview(string href)
跳转话题列表页
打开navtive页面,参数为native页面的id或者其他唯一标示
LIGHTAPI.openNative(JSON.stringify({
type: string type,
string params
}))
目前只有打开话题 type = 'topic'
图片缓存,调用客户端api,返回本地路径
异步,不需要客户端拦截,前端请求地址,返回客户端本地路径
LIGHTAPI.fetchImage(JSON.stringify({
index: int index,
imgSrc: string imgSrc
}))
客户端请求完成后调用全局函数
Function __light__fetch__image__done(param)
param = {
index: 0,
newImgSrc: string imgsrc
}
获取文章内容
LIGHTAPI.postArticle({
source: Object sourceinfo,
docid: docid,
boardid: boarid
})
发送表态
LIGHTAPI.postAttitude(String text)
分享
LIGHTAPI.openShare({
'text': '分享文案',
'photo': 'photourl',
'url': '分享链接',
'title': '文章标题'
})
text和photo都可能为空
查看评论
LIGHTAPI.openComments({
'docid': 'docid',
'boardid': 'boardid',
'position': '12,1'
})
评论
LIGHTAPI.requestComment({
'text': 'text',
'position': '12,1',
'docid': docid,
'boardid': boarid
})
评论完成
window.__light__comment__done = function(position){}
position
为评论文案的坐标
获取评论数
window.__light__comments__count = function(data){}
统计
LIGHTAPI.postStat({"event": "light", "tag": stat})
stat: