UNPKG

bugcore

Version:

bugcore is a JavaScript library that provides a foundational architecture for object oriented JS

117 lines (85 loc) 3.3 kB
/* * Copyright (c) 2016 airbug Inc. http://airbug.com * * bugcore may be freely distributed under the MIT license. */ //------------------------------------------------------------------------------- // Annotations //------------------------------------------------------------------------------- //@Export('StateEvent') //@Require('Class') //@Require('Event') //------------------------------------------------------------------------------- // Context //------------------------------------------------------------------------------- require('bugpack').context("*", function(bugpack) { //------------------------------------------------------------------------------- // BugPack //------------------------------------------------------------------------------- var Class = bugpack.require('Class'); var Event = bugpack.require('Event'); //------------------------------------------------------------------------------- // Declare Class //------------------------------------------------------------------------------- /** * @class * @extends {Event} */ var StateEvent = Class.extend(Event, /** @lends {StateEvent.prototype} */{ _name: "StateEvent", //------------------------------------------------------------------------------- // Constructor //------------------------------------------------------------------------------- /** * @constructs * @param {string} type * @param {string} previousState * @param {string} currentState */ _constructor: function(type, previousState, currentState) { this._super(type); //------------------------------------------------------------------------------- // Private Properties //------------------------------------------------------------------------------- /** * @private * @type {string} */ this.currentState = currentState; /** * @private * @type {string} */ this.previousState = previousState; }, //------------------------------------------------------------------------------- // Getters and Setters //------------------------------------------------------------------------------- /** * @return {string} */ getCurrentState: function() { return this.currentState; }, /** * @return {string} */ getPreviousState: function() { return this.previousState; } }); //------------------------------------------------------------------------------- // Static Properties //------------------------------------------------------------------------------- /** * @static * @enum {string} */ StateEvent.EventTypes = { STATE_CHANGED: "StateEvent:EventTypes:StateChanged" }; //------------------------------------------------------------------------------- // Exports //------------------------------------------------------------------------------- bugpack.export('StateEvent', StateEvent); });