Function use

  • The @use(...) decorator can be used to use a Resource in javascript classes

    import { resource, use } from 'ember-resources';

    const Clock = resource( ... );

    class Demo {
    @use(Clock) time;
    }

    Type Parameters

    • Value

    Parameters

    • definition: Value | (() => Value)

    Returns PropertyDecorator

  • The @use decorator can be used to use a Resource in javascript classes

    import { resource, use } from 'ember-resources';

    const Clock = resource(() => 2);

    class MyClass {
    @use data = Clock;
    }

    (new MyClass()).data === 2

    Type Parameters

    • Prototype

    • Key

    Parameters

    • prototype: NonInstanceType<Prototype>
    • key: DecoratorKey<Key>
    • Optional descriptor: Stage1DecoratorDescriptor

    Returns void

  • The `use function can be used to use a Resource in javascript classes

    Note that when using this version of use, the value is only accessible on the current property.

    import { resource, use } from 'ember-resources';

    const Clock = resource( ... );

    class Demo {
    time = use(this, Clock);
    }

    (new Demo()).data.current === 2

    Type Parameters

    • Value

    Parameters

    • parent: object
    • definition: Value | (() => Value)
    • Optional _: undefined

    Returns Reactive<Value extends Reactive<any> ? Value["current"] : Value>

Generated using TypeDoc