@zoom-image/vue
Version:
Adapter of zoom image core for Vue
34 lines (32 loc) • 872 B
JavaScript
import { reactive, onUnmounted } from 'vue';
import { createZoomImageClick } from '@zoom-image/core';
// src/useZoomImageClick.ts
function useZoomImageClick() {
let result;
const zoomImageState = reactive({
zoomedImgStatus: "idle"
});
const createZoomImage = (...arg) => {
result?.cleanup();
result = createZoomImageClick(...arg);
const currentState = result.getState();
for (const key in currentState) {
zoomImageState[key] = currentState[key];
}
result.subscribe(({ updatedProperties }) => {
for (const key in updatedProperties) {
zoomImageState[key] = updatedProperties[key];
}
});
};
onUnmounted(() => {
result?.cleanup();
});
return {
zoomImageState,
createZoomImage
};
}
export { useZoomImageClick };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-SLEE5MWJ.mjs.map