Skip to content

Commit

Permalink
feat(configuration): The refresh mode strategy can now be configured.
Browse files Browse the repository at this point in the history
You can customise the refresh mode strategy by passing in an additional configuration value of

"refreshMode".  The default value is 'throttle', however, it also supports a value of 'debounce'.

If you select 'debounce' then your component will only be measured after the refresh rate has

expired.  This can be quite useful if your component is subject to animations etc.  Typically you

would only want to start measuring your component after the animations complete.
  • Loading branch information
ctrlplusb committed Sep 12, 2016
1 parent b9f06a6 commit 3749f67
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 14 deletions.
6 changes: 5 additions & 1 deletion example/src/MySizeAwareComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ MyComponent.propTypes = {
style: PropTypes.object,
};

export default sizeMe({ monitorHeight: true })(MyComponent);
export default sizeMe({
monitorHeight: true,
refreshRate: 2500,
refreshMode: 'debounce'
})(MyComponent);
Loading

0 comments on commit 3749f67

Please sign in to comment.