Getting Started
Try it in Devtools of your browser in this website
You can open the Devtools here(maybe Ctrl + Shift + J on Windows/Linux and ⌘ + ⌥ + J on macOS) and try Nostalgist.js with global variable Nostalgist
. No extra setup is required.
// launch an NES gameawait Nostalgist.nes('flappybird.nes')
// launch a Sega Genesis gameawait Nostalgist.megadrive('30yearsofnintendont.bin')
// launch a GBA gameawait Nostalgist.gba('eliminator.gba')
// or choose a ROM file from your diskawait Nostalgist.nes(await showOpenFilePicker().then(([fileHandle]) => fileHandle.getFile()))
Try it in online editors
You can also use some online editor to give it a try.
You can try Nostalgist.js in Stackblitz by hacking this example, a homebrew retro game list.
Build something more complex
If you want to use Nostialgist.js to build something cool, here are some choices to import it into your project.
Use a package manager
If you are building a modern frontend project, you can use npm or its alternatives to install it to your project.
npm i nostalgist
yarn add nostalgist
pnpm i nostalgist
bun i nostalgist
Then you can import it and start hacking.
import { Nostalgist } from 'nostalgist'
await Nostalgist.nes('flappybird')
Use a CDN
Simplely add a script tag with a CDN link to your HTML.
<script src="https://unpkg.com/nostalgist"></script>
<script src="https://cdn.jsdelivr.net/npm/nostalgist"></script>
Then you can use the global variable Nostalgist
in your code and start hacking.
await Nostalgist.nes('flappybird')
You can also use the ESM version of Nostalgist.js with CDN.
<script type="module">import { Nostalgist } from 'https://esm.run/nostalgist'</script>
<script type="module">import { Nostalgist } from 'https://cdn.skypack.dev/nostalgist'</script>
Next steps
You may want to read the API reference.