Skip to content

Hooking up afterViewerChanged/beforeViewerChanged #6186

Answered by zoran995
lob743 asked this question in Q&A
Discussion options

You must be logged in to vote

Already reported in #4752. You probably can use mobx observables to get out around that. I used a combination of reaction and when (not sure why both were needed, long time since it's implemented) to create manual subscribtion to viewer events and it seems to work fine.

  constructor() {
    reaction(
      () => this.cesiumViewer,
      () => this.addUpdateSubscription(),
      {
        equals: (a, b) => {
          return isDefined(b);
        }
      }
    );

    reaction(
      () => this.leafletViewer,
      () => this.addUpdateSubscription(),
      {
        equals: (a, b) => {
          return isDefined(b);
        }
      }
    );

    when(
      () => isDefined(this.cesiumViewer)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lob743
Comment options

Answer selected by lob743
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants