Best practice for run some sequence of actions (analogue of coroutines)?

Roughly speaking, I’m looking for an analogue of Unity coroutines so that it looks good, instead of having to check in update every time.

My current example: you need to move the player from point A to point B in a certain time when it is triggered by an input.

Thoughts:

  1. A separate script with update and startMove method that will turn on and off (enabled/disabled)?
  2. Subscription to the global update event and accumulation of a local variable? (I believe more in this option).

Does anyone have better ideas or critiques of mine?

Something like that. Is this an effective approach?

Mover.prototype.startStep = function(direction){
    if(this.stepStatus != 0) return;
    this.fromPos = this.entity.getPosition();
    this.toPos = direction.add(this.fromPos);
    console.log('startStep from ', this.fromPos, ' to ', this.toPos);
    this.app.on("main:update", this.onStep, this);
};

Mover.prototype.onStep = function(dt){ 
    this.stepStatus += dt / this.stepTime;
    if(this.stepStatus < 1)
    {
        this.currentPos.lerp(this.fromPos, this.toPos, this.stepStatus);
    }
    else 
    {
        console.log('stepEnd');
        this.currentPos = this.toPos;
        this.app.off("main:update", this.onStep, this);
        this.stepStatus = 0;
    };
    this.entity.setPosition(this.currentPos);
};

I personally interpolate vectors only if I need to control the interpolation step in a way that Tween library doesn’t allow. In most other cases I find using Tween is sufficient to move/rotate an entity from state A to state B. You can also chain tweens.

I considered this functionality, but left it for the reasons that I did not see how it is possible, for example, to control several components at the same time (without duplicating). Therefore, I fixed in my mind that Tween is more for animations, and it is better to write gameplay logic with other tools.

Am I fundamentally or slightly wrong somewhere?