this.add = function (descriptionEvent, morph) { if (typeof descriptionEvent === 'object' && morph === undefined) { Object.keys(descriptionEvent).forEach(function (key) { if (typeof descriptionEvent[key] === 'function') { descriptionsEventsStorage[key] = { func: descriptionEvent[key], type: 'trigger' } } else { throw new Error('The description of the event with the name' + key + ' was created incorrectly, the key value is not a function.'); } }); }