You are viewing a single comment's thread from:

RE: SteemJS中文手册

in #starnote6 years ago
steem.api.streamTransactions("head", function(err, result) {
    if (result && !err) {
      console.log(result)
    }
})
eg: 实时获取作者的文章或评论
getData() {
  this.steem.api.streamTransactions("head", function (err, result) {
    if (err) {
      alert("网络有问题!请更换API节点!")
    }
    let txType = result.operations[0][0] //获取操作类别
    let txData = result.operations[0][1] //获取操作内容
    if (txType == "comment" & txData.author == "lemooljiang") {  //获取作者的文章或评论
      let commentBody = txData.body
      let permlink = txData.permlink
      console.log(12345,commentBody)
    }
  })
}