-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In-browser use #96
Comments
Hi @zuzanna-maria If you use Webpack or similar tools, you would add the library to your npm dependencies, import it and get it compiled with your code. That's what I did in (https://www.elzear.de/poll/Uug62KMX) and https://rank-votes.vercel.app (code source is here: https://github.com/lzear/votes/tree/master/demo). It's used like the example in the readme: https://github.com/lzear/votes#%EF%B8%8F-use If you want to import the library without using a bundler, it is now doable by importing the IIFE module compiled at <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.global.js"></script>
<script>
console.log(window.votes)
// shows
// {
// AbsoluteMajority: (...)
// Approbation: (...)
// Baldwin: (...)
// Borda: (...)
// BottomTwoRunoff: (...)
// Coombs: (...)
// Copeland: (...)
// FirstPastThePost: (...)
// InstantRunoff: (...)
// Kemeny: (...)
// MajorityJudgment: (...)
// MaximalLotteries: (...)
// Minimax: (...)
// MinimaxTD: (...)
// MinimaxVariant: (...)
// Nanson: (...)
// RandomCandidates: (...)
// RandomDictator: (...)
// RandomizedCondorcet: (...)
// RankedPairs: (...)
// Schulze: (...)
// Smith: (...)
// TwoRoundRunoff: (...)
// VotingSystem: (...)
// isBallotMethod: (...)
// isBallotSystem: (...)
// isMatrixMethod: (...)
// isMatrixSystem: (...)
// isRandomMethod: (...)
// isRandomSystem: (...)
// methods: (...)
// utils: (...)
// }
</script> Here is an example: https://codesandbox.io/s/votes-iife-demo-gv6vz7?file=/index.html:233-294 |
Hi,
have you tried/had success with adapting this package for in-browser use?
The text was updated successfully, but these errors were encountered: