Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
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
The npm package ml-game-loop receives a total of 0 weekly downloads. As such, ml-game-loop popularity was classified as not popular.
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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.