net4j-loading-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

net4j-loading-plugin

Easily to set loading toast when request pending.

import Net from 'net4j';
import { message } from 'antd';
import NetLoading, { PluginConfig } from 'net4j-loading-plugin';

// Merge plugin config to net4j config,then you can use it in every requst in net4j
declare module 'net4j' {
  interface Config extends PluginConfig {}
}

const net = new Net({
  plugins: [
    new NetLoading({
      loading: message.loading,
      defaultLoadingText: '加载中...', // Default is 'loading'
    }),
  ]
});

// When api/goods is pending, message loading will display and close when request finish;
await net.get('api/goods');

Readme

Keywords

Package Sidebar

Install

npm i net4j-loading-plugin

Weekly Downloads

16

Version

1.0.12

License

ISC

Unpacked Size

3.44 kB

Total Files

5

Last publish

Collaborators

  • forthedamn