2014-09-19 72 views

回答

5

这将在每个文件的工作:

require("sdk/system/unload").when(function(reason) { 
    if (reason == "uninstall") { 
    // do uninstall stuff.. 
    } 
}); 
+2

感谢您的笔记男人生病请记住 – Noitidart 2014-09-23 00:34:27

+0

奇怪的,但在我的情况下,我有'禁用'的原因,当我点击删除附加。但无论如何,谢谢你的解决方案。 – ebaranov 2015-07-03 16:32:37

+0

由于API中的错误,您总是得到“禁用”,请参阅页面底部的注释:https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Listening_for_load_and_unload – msangel 2015-12-30 04:42:40

2

试试这个:

exports.onUnload = function(reason) { 
    //do stuff for unload here 
} 
+1

我觉得这只能在main.js文件,它的弃用。 – erikvold 2014-09-22 22:38:08