An array of objects to delegat actios to
Optional
recursive: booleanWhether to return One instances in get
calls
Optional
context: any[]Shared context for the 'many' functions or object methods
const component = one([data(), view(table)], false, [{}]);
component.create([10000]);
Creates a One object which transmits a call, method dispatch, property get or set applied to the 'one' object to the 'many' objects.
The recursive arg is used to ensure that getting properties always wraps the array results with
one
also.Items in the context arg will be passed to all delegated calls as the final arguments. An empty array is created if not specified.
Sometimes, you may want to pass an array of 1 or more objects to provide a shared context for the items in many. Other times you may prefer no context because it may affect the behavior of the calls, since the functions or methods may be accepting optional arguments there. Passing your own arrays enable you to set the behavior however you like (by emptying or populating the array).