import Signal from "./Signal.js";

/**
 * @param {function(*):boolean} predicate
 */
export function signal_filter(predicate) {
    const signal = new Signal();

    function handler(...args) {
        if (predicate(...args)) {

            signal.dispatch(...args);

        }
    }

    return {
        signal,
        handler
    };
}
