Creates an instance of a class ArrayTransformer.
Configuration parameters for the transformer.
Optionalchanged?: (t: T[]) => voidOptional callback function that is called when the target array changes.
Optionalclean?: (t: T) => voidOptional cleanup function for each item in the target array before it is replaced or removed.
Optionalinit?: (t: T) => Promise<void>Optional asynchronous initialization function for each transformed item in the target array.
OptionalisItemsEquals?: (a: S, b: S) => booleanOptional function to compare items in the source array for equality. Defaults to Object.is.
The source array or a function that returns the source array.
The target array or a function that returns the target array.
OptionaltrackingMode?: TrackingModeFunction that transforms each item from the source array into the target array.
Indicates whether an initialization function is provided and needs to be called for each transformed item.
Starts the transformation process and waits for all initialization promises to resolve before completing. This method ensures that all items in the target array are fully initialized before the method returns.
A promise that resolves when all initialization promises have been completed.
Synchronizes the target array with the current state of the source array. This method updates the target array based on the current contents of the source array.
Asynchronously synchronizes the target array with the source array and waits for all initialization promises to resolve before completing. This ensures that the target array is updated and initialized properly before the method returns.
A promise that resolves when the synchronization and all initialization promises have been completed.
Object for synchronization and transformation a source array into a target array.
Remarks
It observes changes in the source array, applies a transformation function to each item, and updates the target array accordingly. The class also handles item initialization and cleanup if provided by the user.