1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-05-16 15:19:46 +02:00

debounce collapse updation.

This commit is contained in:
Kushagra Gour 2016-11-26 13:29:50 +05:30
parent 6dbc3626c5
commit 5411a1f3a5

View File

@ -81,6 +81,11 @@
function updateCodeWrapCollapseStates() { function updateCodeWrapCollapseStates() {
// if (updateCodeWrapCollapseStates.timeout) {
clearTimeout(updateCodeWrapCollapseStates.timeout);
// }
updateCodeWrapCollapseStates.timeout = setTimeout(function () {
console.log('refreshing');
['#js-html-code', '#js-css-code', '#js-js-code'].forEach(function (selector) { ['#js-html-code', '#js-css-code', '#js-js-code'].forEach(function (selector) {
var el = document.querySelector(selector); var el = document.querySelector(selector);
var bounds = el.getBoundingClientRect(); var bounds = el.getBoundingClientRect();
@ -90,6 +95,7 @@
el.classList.remove('is-minimized'); el.classList.remove('is-minimized');
} }
}); });
}, 500);
} }
function resetSplitting() { function resetSplitting() {
@ -644,7 +650,6 @@
['#js-html-code', '#js-css-code', '#js-js-code'].forEach(function (selector) { ['#js-html-code', '#js-css-code', '#js-js-code'].forEach(function (selector) {
var el = document.querySelector(selector); var el = document.querySelector(selector);
el.addEventListener('transitionend', function() { el.addEventListener('transitionend', function() {
console.log('transitionend')
updateCodeWrapCollapseStates(); updateCodeWrapCollapseStates();
}); });
}); });