npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

newsapp-protocol

v0.8.1

Published

[客户端与前端交互协议wiki](http://doc.ws.netease.com/pages/viewpage.action?pageId=2886075)

Downloads

26

Readme

客户端与前端交互协议wiki

demo

API Usage

import newsappAPI from 'newsapp-protocol'

open

* 打开网易新闻
 * @param  path
 * 首页: /startup
 * 文章: /doc/951C0KA70001124J
 * 专题: /topic/S1385797470941
 * 网页: /web/http%3A%2F%2Fwww.163.com
 * 图集: /photo/0096/32491
 * 跟贴: /tie/C44U3PJ700097U7S
 * 直播: /live/55474
 * 视频: /video/VBV126LCH
 * 问吧: /expert/EX4064892651204023641
 * 话吧: /subject/SJ3699667062136051057
 * 萝卜: /luobo/123123
 * 新闻栏目: /channel/T1348649580692
 * 订阅(网易号): /reader/T1374482883888
 * ...
 */
 
newsappAPI.open(path)

share

// 设置分享配置
newsappAPI.share.setShareData({
      wxUrl: 'http://m.163.com',
      wxImg: '',
      wxTitle: '标题',
      wxText: '描述',
      wbImg: '',
      wbText: '',
      shareDone: function() {}
    })

//调起分享菜单
newsappAPI.share.openShareMenu()

//如果是图片分享 wxUrl参数设为空即可

userinfo

 newsappAPI.userinfo(function (info) {
      alert(JSON.stringify(info))
 })

login

 newsappAPI.login(function (info) {
      alert(JSON.stringify(info))
 })

device

 newsappAPI.device(function (info) {
      alert(JSON.stringify(info))
 })

encrypt 加密

var data = {
      a: 1,
      b: 2,
      c: 3
    }
 // 数据无需做stringify处理,协议中会处理
 newsappAPI.encrypt(data, function (encryText) {
      alert(encryText)
 })

杭研防刷trashID

newsappAPI.trash(function (trashid) {
      alert(trashid)
 })

工具栏UI相关

// 隐藏工具栏
newsappAPI.ui.hideToolbar()

// 修改标题
newsappAPI.ui.modifyTitle('修改标题')

// 定制右上角文字
newsappAPI.ui.button('刷新', function () {
  alert('回调')
})

copy

// 复制文字
newsappAPI.copy('点击复制按纽文本')

location

// 获取当前位置信息
newsappAPI.location('current', function (info) {
      alert(JSON.stringify(info))
})
// 切换位置
newsappAPI.location('switch', function (info) {
      alert(JSON.stringify(info))
})

setting

// 获取客户端设置信息
newsappAPI.setting(function (info) {
      alert(JSON.stringify(info))
})

pushview

// 反馈界面
newsappAPI.pushview.feedback()
// 优惠券界面
newsappAPI.pushview.coupon()
// 个人中心
newsappAPI.pushview.personalcenter()
// 我的任务
newsappAPI.pushview.mytask()
// 内购支付页面
newsappAPI.pushview.inapppurchase()
// 钱包
newsappAPI.pushview.wallet('coupon')
// 系统设置
newsappAPI.pushview.applicationsettings()
// app设置
newsappAPI.pushview.settings()
// 扫一扫
newsappAPI.pushview.qrcode()

单次提醒

// type 为 add remove check enable 中任一
newsappAPI.alarm({
      url:'http://163.com',
      date: '2017-07-13 21:30:00',
      title: '啦啦啦',
      message: 'push来咯',
      type: 'add',
    }, function (bool) {
    alert(bool)
})

多次提醒

// type 为 add remove check change enable 中任一
newsappAPI.remind({
      id: 'test20170712',
      url:'http://m.163.com',
      start: '2017-07-12 18:30:00',
      end: '2017-07-13 18:30:00',
      pattern: 'daily',
      title: '啦啦啦',
      message: 'push来啦',
      type: 'add',
    }, function (bool) {
    alert(bool)
})

下载图片

var url = 'http://cms-bucket.nosdn.127.net/4e6098a83e5f4bd7854fd31d2fc1738d20170620100645.jpeg'
newsappAPI.downloadImage(url, function (imgurl) {
   alert('图片下载成功' + imgurl)
})

上传图片

newsappAPI.uploadimage({ type: 'album' }, function (url) {
  alert(url)
})

写跟贴

newsappAPI.comment({
  boardid: '',
  docid: '',
  replyid: ''
 }, function (text) {
  alert(text)
})

兑奖成功更新

newsappAPI.updateprofile()