Skip to content

Commit

Permalink
Add loadEventCallback
Browse files Browse the repository at this point in the history
The snippet allows for a callback on certain methods. Since the React SDK handles _ps("load") under the hood we need allow users to specify an error handling callback for this method.
  • Loading branch information
jasonabrown authored Apr 26, 2024
1 parent 9aff565 commit cd3bc30
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/PSClickWrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class PSClickWrap extends React.Component {
signerIdSelector,
snapshotLocation,
allowDisagreed,
loadEventCallback,
} = this.props;
const options = {
...(allowDisagreed !== undefined && { allow_disagreed: allowDisagreed }),
Expand Down Expand Up @@ -255,6 +256,7 @@ class PSClickWrap extends React.Component {
if (!isDynamic) group.render();
this.registerEventListeners(key);
}
loadEventCallback && loadEventCallback(err, group);
};

if (customData) {
Expand Down Expand Up @@ -334,6 +336,7 @@ PSClickWrap.propTypes = {
(props) => props.hasOwnProperty('onInvalid'),
PSClickWrap.MUST_SET_ALLOW_DISAGREED,
),
loadEventCallback: PropTypes.func,
debug: PropTypes.bool,
onAll: PropTypes.func,
onSent: PropTypes.func,
Expand Down

0 comments on commit cd3bc30

Please sign in to comment.