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
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 {
data = use(this, Clock);
}
(new Demo()).data.current === 2
The
@use(...)
decorator can be used to use a Resource in javascript classes