Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

QueueAction.js 913B

1234567891011121314151617181920212223242526272829
  1. import { AsyncAction } from './AsyncAction';
  2. export class QueueAction extends AsyncAction {
  3. constructor(scheduler, work) {
  4. super(scheduler, work);
  5. this.scheduler = scheduler;
  6. this.work = work;
  7. }
  8. schedule(state, delay = 0) {
  9. if (delay > 0) {
  10. return super.schedule(state, delay);
  11. }
  12. this.delay = delay;
  13. this.state = state;
  14. this.scheduler.flush(this);
  15. return this;
  16. }
  17. execute(state, delay) {
  18. return (delay > 0 || this.closed) ?
  19. super.execute(state, delay) :
  20. this._execute(state, delay);
  21. }
  22. requestAsyncId(scheduler, id, delay = 0) {
  23. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
  24. return super.requestAsyncId(scheduler, id, delay);
  25. }
  26. return scheduler.flush(this);
  27. }
  28. }
  29. //# sourceMappingURL=QueueAction.js.map