This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const createSocketMiddleware = function(socket, {eventName = 'action'} = {}) { | |
| return ({dispatch}) => { | |
| socket.on(eventName, dispatch); | |
| return (next) => (action) => { | |
| if(action.hasOwnProperty('server')) socket.emit(eventName, action); | |
| return next(action); | |
| }; | |
| }; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isEqual(obj1, obj2) { | |
| const props1 = Object.getOwnPropertyNames(obj1); | |
| const props2 = Object.getOwnPropertyNames(obj2); | |
| if(props1.length != props2.length) { | |
| return false; | |
| } | |
| for(let i = 0; i < props1.length; i++) { | |
| const propName = props1[i]; | |
| if(obj1[propName] !== obj2[propName]) { |
NewerOlder