_findUnitsByIds
How to Use _findUnitsByIds
Method
_findUnitsByIds
method is designed to retrieve unit information based on an array of unit IDs. It utilizes caching and local storage to improve performance and reduce unnecessary API requests. This method is useful for fetching specific unit details from a list of units, which can be used for various purposes in your application.Usage Steps:
1.
unitsIds
:unitsIds
). These IDs represent the units you want to retrieve. You should pass an array of IDs that you need information for.2.
callback function
. This function will be executed once the units are retrieved. The filtered units based on the provided IDs will be passed as an argument to this function.3.
Example:
unitIds
array contains IDs "unit1"
, "unit2"
, and "unit3"
. Replace these with the actual IDs of the units you want to retrieve.handleUnits
function will be executed once the units are retrieved, allowing you to process the data as needed.Common Use Cases:
1.
2.
3.
Notes:
_cache_units
) and in local storage to enhance performance. If the cache is available, it will be used to provide the requested units instead of making a new API call.