
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
cache-per-frame
Advanced tools
Cache the result of a function once per frame. Built for VRDisplay.getFrameData(frameData)
when working with several third party modules that call this once per frame. Does not
memoize via arguments, but only uses the arguments from the first call to the wrapped
function per frame.
Use the browser-ready bundle at dist/cache-per-frame.js:
<script src='cache-per-frame.js'></script>
<script>
var nativeGetFrameData = VRDisplay.prototype.getFrameData;
VRDisplay.prototype.getFrameData = cachePerFrame(function (fd) {
return nativeGetFrameData.call(this, fd);
});
</script>
Or install via npm/yarn:
$ npm install cache-per-frame --save
const cachePerFrame = require('cache-per-frame');
var nativeGetFrameData = VRDisplay.prototype.getFrameData;
VRDisplay.prototype.getFrameData = cachePerFrame(function (fd) {
return nativeGetFrameData.call(this, fd);
});
The root module is a function cachePerFrame(fn)
that takes a function fn
and returns
a new wrapped form of that function that is throttled per frame. This wrapped function
also has two additional methods for stopping and starting the throttling. By default,
the wrapped function is already started.
Stop throttling the function calls once per frame.
Start throttling the function calls once per frame.
Apache License Version 2.0 (see LICENSE)
FAQs
Cache the result of a function once per frame
The npm package cache-per-frame receives a total of 0 weekly downloads. As such, cache-per-frame popularity was classified as not popular.
We found that cache-per-frame 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.