Can ES6's Class stored value function (setter) be asynchronous?

get prop() {
    return this.list
}

set prop(pm = {}) {
    ReqApi.get({
        url: Urls.GET_ENQUIRYLIST,
        pm
    })
        .then(res => {
            this.list = res.list
        })
}

this doesn"t seem to work!

Mar.16,2021

setter can be asynchronous internally, but since it is asynchronous, I'm afraid it can't be obtained immediately after setting the value. If you use setTimeout to simulate asynchronous calls,

const target = {
    // ....

    async setTest(data) {
        return new Promise(resolve => {
            setTimeout(() => {
                this.data = data;
                resolve();
            }, 1000);
        });
    }
};

(async () => {
    await target.setTest("hi");
    console.log(console.log(target.test));
})();

the output here has been waiting until the end of the asynchronous process

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e44b05-44aea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e44b05-44aea.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?