如何从chrome扩展名中查看javascript中的卸载事件? [英] How to listen to uninstallation event in javascript from a chrome extension?

查看:284
本文介绍了如何从chrome扩展名中查看javascript中的卸载事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在google网站上, http://code.google.com/chrome/extensions/external_extensions.html



他们说,要卸载您的扩展名(例如,如果您的软件被卸载),请从首选项文件或注册表中删除元数据。



我真的很想这样做,但是如果我的扩展程序存在,我的扩展程序如何侦听卸载事件。我没有找到这个事件。



请帮忙。

解决方案

p>该段落的含义是,如果要卸载与扩展程序捆绑在一起的软件,则应手动卸载扩展名,然后删除注册表项。



卸载事件

  chrome.management.onUninstalled.addListener(function(string id){...}); 

它将适用于侦听正在卸载的其他扩展,但是最有可能捕获自己的卸载不可能。


I'm trying to clean some preferences files when a user uninstall my extension from chrome browser.

On google website, http://code.google.com/chrome/extensions/external_extensions.html

They say, "To uninstall your extension (for example, if your software is uninstalled), remove the metadata from the preferences file or registry. "

I would really like to do that but how do my extension listens to the 'uninstall event', if it exists. I didn't find this event anywhere.

Please help.

解决方案

What they mean by that paragraph is if you are uninstalling your software that was bundled with the extension, you should manually uninstall the extension as well by removing registry entries.

There is an uninstall event:

chrome.management.onUninstalled.addListener(function(string id) {...});

It would work for listening to other extensions being uninstalled, but catching your own uninstall with it most likely would not be possible.

这篇关于如何从chrome扩展名中查看javascript中的卸载事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆