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

nx-workbench-sdk

v1.0.1

Published

neixin workbench sdk

Readme

'use strict';

var NX = __NX_WORKBENCH_SDK__;

var noop = function() {};

/* 构造 */
function constructDemo() {
    var config = [
        {
            id: 'init',
            content: '初始化'
        },
        {
            id: 'showMessageContext',
            content: '查看消息上下文'
        },
        {
            id: 'onFocus',
            content: '切入告知'
        },
        {
            id: 'onBlur',
            content: '离开告知'
        },
        {
            id: 'getCurrentUserInformation',
            content: '获取当前用户信息'
        },
        {
            id: 'showToast',
            content: '显示消息提示框'
        },
        {
            id: 'uploadFile',
            content: '文件上传'
        },
        {
            id: 'checkAlToken',
            content: '更新鉴权信息'
        },
        {
            id: 'checkAuthorizationCode',
            content: '获取用户授权码'
        },
        {
            id: 'selectContacts',
            content: '选择联系人'
        },
        {
            id: 'sendMessages',
            content: '发送模板消息'
        }
    ];

    var container = document.querySelector('#container');

    function createElement(id, content, type) {
        var ele = document.createElement(type || 'button');
        ele.id = id;
        ele.innerHTML = content;
        return ele;
    }

    for(var i = 0, l = config.length; i < l; i++) {
        container.appendChild(createElement(config[i].id, config[i].content))
    }
}

/* 绑定 */
function bindDemo() {
    function $(selector) {
        return document.querySelectorAll(selector);
    }

    var triggers = $('#container button');

    for(var i = 0, l = triggers.length; i < l; i++) {
        (function(trigger) {
            trigger.addEventListener('click', function(e) {
                handleTrigger(e.target.id);
            });
        })(triggers[i])
    }

    function handleTrigger(type) {
        switch(type) {
            case 'init': {
                /* 初始化 */
                NX.init({
                    appKey: 'appKey',
                    jsTicket: 'jsTicket',
                    /* 离开时,是否清除iframe */
                    killMe: false,
                    complete: function(res) {
                        debugger
                    }
                });
                break;
            }
            case 'showMessageContext': {
                /* 查看消息上下文 */
                NX.showMessageContext({
                    msgid: '544423752834904064',
                    sessionId: '1080539769',
                    type: '1'
                });
                break;
            }
            case 'getCurrentUserInformation': {
                /* 获取当前用户信息 */
                NX.getCurrentUserInformation({
                    complete: function(res) {
                        debugger
                    }
                });
                break;
            }
            case 'showToast': {
                /* 显示消息提示框 */
                NX.showToast({
                    type: 'success',
                    title: '显示消息提示框',
                    duration: 1000
                });
                break;
            }
            case 'uploadFile': {
                /* 文件上传 */
                NX.uploadFile({
                    dnd: 'body',
                    pick: '#uploadFile',
                    onStart: function(obj) {
                        debugger
                    },
                    onProgress: function(obj) {
                        debugger
                    },
                    complete: function(res) {
                        debugger
                    }
                });
                break;
            }
            case 'checkAlToken': {
                /* 更新鉴权信息 */
                NX.checkAlToken();
                break;
            }
            case 'checkAuthorizationCode': {
                /* 更新鉴权信息 */
                NX.checkAuthorizationCode({
                    /* 开发使用线下接口 */
                    url: 'http://develop.xm.test.sankuai.com/oauth/v2/authorize',
                    /* 开发,使用线下日志appKey */
                    appKey: '6061218110f4105p',

                    /* 获取授权后的会跳地址,query参数中包含code信息 */
                    /* 可在全局中监听 onCheckAuthorizationCode获取 */
                    redirectUri: 'http://127.0.0.1:4444/',
                    scope: 'USER_INFO PHONE_NUMBER PERSON_FILE GROUP_FILE'
                });
                break;
            }
            case 'selectContacts': {
                /* 更新鉴权信息 */
                NX.selectContacts({
                    title: '',
                    value: [],
                    onSelect: noop,
                    onCancel: noop,
                    onChange: noop,
                    complete: noop
                });
                break;
            }
            case 'sendMessages': {
                /* 更新鉴权信息 */
                NX.sendMessages({
                    data: {},
                    onStart: noop,
                    onCancel: noop,
                    onFail: noop,
                    onSuccess: noop,
                    complete: noop
                });
                break;
            }
        }
    }

    NX.onFocus(function(res) {
        debugger
    });

    NX.onBlur(function(res) {
        debugger
    });

    NX.onCheckAlToken(function(res) {
        /* 只有鉴权信息改变,才会触发 */
        debugger
    });

    NX.onCheckAuthorizationCode(function(code) {
        /* 用户授权码,使用该授权码,获取access token */
        debugger
    })
}

constructDemo();
bindDemo();