
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
HTML 5 Gamepad controller input (works on latest Chrome), magically beamed to your node.js application over a web socket.
See the demo directory, specifically demo/app.js
for a simple example. Requiring the starfox
module returns a singleton object, which is an EventEmitter.
var starfox = require('starfox');
// Pass an HTTP server in to the module
starfox.mount(httpServerYouCreate, {
url: '', // the prefix URL for the JS file sent to the client, default none
port: 8080 // port for web socket server, default 8080
});
// Each connection represents a single client, who might have multiple
// gamepads attached.
starfox.on('connection', function(player) {
// Whenever the state of the gamepad changes (e.g. once when the button
// is pressed, and again when it is let go), this event is fired
player.on('input', function(gamepadState) {
console.log(gamepadState);
});
// Whenever a gamepad is connected or disconnected, this event fires
player.on('gamepadsChanged', function(gamepads) {
console.log(gamepads);
});
});
The browser API for Starfox is generated on the server using browserify. It can be included as a script tag, or your client-side application can require it and use it with browserify. A simple demo usage is in demo/demo.html
, but here's a bit more color on the API:
<script src="/starfox.js"></script>
<script>
var sf = new Starfox(); // parameter is the websocket URL to use,
// default is ws://+document.domain+8080
// Emits a ready event when socket connects
sf.on('ready', function() {
console.log('It\'s about time you showed up, Fox. You\'re the only hope for our world!');
});
// Optional: listen for controller events on the client too:
sf.on('input', function(gamepadState) {
console.log(gamepadState);
});
sf.on('gamepadsChanged', function(gamepads) {
console.log(gamepads);
});
</script>
MIT
FAQs
HTML 5 Gamepad input, streamed to node via websockets
The npm package starfox receives a total of 2 weekly downloads. As such, starfox popularity was classified as not popular.
We found that starfox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.