@vue-widget/hooks
Version:
hooks from react to vue
16 lines (15 loc) • 488 B
JavaScript
import { ref } from "vue";
export function useEvent(callback) {
var fnRef = 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));
};
}