Methods
(static) invalidate(functionsToInvalidate)
Clears the memoization cache of the given functions.
Parameters:
Name | Type | Description |
---|---|---|
functionsToInvalidate |
Array.<function()> | A list of names of functions to invalidate. |
- Source:
Example
// Call when the output of some functions needs to change
Memoizer.invalidate([
this.myFirstFunction,
this.mySecondFunction,
]);
(static) memoize(parentObject, functionNames)
Memoize the given functions of the object.
Parameters:
Name | Type | Description |
---|---|---|
parentObject |
object | The object to memoize the functions of. |
functionNames |
Array.<string> | A list of names of functions to memoize. |
- Source:
Example
// Call in a constructor or initializer
Memoizer.memoize(this, [
'myFirstFunction',
'mySecondFunction',
]);