Caching Observables/Promises

Written by msarica | Published 2020/01/06
Tech Story Tags: javascript | typescript | programming | software-development | observable | promise | generators-and-decorators | interface

TLDR Typescript decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators use the form @expression, where expression must evaluate to a function that will be called at runtime with information about the decorated declaration. We can create a custom decorator and drop it on a method and be done with it. We check if value is defined, if it is, return the value. If not, call the original function to get the value and return it.via the TL;DR App

no story

Written by msarica | msarica.com
Published by HackerNoon on 2020/01/06