3 Replies Latest reply on Aug 19, 2015 8:20 AM by matias.kiviniemi

    Generator events question

    Sergey Kritskiy Level 1

      Hi again, I have another question!

       

      I'm using imageChanged event (brush tool basically) in Generator to fire jsx-file with some document tweaking, the problem I have is that tweaking in jsx are also registered as imageChanged event.

      Is there a nice way to ignore what's happening in jsx? (I guess timer is the worst because I'm not sure how much time will my jsx function take). Do I need to make a callback from jsx or maybe there's an event from using Brush tool?

       

      Thanks

        • 1. Re: Generator events question
          matias.kiviniemi Level 3

          Basically you should keep track of document id's either by

          • allowing user to explicitly select documents you manage
          • store ids of open documents (see Generator.getOpenDocumentIDs()) at the time of starting your jsx
          • keep track of new documents from the delta having added=true

          Then ignore all events from documents created during your jsx

          • 2. Re: Generator events question
            Sergey Kritskiy Level 1

            I'm sorry I'm not sure I follow. I'm working with one document, imageChanged event dispatches when active document changes and I want to ignore active document changes from my jsx so imageChanged wouldn't go in infinite loop

            • 3. Re: Generator events question
              matias.kiviniemi Level 3

              Not sure either anymore. My understanding was that your JSX is changing/creating docs that causes issue for your Generator plugin that would think user is doing something and would need to fire the JSX again. Because of that my suggestion was that you need logic to detect if doc changes are caused by your jsx or by the user.

               

              But I don't understand why JSX needs to ignore active doc changes since it's the cause of the changes, right? While jsx is running, user can't change anything.