JavaScript JS API - find ID of Window
AnsweredHi all, I am working on integrating an access control systems web interface into NX.
I aim to use alarms or video verification based triggers to pop the camera up to the right of the web page.
So I need to be able to get the id for the VMS.tab.item for the browsers item. I thought maybe in VMS.self but no dice.
From this I also plan to configure the window to only allow one of itself in a tab etc.
If it is not existing functionality and is possible to add this myself with the open source client code I'd be willing to give it a shot with a nudge in the right direction.
Also could the knowledge base please be updated as it looks like self and auth are not fully defined there.
-
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 -
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 -
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 -
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.
Comments
4 comments