javascript - How can I get instances of different tabs such that I can store variables / perform operations specific to respective tabs -
note: using gwt build firefox extension
say have class operates on different tabs of browser:
class tabroutine{ element tab; static int tabdata; public tabroutine(element tab){ this.tab=tab; } public void tabmethod(){ //operation on tab } }
for each tab must create instance of class want destroy once tab closes. therefore each tab has int tabdata related it. here how approached it:
i have document element pertaining each tab available me (i have window object if helps). therefore, decided use
gbrowser.getbrowserfordocument(doc);
my question browser element unique tabs? imply have 2 tabs documents doc1 , doc2. if map these browser elements objects of tabroutine, each individual tab return same (and correct) browser can find object related it?
please tell if aspect of question unclear , i'll elaborate. lot!
yes, each <browser>
element associated particular tab. not bound particular content document - different site can loaded same tab. want go through gbrowser.browsers
collection when extension starts. listen tabopen
, tabclose
events notified whenever tab opened or closed (use gbrowser.getbrowserfortab
method <browser>
element these events associated with).
Comments
Post a Comment