Comments (2)
@outlawpractice Sorry for the delay. In a Forest Gump kind of moment, I simply stopped writing code late December. I used to write code at least 2 hours every day as a hobby. Here is some guidance:
- Add a property "deps" to the argument "o", see line 28
function nanomemoize(fn,o) {
/*o = {
serializer, // used to serialize arguments of single argument functions, multis are not serialized
equals, // equality tester, will force use of slower multiarg approach even for single arg functions
maxAge, // max cache age is ms, set > 0 && < Infinity if you want automatic clearing
maxArgs, // max args to use for signature
vargs = vrgs(fn) // set to true if function may have variable or beyond-signature arguments, default is best attempt at infering
} = {}
*/
- Modify the returned functions at line 59 and 74 something like this
const depchange = o.deps.filter(t => t.id === someId);
line 64 for single arg
return (!depchange && wm.get(a)) || ((!c||c(a,wm)),wm.set(a,r = fn.call(this, a)),r);
line 67 for single arg:
``
return (s[key] && !depchange) || ((!c||c(key,s)),s[key] = fn.call(this, a));
line 76 for multi arg
for(i=k.length-1;!depchange && i>=0;i--)
Let me know how it goes
from nano-memoize.
closing for lack of activity by originator
from nano-memoize.
Related Issues (20)
- Cannot build React app using nano-memoize HOT 3
- that setInterval HOT 41
- Question: How to clear the cache? HOT 3
- Missing serializer causes `TypeError: p is not a function` HOT 2
- Bug on line 40: handling of string argument HOT 5
- TypeScript definitions HOT 5
- Provide es6 modules in package HOT 2
- IE 11 supported? HOT 5
- Curious dependency: growl HOT 1
- Options hash HOT 6
- Bug in vrgs function? HOT 2
- Issue with `equals` since 3.0.0 with `fast-deep-equal` HOT 3
- callTimeout option notworking HOT 1
- Benchmarking is flawed and nano-memoize is much slower in realistic scenarios HOT 5
- Performance vs nano-memoize
- clearing cache with max age HOT 3
- missing type definitions HOT 2
- what does "equals" do? HOT 1
- Timeout Leak from `d` function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nano-memoize.