import { tracked } from '@glimmer/tracking';
import { Resource } from 'ember-could-get-used-to-this';
export default class AsyncProcessResource extends Resource {
  @tracked data;

  get value() {
    return this.data;
  }

  async setup() {
    const fn = this.args.positional[0];

    //pass any remaining arguments directly to the processor function
    this.data = await fn(...this.args.positional.slice(1));
  }
}

import { tracked } from '@glimmer/tracking';
import { Resource } from 'ember-could-get-used-to-this';
export default class AsyncProcessResource extends Resource {
  @tracked data;

  get value() {
    return this.data;
  }

  async setup() {
    const fn = this.args.positional[0];

    //pass any remaining arguments directly to the processor function
    const promise = fn(...this.args.positional.slice(1));
    this.data = promise;
    this.data = await promise;
  }
}

Return the promise before it is resolved
Return the promise before it is resolved

AsyncProcess was returning undefined until the promise is resolved, but
we can return the promise itself and maybe make this more usable.
