diff --git a/lib/std.js b/lib/std.js index 0f4f4c3..88d8738 100644 --- a/lib/std.js +++ b/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.cancelable = false; // Not supported this.composed = false; // Not supported this.currentTarget = null; // Not supported this.defaultPrevented = false; - this.eventPhase = null; + this.eventPhase = null; // TODO this.isTrusted = true; // Not supported this.timeStamp = new Date(); @@ -137,7 +137,7 @@ var stdEvent = function(eventName) { }; }; -var stdEventableObject = function() { +var StdEventableObject = function() { this.dispatchEvent = function(event) { event.target = this; 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.global = global; exports.require = global.require; -exports.Event = stdEvent; -exports.EventableObject = stdEventableObject; +exports.Event = StdEvent; +exports.EventableObject = StdEventableObject; + +exports.getRandomInt = getRandomInt;