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

@irim/ds-net

v1.0.7

Published

digital space net plugin

Downloads

19

Readme

ds-net

version license downloads

快速使用

install

$ npm install --save @irim/ds-core @irim/ds-net
import { Core } from '@irim/ds-core';
import { Net } from '@irim/ds-net';

const ds = new Core();
ds.register('net', Net);

// 请求数据
ds.net.request('/api/todo.list', {
  type: 'jsonp',
}).then(response => {
  console.log('>>>', response);
});

// 连接 socket
await ds.net.initSocket('wss://echo.websocket.org');
ds.net.socket.sendMessage({ content: 'hello world' });
ds.net.socket.onMessage(data => {
  console.log('on message', data);
});

进阶使用

  1. 初始化时指定数据能力
// 这里的参数也可以放到 ds.setConfig({ net: ... }) 或初始化 ds 中,详见 DsCore 文档
ds.register('net', Net, {
  abilities: ['ajax', 'upload'],
});

// 也可以在指定能力时,指定初始化的参数,如:
ds.register('net', Net, {
  abilities: ['ajax', 
    ['jsonp', { timeout: 5000 }]
  ],
});

ds.net.request('/api.aaa.bbb', {
  type: 'jsonp',
  data: { id: 1001 },
});
  1. 初始化时指定数据处理中间件
import { middlewares } from '@irim/ds-net';

ds.setConfig({ net: {
  middlewares: [
    middlewares.printLogger,
    middlewares.delay,

    async ctx => {
      // do something...
      await ctx.next();
      // do something...
    }
  ],
}});

术语规范

参数名规范

  • api 定义接口名,url 不再使用
  • search 用于拼接在请求的 URL 中,即 GET 请求
  • payload 用于传 POST|PUT 请求的数据传输
  • data 用于通用的传递数据或请求参数,queryparams 不再使用(可在中间件作兼容)
  • options 方法的通用参数名,settingsprops 不再使用
  • response 用于定义服务器响应后的数据
  • message 用于定义服务器响应的错误消息

LICENSE

BSD-3-Clause License