-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Is your feature request related to a problem? Please describe.
Some operators currently allow specifying an instance, for example, in window operators. However, in all tutorials and most examples, the instance is presented as a single field.
In practice, there are cases where it is necessary to define an instance composed of multiple components. This is already technically possible today, but it is not obvious to users how such a composite instance is represented and accessed.
Currently, the instance is available via pw.this._pw_instance, where individual components can be accessed as array elements:
- index
0corresponds to the first component, - index
1to the second component, - and so on.
This behavior is non-obvious and poorly documented, which makes working with composite instances confusing for users.
Describe the solution you'd like
The solution consists of two parts:
- Expose the underlying
_pw_instancein a more user-friendly way, so that users can access the instance directly via something likepw.this.instance. A more ergonomic API could be proposed here (suggestions are welcome). - Add a clear example of using composite instances to the tutorials on the website.
Describe alternatives you've considered
Keeping the current behavior as-is.
This is a non-desired alternative, as user feedback indicates that composite instances are a real and recurring need.
Additional context
Since this change only involves making the existing _pw_instance mechanism publicly accessible, no breaking changes are expected. The solution should be fully backward-compatible.