Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Deprecate this library in favor of ember-resources? #12

Open
NullVoxPopuli opened this issue Aug 21, 2021 · 0 comments
Open

Deprecate this library in favor of ember-resources? #12

NullVoxPopuli opened this issue Aug 21, 2021 · 0 comments

Comments

@NullVoxPopuli
Copy link
Contributor

Question for maintainers: myself, @vitch @HeroicEric,

the purpose of this library was mainly to:

  • provide a method by which to use derived data patterns with the safety of ember-concurrency tasks
  • provide a way to access the same invocation/value/data across components without each component having to compute that same data across each of those components.

ember-resources already provides a useTask and will soon (wip here) have a shared utility that will do this for us, with an api that may end up like:

import Component from '@glimmer/component';
import { useTask, shared } from 'ember-resources';

export default class MyComponent extends Component {
   // reactive & derived ember-concurrency task
   // this could also just be _any_ resource
  compute = useTask(this, ...);
  
  // as long as only `data` is accessed (instead of `compute`), the value of `compute` will be shared among
  // all instances of MyComponent.
  //
  // this, like the current MemoizedTask, is still the same as instead defining this on a service 
  // and accessing that service from the component,
  // except: you don't need to define a service.
  // 
  data = shared(this, () => this.compute); 
}  
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant