# File: js/event/BaseEvent.js

    var __extends = (this && this.__extends) || function (d, b) {
        for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
    (function (factory) {
        if (typeof module === 'object' && typeof module.exports === 'object') {
            var v = factory(require, exports); if (v !== undefined) module.exports = v;
        }
        else if (typeof define === 'function' && define.amd) {
            define(["require", "exports", '../BaseObject'], factory);
        }
    })(function (require, exports) {
        var BaseObject_1 = require('../BaseObject');
        /**
         * The {{#crossLink "BaseEvent"}}{{/crossLink}} class is used as the base class for the creation of Event objects, which are passed as parameters to event listeners when an event occurs.
         *
         * The properties of the {{#crossLink "BaseEvent"}}{{/crossLink}} class carry basic information about an event, such as the event's type or whether the event's default behavior can be canceled.
         *
         * For many events, such as the events represented by the Event class constants, this basic information is sufficient. Other events, however, may require more
         * detailed information.
         * @class BaseEvent
         * @extends BaseObject
         * @param type {string} The type of event. The type is case-sensitive.
         * @param [bubbles=false] {boolean} Indicates whether an event is a bubbling event. If the event can bubble, this value is true; otherwise it is false.
         * Note: With event-bubbling you can let one Event subsequently call on every ancestor ({{#crossLink "EventDispatcher/parent:property"}}{{/crossLink}})
         * (containers of containers of etc.) of the {{#crossLink "DisplayObjectContainer"}}{{/crossLink}} that originally dispatched the Event, all the way up to the surface ({{#crossLink "Stage"}}{{/crossLink}}). Any classes that do not have a parent cannot bubble.
         * @param [cancelable=false] {boolean} Indicates whether the behavior associated with the event can be prevented. If the behavior can be canceled, this value is true; otherwise it is false.
         * @param [data=null] {any} Use to pass any type of data with the event.
         * @module StructureJS
         * @submodule event
         * @requires Extend
         * @requires BaseObject
         * @constructor
         * @author Robert S. (www.codeBelt.com)
         * @example
         *     // Example: how to create a custom event by extending BaseEvent.
         *
         *     class CountryEvent extends BaseEvent {
         *
         *          CHANGE_COUNTRY = 'CountryEvent.changeCountry';
         *
         *          constructor(type, bubbles = false, cancelable = false, data = null) {
         *              super(type, bubbles, cancelable, data);
         *
         *              this.countryName = null;
         *          }
         *      }
         *
         *     // Example: how to use the custom event.
         *     let event = new CountryEvent(CountryEvent.CHANGE_COUNTRY);
         *     event.countryName = 'Canada';
         *     this.dispatchEvent(event);
         */
        var BaseEvent = (function (_super) {
            __extends(BaseEvent, _super);
            function BaseEvent(type, bubbles, cancelable, data) {
                if (bubbles === void 0) { bubbles = false; }
                if (cancelable === void 0) { cancelable = false; }
                if (data === void 0) { data = null; }
                _super.call(this);
                /**
                 * The type of event.
                 *
                 * @property type
                 * @type {string}
                 * @default null
                 * @public
                 * @readOnly
                 */
                this.type = null;
                /**
                 * A reference to the object that originally dispatched the event.
                 *
                 * @property target
                 * @type {any}
                 * @default null
                 * @public
                 * @readOnly
                 */
                this.target = null;
                /**
                 * The currentTarget property always points to the {{#crossLink "DisplayObjectContainer"}}{{/crossLink}} that the event is currently processing (i.e. bubbling at).
                 *
                 * @property currentTarget
                 * @type {any}
                 * @default null
                 * @public
                 * @readOnly
                 */
                this.currentTarget = null;
                /**
                 * Used to pass any type of data with the event.
                 *
                 * @property data
                 * @type {any}
                 * @public
                 * @default null
                 */
                this.data = null;
                /**
                 * Indicates whether an event is a bubbling event.
                 *
                 * @property bubbles
                 * @type {boolean}
                 * @public
                 * @default false
                 */
                this.bubbles = false;
                /**
                 * Indicates whether the behavior associated with the event can be prevented.
                 *
                 * @property cancelable
                 * @type {boolean}
                 * @public
                 * @default false
                 */
                this.cancelable = false;
                /**
                 * Indicates if the {{#crossLink "BaseEvent/stopPropagation:method"}}{{/crossLink}} was called on the event object.
                 *
                 * @property isPropagationStopped
                 * @type {boolean}
                 * @default false
                 * @public
                 * @readOnly
                 */
                this.isPropagationStopped = false;
                /**
                 * Indicates if the {{#crossLink "BaseEvent/stopImmediatePropagation:method"}}{{/crossLink}} was called on the event object.
                 *
                 * @property isImmediatePropagationStopped
                 * @type {boolean}
                 * @default false
                 * @public
                 * @readOnly
                 */
                this.isImmediatePropagationStopped = false;
                this.type = type;
                this.bubbles = bubbles;
                this.cancelable = cancelable;
                this.data = data;
            }
            /**
             * Prevents processing of any event listeners in nodes subsequent to the current node in the event flow.
             * This method does not affect any event listeners in the current node (currentTarget). In contrast,
             * the {{#crossLink "BaseEvent/stopImmediatePropagation:method"}}{{/crossLink}} method prevents processing
             * of event listeners in both the current node and subsequent nodes. Additional calls to this method have no effect.
             *
             * @method stopPropagation
             * @public
             * @example
             *     event.stopPropagation();
             */
            BaseEvent.prototype.stopPropagation = function () {
                this.isPropagationStopped = true;
            };
            /**
             * Prevents processing of any event listeners in the current node and any subsequent nodes in the event flow.
             * This method takes effect immediately, and it affects event listeners in the current node. In contrast,
             * the {{#crossLink "BaseEvent/stopPropagation:method"}}{{/crossLink}} method doesn't take effect until
             * all the event listeners in the current node finish processing.
             *
             * @method stopImmediatePropagation
             * @public
             * @example
             *     event.stopImmediatePropagation();
             */
            BaseEvent.prototype.stopImmediatePropagation = function () {
                this.stopPropagation();
                this.isImmediatePropagationStopped = true;
            };
            /**
             * Duplicates an instance of an BaseEvent subclass.
             *
             * Returns a new BaseEvent object that is a copy of the original instance of the BaseEvent object.
             *
             * The new BaseEvent object includes all the properties of the original.
             *
             * @method clone
             * @returns {BaseEvent}
             * @public
             * @example
             *     let cloneOfEvent = event.clone();
             */
            BaseEvent.prototype.clone = function () {
                var clonedBaseModel = new this.constructor(this.type, this.bubbles, this.cancelable, this.data);
                for (var key in this) {
                    if (this.hasOwnProperty(key)) {
                        clonedBaseModel[key] = this[key];
                    }
                }
                return clonedBaseModel;
            };
            /**
             * The BaseEvent.ACTIVATE constant defines the value of the type property of an activate event object.
             *
             * @event ACTIVATE
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.ACTIVATE = 'BaseEvent.activate';
            /**
             * The BaseEvent.ADDED constant defines the value of the type property of an added event object.
             *
             * @event ADDED
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.ADDED = 'BaseEvent.added';
            /**
             * The BaseEvent.ADDED_TO_STAGE constant defines the value of the type property of an addedToStage event object.
             *
             * @event ADDED_TO_STAGE
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.ADDED_TO_STAGE = 'BaseEvent.addedToStage';
            /**
             * The BaseEvent.CANCEL constant defines the value of the type property of a cancel event object.
             *
             * @event CANCEL
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.CANCEL = 'BaseEvent.cancel';
            /**
             * The BaseEvent.CHANGE constant defines the value of the type property of a change event object.
             *
             * @event CHANGE
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.CHANGE = 'BaseEvent.change';
            /**
             * The BaseEvent.CLEAR constant defines the value of the type property of a clear event object.
             *
             * @event CLEAR
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.CLEAR = 'BaseEvent.clear';
            /**
             * The BaseEvent.CLOSE constant defines the value of the type property of a close event object.
             *
             * @event CLOSE
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.CLOSE = 'BaseEvent.close';
            /**
             * The BaseEvent.CLOSING constant defines the value of the type property of a closing event object.
             *
             * @event CLOSING
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.CLOSING = 'BaseEvent.closing';
            /**
             * The BaseEvent.COMPLETE constant defines the value of the type property of a complete event object.
             *
             * @event COMPLETE
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.COMPLETE = 'BaseEvent.complete';
            /**
             * The BaseEvent.CONNECT constant defines the value of the type property of a connect event object.
             *
             * @event CONNECT
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.CONNECT = 'BaseEvent.connect';
            /**
             * Defines the value of the type property of a copy event object.
             *
             * @event COPY
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.COPY = 'BaseEvent.copy';
            /**
             * Defines the value of the type property of a cut event object.
             *
             * @event CUT
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.CUT = 'BaseEvent.cut';
            /**
             * The BaseEvent.DEACTIVATE constant defines the value of the type property of a deactivate event object.
             *
             * @event DEACTIVATE
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.DEACTIVATE = 'BaseEvent.deactivate';
            /**
             * The BaseEvent.DISPLAYING constant defines the value of the type property of a displaying event object.
             *
             * @event DISPLAYING
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.DISPLAYING = 'BaseEvent.displaying';
            /**
             * The BaseEvent.ENTER_FRAME constant defines the value of the type property of an enterFrame event object.
             *
             * @event ENTER_FRAME
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.ENTER_FRAME = 'BaseEvent.enterFrame';
            /**
             * The BaseEvent.EXIT_FRAME constant defines the value of the type property of an exitFrame event object.
             *
             * @event EXIT_FRAME
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.EXIT_FRAME = 'BaseEvent.exitFrame';
            /**
             * The BaseEvent.EXITING constant defines the value of the type property of an exiting event object.
             *
             * @event EXITING
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.EXITING = 'BaseEvent.exiting';
            /**
             * The BaseEvent.FULL_SCREEN constant defines the value of the type property of a fullScreen event object.
             *
             * @event FULLSCREEN
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.FULLSCREEN = 'BaseEvent.fullScreen';
            /**
             * The BaseEvent.INIT constant defines the value of the type property of an init event object.
             *
             * @event INIT
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.INIT = 'BaseEvent.init';
            /**
             * The BaseEvent.NETWORK_CHANGE constant defines the value of the type property of a networkChange event object.
             *
             * @event NETWORK_CHANGE
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.NETWORK_CHANGE = 'BaseEvent.networkChange';
            /**
             * The BaseEvent.OPEN constant defines the value of the type property of an open event object.
             *
             * @event OPEN
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.OPEN = 'BaseEvent.open';
            /**
             * The BaseEvent.PASTE constant defines the value of the type property of a paste event object.
             *
             * @event PASTE
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.PASTE = 'BaseEvent.paste';
            /**
             * The BaseEvent.PREPARING constant defines the value of the type property of a preparing event object.
             *
             * @event PREPARING
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.PREPARING = 'BaseEvent.preparing';
            /**
             * The BaseEvent.REMOVED constant defines the value of the type property of a removed event object.
             *
             * @event REMOVED
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.REMOVED = 'BaseEvent.removed';
            /**
             * The BaseEvent.RENDER constant defines the value of the type property of a render event object.
             *
             * @event RENDER
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.RENDER = 'BaseEvent.render';
            /**
             * The BaseEvent.RESIZE constant defines the value of the type property of a resize event object.
             *
             * @event RESIZE
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.RESIZE = 'BaseEvent.resize';
            /**
             * The BaseEvent.SELECTED constant defines the value of the type property of a selected event object.
             *
             * @event SELECTED
             * @type {string}
             * @public
             * @static
             */
            BaseEvent.SELECTED = 'BaseEvent.selected';
            return BaseEvent;
        })(BaseObject_1.default);
        Object.defineProperty(exports, "__esModule", { value: true });
        exports.default = BaseEvent;
    });