当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript element-ready.default函数代码示例

本文整理汇总了TypeScript中element-ready.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: sendConversationList

async function sendConversationList(): Promise<void> {
	const conversations: Conversation[] = await Promise.all(
		([...(await elementReady(listSelector)).children] as HTMLElement[])
			.splice(0, 10)
			.map(async (el: HTMLElement) => {
				const profilePic = el.querySelector<HTMLImageElement>('._55lt img');
				const groupPic = el.querySelector<HTMLImageElement>('._4ld- div');

				// This is only for group chats
				if (groupPic) {
					// Slice image source from background-image style property of div
					const bgImage = groupPic.style.backgroundImage!;
					groupPic.src = bgImage.slice(5, bgImage.length - 2);
				}

				const isConversationMuted = el.classList.contains('_569x');

				return {
					label: el.querySelector<HTMLElement>('._1ht6')!.textContent!,
					selected: el.classList.contains('_1ht2'),
					unread: el.classList.contains('_1ht3') && !isConversationMuted,
					icon: await getDataUrlFromImg(
						profilePic ? profilePic : groupPic!,
						el.classList.contains('_1ht3')
					)
				};
			})
	);

	ipc.send('conversations', conversations);
}
开发者ID:kusamakura,项目名称:caprine,代码行数:31,代码来源:browser.ts

示例2: selectConversation

// Focus on the conversation with the given index
async function selectConversation(index: number): Promise<void> {
	const conversationElement = (await elementReady(listSelector)).children[index];

	if (conversationElement) {
		(conversationElement.firstChild!.firstChild as HTMLElement).click();
	}
}
开发者ID:kusamakura,项目名称:caprine,代码行数:8,代码来源:browser.ts

示例3: sendReply

async function sendReply(message: string): Promise<void> {
	const inputField = document.querySelector<HTMLElement>('[contenteditable="true"]');
	if (inputField) {
		const previousMessage = inputField.textContent;
		// Send message
		inputField.focus();
		insertMessageText(message, inputField);
		(await elementReady<HTMLElement>('._30yy._38lh')).click();

		// Restore (possible) previous message
		if (previousMessage) {
			insertMessageText(previousMessage, inputField);
		}
	}
}
开发者ID:kusamakura,项目名称:caprine,代码行数:15,代码来源:browser.ts

示例4: elementReady

  selectors.forEach(async selector => {
    try {
      const buttonReady = elementReady(`body.xE .G-atb .${selector}`)

      const readyTimeout = setTimeout(() => {
        buttonReady.cancel(`Detect button "${selector}" timed out`)
      }, 10000)

      const button = await buttonReady
      clearTimeout(readyTimeout)

      button.addEventListener('click', () => window.close())
    } catch (error) {
      log.error(error)
    }
  })
开发者ID:,项目名称:,代码行数:16,代码来源:

示例5:

(async () => {
	const startCallButton = await elementReady<HTMLElement>('._3quh._30yy._2t_');
	startCallButton.click();
})();
开发者ID:kusamakura,项目名称:caprine,代码行数:4,代码来源:browser-call.ts

示例6: withSettingsMenu

async function withSettingsMenu(callback: () => Promise<void> | void): Promise<void> {
	await withMenu(await elementReady<HTMLElement>('._30yy._2fug._p'), callback);
}
开发者ID:kusamakura,项目名称:caprine,代码行数:3,代码来源:browser.ts


注:本文中的element-ready.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。