Modules.nas: Difference between revisions

Jump to navigation Jump to search
m
Line 92: Line 92:
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 {{code|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.
'''Example:''' any canvas created by the module should have called its {{code|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()}}.}}
{{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 ===
252

edits

Navigation menu