This commit is contained in:
Oleg Mokhov
2015-06-20 12:26:08 +03:00
committed by mokhov
parent a716969f4e
commit f3546ef3a5
85 changed files with 16682 additions and 1 deletions

View File

@@ -0,0 +1,60 @@
modules.define(
'y-block-event',
[
'inherit'
],
function (
provide,
inherit
) {
/**
* Класс, представляющий событие блока.
*/
var YBlockEvent = inherit({
/**
* @param {String} type Тип события.
* @param {Boolean} [isPropagationStopped=false] Запрещает распространение события.
* @param {Boolean} [isDefaultPrevented=false] Запрещает действие по умолчанию.
*/
__constructor: function (type, isPropagationStopped, isDefaultPrevented) {
this.type = type;
this._isPropagationStopped = Boolean(isPropagationStopped);
this._isDefaultPrevented = Boolean(isDefaultPrevented);
},
/**
* Определяет, прекращено ли распространение события.
*
* @returns {Boolean}
*/
isPropagationStopped: function () {
return this._isPropagationStopped;
},
/**
* Проверяет, отменена ли реакция по умолчанию на событие.
*
* @returns {Boolean}
*/
isDefaultPrevented: function () {
return this._isDefaultPrevented;
},
/**
* Прекращает распространение события.
*/
stopPropagation: function () {
this._isPropagationStopped = true;
},
/**
* Отменяет реакцию по умолчанию на событие.
*/
preventDefault: function () {
this._isDefaultPrevented = true;
}
});
provide(YBlockEvent);
});