Update std.js

This commit is contained in:
Namhyeon Go 2023-02-01 10:50:15 +09:00 committed by GitHub
parent f79e1e0e65
commit 83e4c02f16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -351,8 +351,7 @@ StdEvent.CAPTURING_PHASE = 1; // Not used but to be compatible
StdEvent.AT_TARGET = 2; StdEvent.AT_TARGET = 2;
StdEvent.BUBBLING_PHASE = 3; // Not used but to be compatible StdEvent.BUBBLING_PHASE = 3; // Not used but to be compatible
// maybe, the "EventTarget" is preserved word function StdEventTarget() {
function StdEventableObject() {
this.__events__ = []; this.__events__ = [];
this.dispatchEvent = function(event, __exception__) { this.dispatchEvent = function(event, __exception__) {
@ -377,9 +376,9 @@ function StdEventableObject() {
this.__events__.push({ this.__events__.push({
"type": type, "type": type,
"listener": listener, "listener": listener,
"counter": StdEventableObject.__counter__ "counter": StdEventTarget.__counter__
}); });
StdEventableObject.__counter__++; StdEventTarget.__counter__++;
} else { } else {
throw new TypeError("EventListener must be a function"); throw new TypeError("EventListener must be a function");
} }
@ -398,7 +397,7 @@ function StdEventableObject() {
} }
}; };
}; };
StdEventableObject.__counter__ = 0; StdEventTarget.__counter__ = 0;
function AsyncFunction(f, _filename) { function AsyncFunction(f, _filename) {
this.f = f; this.f = f;
@ -460,11 +459,11 @@ global.splitLn = splitLn;
global.addslashes = addslashes; global.addslashes = addslashes;
global.AsyncFunction = AsyncFunction; global.AsyncFunction = AsyncFunction;
exports.VERSIONINFO = "Standard Library (std.js) version 0.7.5"; exports.VERSIONINFO = "Standard Library (std.js) version 0.8";
exports.global = global; exports.global = global;
exports.require = global.require; exports.require = global.require;
exports.Event = StdEvent; exports.Event = StdEvent;
exports.EventableObject = StdEventableObject; exports.EventTarget = StdEventTarget;
exports.alert = alert; exports.alert = alert;