On UNLOAD » History » Version 1
Per Amundsen, 11/14/2015 02:43 AM
| 1 | 1 | Per Amundsen | _Added in 1.8.10_ |
|---|---|---|---|
| 2 | |||
| 3 | *on <level>:UNLOAD:<commands>* |
||
| 4 | |||
| 5 | Triggers when a script file is unloaded. |
||
| 6 | |||
| 7 | See also [[on LOAD]] [[on START]]. |
||
| 8 | |||
| 9 | *Parameters* |
||
| 10 | |||
| 11 | <level> - The level for the event to trigger. |
||
| 12 | <commands> - The commands to be performed when the event listener's criteria is met. |
||
| 13 | |||
| 14 | *Example* |
||
| 15 | |||
| 16 | <pre> |
||
| 17 | ; Create a cleanup alias. |
||
| 18 | alias -l cleanup { |
||
| 19 | ; Unset the %loaded variable |
||
| 20 | unset %loaded |
||
| 21 | } |
||
| 22 | |||
| 23 | ; Listen for the UNLOAD event, and when matched, run this cleanup alias. |
||
| 24 | on *:UNLOAD:cleanup | echo -ag Script is $iif(%loaded,loaded,not loaded) |
||
| 25 | </pre> |