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

@uni/subscribe-message

v1.0.0

Published

[![npm](https://img.shields.io/npm/v/@uni/subscribe-message.svg)](https://www.npmjs.com/package/@uni/subscribe-message)

Downloads

6

Readme

subscribeMessage

npm

Bring up the client applet subscription message interface, and return the user's operation result of subscribing to the message. When the user selects "Always keep the above selections and do not ask again" in the subscription panel, the template message will be added to the user's applet settings page, and the user's subscription status to the relevant template message can be obtained through the wx.getSetting interface .

Supported

Precautions for WeChat Containers

  • One-time template id and permanent template id cannot be used at the same time.
  • The lower version of the basic library 2.4.4~2.8.3 already supports the call of the subscription message interface, and only supports the input of a one-time tmplId/permanent tmplId.
  • Starting from version 2.8.2, after the user clicks or initiates a payment callback, the subscription message interface can be called up.
  • Starting from version 2.10.0, the development version and the trial version of applets will prohibit the use of template message formId.
  • In an authorization call, the template title corresponding to each tmplId cannot be the same. If there are the same, only one is kept.
  • Starting from version 2.10.0, support for subscribing to voice message reminders, details

Install

$ npm install @uni/subscribeMessage --save

or

$ npm install @uni/apis --save

Usage

import subscribeMessage from '@uni/subscribeMessage';

subscribeMessage({
  tmplIds: [''],
  success: () => {
    console.log('success');
  },
  fail: (res) => {
    console.log('fail', res);
  },
  complete: (res) => {
    console.log('complete', res);
  }
});

subscribeMessage({
  tmplIds: [''],
}).then((res?) => {
  console.log('success');
});

你也可以从大包引入:

import { subscribeMessage } from '@uni/apis';

Parameters

| Property | Type | Description | Required | Default | | --- | --- | --- | --- | --- | | options | object  | | 是 | - | | options.tmplIds | Array  | A collection of IDs of message templates that need to be subscribed. Up to 3 messages can be subscribed in one call | Yes | - | | options.success | Function  | The callback function for a successful API call | No | - | | options.fail | Function  | The callback function for a failed API call | No | - | | options.complete | Function  | The callback function used when the API call completed (always executed whether the call succeeds or fails) | No | - |

object.success Callback returns

| Property | Type | Description | | --- | --- | --- | | errMsg | string | When the interface call is successful, the errMsg value is'requestSubscribeMessage: ok' | | [TEMPLATE_ID: string] | string  | [TEMPLATE_ID] is a dynamic key, the template id, and its values ​​include'accept','reject','ban', and'filter'. 'accept' means that the user agrees to subscribe to the template message corresponding to this id,'reject' means that the user refuses to subscribe to the template message corresponding to this id,'ban' means it has been banned by the background, and'filter' means that the template has been banned because the template title has the same name. Background filtering. For example, {errMsg: "requestSubscribeMessage:ok", zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: "accept"} means that the user agrees to subscribe to this message zun-LzcQyW-edafCVvzPkK4de2RXllr1f |

object.fail Callback returns

| Property | Type | Description | | --- | --- | --- | | errMsg | string | Interface call failure error message | | errCode | string  | Interface call failure error code |