component-shipinlv 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import './index.less';
3
3
  interface Props {
4
4
  productType: string;
5
5
  port?: number;
6
+ onRunStatus: (runStatus: SubClient.RunStatus) => void;
6
7
  }
7
8
  declare const JoinClient: React.FC<Props>;
8
9
  export default JoinClient;
@@ -1,7 +1,7 @@
1
1
  import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
- import React, { useRef, useState } from 'react';
4
+ import React, { useEffect, useRef, useState } from 'react';
5
5
  import * as SubClientController from "../service/api/SubClientController";
6
6
  import { useRequest } from '@umijs/hooks';
7
7
  import "./index.less";
@@ -16,7 +16,9 @@ var TryRunStatusIntervalMillisecond = 1000;
16
16
  var JoinClient = function JoinClient(_ref) {
17
17
  var productType = _ref.productType,
18
18
  _ref$port = _ref.port,
19
- port = _ref$port === void 0 ? 0 : _ref$port;
19
+ port = _ref$port === void 0 ? 0 : _ref$port,
20
+ _ref$onRunStatus = _ref.onRunStatus,
21
+ onRunStatus = _ref$onRunStatus === void 0 ? function () {} : _ref$onRunStatus;
20
22
  var _useState = useState('loading'),
21
23
  _useState2 = _slicedToArray(_useState, 2),
22
24
  runStatus = _useState2[0],
@@ -25,6 +27,8 @@ var JoinClient = function JoinClient(_ref) {
25
27
  var _useRequest = useRequest(function () {
26
28
  return SubClientController.start({
27
29
  productType: productType
30
+ }, {
31
+ silent: true
28
32
  });
29
33
  }, {
30
34
  // manual: true,
@@ -190,6 +194,9 @@ var JoinClient = function JoinClient(_ref) {
190
194
  children: runStatus
191
195
  });
192
196
  };
197
+ useEffect(function () {
198
+ onRunStatus(runStatus);
199
+ }, [runStatus]);
193
200
  return /*#__PURE__*/_jsxs("div", {
194
201
  className: "clientStatus",
195
202
  children: [$status(), /*#__PURE__*/_jsx(Divider, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",