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 🙏

© 2026 – Pkg Stats / Ryan Hefner

lightning_wb

v1.0.0

Published

广告位sdk入口文件

Readme

使用方法

  1. 首先在需要接入的页面引入 lightning.js
<script type="text/javascript" src="//j1.58cdn.com.cn/job/pc/lightning/lightning.js"></script>
  1. 在接入lightning.js之后,调用window.lightning方法,并传入一个对象为参数,默认为只调用数据的模式,如下
	window.lightning({
		page_id: 1,	// 在lightning平台配置生成的对应id		
		callback: function (data) {	// 在回调函数中拿到广告位的所有数据,进行你自己的操作
			var res = data;
			console.log('res', res);
			// TODO....
		}
	});
  1. 如果需要进行渲染模式,则需要按照以下格式进行参数配置
	window.lightning({
		page_id: 1,	// 在lightning平台配置生成的对应id
		isRender: true,	// 设置为true
		renderID: {		// 需要进行渲染的广告位,广告位需要设置id, 例如:<div id="adposition_id">,
			renderID_ + adposition_id: 'adposition_id1',	// adposition_id是在平台配置之后生成的对应id
			renderID_ + adposition_id: 'adposition_id2'
		},
		cityName: 'bj',	// 城市名字,北京 'bj',上海 'sh',如果在lightning平台配置,则需要此参数
		cateType: '2'	// 类别,如果在lightning平台配置,则需要此参数
	});

注意: 在所传渲染page_id拿到数据为空的时候,默认会隐藏目标广告位。

错误代码提示

  • -1001: 参数错误,所传参数必须是一个Object,且不为Array,page_id为number类型;
  • -1002: 在isRender为true时,renderID是必传参数,且为Object
  • -1003: callback错误
  • -1004: callback错误
  • -1005: callback错误
  • -1006: 目标广告位id不存在
  • -1007: cityName错误
  • -1008: cateType错误