function decorator(dom, type, fn) {
        if(typeof dom[type] == 'funtion') {
            let oldMethods = dom[type];
            dom[type] = function() {
                oldMethods()
                fn()
            }
        } else {
            dom[type] = fn()
        }
    } 
Copy the code