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

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

There is a newer version: 3.14.1
Show newest version
import { magic } from '../magics'
import { watch } from '../reactivity'

magic('watch', (el, { evaluateLater, cleanup }) => (key, callback) => {
    let evaluate = evaluateLater(key)

    let getter = () => {
        let value

        evaluate(i => value = i)

        return value
    }

    let unwatch = watch(getter, callback)

    cleanup(unwatch)
})




© 2015 - 2024 Weber Informatics LLC | Privacy Policy