disqus / disqus-react

A React component for Disqus
MIT License
369 stars 46 forks source link

Add callbacks support #62

Closed poohitan closed 4 years ago

poohitan commented 4 years ago

Added support for built-in Disqus callbacks.

Motivation and Context

Currently this module support only onNewComment callback, however more callbacks are available in Disqus. This is the full list of callbacks found in Disqus embed.js script:

After a few tests I've found that actually only onNewComment and onReady are firing, maybe the rest are reserved for the future.

This PR fixes #61.

How Has This Been Tested?

I built the package and tested it on my own website.

Types of changes

Checklist:

tterb commented 4 years ago

@poohitan It looks like another Disqus user submitted a discussion with similar findings, but seemed to believe that onPaginate() was firing as well.
https://disqus.com/home/discussion/channel-discussdisqus/api_supported_callbacks/

I can test these this evening and see what I'm able to get working, but I think we'll probably only want to add support for the callbacks that we're able to confirm are working.

poohitan commented 4 years ago

@tterb I saw that discussion as well and tried the onPaginate callback, but with no success, not sure what's the reason. Tested it with 55 comments, 5 of which went to the second page (so I believe onPaginate should have fired when I clicked to load more comments).

Maybe we can document only those which are already working but leave the code as it is in case other callbacks will start working in the future? Anyway, looking forward to your feedback.

poohitan commented 4 years ago

@tterb thanks!