I am currently working on a project which requires a popup to be able to run a method on a component on another view (more specifically the map components flyTo() method).
I was wondering if there is anyway of accessing another views root container from Perspective (as you can in Vision through hierachies and the system.nav / system.gui package).
but this unfortunately seems to not yield the results I am looking for instead if I catch the error and print it to console I am provided with the message:
'unicode' object has no attribute 'getChild'
which I assume just means that self.page.props.primaryView is not an object representing the view (as I hoped it was).
Create a session level message on the map, and call that message handler with the payload that you want to pass. The session level message on the map would digest the payload and do the flyTo function based on that payload.
Thanks @ryan.white and @bschroeder will have a look into this. Don't often touch perspective so this is and the method and explanation is appreciated (as I will be diving into it and getting more involved in it). Also hope this helps someone in the future as I had real trouble looking for the solution to this!
Bonus Note for anyone reading this. Ensure you set your scope when using system.perspective.sendMessage() to deliver session messages. Scratched my head for a while not realising the scope defaults to page if not specified.
There is a meaningful difference between the scopes. For example if the user has two tabs open under the same session, both pages will call the fly to method if you use the session scope. Page scope will only affect the page they're interacting with. Possibly an extremely edge case or inconceivable, but being such a simple thing to design for, we may as well