How to use the omi.options.afterInstall function in omi

To help you get started, we’ve selected a few omi examples, based on popular ways it is used in public projects.

github Tencent / omi / packages / omi-mobx / index.js View on Github external
cb({
                didTimeout: false,
                timeRemaining: function () {
                    return Math.max(0, 50 - (Date.now() - start))
                }
            })
        }, 1)
    }

window.cancelIdleCallback = window.cancelIdleCallback ||
    function (id) {
        clearTimeout(id)
    }


options.afterInstall = function (ele) {
    if (ele.constructor.observe) {
        oba(ele.data, ele)
    }
}

let idleId = null
const updateList = []

function oba(data, ele) {
    const o = observable(data)

    autorun(() => {
        JSON.stringify(o)
        if (ele._isInstalled) {
            updateList.push(ele)
            cancelIdleCallback(idleId)