在 moodle 中删除事件监听器

问题描述 投票:0回答:0

我创建了一个包含表单的 moodle 块插件。

当移动用户尝试使用表单时,由于弹出键盘而调整窗口大小关闭了抽屉块,我试图调查是哪个事件监听器导致了这个,这里是处理程序的代码:

    define("core/utils", ["exports"], (function(_exports) {
    Object.defineProperty(_exports, "__esModule", {
        value: !0
    }),
    _exports.throttle = _exports.debounce = void 0;
    _exports.throttle = (func,wait)=>{
        let onCooldown = !1
          , runAgain = null;
        const run = function() {
            for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
                args[_key] = arguments[_key];
            runAgain = null !== runAgain,
            onCooldown || (func.apply(this, args),
            onCooldown = !0,
            setTimeout((()=>{
                const recurse = runAgain;
                onCooldown = !1,
                runAgain = null,
                recurse && run(args)
            }
            ), wait))
        };
        return run
    }
    ;
    _exports.debounce = (func,wait)=>{
        let timeout = null;
        return function() { // THIS IS THE HANDLER.
            for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)
                args[_key2] = arguments[_key2];
            clearTimeout(timeout),
            timeout = setTimeout((()=>{
                func.apply(this, args)
            }
            ), wait)
        }
    }
}
));

我不知道如何使用 $this->page->requires->js_init_code($code) 添加代码;停止这个事件

请注意,我使用的是 moove (boost child) 主题。

moodle moodle-boost
© www.soinside.com 2019 - 2024. All rights reserved.