Skip to content

Commit adcc66f

Browse files
committed
Refactor something
1 parent 8e57f1e commit adcc66f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

code.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,11 @@ Code.loadDemoArea = function () {
471471
select.value = localStorage.demoAreaSelect;
472472
Code.reloadSandbox();
473473

474+
window.addEventListener('unload', function () {
475+
localStorage.demoAreaWidth = area.style.width;
476+
localStorage.demoAreaHeight = area.style.height;
477+
});
478+
474479
content.addEventListener('mousedown', function (e) {
475480
e.stopPropagation();
476481
});
@@ -528,7 +533,6 @@ Code.loadDemoArea = function () {
528533
var move = function (evt) {
529534
var rx = evt.pageX;
530535
area.style.width = dw - rx + ox - 20 + 'px';
531-
localStorage.demoAreaWidth = area.style.width;
532536
};
533537

534538
var up = function () {
@@ -617,7 +621,6 @@ Code.loadDemoArea = function () {
617621
var move = function (evt) {
618622
var ry = evt.pageY;
619623
area.style.height = dh + ry - oy - 20 + 'px';
620-
localStorage.demoAreaHeight = area.style.height;
621624
};
622625

623626
var up = function () {
@@ -821,8 +824,6 @@ Code.loadSimulator = function () {
821824
frame.contentWindow.addEventListener('load', frameReady);
822825
}
823826

824-
window.addEventListener('resize', updateHeight);
825-
826827
window.addEventListener('unload', function () {
827828
storage.config = frame.contentWindow.blockly.config();
828829
storage.opened = area.classList.contains('show');

0 commit comments

Comments
 (0)