Class ItemsManager
Hierarchy
- EventBasedManager<ItemEvents>
- ItemsManager (View Summary)
Accessors
count
-
get count(): number
Return the number of items received.
Returns number
hints
-
Returns a copy of all hints for this player.
Returns Hint[]
Remarks
Hints may take a moment to populate after establishing connection to server, as it needs to wait for data storage to fetch all current hints. If you need hints right after connecting, listen for the ItemEvents.hintsInitialized event.
received
-
Returns a copy of all items ever received.
Returns Item[]
Methods
off
-
off<
Event extends
| "itemsReceived"
| "hintReceived"
| "hintFound"
| "hintUpdated"
| "hintsInitialized",
>(
event: Event,
listener: (...args: ItemEvents[Event]) => void,
): thisRemoves an existing event listener.
Type Parameters
- Event extends
| "itemsReceived"
| "hintReceived"
| "hintFound"
| "hintUpdated"
| "hintsInitialized"
Parameters
- event: Event
The event name associated with this listener to remove.
- listener: (...args: ItemEvents[Event]) => void
The callback function to remove.
Returns this
This object.
- Event extends
on
-
on<
Event extends
| "itemsReceived"
| "hintReceived"
| "hintFound"
| "hintUpdated"
| "hintsInitialized",
>(
event: Event,
listener: (...args: ItemEvents[Event]) => void,
): thisAdd an event listener for a specific event.
Type Parameters
- Event extends
| "itemsReceived"
| "hintReceived"
| "hintFound"
| "hintUpdated"
| "hintsInitialized"
Parameters
- event: Event
The event name to listen for.
- listener: (...args: ItemEvents[Event]) => void
The callback function to fire when this event is received.
Returns this
This object.
- Event extends
wait
-
wait<
Event extends
| "itemsReceived"
| "hintReceived"
| "hintFound"
| "hintUpdated"
| "hintsInitialized",
>(
event: Event,
clearPredicate?: (...args: ItemEvents[Event]) => boolean,
): Promise<ItemEvents[Event]>Returns a promise that waits for a single specified event to be received. Resolves with the list of arguments dispatched with the event.
Type Parameters
- Event extends
| "itemsReceived"
| "hintReceived"
| "hintFound"
| "hintUpdated"
| "hintsInitialized"
Parameters
- event: Event
The event name to listen for.
- clearPredicate: (...args: ItemEvents[Event]) => boolean = ...
An optional predicate to check on incoming events to validate if the correct event has been received. If omitted, will return immediately on next event type received.
Returns Promise<ItemEvents[Event]>
- Event extends
Manages tracking and receiving of all received items and hints.