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 🙏

© 2024 – Pkg Stats / Ryan Hefner

snail-ad-plugin

v1.3.0

Published

plugin for advertisement page in snailreader app

Downloads

3

Readme

网易蜗牛读书广告接入插件

本插件用于运行在网易蜗牛书App的HTML5广告页面中,通过本插件通知蜗牛读书客户端广告条件已满足,执行领取免费时长操作。

广告条件一般分为两种类型,由广告提供方自行决定:

  1. 自动领取:页面加载完成展现完毕后停留一定时间即视为满足条条件
  2. 手动领取:页面加载完成后,仍需完成某些操作才视为满足条件(例如停留时长超过几秒,或是手动点击某一按钮)
  • 使用前需先实例化,在页面加载完之前或之后都允许
  • sdk默认广告为手动领取类型,手动领取类型需要在判断用户满足条件后手动调用report方法

安装

npm install snail-ad-plugin --save

使用

es6 module 引入

示例:

import AD from 'snail-ad-plugin'
//使用前需实例化
const ad = new AD({type: 0, time: 2000}); //此配置表示页面加载完成并停留2s后自动领取时长

浏览器直接引入

<button onclick="report()">完成</button>
<script src="snailAdPlugin.iife.js"></script>
<script>
  //使用前需实例化
  var ad = new SnailAdPlugin();
  //点击按钮通知客户端领取时长
  function report(){    
    ad.report(function(result){
      if(result.success){
        //时长领取成功
      }else{
        //时长领取失败
      }
    })
  }
</script>

方法

  • isSnail 判断当前页面是否为蜗牛读书客户端内
  • parseUrl 将给定的url查询参数解析为对象
  • report 通知蜗牛读书客户端,广告条件已满足,执行领取时长流程,此方法可传入一个回调方法,该回调方法的参数为{success: true/false},代表时长领取流程是否执行成功。如果是手动领取类型的广告,那么必须在条件满足时手动调用