Wait a result before enqueue

There are various ways to do that, e.g. by moving the add_action for method b inside a

class AwesomeClass{

    private storedResult;

    private __construct(){
        add_action( 'set_logged_in_cookie', array($this, 'a'),10,1);
    }

    Function a(p1){
        //some interesting process with p1
        // UPDATE $this->storedResult
        add_action('wp_enqueue_scripts', array($this, 'b')); 
    }

    Function b(){
        //some interesting process
        // USAGE OF $this->storedResult
    }
}

error code: 523