Skip to content

TST API Question: get/set-tree-structure #3747

Answered by piroor
irvinm asked this question in Q&A
Discussion options

You must be logged in to vote

The tabs parameter looks missing in your example codes. As documented at https://github.com/piroor/treestyletab/wiki/API-for-other-addons#take-a-tree-structure-snapshot-of-tabs the id information of got snapshot is ignored by TST, so you still need to specify tabs to be applied the given snapshot.

Here is an example to invert collapsed/expanded state with get-tree-structure and set-tree-structure which successfully worked on my environment:

(async () => {
  const original = await browser.runtime.sendMessage('[email protected]', {
    type: 'get-tree-structure',
    tabs: '*',
  });
  const inverted = JSON.parse(JSON.stringify(original).replace(/true/g,'WAS_TRUE').replace(/false/

Replies: 1 comment 1 reply

Comment options

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

Answer selected by irvinm
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