wappsto-redux
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -40,11 +40,23 @@ import querystring from 'querystring'; | ||
export function updateStream(name, status, step, ws, json, increment){ | ||
return { | ||
type: UPDATE_STREAM, | ||
name, | ||
status, | ||
step, | ||
ws, | ||
json, | ||
increment | ||
const obj = { type: UPDATE_STREAM }; | ||
if(ws !== undefined){ | ||
websockets[name] = ws; | ||
obj.ws = ws; | ||
} | ||
if(name !== undefined){ | ||
obj.name = name; | ||
} | ||
if(status !== undefined){ | ||
obj.status = status; | ||
} | ||
if(step !== undefined){ | ||
obj.step = step; | ||
} | ||
if(json !== undefined){ | ||
obj.json = json; | ||
} | ||
if(increment !== undefined){ | ||
obj.increment = increment; | ||
} | ||
return obj; | ||
} | ||
@@ -65,6 +77,7 @@ | ||
export function closeStream(name){ | ||
export function closeStream(name, silent = false){ | ||
return (dispatch, getState) => { | ||
_clearStreamTimeouts({ name }); | ||
if (websockets[name]) { | ||
websockets[name].silent = silent; | ||
websockets[name].stop = true; | ||
@@ -233,3 +246,5 @@ websockets[name].close(); | ||
_clearStreamTimeouts(stream); | ||
dispatch(updateStream(stream.name, status.LOST, null, null, stream)); | ||
if(!ws.silent){ | ||
dispatch(updateStream(stream.name, status.LOST, null, null, stream)); | ||
} | ||
if (websockets[stream.name]) { | ||
@@ -242,5 +257,9 @@ websockets[stream.name].stop = true; | ||
} | ||
dispatch(updateStream(stream.name, status.RECONNECTING, steps.CONNECTING.WAITING, ws, stream, true)); | ||
if(!ws.silent){ | ||
dispatch(updateStream(stream.name, status.RECONNECTING, steps.CONNECTING.WAITING, ws, stream, true)); | ||
} | ||
} else { | ||
dispatch(updateStream(stream.name, status.CLOSED, e.code, ws, stream)); | ||
if(!ws.silent){ | ||
dispatch(updateStream(stream.name, status.CLOSED, e.code, ws, stream)); | ||
} | ||
} | ||
@@ -247,0 +266,0 @@ }; |
{ | ||
"name": "wappsto-redux", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -17,17 +17,7 @@ import { UPDATE_STREAM, REMOVE_STREAM, status } from "../actions/stream"; | ||
state[action.name] = { | ||
name: action.name, | ||
status: action.status, | ||
step: action.step, | ||
ws: action.ws, | ||
...state[action.name] || {}, | ||
...action, | ||
count | ||
} | ||
break; | ||
case status.LOST: | ||
state = Object.assign({}, state); | ||
state[action.name] = { | ||
...(state[action.name] || {}), | ||
name: action.name, | ||
status: action.status, | ||
json: action.json, | ||
}; | ||
delete state[action.name].type; | ||
break; | ||
@@ -37,8 +27,6 @@ default: | ||
state[action.name] = { | ||
name: action.name, | ||
status: action.status, | ||
step: action.step, | ||
ws: action.ws, | ||
json: action.json | ||
} | ||
...state[action.name] || {}, | ||
...action | ||
}; | ||
delete state[action.name].type; | ||
break; | ||
@@ -45,0 +33,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48110
1228