Modules.nas: Difference between revisions

Jump to navigation Jump to search
m
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 '''unload''' that removes any resources which were created by the module.
For this the main.nas shall contain a function {{code|unload()}} that removes any resources which were created by the module.
Exception: setlistener and maketimer are automatically tracked by Module class for you, timers will be stopped automatically, listeners will be removed automatically on unload().


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 ===
250

edits

Navigation menu