@fmdeui/fmui 1.0.22 → 1.0.23

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.
@@ -2,46 +2,50 @@ import * as SignalR from '@microsoft/signalr';
2
2
  import { ElNotification } from 'element-plus';
3
3
  import { getToken } from './request.mjs';
4
4
 
5
- const connection = new SignalR.HubConnectionBuilder().configureLogging(SignalR.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${getToken()}`, { transport: SignalR.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
6
- nextRetryDelayInMilliseconds: () => {
7
- return 5e3;
8
- }
9
- }).build();
10
- connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
11
- connection.serverTimeoutInMilliseconds = 30 * 1e3;
12
- connection.start().then(() => {
13
- });
14
- connection.onclose(async () => {
15
- });
16
- connection.onreconnecting(() => {
17
- ElNotification({
18
- title: "\u63D0\u793A",
19
- message: "\u8FDE\u63A5\u5DF2\u65AD\u5F00 >>>>>",
20
- type: "error",
21
- position: "bottom-right"
5
+ if (!window.__SIGNALR_INSTANCE__) {
6
+ const connection = new SignalR.HubConnectionBuilder().configureLogging(SignalR.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${getToken()}`, { transport: SignalR.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
7
+ nextRetryDelayInMilliseconds: () => {
8
+ return 5e3;
9
+ }
10
+ }).build();
11
+ connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
12
+ connection.serverTimeoutInMilliseconds = 30 * 1e3;
13
+ connection.start().then(() => {
22
14
  });
23
- });
24
- connection.onreconnected(() => {
25
- ElNotification({
26
- title: "\u63D0\u793A",
27
- message: "\u8FDE\u63A5\u5DF2\u6062\u590D >>>>>",
28
- type: "success",
29
- position: "bottom-right"
15
+ connection.onclose(async () => {
30
16
  });
31
- });
32
- connection.on("OnlineUserList", () => {
33
- });
34
- connection.on("ReceiveMessage", (message) => {
35
- var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
36
- tmpMsg += `<p style="color:#808080; font-size:10px;float:right"> ${message.sendUserName} ${message.sendTime}<p>`;
37
- ElNotification({
38
- title: `${message.title}`,
39
- message: tmpMsg,
40
- type: message.messageType.toString().toLowerCase(),
41
- position: "top-right",
42
- dangerouslyUseHTMLString: true,
43
- duration: 5e3
17
+ connection.onreconnecting(() => {
18
+ ElNotification({
19
+ title: "\u63D0\u793A",
20
+ message: "\u8FDE\u63A5\u5DF2\u65AD\u5F00 >>>>>",
21
+ type: "error",
22
+ position: "bottom-right"
23
+ });
44
24
  });
45
- });
25
+ connection.onreconnected(() => {
26
+ ElNotification({
27
+ title: "\u63D0\u793A",
28
+ message: "\u8FDE\u63A5\u5DF2\u6062\u590D >>>>>",
29
+ type: "success",
30
+ position: "bottom-right"
31
+ });
32
+ });
33
+ connection.on("OnlineUserList", () => {
34
+ });
35
+ connection.on("ReceiveMessage", (message) => {
36
+ var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
37
+ tmpMsg += `<p style="color:#808080; font-size:10px;float:right"> ${message.sendUserName} ${message.sendTime}<p>`;
38
+ ElNotification({
39
+ title: `${message.title}`,
40
+ message: tmpMsg,
41
+ type: message.messageType.toString().toLowerCase(),
42
+ position: "top-right",
43
+ dangerouslyUseHTMLString: true,
44
+ duration: 5e3
45
+ });
46
+ });
47
+ window.__SIGNALR_INSTANCE__ = connection;
48
+ }
49
+ const signalR = window.__SIGNALR_INSTANCE__;
46
50
 
47
- export { connection as signalR };
51
+ export { signalR };
@@ -1,3 +1,7 @@
1
1
  import * as SignalR from '@microsoft/signalr';
2
- declare const connection: SignalR.HubConnection;
3
- export { connection as signalR };
2
+ export declare const signalR: SignalR.HubConnection;
3
+ declare global {
4
+ interface Window {
5
+ __SIGNALR_INSTANCE__: SignalR.HubConnection;
6
+ }
7
+ }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.22 */
1
+ /*! fmdeui-fmui v1.0.23 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pinia'), require('crypto-js'), require('xlsx-js-style'), require('element-plus'), require('vue'), require('@element-plus/icons-vue'), require('axios'), require('js-cookie'), require('@microsoft/signalr'), require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('vue-i18n'), require('exceljs'), require('lodash-es'), require('@vueuse/core'), require('mitt'), require('vue-router'), require('nprogress')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'pinia', 'crypto-js', 'xlsx-js-style', 'element-plus', 'vue', '@element-plus/icons-vue', 'axios', 'js-cookie', '@microsoft/signalr', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'vue-i18n', 'exceljs', 'lodash-es', '@vueuse/core', 'mitt', 'vue-router', 'nprogress'], factory) :
@@ -1690,51 +1690,55 @@
1690
1690
  return entity;
1691
1691
  }
1692
1692
 
1693
- const connection = new SignalR__namespace.HubConnectionBuilder().configureLogging(SignalR__namespace.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${getToken()}`, { transport: SignalR__namespace.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
1694
- nextRetryDelayInMilliseconds: () => {
1695
- return 5e3;
1696
- }
1697
- }).build();
1698
- connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
1699
- connection.serverTimeoutInMilliseconds = 30 * 1e3;
1700
- connection.start().then(() => {
1701
- });
1702
- connection.onclose(async () => {
1703
- });
1704
- connection.onreconnecting(() => {
1705
- elementPlus.ElNotification({
1706
- title: "\u63D0\u793A",
1707
- message: "\u8FDE\u63A5\u5DF2\u65AD\u5F00 >>>>>",
1708
- type: "error",
1709
- position: "bottom-right"
1693
+ if (!window.__SIGNALR_INSTANCE__) {
1694
+ const connection = new SignalR__namespace.HubConnectionBuilder().configureLogging(SignalR__namespace.LogLevel.Warning).withUrl(`${window.__env__.VITE_API_URL}/hubs/onlineUser?token=${getToken()}`, { transport: SignalR__namespace.HttpTransportType.WebSockets, skipNegotiation: true }).withAutomaticReconnect({
1695
+ nextRetryDelayInMilliseconds: () => {
1696
+ return 5e3;
1697
+ }
1698
+ }).build();
1699
+ connection.keepAliveIntervalInMilliseconds = 15 * 1e3;
1700
+ connection.serverTimeoutInMilliseconds = 30 * 1e3;
1701
+ connection.start().then(() => {
1710
1702
  });
1711
- });
1712
- connection.onreconnected(() => {
1713
- elementPlus.ElNotification({
1714
- title: "\u63D0\u793A",
1715
- message: "\u8FDE\u63A5\u5DF2\u6062\u590D >>>>>",
1716
- type: "success",
1717
- position: "bottom-right"
1703
+ connection.onclose(async () => {
1718
1704
  });
1719
- });
1720
- connection.on("OnlineUserList", () => {
1721
- });
1722
- connection.on("ReceiveMessage", (message) => {
1723
- var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
1724
- tmpMsg += `<p style="color:#808080; font-size:10px;float:right"> ${message.sendUserName} ${message.sendTime}<p>`;
1725
- elementPlus.ElNotification({
1726
- title: `${message.title}`,
1727
- message: tmpMsg,
1728
- type: message.messageType.toString().toLowerCase(),
1729
- position: "top-right",
1730
- dangerouslyUseHTMLString: true,
1731
- duration: 5e3
1705
+ connection.onreconnecting(() => {
1706
+ elementPlus.ElNotification({
1707
+ title: "\u63D0\u793A",
1708
+ message: "\u8FDE\u63A5\u5DF2\u65AD\u5F00 >>>>>",
1709
+ type: "error",
1710
+ position: "bottom-right"
1711
+ });
1732
1712
  });
1733
- });
1713
+ connection.onreconnected(() => {
1714
+ elementPlus.ElNotification({
1715
+ title: "\u63D0\u793A",
1716
+ message: "\u8FDE\u63A5\u5DF2\u6062\u590D >>>>>",
1717
+ type: "success",
1718
+ position: "bottom-right"
1719
+ });
1720
+ });
1721
+ connection.on("OnlineUserList", () => {
1722
+ });
1723
+ connection.on("ReceiveMessage", (message) => {
1724
+ var tmpMsg = `<div style="white-space: pre-wrap;">${message.message}<div><br/>`;
1725
+ tmpMsg += `<p style="color:#808080; font-size:10px;float:right"> ${message.sendUserName} ${message.sendTime}<p>`;
1726
+ elementPlus.ElNotification({
1727
+ title: `${message.title}`,
1728
+ message: tmpMsg,
1729
+ type: message.messageType.toString().toLowerCase(),
1730
+ position: "top-right",
1731
+ dangerouslyUseHTMLString: true,
1732
+ duration: 5e3
1733
+ });
1734
+ });
1735
+ window.__SIGNALR_INSTANCE__ = connection;
1736
+ }
1737
+ const signalR$1 = window.__SIGNALR_INSTANCE__;
1734
1738
 
1735
- var signalR$1 = /*#__PURE__*/Object.freeze({
1739
+ var signalR$2 = /*#__PURE__*/Object.freeze({
1736
1740
  __proto__: null,
1737
- signalR: connection
1741
+ signalR: signalR$1
1738
1742
  });
1739
1743
 
1740
1744
  const setWatermark = (str) => {
@@ -18797,7 +18801,7 @@
18797
18801
  let signalR;
18798
18802
  async function loadSignalR() {
18799
18803
  if (!signalR) {
18800
- const module = await Promise.resolve().then(function () { return signalR$1; });
18804
+ const module = await Promise.resolve().then(function () { return signalR$2; });
18801
18805
  signalR = module.signalR;
18802
18806
  }
18803
18807
  return signalR;
@@ -23155,7 +23159,7 @@
23155
23159
  exports.setJsCdn = setJsCdn;
23156
23160
  exports.setPathPrefix = setPathPrefix;
23157
23161
  exports.setupI18n = setupI18n;
23158
- exports.signalR = connection;
23162
+ exports.signalR = signalR$1;
23159
23163
  exports.signatureByKSort = signatureByKSort;
23160
23164
  exports.sleep = sleep;
23161
23165
  exports.tansParams = tansParams;