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

@fgz/enhanced-wx-js-sdk

v1.6.0

Published

Vue plugin wrapper for WeChat JSSDK

Downloads

14

Readme

Enhanced WeChat JSSDK

A Promise-based WeChat JSSDK wrapper with TypeScript support and framework integrations.

Features

  • 🚀 Promise-based API
  • 📦 TypeScript support
  • ⏱️ Timeout control
  • 🔌 Framework integrations (Vue 2/3)
  • 🌐 Works in both module and non-module environments

Installation

NPM (For Vue/JavaScript projects)

npm install @fgz/enhanced-wx-js-sdk

CDN (For pure HTML/JavaScript)

<script src="path/to/wx-js-sdk-plugin.min.js"></script>

Usage

JavaScript Environment

<script src="path/to/wx-js-sdk-plugin.min.js"></script>
<script>
  // WxJsSDK is globally available
  WxJsSDK.config({
    debug: false,
    appId: 'your-app-id',
    timestamp: 'your-timestamp',
    nonceStr: 'your-nonce-str',
    signature: 'your-signature',
  }).then(() => {
    // Ready to use WeChat JSSDK
    return WxJsSDK.getLocation();
  }).then(location => {
    console.log('Current location:', location);
  }).catch(err => {
    console.error('Error:', err);
  });
</script>

Vue Environment

Register the Plugin (Optional)

Vue 3.x

import { createApp } from 'vue'
import WxJsSdkPlugin from '@vue/wx-js-sdk-plugin'

const app = createApp(App)
app.use(WxJsSdkPlugin)
app.mount('#app')

Vue 2.x

import Vue from 'vue'
import WxJsSdkPlugin from '@vue/wx-js-sdk-plugin'

Vue.use(WxJsSdkPlugin)

new Vue({
  // ... your Vue options
})

Using in Components

import { defineComponent } from 'vue'
import { WxJsSDK } from '@fgz/enhanced-wx-js-sdk'

export default defineComponent({
  async mounted() {
    // Using via global properties
    await this.$wxJsSdk.config({
      debug: false,
      appId: 'your-app-id',
      timestamp: 'your-timestamp',
      nonceStr: 'your-nonce-str',
      signature: 'your-signature',
    })

    // Or using via inject
    const wxJsSdk = inject('wxJsSdk')
    await wxJsSdk.config({
      // ... configuration options
    })
  }
})

API

Available Methods

All methods return a Promise and support timeout configuration:

// Configuration
await WxJsSDK.config(params: ConfigOptions, timeout?: number)

// Image APIs
await WxJsSDK.chooseImage(params: ChooseImageOptions, timeout?: number)
await WxJsSDK.previewImage(params: PreviewImageOptions, timeout?: number)

// Location APIs
await WxJsSDK.getLocation(params?: GetLocationOptions, timeout?: number)
await WxJsSDK.openLocation(params: OpenLocationOptions, timeout?: number)

// Payment
await WxJsSDK.chooseWXPay(params: ChooseWXPayOptions, timeout?: number)

// And more...

Type Definitions

interface ConfigOptions {
  debug?: boolean
  appId: string
  timestamp: string
  nonceStr: string
  signature: string
  jsApiList?: string[]
}

interface ChooseImageOptions {
  count?: number
  sizeType?: Array<'original' | 'compressed'>
  sourceType?: Array<'album' | 'camera'>
}

interface GetLocationOptions {
  type?: 'wgs84' | 'gcj02'
  // ...
}

Building

# Install dependencies
npm install

# Build the plugin
npm run build

Version Numbering

The plugin follows WeChat JSSDK versioning scheme:

  • Major and minor versions follow the official WeChat JSSDK
  • Patch version is a 5-digit number:
    • First 3 digits: WeChat JSSDK patch version
    • Last 2 digits: Plugin patch version

Example:

  • 1.6.10000 = WeChat JSSDK 1.6.1 + Plugin patch 00
  • 1.6.10001 = WeChat JSSDK 1.6.1 + Plugin patch 01

License

MIT