From d66dbcda31c660fd2b4ca576cb413a5740502981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20BOULETKESSLER?= Date: Mon, 21 Aug 2017 09:46:10 +0200 Subject: [PATCH] rename register methods --- README.md | 4 ++-- src/component/index.js | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 01218c7..5d10025 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/component/index.js b/src/component/index.js index 4a10f32..567b501 100644 --- a/src/component/index.js +++ b/src/component/index.js @@ -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 = { @@ -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 { @@ -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); @@ -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());