
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
ml-game-loop
Advanced tools
Simple game loop that allow queue of sync instructions.
npm install ml-game-loop --save
'use strict';
var GameLoop = require('ml-game-loop');
var loop = new GameLoop(),
i = 0;
// this will run every time loop is started
// every time will have counter instead writing new line
loop.add(function (time, diff) {
// time is current timestamp with milliseconds
// diff is a time that passed since last execution
process.stdout.write("\r every time!" + String(i++));
});
// this will run every after at least 100ms pass but always after previous callback
loop.throttle(100, function (time, diff) {
process.stdout.write("\n* EVERY 100 MS !!!!!! *\n");
});
// as above but after 1000ms and it is named "every-second"
loop.throttle(1000, function (time, diff) {
process.stdout.write("\n*** ALWAYS AFTER 1 SECOND - 1000 MS !!!!!! ***\n");
}, 'every-second');
/*
* start loop, remember that callback always run in same order so if all three callbacks are valid (and all are on first start)
* you will see three sentences
* - every time! X
* - * EVERY 100 MS !!!!!! *
* - *** ALWAYS AFTER 1 SECOND - 1000 MS !!!!!! ***
* ALWAYS in same order
*/
loop.start();
setTimeout(function () {
// this will pause the loop after 5 seconds
loop.pause();
// this will stop execution of "every-second" callback, use loop.enable('every-second') to resume it
loop.disable('every-second');
}, 5000);
setTimeout(function () {
// this will pause the loop after 7 seconds, 2 seconds after pause
loop.resume();
}, 7000);
setTimeout(function () {
// this will stop the program after 10 seconds of working
loop.stop();
}, 10000);
FAQs
Simple game loop
We found that ml-game-loop 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.