Demo of web component below
<html> <head> <script src="https://vote-widget.snyk.io/vote.js" type="module"></script> </head> <body> <snyk-vote selector="some-specific-id"></snyk-vote> </body> </html>
The project origin defaults to the current origin the web component is being hosted on, but can be changed via an attribute. It's important that this remains consistent throughout your project to be able to retrieve your content and not cross pollinate other origins.
<snyk-vote origin="advisor.snyk.io" selector="some-specific-id"></snyk-vote>
The vote widget also emits a
vote event, and the direction of vote is contained in the
event.details.positive value -
true if thumbs-up,
false if thumbs-down.