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

easy-web-share

v1.0.1

Published

[![Npm](https://badgen.net/npm/v/easy-web-share)](https://www.npmjs.com/package/easy-web-share) [![Bundlephobia](https://badgen.net/bundlephobia/minzip/easy-web-share)](https://bundlephobia.com/result?p=easy-web-share)

Downloads

1,361

Readme

WebShare - 网页分享 SDK

Npm Bundlephobia

网页端经常遇到的场景:点击右上角转发给好友或直接调起原生 APP 的分享。为了让分享后等到比较好的展示效果,比如标题、简略图片、描述等,开发者部的不对每个平台进行配置。由于但平台众多,每个平台都不一致,让人十分头疼。

支持平台

  • Web Social
  • QQ
  • QQ 空间
  • 微信

Usage

import webShare from 'easy-web-share'

webShare.setGlobalShareInfo({
  url: '分享地址',
  title: '分享标题',
  desc: '分享描述',
  imageUrl: '分享图片地址
})

// 更新分享信息
// SPA 应用需要在每个页面调用,否则会使用 GlobalShareInfo 的配置
webShare.setShareInfo({
  url: '分享地址',
  title: '分享标题',
  desc: '分享描述',
  imageUrl: '分享图片地址
})

手动创建

import { createWebShare } from 'easy-web-share'
const webShare = createWebShare({
  url: '分享地址',
  title: '分享标题',
  desc: '分享描述',
  imageUrl: '分享图片地址
})

特殊配置

在需要 SDK 才能设置分享内容的环境中,如微信、QQ ,如果没有加载对应的 jssdk,本项目会自动加载对应的 jssdk。

微信

在微信内分享必须借助微信 jssdk,且获取相应的接口权限,因此需要在页面加载时调用 wx.config 初始化 SDK.

wx.config({
  debugger: false,
  appId: 'your appId',
  timestamp,
  nonceStr: noncestr,
  signature,
  jsApiList: ['updateAppMessageShareData'],
})

API

setGlobalShareInfo

getGlobalShareInfo

setShareInfo

getShareInfo