content/hifi-content/caitlyn/dev/spacenavigator/Utility.js
2022-02-13 22:19:19 +01:00

33 lines
No EOL
1 KiB
JavaScript

"use strict";
module.exports = /** @class */ (function () {
function Utility() {
this.isDebug = false;
this.noop = 0;
}
Utility.prototype.toString = function () {
return "[Utility isDebug=" + this.isDebug + "]";
};
Utility.prototype.sleep = function (milliseconds) {
var now = Date.now();
var then = now + milliseconds;
while (Date.now() !== then) {
this.noop = 0;
}
};
Utility.prototype.clamp = function (value, min, max) {
var result = Math.min(Math.max(min, value), max);
return result;
};
Utility.prototype.debugLog = function (text) {
if (this.isDebug) {
console.log(text);
}
};
Utility.prototype.debugVariable = function (label, variable) {
if (this.isDebug) {
console.info(label, variable, typeof variable, JSON.stringify(variable));
}
};
return Utility;
}());
//# sourceMappingURL=Utility.js.map