UNPKG

@studiometa/js-toolkit

Version:

A set of useful little bits of JavaScript to boost your project! 🚀

35 lines (34 loc) • 889 B
import { usePointer } from "../services/index.js"; function withRelativePointer(BaseClass, { target = (instance) => instance.$el } = {}) { class WithRelativePointer extends BaseClass { /** * Config. */ static config = { ...BaseClass.config, emits: ["movedrelative"] }; /** * Class constructor. */ constructor(element) { super(element); this.$on("mounted", () => { this.$services.register( "movedrelative", usePointer.bind(void 0, target.call(this, this)) ); this.$services.enable("movedrelative"); }); this.$on("destroyed", () => { this.$services.disable("movedrelative"); this.$services.unregister("movedrelative"); }); } } return WithRelativePointer; } export { withRelativePointer }; //# sourceMappingURL=withRelativePointer.js.map