MCPcopy
hub / github.com/adobe-webplatform/Snap.svg / cacher

Function cacher

src/svg.js:250–266  ·  view source on GitHub ↗
(f, scope, postprocessor)

Source from the content-addressed store, hash-verified

248 }
249}
250function cacher(f, scope, postprocessor) {
251 function newf() {
252 var arg = Array.prototype.slice.call(arguments, 0),
253 args = arg.join("\u2400"),
254 cache = newf.cache = newf.cache || {},
255 count = newf.count = newf.count || [];
256 if (cache[has](args)) {
257 repush(count, args);
258 return postprocessor ? postprocessor(cache[args]) : cache[args];
259 }
260 count.length >= 1e3 && delete cache[count.shift()];
261 count.push(args);
262 cache[args] = f.apply(scope, arg);
263 return postprocessor ? postprocessor(cache[args]) : cache[args];
264 }
265 return newf;
266}
267Snap._.cacher = cacher;
268function angle(x1, y1, x2, y2, x3, y3) {
269 if (x3 == null) {

Callers 2

svg.jsFile · 0.70
toHexFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected