I have created some custom properties which are binded to tags within perspective. I will be using these properties on several objects within this page/view. Is there a difference or preferred method to creating these custom properties on the actual view versus on the root container?
Having them on the view itself makes it slightly easier to reference from scripting (self.view.custom.someProperty
) and, in my opinion, slightly easier to reason about. Performance wise, there shouldn’t be any difference.
Ok cool. Agreed using the view instead of the root does make things simpler to read. Would this same self.view.custom.someProperty be used whether you are in perspective or vision?
Thanks.
I agree with @PGriffith; I always put my view-wide custom properties on the view node. I always try to scope my custom properties to the node which would use them. Placing a custom property on the root node sort of implies that only the root would use that property. I’ve always considered properties on the View node to be available for use throughout the View.
No, Vision has completely different semantics for accessing things through scripting and different conventions. The same general advice applies (put things at the highest level that 'makes sense' for encapsulation), but Vision's got a stronger delineation between 'windows' and 'templates', where templates have dedicated support for parameters. Perspective blended the two into 'views', which also have (directional) parameters.
Good to know, thanks. I have only worked on perspective projects so far.
Makes sense!