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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@anikthedev/nwruffle

v2.0.1

Published

the wonders of ruffle and nw.js mixed with an easy api

Readme

NWRuffle

This NWRuffle project combines and helps you to add Ruffle support to your NW.js projects with adding an api that just makes it so easy to handle ruffle npm commit

📘 Table of Contents

Overview

NWRuffle provides an easy way to add Ruffle support to your NW.js projects, Once set up, it automatically includes ruffle.js and allows you to do all the normal ruffle stuff


Installation

  1. Download the NWRuffle project by doing :
npm install @anikthedev/nwruffle
  1. In your NW.js package.json, add the dependecies
"dependencies": {
  "@ruffle-rs/ruffle": "latest"
  "nwruffle": "latest"
}
  1. (remember) add this in html <script src="node_modules/nwruffle/bootstrap.js"></script> and installation done.

Adding & Customizing ruffle

THERE IS AN EXAMPLE HERE!. Ruffle must be included in your HTML. Since NWRuffle handles script injection automatically, you only need to add the configuration and player container in your HTML file Example Setup

<div id="flash-content"></div>


  <script>
    function waitForRuffle(cb) {
      if (window.RufflePlayer) cb();
      else requestAnimationFrame(() => waitForRuffle(cb));
    }

    waitForRuffle(() => {
      const container = document.getElementById("flash-content");

      const ruffle = window.RufflePlayer.newest();
      const player = ruffle.createPlayer();

      Object.assign(player.style, {
        width: "100%",
        height: "100%",
        display: "block"
      });


      container.appendChild(player);


      player.load("file.swf");

      console.log("[NWRuffle] SWF loaded: file.swf");
    });
  </script>

Troubleshooting & Issues

If you encounter issues:

  1. Ruffle-related issues: Report Here
  2. NW.js-related issues: Report Here
  3. NWRuffle-specific issues or feature requests: Report Here

API

Why NWRuffle? Normally, setting up Ruffle looks like this:

    function waitForRuffle(cb) {
      if (window.RufflePlayer) cb();
      else requestAnimationFrame(() => waitForRuffle(cb));
    }

    waitForRuffle(() => {
      const container = document.getElementById("flash-content");

      const ruffle = window.RufflePlayer.newest();
      const player = ruffle.createPlayer();

      Object.assign(player.style, {
        width: "100%",
        height: "100%",
        display: "block"
      });


      container.appendChild(player);


      player.load("file.swf");

      console.log("[NWRuffle] SWF loaded: file.swf");
    });

With NWRuffle, the same thing becomes:

NWRuffle.initialize(() => {
NWRuffle.container("flash-content");

Object.assign(NWRuffle.player.style, {
  width: "100%",
  height: "100%",
  display: "block"
});
NWRuffle.player.load("file.swf");
});

So now it’s cleaner, easier to read, and nicer to work with :)


  • NWRuffle.initialize();    is VERY important, you must call this first.   It waits for Ruffle to be ready and then runs your code.   it can also be run as   
NWRuffle.initialize(() => {
  // cats please
  });

  • NWRuffle.container("flash-content");   creates the Ruffle player and   attaches it to your container.   After this runs, "NWRuffle.player" will exist. ()

  • NWRuffle.player   is the Ruffle player instance.   It is created after calling NWRuffle.container(...).

  You can use it like a normal Ruffle player, for example:

Object.assign(NWRuffle.player.style, {
width: "100%",
height: "100%",
display: "block"
});

  And load SWF files like this:

NWRuffle.player.load("file.swf");

  • NWRuffle.swap(swf)   Replaces the currently loaded SWF with another one   without destroying the player.   Example :
NWRuffle.swap("cats.swf");

  • NWRuffle.destroy() Completely removes the Ruffle player from the DOM. After calling this, the player no longer exists.

  • NWRuffle.reinstate()   Recreates the player after it was   destroyed.   Useful if you want to reload or   reset everything.

sidequote - "if it can die it can re-exist"


  • NWRuffle.fullscreen()   Toggles fullscreen mode for the   Ruffle player.

  • NWRuffle.setSize(w, h)   Manually sets the player size.

  Example:

NWRuffle.setSize(800, 600);

THE VAULT OF EVERY API I HAVE

window.NWRuffle → The global object exposing all NWRuffle APIs (initialize, container, load, swap, destroy, reinstate, fullscreen, setSize, and internal references like main, player, containerEl, lastSWF)

NWRuffle.initialize(cb)          → Waits for Ruffle to be loaded and initializes NWRuffle; calls optional callback when ready.
NWRuffle.container(id)          → Sets the HTML element (by id) where the SWF will be injected.
NWRuffle.load(swf)              → Loads the specified SWF into the container and replaces any existing player.
NWRuffle.swap(swf)              → Swaps the currently loaded SWF for a new one without recreating the container.
NWRuffle.destroy()               → Removes the current Ruffle player from the container.
NWRuffle.reinstate()             → Recreates the last destroyed Ruffle player and reloads the last SWF.
NWRuffle.fullscreen()            → Puts the container into fullscreen mode using the browser API.
NWRuffle.setSize(w, h)           → Resizes the container to the specified width and height in pixels.
NWRuffle.main                    → Reference to `window.RufflePlayer.newest()`, the main Ruffle instance.
NWRuffle.player                  → Reference to the currently active Ruffle player (<ruffle-player> element).
NWRuffle.containerEl             → Reference to the DOM element used as the container for the player.
NWRuffle.lastSWF                 → Stores the path/URL of the last loaded SWF for reinstate and swap.

bye!!


Contributing

Contributions, suggestions, and improvements are always welcome! Feel free to submit a pull request or open an issue.

End

images

me NW.js general gary