vide/docs/api/reactivity-utility.md
Aaron Smith 8e31946dda
2023-08-03 15:06:40 +01:00

467 B

Reactivity API: Utility

cleanup()

Runs a callback anytime a reactive scope is re-ran.

  • Type

    function cleanup(callback: () -> ())
    
  • Example

    local data = source(1)
    
    watch(function()
        local label = create "TextLabel" { Text = data }
    
        cleanup(function()
            label:Destroy()
        end)
    end)