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

js-icp-sdk

v1.2.0

Published

iframe html interface with community frame for icity.

Downloads

9

Readme

Summary

iframe html interface with community frame for icity.

Emphasize

sdk is only valid in the icity's community platform.

Install

npm install js-icp-sdk --save
OR
yarn add js-icp-sdk

Import

import icp from 'js-icp-sdk'

Use

1、Token (非三方调用)

const token = await icp.getToken()

2、User's info (获取用户信息)

const info = await icp.getUserInfo()
> info { 
    type, //10:市, 0:区级, 1:街道级, 2:社区级
    orgId, //组织id
    id, //用户唯一标识
    uid, //用户唯一标识(uuid规则)
    name, //姓名
    mobile, //手机号
    province, //省份
    provinceId, //省份id
    city, //市
    cityId, //市id
    district, //区
    districtId, //区id
    street, //街道
    streetId, //街道id
    community //社区
  }

3、Grid's info(获取网格信息)

const info = await icp.getGridInfo()
> info {
    name: '网格员',
    role: 1, //0非网格员,1网格员
    scope: [
      {
        gridId: '', //网格id
        gridName: '' //网格名
      }
    ]
  }

4、Community's list(获取当前街道的社区列表)

const list = await icp.getCommunityList()
> list [
    {
      name: '演示社区',
      code: '552054350c0b40a9951b0b9b8dd9ac6d'
    }  
  ]

5、Relogin (提示重新登录)

icp.relogin()

6、Code (获取临时授权码)

const code = await icp.getCode([host])
> host: 域名, 默认为https://new3.icity24.cn, 可选
> 示例: await icp.getCode()
        await icp.getCode('http://www.test.cn')

7、获取手机号后四位验证ticket

const ticket = await icp.getMobileVerifyTicket()

8、记录手机号后四位验证ticket

icp.setMobileVerifyTicket(ticket)

9、获取手机号验证码ticket

const ticket = await icp.getSmsVerifyTicket()

10、记录手机号验证码ticket

icp.setSmsVerifyTicket(ticket)

11、打开URL并携带参数

icp.openUrlWithBody(url, body)
> icp.openUrlWithBody('https://www.baidu.com', ['首页', '详情页'])

12、从打开的页面中获取携带的参数

const body = await icp.getUrlBody()

13、外部打开页面获取用户信息

npm install js-guava --save

import { browser } from 'js-guava'
browser.receive(params=>{
  //业务处理,返回格式参见2
})

14、跳转其他链接后,保持上个链接页面状态的方法

icp.openUrlWithBody(params)
> icp.openUrlWithBody({
  url:"https://www.baidu.com"
})