UNPKG

starling-framework

Version:

A fast, productive library for 2D cross-platform development.

116 lines (100 loc) 3.31 kB
// Class: starling.events.Event var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this $global.Object.defineProperty(exports, "__esModule", {value: true}); var __map_reserved = {}; // Imports var $hxClasses = require("./../../hxClasses_stub").default; var $hxEnums = require("./../../hxEnums_stub").default; var $import = require("./../../import_stub").default; function starling_utils_StringUtil() {return require("./../../starling/utils/StringUtil");} function Type() {return require("./../../Type");} function openfl__$Vector_Vector_$Impl_$() {return require("./../../openfl/_Vector/Vector_Impl_");} // Constructor var Event = function(type,bubbles,data) { if(bubbles == null) { bubbles = false; } this.type = type; this.bubbles = bubbles; this.data = data; } // Meta Event.__name__ = "starling.events.Event"; Event.__isInterface__ = false; Event.prototype = { stopPropagation: function() { this.stopsPropagation = true; }, stopImmediatePropagation: function() { this.stopsPropagation = this.stopsImmediatePropagation = true; }, toString: function() { return (starling_utils_StringUtil().default).format("[{0} type=\"{1}\" bubbles={2}]",[(Type().default).getClassName((Type().default).getClass(this)).split("::").pop(),this.type,this.bubbles]); }, setTarget: function(value) { this.target = value; }, setCurrentTarget: function(value) { this.currentTarget = value; }, setData: function(value) { this.data = value; }, reset: function(type,bubbles,data) { if(bubbles == null) { bubbles = false; } this.type = type; this.bubbles = bubbles; this.data = data; this.target = this.currentTarget = null; this.stopsPropagation = this.stopsImmediatePropagation = false; return this; } }; Event.prototype.__class__ = Event.prototype.constructor = $hxClasses["starling.events.Event"] = Event; // Init // Statics Event.fromPool = function(type,bubbles,data) { if(bubbles == null) { bubbles = false; } if(Event.sEventPool.length != 0) { return (openfl__$Vector_Vector_$Impl_$().default).pop(Event.sEventPool).reset(type,bubbles,data); } else { return new Event(type,bubbles,data); } } Event.toPool = function(event) { event.data = event.target = event.currentTarget = null; (openfl__$Vector_Vector_$Impl_$().default).set(Event.sEventPool,Event.sEventPool.length,event); } Event.ADDED = "added" Event.ADDED_TO_STAGE = "addedToStage" Event.ENTER_FRAME = "enterFrame" Event.REMOVED = "removed" Event.REMOVED_FROM_STAGE = "removedFromStage" Event.TRIGGERED = "triggered" Event.RESIZE = "resize" Event.COMPLETE = "complete" Event.CONTEXT3D_CREATE = "context3DCreate" Event.RENDER = "render" Event.SKIP_FRAME = "skipFrame" Event.ROOT_CREATED = "rootCreated" Event.REMOVE_FROM_JUGGLER = "removeFromJuggler" Event.TEXTURES_RESTORED = "texturesRestored" Event.IO_ERROR = "ioError" Event.SECURITY_ERROR = "securityError" Event.PARSE_ERROR = "parseError" Event.FATAL_ERROR = "fatalError" Event.CHANGE = "change" Event.CANCEL = "cancel" Event.SCROLL = "scroll" Event.OPEN = "open" Event.CLOSE = "close" Event.SELECT = "select" Event.READY = "ready" Event.UPDATE = "update" Event.sEventPool = (openfl__$Vector_Vector_$Impl_$().default)._new() // Export exports.default = Event;