Add some docs

This commit is contained in:
Chi Vinh Le
2017-11-21 12:42:17 +01:00
parent 548a204665
commit 5360bdc8ec
2 changed files with 11 additions and 0 deletions
@@ -18,11 +18,13 @@ class AssetStatusInfo extends React.Component {
this.setupTimer(nextProps);
}
// Rerendering interval. If remaining time > 1min, rerender every minute, otherwise evey second.
interval(closedAt) {
const diff = new Date(closedAt).getTime() - new Date().getTime();
return diff > 60000 ? 60000 : 1000;
}
// Timer that counts down the remaining time.
setupTimer({closedAt, isClosed} = this.props) {
if (this.timer && (isClosed || !closedAt)) {
clearTimeout(this.timer);
@@ -3,6 +3,15 @@ import assignWith from 'lodash/assignWith';
import get from 'lodash/get';
import {withPropsOnChange} from 'recompose';
/**
* Exports a HOC that applies props at `pending` to
* props at `settings` and writes into `result` prop name.
* `Settings`, and `pending` can have a dotnotation like
* "asset.settings".
*
* Example:
* withMergedSettings('asset.settings', 'pending', 'mergedSettings')
*/
const withMergedSettings = (settings, pending, result) =>
withPropsOnChange(
(props, nextProps) =>