Skip to content

Commit

Permalink
rename register methods
Browse files Browse the repository at this point in the history
  • Loading branch information
c3dr0x committed Aug 21, 2017
1 parent 6cedd2a commit f54c960
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ Please note that you must you React with addons, so choose the appropriate built
- **messageSentCallback** (`function`): a callback to know when a message has been sent
- **timeDisplay** (`string`): the display format, either `ago` or `dateTime`, `ago` by default
- **dateTimeFormat** (`string`): the dateTime format if **timeDisplay** is set to `dateTime`
- **registerRefreshCommentsCallback** (`function`): method to register a refresh comment callback into parent
- **unregisterRefreshCommentsCallback** (`function`): method to unregister the refresh comment callback from parent
- **registerRefreshCommentsMethod** (`function`): method to register the refresh comment method into parent
- **unregisterRefreshCommentsMethod** (`function`): method to unregister the refresh comment method from parent
20 changes: 10 additions & 10 deletions src/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const propTypes = {
messageSentCallback: PropTypes.func,
timeDisplay: PropTypes.oneOf(['ago', 'dateTime']),
dateTimeFormat: PropTypes.string,
registerRefreshCommentsCallback: PropTypes.func,
unregisterRefreshCommentsCallback: PropTypes.func
registerRefreshCommentsMethod: PropTypes.func,
unregisterRefreshCommentsMethod: PropTypes.func
}

const defaultProps = {
Expand All @@ -50,8 +50,8 @@ const defaultProps = {
locale: 'en',
timeDisplay: 'ago',
dateTimeFormat: 'DD/MM/YYYY HH:mm',
registerRefreshCommentsCallback: undefined,
unregisterRefreshCommentsCallback: undefined
registerRefreshCommentsMethod: undefined,
unregisterRefreshCommentsMethod: undefined
}

class Container extends Component {
Expand All @@ -63,10 +63,10 @@ class Container extends Component {
}

componentWillMount() {
const { dispatch, apiRootUrl, concept, conceptId, locale, registerRefreshCommentsCallback } = this.props;
const { dispatch, apiRootUrl, concept, conceptId, locale, registerRefreshCommentsMethod } = this.props;

if (registerRefreshCommentsCallback) {
registerRefreshCommentsCallback(this._refreshComments);
if (registerRefreshCommentsMethod) {
registerRefreshCommentsMethod(this._refreshComments);
}

moment.locale(this.props.locale);
Expand All @@ -81,10 +81,10 @@ class Container extends Component {
}

componentWillUnmount() {
const { dispatch, unregisterRefreshCommentsCallback } = this.props;
const { dispatch, unregisterRefreshCommentsMethod } = this.props;

if (unregisterRefreshCommentsCallback) {
unregisterRefreshCommentsCallback();
if (unregisterRefreshCommentsMethod) {
unregisterRefreshCommentsMethod();
}

dispatch(clearComments());
Expand Down

0 comments on commit f54c960

Please sign in to comment.