nfl / react-gpt

A React display ad component using Google Publisher Tag
MIT License
145 stars 84 forks source link

Expose onScriptRequestStarted and onScriptError callbacks via props #87

Open AlexisGlez opened 6 years ago

AlexisGlez commented 6 years ago

Description

It would be cool and really helpful if the Bling component can receive the props onScriptRequestStarted and onScriptError so the users can get these callbacks in their application.

Use Case Example

If we wrap this component with another one to display a progress bar while the ad is being requested, we can simplify the logic in our application to replace the progress bar with another thing if an error occurred.

Implementation Suggestion

The implementation for this would be really simple, in the Bling's componentDidMount we would call this.props.onScriptRequestStarted() method and in the function onScriptError we would call this.props.onScriptError()

Note: Maybe the callbacks can have a different name 😄