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

sudongyu-info-js

v1.0.6-alpha5

Published

client information

Downloads

1

Readme

InfoJs ⚡

更方便的获取客户端信息

infoJs

Install 💡

npm install sudongyu-info-js --save

npm install sudongyu-infojs-plugin --save-dev

or

yarn add sudongyu-info-js

yarn add sudongyu-infojs-plugin --dev

Useage 🌲

step1: 配置vite插件

//在vite.config.js中进行配置
//引入我们安装的vite插件
import infoJsPlugin from 'sudongyu-infojs-plugin'
export default defineConfig({
  plugins: [vue(),infoJsPlugin()],
  //优化包依赖
  optimizeDeps:{
      //!!!在这里排除我们插件生成的虚拟路径
    exclude:['@infoJs-plugin-virtual-module']
  }
})

step2: 使用极其方便,并且在任意地方都可以使用

import 'sudongyu-info-js'//仅需在main.ts导入即可

tips:完成导入后,所有的信息对象都会被注入到window对象上

API 🍉

Window

window.browserInfo : BrowserInfo
window.browserExtension : BrowserExtension

BrowserExtension (Writable/Readable)

| key | value | 解释 | | :-----| ----: | :----: | | language | zh-cn |客户端当前浏览器语言 |

BrowserInfo (OnlyRead)

| key | value | 解释 | | :-----| ----: | :----: | | screenResolution | 1080*1920 | 客户端浏览器的分辨率 | | isMobileDevice | false| 客户端是否为移动设备 | | userAgent | MacIntel | 客户度浏览器 | | appPackageName | vue-demo-web | app包名 | | appVersion |5.0 (Macintosh; Intel Mac OS X 10_15_7)...| 客户端浏览器的平台和版本信息 | | appVersionCode | 1.0.1 | app版本号 | | platform | MacIntel | 客户端运行浏览器的操作系统平台 | | appIpAddress | 2409:8a62:810:93f0:1dd4:52b4:ab29:d752 | 客户端ip地址 | | appIpCountry | CN | 客户端ip所在地理位置 | | appMode | beta|prod | App的运行环境 | | viteMode | development|build | App的运行环境 | | client | ClientInfo | 客户端信息对象 |

window.browserInfo.client


window.browserInfo.client : ClientInfo

| key | 解释 | | :-----| :----: | | packageName | 客户端包名 | | appVersionCode | 客户端版本号 | | appVersionName | 客户端版本名称 | | platform | 客户端平台 | | platformVersion | 客户端平台版本号 | | deviceId | 客户端设备Id | | deviceBrand | 客户端设备品牌 |

example 📦

console.log(window.browserInfo.platform)//MacIntel
console.log(window.browserInfo.screenResolution)//1440*900
console.log(window.browserInfo.client)// a Object ^_^
console.log(window.browserInfo.isMobileDevice)// false
console.log(window.browserInfo.appIpAddress)//2409:8a62:810:93f0:1dd4:52b4:ab29:d752
console.log(window.browserInfo.appIpCountry)//CN
console.log(window.browserInfo.appMode)//beta
console.log(window.browserInfo.appPackageName)//vue-demo-web
console.log(window.browserInfo.appVersionCode)//1.0.0
......

console.log(window.browserExtension.language)//zh-cn
window.browserExtension.language='zh-cn'//set language

Future 🛠️

已完成:✅           未完成:❌

  • 应用版本号 ✅
  • 浏览器指纹 ❌
  • 用户ip地址 ✅
  • 用户所在国家 ✅
  • 项目运行的环境类型(prod beat )✅