nextcloud-files icon indicating copy to clipboard operation
nextcloud-files copied to clipboard

fix!: Allow to inherit from `View` to create custom classes

Open susnux opened this issue 5 months ago • 7 comments

Use case: You want to scope logic and state into the view rather than somewhere in a module.

Problems: Currently there are two problem that prevent creating a child-class of view:

  1. The view class did not implement the methods as methods but getters, this forces also child classes to use getters leading to really ugly code.
  2. The constructor required getContents to be part of the ViewData, but for child classes this makes no sense, as you probably want to overwrite this with a member function instead. Fixed by checking if new View was called or a new subclass.

susnux avatar Sep 03 '24 22:09 susnux