Skip to content

Instantly share code, notes, and snippets.

@d0rsha
Last active April 25, 2019 21:06
Show Gist options
  • Save d0rsha/abc527990c618fcd0a70bc0006886b72 to your computer and use it in GitHub Desktop.
Save d0rsha/abc527990c618fcd0a70bc0006886b72 to your computer and use it in GitHub Desktop.
[cache Map] Save values to map instead of reinvoking call #programming
// 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