question

Upvotes
Accepted
1 0 1 1

onLinked/onUnlinked events not triggering

Hi,

I'm having issues with the onLinked/onUnlinked events triggering. I have developed my app to listen for the events and it works fine in the development environment using localhost, however as soon as I run in production, those events no longer trigger.
For testing I just deploy the same code as development with no modifications just that its now hosted on a proper domain (same as the domain registered in appStudio) rather than localhost.

example code that I'm using to debug this:

JET.onLoad(function() {
  JET.onLinked(function () { console.log('linked') })
  JET.onUnlinked(function () { console.log('unlinked') })
})
eikoneikon-app-studiojavascript
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
4.6k 26 7 22

@nick.beckenham this event is not triggered in the App Studio container and is primarily used for internal purposes. You only need to monitor OnContextChange() event.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

@Zhenya Kovalyov that is unfortunate as we have 2 windows open, 1 with a custom form and the other with a table, where we want to be able to notify the custom form to update based on the selected item in the table only if the windows are linked.

@nick.beckenham
I'm not sure I understand you. Even if you could use onLinked/OnUnlinked events, I don't see how they would help your use case. These events are raised when the user links/unlinks the app. Your use case is facilitated by the context sharing. When the user clicks on an item in the table you should call contextChange method. This will trigger onContextChange event in the app with the form, but only if the two apps are linked. Isn't this what you're looking for?

@Alex Putkov.

Doesn't contextChange/onContextChange only give you the RIC and other Instrument specific data? How can I include custom data?
Furthermore if there were 3 of our App's windows linked together we wouldn't want both of the other 2 windows to show the same page. Rather if we knew they were linked we could setup a message channel and communicate further details to work with multiple windows.
I realise I can do a message channel without linking, however then it would be confusing for the user if the windows behaved linked/unlinked regardless of the visible window linking.

Show more comments
Click below to post an Idea Post Idea