You are viewing a single comment's thread from:

RE: SteemJS中文手册

in #starnote6 years ago

SteemJS中有些函数可以加上Async,以得到Promise的写法。比如:steem.api.getContentAsync

//获取某篇文章
steem.api.getContentAsync(author, permlink)

//获取一篇文章的回复
steem.api.getContentRepliesAsync(author, permlink)

//连续获取文章
steem.api.getDiscussionsByAuthorBeforeDateAsync(author, null, beforeDate, 5)
  .then(res=>{
    console.log(222, res)
  })

//获取作者的评论
let query = { limit : 10, start_author:'lemooljiang', "start_permlink": pPermLink}
comments = await this.steem.api.getDiscussionsByCommentsAsync(query)


//获取帐户历史
steem.api.getAccountHistoryAsync(account, from, limit)
  .then(res=>{
    console.log(122, res)}
  )