1
0
This commit is contained in:
2024-05-23 19:40:42 +03:00
parent f6806d8a5a
commit fbcdbf4e12
5 changed files with 248 additions and 0 deletions

27
Лаб8/Сайт/base.js Normal file
View File

@@ -0,0 +1,27 @@
function BaseObject() {
this.actions = [];
}
BaseObject.prototype.registerAction = function (actionName, args) {
const timestamp = new Date().toISOString();
this.actions.push({ actionName, args, timestamp });
};
BaseObject.prototype.clearActions = function () {
this.actions = [];
};
BaseObject.prototype.getActions = function () {
return Array.from(this.actions);
};
BaseObject.prototype.formatAction = function (action) {
return `Действие: ${action.actionName}\n\tПараметры: ${action.args}\n\tВремя: ${action.timestamp}`;
};
BaseObject.prototype.logActions = function () {
console.log('Зарегистрированные действия:');
this.actions.forEach((action) => {
console.log(this.formatAction(action));
});
};