local E=require(script.Parent.Parent.createSignal)local p={}function p.componentRegistered(T,E,p)function p.updateProperty(E,p,T)local I=E[p]E[p]=T E.raisePropertyChanged(p,T,I)end end function p.componentAdded(g,p,T,I)local Z,B=E()I.changed=Z I.raisePropertyChanged=B end return p
local createSignal = require(script.Parent.Parent.createSignal)

local componentChangedEventPlugin = {}

function componentChangedEventPlugin:componentRegistered(core, componentClass)
    function componentClass.updateProperty(componentInstance, key, newValue)
        local oldValue = componentInstance[key]

        componentInstance[key] = newValue

        componentInstance.raisePropertyChanged(key, newValue, oldValue)
    end
end

function componentChangedEventPlugin:componentAdded(core, entityId, componentInstance)
    local propertyChangedSignal, raisePropertyChanged = createSignal()

    componentInstance.changed = propertyChangedSignal
    componentInstance.raisePropertyChanged = raisePropertyChanged
end

return componentChangedEventPlugin
