@cran/lib.vue.ref
Version:
Vue Reactivity Extensions
19 lines (18 loc) • 545 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.watchFilter = void 0;
const vue_1 = require("vue");
/**
* @since 0.0.1
* @category Watch
*/
function watchFilter(source, filter, cb, options) {
const filterFn = filter instanceof Function
? filter : function filterFn(next) { return next === filter; };
return (0, vue_1.watch)(source, function onSourceChange(...args) {
if (filterFn(...args)) {
cb(...args);
}
}, options);
}
exports.watchFilter = watchFilter;