syndication_service.he

来自「维信SDK文档。源码要求为至少5个C或Java源码」· HE 代码 · 共 47 行

HE
47
字号
class
{
  void startWidget()
  {
    setMinimizedView(createMinimizedView("viewMini", getStyle("default")));
  }


  Shell openWidget()
  {
    fetch();
    
    return null;
  }

  
  void fetch()
  {
    //as we don't have any content we want all feed items
    //since year 1970 (usually RSS feeds contain 20-30 items)
    Value arg = [
      "ts" => 0,
      "max" => 10
    ];

    call(null, "syndService", "getItems", arg, ok, nok);
  }


  void ok(Object state, Value ret)
  {
    setBubble(null, "Got "+ret.size()+" items");
    
    //print subjects to log
    foreach (Value item : ret) {
      printf("subject: "+item.title);
    }
  }


  void nok(Object state, String error)
  {
    setBubble(null, "Syndication get failed: "+error);
  }

} //class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?