XMLHttpRequest 问题请教

源码如下:

const webRequest = new XMLHttpRequest();
webRequest.onreadystatechange = () => {
    if (webRequest.readyState != XMLHttpRequest.DONE) {
        return;
    }

    if (webRequest.status != 200) {
        LogUtil.log(LOG_TAG.NORMAL, `status : ${webRequest.status}`);
        this.sendNotification(LoginCommandDefine.GetUserInformationResponse);
        return;
    }

    LogUtil.log(LOG_TAG.NORMAL, `response : ${webRequest.responseText}`);
    const response = JSON.parse(webRequest.responseText);
    this.sendNotification(LoginCommandDefine.GetUserInformationResponse, response);
};

这段代码是 typescript 写的。

请教下 XMLHttpRequest.DONE 这个代码为啥在原生平台上为 undefined,在web平台表现为 4 ?

原生平台貌似没有Dom

XMLHttpRequest.DONE 是在 Dom 中定义的吗?我查看了MDN文档,没有发现类似说明。

我直接点进去是在lib.dom.d.ts

要不直接写4吧。。。