Confirmed users, Bureaucrats and Sysops emeriti
2,088
edits
(→API) |
|||
Line 21: | Line 21: | ||
self.onUpgrade( function ) | self.onUpgrade( function ) | ||
self.onUninstall( function ) | self.onUninstall( function ) | ||
Line 35: | Line 31: | ||
The <code>onUninstall</code> handler is called when the add-on is uninstalled, giving add-ons the opportunity to clean up files, preferences, annotations <strike>or to flip the bird at the user on the way out</strike>. | The <code>onUninstall</code> handler is called when the add-on is uninstalled, giving add-ons the opportunity to clean up files, preferences, annotations <strike>or to flip the bird at the user on the way out</strike>. | ||
'''Enable/Disable''' | |||
There's no need for explicit support for enabling and disabling of add-ons here. When an add-on is disabled, any callbacks the code registered with require("unload").when() or require("unload").ensure() are automatically called, and when an addon is enabled, its code is re-evaluated and its exports.main() is called. | |||
=== Use Cases === | === Use Cases === |