@zoom-image/vue
Version:
Adapter of zoom image core for Vue
36 lines (33 loc) • 883 B
JavaScript
;
var vue = require('vue');
var core = require('@zoom-image/core');
// src/useZoomImageClick.ts
function useZoomImageClick() {
let result;
const zoomImageState = vue.reactive({
zoomedImgStatus: "idle"
});
const createZoomImage = (...arg) => {
result?.cleanup();
result = core.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];
}
});
};
vue.onUnmounted(() => {
result?.cleanup();
});
return {
zoomImageState,
createZoomImage
};
}
exports.useZoomImageClick = useZoomImageClick;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=useZoomImageClick.js.map