Function Cached

  • Apply to the property that can provide dependency to its children

    Parameters

    • injectKey: string | symbol | Typed

      The index of the dependency

    Returns PropertyDecorator

    if you want to provide a method, you must write it as arrow function to so that the this won't change when inject

    Resolved

    @Cached("username")
    username: string;

    @Cached("register")
    register = (name: string, password: string): void => { };