How to use the ember-concurrency-decorators.lastValue function in ember-concurrency-decorators

To help you get started, we’ve selected a few ember-concurrency-decorators examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NullVoxPopuli / react-vs-ember / concurrency / ember / src / ui / components / async-button / component.ts View on Github external
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { timeout } from 'ember-concurrency';
import { task, lastValue } from 'ember-concurrency-decorators';

export default class AsyncButton extends Component {
  @tracked clickCount = 0;

  // get lastCoords() {
  //   return this.clickTask.lastSuccessful.value;
  // }
  @lastValue('clickTask') lastCoords!: string;

  @task
  clickTask = function*(e: MouseEvent) {
    yield timeout(2000);

    this.clickCount++;

    return `${e.x} x ${e.y}`;
  };
}

ember-concurrency-decorators

decorator syntax for declaring/configuring ember-concurrency tasks

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis