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 🙏

© 2025 – Pkg Stats / Ryan Hefner

hiback

v2.1.11

Published

优化令牌刷新

Downloads

43

Readme

CORE

修复说明

  • 修复 UploadRequestFactory实例导出丢失this问题
  • [20241120] 处理文件上传请求时请求头令牌设置问题

说明:

用于辅助前端开发的工具包

  • 【RequestFactory】基于Axios封装的标准化前端请求模块
  • 【UploadRequestFactory】提供Element-Plus组件upload分片上传或者WangEditor编辑器文件分片上传的标准化请求处理器,也可用于其他受支持的上传模块
  • 【ProgressComputing】用于提供符合实际情况的进度值计算的工具,比如它可以借助Vue组件的onMounte 和 onUnmounted钩子函数实现页面需要多组件耗时加载的统一进度展示功能。
  • 【utils】基本工具库,后期还将扩充

getFileMd5 获取文件的MD5 precision 精度控制 debounce 防抖 throttle 节流

使用

安装

yarn add kongj@latest

OR

npm install kongj@latest

定义配置文件 axiosConfig.ts

const config:AxiosConfig = {
    baseUrl: baseURL,
    timeout: 3000,
    bigUploadApi: '',
    normalUploadAPi: '',
    refreshTokenApi:'',
    headerHook: (headers) => {
        console.debug("尚未实现kconfig.api.headerHook",headers)
    },
    signOut: () => {
        store.dispatch('user/loginOut')
    },
    token: () => {
        return  store.state.user.token
    },
    refreshToken: () => {
        return store.state.user.refreshToken
    },
    saveToken: (token) => {
        store.commit('user/tokenChange',token)
    },
    uploadNotify: (e: { uid: string | number; message: string} ) => {
        mitter.emit('uploadNotify',e as any)
    },
    messageBox: (type,message) => {
        ElMessage({
            message: message || '服务异常',
            type: 'error',
            duration: 3 * 1000
        })
    },
    chunkSize: 1024 * 1024 * 1,
    merge: function (options: Optional<AxiosConfig>): void {
    }
}
export default config

定义用于api请求的文件 request.ts

import {baseUrl} from '@/config'
import {RequestFactory} from 'kongj'
import axiosConfig from '@/config/axiosConfig'
import { AxiosRequestConfig } from 'axios'
let baseURL: any = import.meta.env.VITE_BASE_URL
baseURL = baseURL=='/pro-api'?baseUrl:baseURL
const facory = new RequestFactory(axiosConfig)
export const getAxiosResponse= ()=>facory.getAxiosResponse
export const responseProcess= ()=>facory.responseProcess
const request=<T>(config: AxiosRequestConfig)=>{
   return facory.request()<T>(config)
}
export default request