All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.magics.$refs.js Maven / Gradle / Ivy

There is a newer version: 3.14.1
Show newest version
import { closestRoot, findClosest } from '../lifecycle'
import { mergeProxies } from '../scope'
import { magic } from '../magics'

magic('refs', el => {
    if (el._x_refs_proxy) return el._x_refs_proxy

    el._x_refs_proxy = mergeProxies(getArrayOfRefObject(el))

    return el._x_refs_proxy
})

function getArrayOfRefObject(el) {
    let refObjects = []

    findClosest(el, (i) => {
        if (i._x_refs) refObjects.push(i._x_refs)
    })

    return refObjects
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy