1
나는 드래그 가능한 객체에서 위치 변경을 저장하기 위해 MutationObserver
을 사용하고 있습니다.마지막 돌연변이 전용 MutationObserver
그것은 다음과 같습니다
let observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
this.builderData[element.id].$position.left = element.style.left;
this.builderData[element.id].$position.top = element.style.top;
this.saveBuilderData();
});
});
observer.observe(element, { attributes : true, attributeFilter : ['style'] });
그러나, 모든 픽셀이 실행이 변경이 운영되고 실행 된 저장 많은 그래서. 약 1 초 동안 정지 변이가 있거나 각 콜백이 이전 것을 제외시킨 후에 만 저장하고 싶습니다. 이미
RxJava으로이 작업을 수행했지만
MutationObserver
으로 작업하지 않았습니다.
아이디어가 있으십니까?
당신이 사용할 수있는 [디 바운스는 (https://github.com/component/debounce) 줄일 수있는 양 저장된 정보가 – Flying