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

nativescript-wechat-share

v0.1.1

Published

A NativeScript module providing Wechat share for Android and iOS

Downloads

8

Readme

nativescript-wechat-share

Now only iOS is supported. Android is not supported because WeChat SDK requires an acitivity is defined under the same package of the main project while the NativeScript does not support this now(v1.4).

How to use

Add the plugin

by tns plugin add nativescript-wechat-share.

Configurations in Xcode

Open the iOS project in XCode and do configurations shown below:

  1. Add libraries that the WeChat SDK depends on by Target->Build Phases->Link Binary With Libraries:

    • CoreTelephony.framework
    • libc++.tbd
    • libsqlite3.0.tbd
    • libz.tbd
    • SystemConfiguration.framework
  2. Add URL Scheme for WeChat so your app can communication with WeChat app

    • go to Target-> Info -> URL Types
    • click the + button and add a new scheme: identifier = weixin, URL Schemes = APP-ID
    • APP-ID is the APPID you got from WeChat after you registered your application on WeChat OpenApi dashboard: https://open.weixin.qq.com/
  3. Add below into your Info.plist, you can find the file in Xcode's project navigator->project-name->project-name->Supporting Files->project-name-Info.plist

LSApplicationQueriesSchemes weixin

NSAppTransportSecurity NSAllowsArbitraryLoads ``` - LSApplicationQueriesSchemes is set so your app can check if WeChat is installed or not. - NSAppTransportSecurity is set to NSAllowsArbitraryLoads so that the iOS will not force you use https exclusively - If you want this default high security setting NSAppTransportSecurity brings, you can use NSExceptionDomains instead of NSAllowsArbitraryLoads, and and pingma.qq.com as a whitelisted domain name.

Prepare codes before sharing

  1. Customize the logic for the handlOpenUrl and openUrl methods of your UIApplicationDelegate, so that it is handled by WXApi.handleOpenURLDelegate. So you will have a app.ios.ts similar to this:

var application = require("application"); var wechatPlugin = require("nativescript-wechat-share"); application.mainModule = "main-page"; application.cssFile = "./app.css";

class MyDelegate extends UIResponder implements UIApplicationDelegate { public static ObjCProtocols = [UIApplicationDelegate];

applicationHandleOpenURL(application: UIApplication, url: NSURL): boolean { return WXApi.handleOpenURLDelegate(url, wechatPlugin.myWXApiDelegate); } applicationOpenURLSourceApplicationAnnotation(application: UIApplication, url: NSURL, sourceApplication: NSString, annotation: id): boolean { return WXApi.handleOpenURLDelegate(url, wechatPlugin.myWXApiDelegate); } }

application.ios.delegate = MyDelegate; application.start(); ```

  1. Register the callback function to handle the response code returned by WeChat app like this:

var wechatPlugin = require("nativescript-wechat-share"); wechatPlugin.registerOnRespCallback(function(code){ if (code == wechatPlugin.RespCodeEnum.Success) { alert("the url is shared successfully"); } else { alert("share url failed with errCode: " + code); } }); ```

  1. Register your app(only once) before you really do the sharing:

var wechatPlugin = require("nativescript-wechat-share"); wechatPlugin.registerApp("Your-App-ID"); ```

Do the sharing

Finally you can do the sharing when needed:

var wechatPlugin = require("nativescript-wechat-share");
// share an URL to the timeline
wechatPlugin.shareUrl("the title", "the description", thumbImage, "the url", wechatPlugin.ShareToEnum.Timeline);
// or send to a friend
// wechatPlugin.shareUrl("the title", "the description", thumbImage, "the url", wechatPlugin.ShareToEnum.Chat);
// or save to favorite
// wechatPlugin.shareUrl("the title", "the description", thumbImage, "the url", wechatPlugin.ShareToEnum.Favorite);
// or share text
// wechatPlugin.shareText("the text", wechatPlugin.ShareToEnum.Timeline);
// or share image
// wechatPlugin.shareImage(image, thumbImage, wechatPlugin.ShareToEnum.Timeline);