Skip to main content

JavaScript JS API - find ID of Window

Answered

Comments

4 comments

  • Jaemyn Kinney

    Adding in hopes one of the NX team sees this. I'm happy enough with an answer of no direct method to determine the windows ID. It's a nice to have, but I'm sure there's a creative way to figure it out.

    0
  • Ichiro
    • Network Optix team

    Hi Jaemyn Kinney

    Thanks for your question, but at this moment, we provide the option is to find the item by name : 
    const state = await window.vms.tab.state();
    const webpage = state.items.find(item => item.resource.name === "Example")
    // webpage.id

     

    Please let us know if you have any other questions, we sincerely hope this helps.
    Thanks.

    0
  • Jaemyn Kinney

    Hi Ichiro,

    That's a good idea. The tricky thing for me here is I can't control how people might add the web page.

    Is there anything on VMS.tab.state that Indicates when an item was added to the tab?

    I could probably do an educated guess from that

    0
  • Ichiro
    • Network Optix team

    Hi Jaemyn Kinney

    You may receive itemAdded signal on every new item on the tab, the sample code is

    vms.tab.itemAdded.connect((item) => { /*item.resource.name*/ })
     
    Thanks.
    0

Please sign in to leave a comment.