20,741
edits
Line 2,340: | Line 2,340: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
_setlistener( "/sim/signals/reinit", remove_listeners ); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Note how we're using the low level _setlistener() call directly here, to avoid adding the listener id to the "cleanup" vector, which would mean that we're also removing this listener - i.e. the cleanup would then only work once. | |||
Now, you'll probably have noticed that it would make sense to consider wrapping all these helpers and variables inside an enclosing helper class, this can be accomplished in Nasal using a hash. | Now, you'll probably have noticed that it would make sense to consider wrapping all these helpers and variables inside an enclosing helper class, this can be accomplished in Nasal using a hash. |