[关闭]
@duanyubin 2015-09-02T10:01:38.000000Z 字数 1256 阅读 314

LIGHT

javascript


  1. 视频

    1. LIGHTAPI.requestVideo(string videoSrc)
  2. 普通图片

    1. LIGHTAPI.requestPhoto(JSON.stringify({
    2. imgList: Array photos,
    3. index: Number currentIndex,
    4. position: {
    5. top: Number top,
    6. left: Number left,
    7. width: Number width,
    8. height: Number height
    9. }
    10. }))

    photos为当前页面中所有图片的路径
    currentIndex为当前显示的页面索引

  3. 查看原文,打开新的webview

    1. LIGHTAPI.openWebview(string href)
  4. 跳转话题列表页
    打开navtive页面,参数为native页面的id或者其他唯一标示

    1. LIGHTAPI.openNative(JSON.stringify({
    2. type: string type,
    3. string params
    4. }))

    目前只有打开话题 type = 'topic'

  5. 图片缓存,调用客户端api,返回本地路径
    异步,不需要客户端拦截,前端请求地址,返回客户端本地路径

    1. LIGHTAPI.fetchImage(JSON.stringify({
    2. index: int index,
    3. imgSrc: string imgSrc
    4. }))

    客户端请求完成后调用全局函数

    1. Function __light__fetch__image__done(param)
    2. param = {
    3. index: 0,
    4. newImgSrc: string imgsrc
    5. }
  6. 获取文章内容

    1. LIGHTAPI.postArticle({
    2. source: Object sourceinfo,
    3. docid: docid,
    4. boardid: boarid
    5. })
  7. 发送表态

    1. LIGHTAPI.postAttitude(String text)
  8. 分享

    1. LIGHTAPI.openShare({
    2. 'text': '分享文案',
    3. 'photo': 'photourl',
    4. 'url': '分享链接',
    5. 'title': '文章标题'
    6. })

    text和photo都可能为空

  9. 查看评论

    1. LIGHTAPI.openComments({
    2. 'docid': 'docid',
    3. 'boardid': 'boardid',
    4. 'position': '12,1'
    5. })
  10. 评论

    1. LIGHTAPI.requestComment({
    2. 'text': 'text',
    3. 'position': '12,1',
    4. 'docid': docid,
    5. 'boardid': boarid
    6. })
  11. 评论完成

    1. window.__light__comment__done = function(position){}

    position为评论文案的坐标

  12. 获取评论数

    1. window.__light__comments__count = function(data){}
  13. 统计

    1. LIGHTAPI.postStat({"event": "light", "tag": stat})

    stat:

    • comment 评论
    • share 分享
    • drag 拖拽激活
    • tap 长按激活
    • lit 点亮
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注