mirror of
https://github.com/wassname/talk.git
synced 2026-07-23 13:10:20 +08:00
Add some docs
This commit is contained in:
@@ -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) =>
|
||||
|
||||
Reference in New Issue
Block a user