简体   繁体   English

Chrome扩展程序和主题之间的通信?

[英]Communication between Chrome Extension and Theme?

I create a Chrome Extension and I have a theme too. 我创建了Chrome扩展程序,并且也有一个主题。 In the extension I made a link to the theme (kind of self advertising). 在扩展程序中,我链接到了主题(一种自我广告)。 I want to hide this link if the theme is in use. 如果主题正在使用中,我想隐藏此链接。

I know extensions can pass messages if their ID is known. 我知道扩展名可以通过消息传递,如果它们的ID是已知的。 But is there a way to check if given theme is in use, as themes has their own id too? 但是有没有一种方法可以检查给定主题是否正在使用,因为主题也有自己的ID? I tried: 我试过了:

chrome.extension.sendRequest(string extensionId, any request, function responseCallback);

but it does not work, as there is no way to respond with Theme. 但这是行不通的,因为无法通过主题进行响应。 Only thing I need is the javascript code for this. 我唯一需要的就是为此的JavaScript代码。 No more, no less. 不多不少。 Thanks in advance! 提前致谢!

主题具有唯一的ID(您可以从网上商店网址获取它),因此可以使用chrome.management.getAll()方法检查主题是否已安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM