new EventHandler(callback, context, priority, order)
Represents a single event subscription entry used by the event system.
EventHandler instances are stored inside event emitter structures and
sorted using priority and order to determine execution sequence.
Higher priority values execute before lower ones. When priorities match,
order acts as a stable tie-breaker preserving insertion sequence.
Instances are pooled through recycle to reduce GC pressure in hot loops.
Properties:
| Name | Type | Description |
|---|---|---|
callback |
function
|
|
context |
Object
|
|
priority |
Number
|
|
order |
Number
|
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function
|
Function invoked when the event fires. |
context |
Object
|
Value used as |
priority |
Number
|
Execution priority (higher runs first). |
order |
Number
|
Stable ordering index used when priorities match. |
Methods
(static) recycle(eventHandler)
Returns EventHandler back to cache. If the instance has outstanding holds, the recycle is deferred until all holds are released.
Prefer calling eventHandler.recycle()
instead of direct pool access.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
eventHandler |
platypus.EventHandler
|
(static) recycleHold(eventHandler) → {platypus.EventHandler}
Increments the hold count on the instance, preventing recycling until all holds are released. Returns the instance for chaining.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
eventHandler |
platypus.EventHandler
|
Returns:
- Type:
-
platypus.EventHandler
(static) recycleRelease(eventHandler) → {platypus.EventHandler}
Decrements the hold count. When it reaches zero, any pending recycle is flushed. Returns the instance for chaining.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
eventHandler |
platypus.EventHandler
|
Returns:
- Type:
-
platypus.EventHandler
(static) setUp() → {platypus.EventHandler}
Returns EventHandler from cache or creates a new one.
- Source:
Returns:
- Type:
-
platypus.EventHandler
recycle()
Clears internal references and recycles the instance. If the instance has outstanding holds, the recycle is deferred until all holds are released.
- Source:
recycleHold() → {platypus.EventHandler}
Increments the hold count on the instance, preventing recycling until all holds are released. Returns the instance for chaining.
- Source:
Returns:
- Type:
-
platypus.EventHandler
recycleRelease() → {platypus.EventHandler}
Decrements the hold count. When it reaches zero, any pending recycle is flushed. Returns the instance for chaining.
- Source:
Returns:
- Type:
-
platypus.EventHandler