boda_jsEnv/bodaEnv/env/EventSource.js
xuxiaobo-bobo 842b34b5ca 0218
2024-02-18 15:40:48 +08:00

136 lines
4.6 KiB
JavaScript

// EventSource对象
bodaEnv.memory.globlProtoObj["EventSource"] = function EventSource() {
let arg = arguments[0];
if (arg != 'bobo') {
bodaEnv.toolsFunc.console_copy('EventSource 实例化对象 --->', bodaEnv.toolsFunc.stringify_bo(arguments, function (k, v) {
if (v == window) {
return 'window';
} else {
return v;
}
}));
}
;
};
bodaEnv.toolsFunc.safeProto(bodaEnv.memory.globlProtoObj["EventSource"], "EventSource");
bodaEnv.memory.globlProtoObj["EventSource"].prototype.__proto__ = bodaEnv.memory.globlProtoObj["EventTarget"].prototype;
bodaEnv.memory.globlProtoObj["EventSource"].__proto__ = bodaEnv.memory.globlProtoObj["EventTarget"];
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"], "CONNECTING", {
configurable: false,
enumerable: true,
writable: false,
value: 0
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"], "OPEN", {
configurable: false,
enumerable: true,
writable: false,
value: 1
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"], "CLOSED", {
configurable: false,
enumerable: true,
writable: false,
value: 2
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "url", {
configurable: true,
enumerable: true,
get: {
url() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "url_get", arguments);
}
}.url,
set: undefined
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "withCredentials", {
configurable: true,
enumerable: true,
get: {
withCredentials() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "withCredentials_get", arguments);
}
}.withCredentials,
set: undefined
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "readyState", {
configurable: true,
enumerable: true,
get: {
readyState() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "readyState_get", arguments);
}
}.readyState,
set: undefined
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "onopen", {
configurable: true,
enumerable: true,
get: {
onopen() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "onopen_get", arguments);
}
}.onopen,
set: {
onopen() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "onopen_set", arguments);
}
}.onopen
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "onmessage", {
configurable: true,
enumerable: true,
get: {
onmessage() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "onmessage_get", arguments);
}
}.onmessage,
set: {
onmessage() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "onmessage_set", arguments);
}
}.onmessage
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "onerror", {
configurable: true,
enumerable: true,
get: {
onerror() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "onerror_get", arguments);
}
}.onerror,
set: {
onerror() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "onerror_set", arguments);
}
}.onerror
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "CONNECTING", {
configurable: false,
enumerable: true,
writable: false,
value: 0
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "OPEN", {
configurable: false,
enumerable: true,
writable: false,
value: 1
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "CLOSED", {
configurable: false,
enumerable: true,
writable: false,
value: 2
});
bodaEnv.toolsFunc.defineProperty(bodaEnv.memory.globlProtoObj["EventSource"].prototype, "close", {
configurable: true,
enumerable: true,
writable: true,
value: {
close() {
return bodaEnv.toolsFunc.dispatch(this, bodaEnv.memory.globlProtoObj["EventSource"].prototype, "EventSource", "close", arguments);
}
}.close
});