/**
 * DevExtreme (cjs/mobile/hide_callback.js)
 * Version: 24.1.7-build-24272-1937
 * Build date: Sat Sep 28 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
"use strict";
exports.hideCallback = void 0;
const hideCallback = exports.hideCallback = function() {
    let callbacks = [];
    return {
        add: function(callback) {
            if (!callbacks.includes(callback)) {
                callbacks.push(callback)
            }
        },
        remove: function(callback) {
            const indexOfCallback = callbacks.indexOf(callback);
            if (-1 !== indexOfCallback) {
                callbacks.splice(indexOfCallback, 1)
            }
        },
        fire: function() {
            const callback = callbacks.pop();
            const result = !!callback;
            if (result) {
                callback()
            }
            return result
        },
        hasCallback: function() {
            return callbacks.length > 0
        }
    }
}();
