import { getByRemoteOnce, getInLocal } from './pipe';
export function addUpdateCallbackListener(fn) {
    var _a, _b;
    var RefreshUtils = (_a = getByRemoteOnce('RefreshUtils')) !== null && _a !== void 0 ? _a : getInLocal('RefreshUtils');
    if (!RefreshUtils) {
        throw new Error('没有找到 RefreshUtils');
    }
    (_b = RefreshUtils === null || RefreshUtils === void 0 ? void 0 : RefreshUtils.eventEmitter) === null || _b === void 0 ? void 0 : _b.on('updateCallback', fn);
    return () => {
        var _a;
        (_a = RefreshUtils === null || RefreshUtils === void 0 ? void 0 : RefreshUtils.eventEmitter) === null || _a === void 0 ? void 0 : _a.off('updateCallback', fn);
    };
}
export function addExecuteRuntimeListener(fn) {
    var _a, _b;
    var RefreshUtils = (_a = getByRemoteOnce('RefreshUtils')) !== null && _a !== void 0 ? _a : getInLocal('RefreshUtils');
    if (!RefreshUtils) {
        throw new Error('没有找到 RefreshUtils');
    }
    const handler = function () {
        setTimeout(() => {
            fn.apply(this, arguments);
        }, 100);
    };
    (_b = RefreshUtils === null || RefreshUtils === void 0 ? void 0 : RefreshUtils.eventEmitter) === null || _b === void 0 ? void 0 : _b.on('executeRuntime', handler);
    return () => {
        var _a;
        (_a = RefreshUtils === null || RefreshUtils === void 0 ? void 0 : RefreshUtils.eventEmitter) === null || _a === void 0 ? void 0 : _a.off('executeRuntime', handler);
    };
}
//# sourceMappingURL=hot.js.map