Scripts are run in isolated instances, so in order to shared variables
between different javascript patches you must pass data via inputs and
outputs in QC. You could do this by expecting a settings structure
(and initializing one if empty), copying the values into a __structure
global to your JS patch (outside the scope of your main function), modifying
them as need be, and then returning them as a structure identical to the
input __structure expected. Then, if you have other simular JS patches, you
can from a loop with all of the settings outputs going to another node's
setting input.

If you do no want to pass through QC, then you would have to keep all of
your code contained in one JS patch and take a muli-pass based approach.
This would be easily achievable by putting each of your patches' code into
functions in one JS patch, and then have a main function which calls a
specific function depending on an input __index. Then, if you have your
settings declared above the scope of all of your functions, and initialize
them in your main function as needed, and each of your functions will have
read/write access to them.
-Colin


On Fri, May 6, 2011 at 11:51 AM, Nisar Ahmed <[email protected]> wrote:

>  How do I define a global variable in a JS patch that can be shared with
> another JS patch?
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Quartzcomposer-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
>
> http://lists.apple.com/mailman/options/quartzcomposer-dev/ccr09%40hampshire.edu
>
> This email sent to [email protected]
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to