How to use the ember-concurrency.Process.create function in ember-concurrency

To help you get started, we’ve selected a few ember-concurrency 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 machty / ember-concurrency / app / services / ember-concurrency-dispatcher.js View on Github external
if (currentlyExecutingTask) {
        if (currentlyExecutingTask._depTask !== task) {
          // this task is unperformable and is not a dependency
          // of the currently running task, so we error.
          return didNotRun();
        } else {
          // this task is unperformable, but that is because
          // the currently running task (which specifies this task
          // as a dependency) marked it as such. it is actually performable.
        }
      } else {
        return didNotRun();
      }
    }

    let proc = Process.create({
      owner: task._hostObject,
      generatorFunction: task._genFn,
      propertyName: "TODO",
      _task: task,
    });
    task._proc = proc;

    this._incrementSemaphoresForTaskChain(task, +1);

    return new Ember.RSVP.Promise(r => {
      proc.start(args, returnValue => {
        this._taskDidFinish(task);
        r(returnValue);
      });
    });
  },