250
edits
Line 91: | Line 91: | ||
=== unload() function === | === unload() function === | ||
If you want the module to be re-/un-loadable, you must make sure to track resources and remove them on onload. | If you want the module to be re-/un-loadable, you must make sure to track resources and remove them on onload. | ||
For this the main.nas shall contain a function | For this the main.nas shall contain a function {{code|unload()}} that removes any resources which were created by the module. | ||
Example: any canvas created by the module should have called its del() method here. | {{note|Calls to {{code|setlistener()}} and {{code|maketimer()}} are automatically tracked by the Module class for you, timers will be stopped automatically, listeners will be removed automatically on {{code|unload()}}.}} | ||
'''Example:''' any canvas created by the module should have called its del() method here. | |||
=== Rules for Module names === | === Rules for Module names === |
edits