starling-framework
Version:
A fast, productive library for 2D cross-platform development.
169 lines • 5.77 kB
TypeScript
import EventDispatcher from "./EventDispatcher";
declare namespace starling.events {
/**
* Event objects are passed as parameters to event listeners when an event occurs.
* * This is Starling's version of the Flash Event class.
* *
* * <p>EventDispatchers create instances of this class and send them to registered listeners.
* * An event object contains information that characterizes an event, most importantly the
* * event type and if the event bubbles. The target of an event is the object that
* * dispatched it.</p>
* *
* * <p>For some event types, this information is sufficient; other events may need additional
* * information to be carried to the listener. In that case, you can subclass "Event" and add
* * properties with all the information you require. The "EnterFrameEvent" is an example for
* * this practice; it adds a property about the time that has passed since the last frame.</p>
* *
* * <p>Furthermore, the event class contains methods that can stop the event from being
* * processed by other listeners - either completely or at the next bubble stage.</p>
* *
* * @see EventDispatcher
*
*/
export class Event {
/**
* Creates an event object that can be passed to listeners.
*/
constructor(type: string, bubbles?: boolean, data?: any);
/**
* Event type for a display object that is added to a parent.
*/
static readonly ADDED = "added";
/**
* Event type for a display object that is added to the stage
*/
static readonly ADDED_TO_STAGE = "addedToStage";
/**
* Event type for a display object that is entering a new frame.
*/
static readonly ENTER_FRAME = "enterFrame";
/**
* Event type for a display object that is removed from its parent.
*/
static readonly REMOVED = "removed";
/**
* Event type for a display object that is removed from the stage.
*/
static readonly REMOVED_FROM_STAGE = "removedFromStage";
/**
* Event type for a triggered button.
*/
static readonly TRIGGERED = "triggered";
/**
* Event type for a resized Flash Player.
*/
static readonly RESIZE = "resize";
/**
* Event type that may be used whenever something finishes.
*/
static readonly COMPLETE = "complete";
/**
* Event type for a (re)created stage3D rendering context.
*/
static readonly CONTEXT3D_CREATE = "context3DCreate";
/**
* Event type that is dispatched by the Starling instance directly before rendering.
*/
static readonly RENDER = "render";
/**
* Event type for a frame that is skipped because the display list did not change.
* * Dispatched instead of the <code>RENDER</code> event.
*/
static readonly SKIP_FRAME = "skipFrame";
/**
* Event type that indicates that the root DisplayObject has been created.
*/
static readonly ROOT_CREATED = "rootCreated";
/**
* Event type for an animated object that requests to be removed from the juggler.
*/
static readonly REMOVE_FROM_JUGGLER = "removeFromJuggler";
/**
* Event type that is dispatched by the AssetManager after a context loss.
*/
static readonly TEXTURES_RESTORED = "texturesRestored";
/**
* Event type that is dispatched by the AssetManager when a file/url cannot be loaded.
*/
static readonly IO_ERROR = "ioError";
/**
* Event type that is dispatched by the AssetManager when a file/url cannot be loaded.
*/
static readonly SECURITY_ERROR = "securityError";
/**
* Event type that is dispatched by the AssetManager when an xml or json file couldn't
* * be parsed.
*/
static readonly PARSE_ERROR = "parseError";
/**
* Event type that is dispatched by the Starling instance when it encounters a problem
* * from which it cannot recover, e.g. a lost device context.
*/
static readonly FATAL_ERROR = "fatalError";
/**
* An event type to be utilized in custom events. Not used by Starling right now.
*/
static readonly CHANGE = "change";
/**
* An event type to be utilized in custom events. Not used by Starling right now.
*/
static readonly CANCEL = "cancel";
/**
* An event type to be utilized in custom events. Not used by Starling right now.
*/
static readonly SCROLL = "scroll";
/**
* An event type to be utilized in custom events. Not used by Starling right now.
*/
static readonly OPEN = "open";
/**
* An event type to be utilized in custom events. Not used by Starling right now.
*/
static readonly CLOSE = "close";
/**
* An event type to be utilized in custom events. Not used by Starling right now.
*/
static readonly SELECT = "select";
/**
* An event type to be utilized in custom events. Not used by Starling right now.
*/
static readonly READY = "ready";
/**
* An event type to be utilized in custom events. Not used by Starling right now.
*/
static readonly UPDATE = "update";
/**
* Prevents listeners at the next bubble stage from receiving the event.
*/
stopPropagation(): void;
/**
* Prevents any other listeners from receiving the event.
*/
stopImmediatePropagation(): void;
/**
* Returns a description of the event, containing type and bubble information.
*/
toString(): string;
/**
* Indicates if event will bubble.
*/
bubbles: boolean;
/**
* The object that dispatched the event.
*/
target: EventDispatcher;
/**
* The object the event is currently bubbling at.
*/
currentTarget: EventDispatcher;
/**
* A string that identifies the event.
*/
type: string;
/**
* Arbitrary data that is attached to the event.
*/
data: any;
}
}
export default starling.events.Event;