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.
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: