lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
41 lines • 1.33 kB
JavaScript
/**
* Which event propagation model is an event type using?
*
* @category Event
*/
export var PropagationModel;
(function (PropagationModel) {
/**
* This event is propagated down the UI tree, in depth-first order. The
* event is handled at every iterated {@link Widget}.
*/
PropagationModel[PropagationModel["Trickling"] = 0] = "Trickling";
/**
* This event is propagated down the UI tree. The event is handled at every
* iterated {@link Widget}.
*/
PropagationModel[PropagationModel["Bubbling"] = 1] = "Bubbling";
/**
* This event is only handled at the origin of the event; it does not
* propagate.
*/
PropagationModel[PropagationModel["Sticky"] = 2] = "Sticky";
})(PropagationModel || (PropagationModel = {}));
/**
* An event fired to/from a {@link Widget} in a UI tree.
*
* @category Event
*/
export class WidgetEvent {
/**
* Check if the type of this event instance matches the type of a given
* event class, asserting that the instance is of the class' type.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
isa(clazz) {
// XXX this is really ugly, but i'm not sure how this can be done
// properly
return clazz.type === this.type;
}
}
//# sourceMappingURL=WidgetEvent.js.map