mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-15 06:01:04 +00:00
Update std.js
This commit is contained in:
parent
aeb474b888
commit
8fe35ac9c5
18
lib/std.js
18
lib/std.js
|
@ -104,13 +104,13 @@ exports.CreateObject = function(progId, serverName, callback) {
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var stdEvent = function(eventName) {
|
var StdEvent = function(eventName) {
|
||||||
this.bubbles = false; // Not supported
|
this.bubbles = false; // Not supported
|
||||||
this.cancelable = false; // Not supported
|
this.cancelable = false; // Not supported
|
||||||
this.composed = false; // Not supported
|
this.composed = false; // Not supported
|
||||||
this.currentTarget = null; // Not supported
|
this.currentTarget = null; // Not supported
|
||||||
this.defaultPrevented = false;
|
this.defaultPrevented = false;
|
||||||
this.eventPhase = null;
|
this.eventPhase = null; // TODO
|
||||||
this.isTrusted = true; // Not supported
|
this.isTrusted = true; // Not supported
|
||||||
this.timeStamp = new Date();
|
this.timeStamp = new Date();
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ var stdEvent = function(eventName) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
var stdEventableObject = function() {
|
var StdEventableObject = function() {
|
||||||
this.dispatchEvent = function(event) {
|
this.dispatchEvent = function(event) {
|
||||||
event.target = this;
|
event.target = this;
|
||||||
if(eventName in this) this['on' + event.eventName](event);
|
if(eventName in this) this['on' + event.eventName](event);
|
||||||
|
@ -152,9 +152,17 @@ var stdEventableObject = function() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var getRandomInt = function(min, max) {
|
||||||
|
min = Math.ceil(min);
|
||||||
|
max = Math.floor(max);
|
||||||
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
|
}
|
||||||
|
|
||||||
exports.VERSIONINFO = "Standard Lib (std.js) version 0.3";
|
exports.VERSIONINFO = "Standard Lib (std.js) version 0.3";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
||||||
exports.Event = stdEvent;
|
exports.Event = StdEvent;
|
||||||
exports.EventableObject = stdEventableObject;
|
exports.EventableObject = StdEventableObject;
|
||||||
|
|
||||||
|
exports.getRandomInt = getRandomInt;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user