Skip to content

Callback for when a plugin is reloaded #2

@AndreLouisIssa

Description

@AndreLouisIssa

proposed on_reload (unsure where it would be put, perhaps a new namespace called meta?)

would make it easier for plugins that manage other plugins to clear any information would otherwise accumulate negatively over reloads.

e.g.

rom.<namespace>.on_reload(function(env)
    my_callbacks[env._PLUGIN.guid] = {}
end)

or

rom.<namespace>.on_reload(function(env)
    local callbacks = my_callbacks[env._PLUGIN.guid]
    if callbacks == nil then return end
    for k in pairs(callbacks) do
        callbacks[k] = nil
    end
end)

or it could be used to declare some features inert in preparation for a reload as they might not make sense in that context (e.g. managing external state like sockets, file handles etc.).

unsure if there's any benefit in an on_reload.post variant, I suppose it could be used for removing any flags that might have been set in on_reload.pre.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions