@vue-widget/hooks
Version:
hooks from react to vue
19 lines (18 loc) • 541 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useEvent = useEvent;
var _vue = require("vue");
function useEvent(callback) {
var fnRef = (0, _vue.ref)();
fnRef.value = callback;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var _fnRef$current;
return (_fnRef$current = fnRef.value) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
};
}