This is not a core part of ember-resources, but demonstrates how services are an extension of resources. This utility should be considered a prototype, but this utility is still under the broader library's SemVer policy.
A consuming app will not pay for the bytes of this utility unless imported.
An alternative to Ember's built in @service decorator.
This decorator takes a resource and ties the resource's lifeime to the app / owner.
The reason a resource is required, as opposed to allowing "any class", is that a
resource already has implemented the concept of "teardown" or "cleanup",
and native classes do not have this concept.
This is not a core part of ember-resources, but demonstrates how services are an extension of resources. This utility should be considered a prototype, but this utility is still under the broader library's SemVer policy.
A consuming app will not pay for the bytes of this utility unless imported.
An alternative to Ember's built in
@service
decorator.This decorator takes a resource and ties the resource's lifeime to the app / owner.
The reason a resource is required, as opposed to allowing "any class", is that a resource already has implemented the concept of "teardown" or "cleanup", and native classes do not have this concept.
Example:
For Stage 1 decorators and typescript, you'll need to manually declare the type: