Method: OpenHAB::Core::ScriptHandling.script_unloaded

Defined in:
lib/openhab/core/script_handling.rb

.script_unloaded(priority: nil, &block) ⇒ void

This method returns an undefined value.

Add a block of code to be executed when the script is unloaded.

This can occur when openHAB shuts down, or when the script is being reloaded.

Multiple hooks can be added by calling #script_unloaded multiple times. They can be used to perform final cleanup.

Examples:

script_unloaded do
  logger.info 'Hi, this script has been unloaded'
end

Parameters:

  • priority (Integer, nil) (defaults to: nil)

    The order at which the the given hook will be executed. The higher the number, the lower the priority. Higher priority hooks will be executed first, before the lower priority hooks. When nil, the default priority of zero will be used.



54
55
56
# File 'lib/openhab/core/script_handling.rb', line 54

def script_unloaded(priority: nil, &block)
  ScriptHandlingCallbacks.script_unloaded_hooks[priority || 0] << block
end