npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-emulatorjs

v2.2.6

Published

React wrapper for emulatorjs

Downloads

123

Readme

react-emulatorjs 🕹️

[![Button Playground]][Playground] [![Button NPM]][NPM] [![Button Gihub]][Github] [![Button API]][API]

what is emulatorjs

Emulatorjs is a js library to configure and run retro games in web version of retroarch with great UI and features like save states, capturing screenshots, configuring controls, etc... Emulatorjs team did the great job to compile retroarch cores. Check out cores list.

what is react-emulatorjs

react-emulatorjs is a easiest way to use emulatorjs in React with full typescript support including all emulatorjs options. Available cores, available options.

⚡ quick start

Install react-emulatorjs

npm install react-emulatorjs

Next we have to provide url to ROM. It can be somewhere in the internet. Or we can upload a local file. Let's create a file handler to make url to our local blob.

Next we have to select core and start the emulator when the rom is ready.

import { ChangeEvent, useState } from "react"
import { EmulatorJS } from "react-emulatorjs"

function App() {
  const [rom, setRom] = useState<string>()

  const onFileSelect = async (e: ChangeEvent<HTMLInputElement>) => {
    if (!e.target.files?.[0]) return
    const file = e.target.files?.[0]
    setRom(URL.createObjectURL(file))
  }

  return (
    <>
      <input type="file" onChange={onFileSelect} />

      {rom && (
        <EmulatorJS
          EJS_core="nes" // emulator core
          EJS_gameUrl={rom} // rom url
        />
      )}
    </>
  )
}

And thats all! Now You can run nes roms in browser.

Checkout codesandbox demo with this code.

📎 using locally installed cores

The most important option is EJS_pathtodata. This path points to emulatorjs's binaries. And the best performance option is keep them close as possible, on Your sever. And it is very easy.

  • Just extract data folder from latest emulatorjs release and copy in to project's public folder. For example, if You are using 'vite' data folder should be in /public/data.
  • Update prop with new path
    <EmulatorJS
        //...
        EJS_pathtodata="/data"
    />

Docs and examples