Should I use $.Data() instead of Global object variable ?
I have a client that has a 'switch' - when on it run's various routines every 30 seconds - when off, it avoids running the routines.
I have a jquery mobile ui that permits the operator to switch the status on/off in the client browser.
When the switch is on, there are additional values that are stored (a session name, the last record id that the service client previously processed).
I am storing the state and additional values via using the switch as a jquery selector and $.data() but I am thinking in hindsight, perhaps its better I just have a global object as my single point of reference. From a performance point of view, it takes the heat of jquery having to set/get the data.
I can understand that $.Data() can be useful for some situations (remove something from the DOM and its related events and associated data gets kicked with it all at once). But in my example above, I suspect that a global object variable would probably be 'more correct'.
Anyway care to comment on my understanding/method of syncing?