Last active
April 26, 2024 22:11
-
-
Save freaktechnik/96487f9dbbecf693017fd11928bf0056 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| // Require some stuff | |
| const { myMethod } = require("my-method"); | |
| // Init code | |
| myMethod("initializing"); | |
| ... | |
| // Cleaning up | |
| exports.onUnload = () => { | |
| // Do cleanup | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| // Require some stuff | |
| const { when: unload } = require("sdk/system/unload"); | |
| // Init code | |
| const MY_CONSTANT = "foo"; | |
| // Exports (there are multiple way to organize these, some like to define then export, some prefer to directly export) | |
| exports.aMethod = () => MY_CONSTANT; | |
| // Unload | |
| unload(() => { | |
| // Clean up the mess this module made. | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment