Files
2020-08-15 16:08:10 +08:00

26 lines
486 B
JavaScript

/**
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
*/
import { createAction } from 'common/redux';
export const pingSuccess = createAction(
'ping/success',
ping => {
const now = Date.now();
const roundtrip = (now - ping.sentAt) * 0.5;
return {
payload: {
lastId: ping.id,
roundtrip,
},
meta: { now },
};
}
);
export const pingFail = createAction('ping/fail');
export const pingReply = createAction('ping/reply');