MCPcopy
hub / github.com/sindresorhus/caprine / selectConversation

Function selectConversation

source/browser.ts:542–558  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

540
541// Focus on the conversation with the given index
542async function selectConversation(index: number): Promise<void> {
543 const list = await elementReady(selectors.conversationList, {stopOnDomReady: false});
544
545 if (!list) {
546 console.error('Could not find conversations list', selectors.conversationList);
547 return;
548 }
549
550 const conversation = list.children[index];
551
552 if (!conversation) {
553 console.error('Could not find conversation', index);
554 return;
555 }
556
557 conversation.querySelector<HTMLLegendElement>('[role=link]')!.click();
558}
559
560function selectedConversationIndex(offset = 0): number {
561 const selected = document.querySelector<HTMLElement>(selectors.selectedConversation);

Callers 4

nextConversationFunction · 0.85
previousConversationFunction · 0.85
jumpToConversationFunction · 0.85
browser.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected