Last active
April 25, 2019 21:06
-
-
Save d0rsha/abc527990c618fcd0a70bc0006886b72 to your computer and use it in GitHub Desktop.
[cache Map] Save values to map instead of reinvoking call #programming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dictionary with Observable | |
dictionary = {}; | |
getItem(name) { | |
if (name in this.dictionary) { | |
return this.dictionary[name] | |
} else { | |
this.dictionary[name] = getObserverableByName(name) | |
return this.dictionary[name] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment