Skip to content

Commit

Permalink
Slight optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
keanulee committed Jun 20, 2016
1 parent ee0d36e commit c738ce1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
10 changes: 5 additions & 5 deletions app-drawer-layout/app-drawer-layout.html
Expand Up @@ -209,13 +209,12 @@
},

resetLayout: function() {
this.debounce('_resetLayout', function() {
if (!this.isAttached) {
return;
}
if (!this.isAttached) {
return;
}

this.debounce('_resetLayout', function() {
var drawer = this.drawer;
var drawerWidth = this.drawer.getWidth();
var contentContainer = this.$.contentContainer;

if (this.narrow) {
Expand All @@ -228,6 +227,7 @@
drawer.opened = drawer.persistent = true;
contentContainer.classList.remove('narrow');

var drawerWidth = this.drawer.getWidth();
if (drawer.position == 'right') {
contentContainer.style.marginLeft = '';
contentContainer.style.marginRight = drawerWidth + 'px';
Expand Down
3 changes: 1 addition & 2 deletions app-drawer-layout/test/app-drawer-layout.html
Expand Up @@ -137,9 +137,8 @@
});

test('content layout', function(done) {
var listenerSpy = sinon.spy();
var xResizeable = drawerLayout.querySelector('x-resizeable');
xResizeable.addEventListener('iron-resize', listenerSpy);
var listenerSpy = sinon.spy(xResizeable, 'notifyResize');
drawerLayout.responsiveWidth = '10000px';

window.setTimeout(function() {
Expand Down
7 changes: 3 additions & 4 deletions app-drawer/app-drawer.html
Expand Up @@ -234,7 +234,7 @@
},

observers: [
'resetLayout(position)',
'resetLayout(position, isAttached)',
'_resetPosition(align, isAttached)'
],

Expand Down Expand Up @@ -308,9 +308,8 @@
},

/**
* Resets the layout. If you changed the size of app-header via CSS
* you can notify the changes by either firing the `iron-resize` event
* or calling `resetLayout` directly.
* Resets the layout. The event fired is used by app-drawer-layout to position the
* content.
*
* @method resetLayout
*/
Expand Down

0 comments on commit c738ce1

Please sign in to comment.