ws-process 0.3.45 → 0.3.47

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.
Files changed (2) hide show
  1. package/index.js +14 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import axios from 'axios';
4
4
  import * as Sentry from '@sentry/react';
5
5
  import {
6
- defined, clone, makeid, tryit,
6
+ defined, clone, makeid, tryit, wait,
7
7
  } from '@bsgp/lib-core';
8
8
  import { ref, Loading, getRef } from './Loading-esm';
9
9
  import {
@@ -89,8 +89,14 @@ function getWebSocket() {
89
89
  close()하면 onmessage 이벤트핸들러가 실행중에 중단되어
90
90
  프로그램이 정상적으로 동작하지 않는다.
91
91
  */
92
- if (isPreviewMode() && !existWS.url.endsWith('/dev')) {
93
- //
92
+ if (
93
+ (isPreviewMode() && !existWS.url.endsWith('/dev')) // preview mode
94
+ || (
95
+ !isPreviewMode()
96
+ && existWS.url.endsWith('/dev')
97
+ && window.location.hostname !== 'localhost'
98
+ ) // not preview mode
99
+ ) {
94
100
  if (existWS.readyState === existWS.OPEN) {
95
101
  // existWS.close();
96
102
  local.dispatch(removeWSInstance(existWS, true));
@@ -536,6 +542,7 @@ function handleResponseHandler(res, getState, isLast = true, isFirst = true) {
536
542
  local.dispatch(
537
543
  updateWSProcess(res.processID, {
538
544
  jsonResponse: res,
545
+ cbData,
539
546
  }),
540
547
  );
541
548
 
@@ -1170,7 +1177,7 @@ function runProcess(processID, data) {
1170
1177
  : prcItem.reqParameters;
1171
1178
  if (!reqParameters) {
1172
1179
  local.afterEachProcess(prc, local.wsProcess.processes);
1173
- prc.reject({ requestIsFalsy: true, message: 'No request to send, process is stopped' });
1180
+ prc.reject({ requestIsFalsy: true, message: 'No request to send, process is stopped', cbData: prevPrcItem.cbData });
1174
1181
  wrapClearWSProcess(processID);
1175
1182
  return;
1176
1183
  }
@@ -1212,12 +1219,13 @@ function runProcess(processID, data) {
1212
1219
  }),
1213
1220
  );
1214
1221
 
1215
- dispatch(
1222
+ const delaySeconds = prcItem.delaySeconds || 0;
1223
+ wait(delaySeconds).then(() => dispatch(
1216
1224
  asyncSend({
1217
1225
  ...(reqParameters || prcItem.reqParameters),
1218
1226
  processID,
1219
1227
  }),
1220
- )
1228
+ ))
1221
1229
  .then((dataInner) => {
1222
1230
  const prcInner = local.wsProcess.processes[dataInner.processID];
1223
1231
  const promise = dispatch(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws-process",
3
- "version": "0.3.45",
3
+ "version": "0.3.47",
4
4
  "description": "Process Management for Web Socket Client",
5
5
  "main": "index.js",
6
6
  "scripts": {