comic-plus
Version:
<p align="center"> <img width="200px" src="./logo.png"/> </p>
29 lines (28 loc) • 634 B
JavaScript
import { createTooltip } from "./src/tooltip.mjs";
const SCOPE = "__TOOLTIP__";
const useTooltip = function() {
return {
mounted(el, binding) {
el[SCOPE] = createTooltip(el, binding.value, binding.arg);
},
updated(el, binding) {
var _a, _b;
(_b = (_a = el[SCOPE]) == null ? void 0 : _a.update) == null ? void 0 : _b.call(_a, binding.value);
},
unmounted(el) {
if (el[SCOPE]) {
el[SCOPE].destroy();
delete el[SCOPE];
}
}
};
};
const vTooltip = {
install: function(app) {
app.directive("tooltip", useTooltip());
}
};
export {
useTooltip,
vTooltip
};