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

    Parameters

    • prototype: object
    • key: string
    • 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)

    Returns Reactive<Value>

Generated using TypeDoc