Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #31810 from justindarc/bug1203270
Browse files Browse the repository at this point in the history
Bug 1203270 - [Music][NGA] Optimize view lifecycle
  • Loading branch information
justindarc committed Sep 16, 2015
2 parents e27fd43 + 59609d2 commit 19696d5
Show file tree
Hide file tree
Showing 28 changed files with 509 additions and 357 deletions.
7 changes: 4 additions & 3 deletions dev_apps/music-nga/css/app.css
Expand Up @@ -32,6 +32,7 @@ a {
bottom: 4.6rem;
left: 0;
width: 100%;
height: auto;
transition: bottom 0s linear 0.2s;
}

Expand All @@ -52,14 +53,14 @@ body[data-search="true"] #view-stack {
transition: none;
}

body[data-active-view-id="player"] #tab-bar {
body[data-active-view-url="/views/player/index.html"] #tab-bar {
transform: translate(0, 4.6rem);
visibility: hidden;
transition-delay: 0s, 0.2s;
}

body:not([data-active-view-id]) #view-stack,
body[data-active-view-id="player"] #view-stack {
body:not([data-active-view-url]) #view-stack,
body[data-active-view-url="/views/player/index.html"] #view-stack {
bottom: 0;
transition-delay: 0s;
}
1 change: 1 addition & 0 deletions dev_apps/music-nga/elements/music-rating.js
Expand Up @@ -10,6 +10,7 @@ var template =
flex-flow: row nowrap;
width: 100%;
height: 100%;
-moz-user-select: none;
}
#container > button {
background-color: transparent;
Expand Down
16 changes: 8 additions & 8 deletions dev_apps/music-nga/elements/music-tab-bar.js
Expand Up @@ -31,11 +31,18 @@ proto.createdCallback = function() {

this.addEventListener('click', (evt) => {
var tab = evt.target.closest('button');
if (!tab) {
if (!tab || tab === this.selectedElement) {
return;
}

this.selectedElement = tab;

this.dispatchEvent(new CustomEvent('change', {
detail: {
selectedElement: this.selectedElement,
selectedIndex: this.selectedIndex
}
}));
});

this.selectedIndex = 0;
Expand Down Expand Up @@ -75,13 +82,6 @@ Object.defineProperty(proto, 'selectedIndex', {

tab.classList.remove('selected');
});

this.dispatchEvent(new CustomEvent('change', {
detail: {
selectedElement: this.selectedElement,
selectedIndex: this._selectedIndex
}
}));
}
});

Expand Down

0 comments on commit 19696d5

Please sign in to comment.