Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: ui/file_manager/audio_player/elements/track_list.js

Issue 1495873002: AudioPlayer: Stop using Object.observe() and Array.observe(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Listen to property-change events for four states explicitly. Stop using Array.observe. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/audio_player/elements/track_list.js
diff --git a/ui/file_manager/audio_player/elements/track_list.js b/ui/file_manager/audio_player/elements/track_list.js
index d1a030e4652d785364e0e65fbcaf147161580a52..e04b727b8fba411b466e7e3fa531ee0c75e70735 100644
--- a/ui/file_manager/audio_player/elements/track_list.js
+++ b/ui/file_manager/audio_player/elements/track_list.js
@@ -56,26 +56,9 @@ var TrackInfo;
* element is ready.
*/
ready: function() {
- this.observeTrackList();
-
window.addEventListener('resize', this.onWindowResize_.bind(this));
},
- observeTrackList: function() {
- // Unobserve the previous track list.
- if (this.unobserveTrackList_)
- this.unobserveTrackList_();
-
- // Observe the new track list.
- var observer = this.tracksValueChanged_.bind(this);
- Array.observe(this.tracks, observer);
-
- // Set the function to unobserve it.
- this.unobserveTrackList_ = function(tracks, observer) {
- Array.unobserve(tracks, observer);
- }.bind(null, this.tracks, observer);
- },
-
/**
* Play order of the tracks. Each value is the index of 'this.tracks'.
* @type {Array<number>}
@@ -130,9 +113,6 @@ var TrackInfo;
// Note: Sometimes both oldValue and newValue are null though the actual
// values are not null. Maybe it's a bug of Polymer.
- // Re-register the observer of 'this.tracks'.
- this.observeTrackList();
-
if (this.tracks.length !== 0) {
// Restore the active track.
if (this.currentTrackIndex !== -1 &&
@@ -149,17 +129,6 @@ var TrackInfo;
},
/**
- * Invoked when the value in the 'tracks' is changed.
- * @param {Array<Object>} changes The detail of the change.
- */
- tracksValueChanged_: function(changes) {
- if (this.tracks.length === 0)
- this.currentTrackIndex = -1;
- else
- this.set('tracks.' + this.currentTrackIndex + '.active', true);
- },
-
- /**
* Invoked when the track element is clicked.
* @param {Event} event Click event.
*/
« no previous file with comments | « ui/file_manager/audio_player/elements/audio_player.js ('k') | ui/file_manager/audio_player/js/audio_player.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698