Installation
NPM
You can install Newgrounds.js using any of your favorite package managers
npm i newgrounds.js
pnpm add newgrounds.js
yarn add newgrounds.js
bun add newgrounds.js
ni newgrounds.js
import ng from "newgrounds.js";
// Connect to your projectawait ng.connect("533327:b6GaR8Eb", "ivuwzsfewkqñwacRQ==");
// Start using NG.ioawait ng.unlockMedal(129521);await ng.postScore(12052012, 50);
Also using this way you should build your project with a bundler like ESBuild or Webpack. This way has some benefits like autocomplete (thanks to TypeScript), minor bundle size, and tree shaking.
CDN
If you prefer, you can also use a CDN to include Newgrounds.js in your project.
<script src="https://cdn.jsdelivr.net/npm/newgrounds.js/dist/newgrounds.js"></script>
// Then use it with the ng object
ng.connect();ng.unlockMedal(129521);ng.postScore(12052012, 50);