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 a4a8db7 commit d66dbcd
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 @@ -37,5 +37,5 @@ Please note that you must you React with addons, so choose the appropriate built
- **empty** (`string`): empty caption
- **locale** (`string`): application locale (from [momentJS](http://momentjs.com/docs/#/i18n/changing-locale/)),
- **currentUserId** (`number`): the current user id
- **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 @@ -26,8 +26,8 @@ const propTypes = {
empty: PropTypes.string.isRequired
}).isRequired,
locale: PropTypes.string.isRequired,
registerRefreshCommentsCallback: PropTypes.func,
unregisterRefreshCommentsCallback: PropTypes.func
registerRefreshCommentsMethod: PropTypes.func,
unregisterRefreshCommentsMethod: PropTypes.func
}

const defaultProps = {
Expand All @@ -45,8 +45,8 @@ const defaultProps = {
empty: 'Be the first to leave your comment below !'
},
locale: 'en',
registerRefreshCommentsCallback: undefined,
unregisterRefreshCommentsCallback: undefined
registerRefreshCommentsMethod: undefined,
unregisterRefreshCommentsMethod: undefined
}

class Container extends Component {
Expand All @@ -58,10 +58,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 @@ -76,10 +76,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 d66dbcd

Please sign in to comment.